Files
threshold-ui/ui/desktop/app/controllers/cluster-url.js
T
Cameron Perera 750cc1ecae feat: 🎸 add logging to notifyError decorator (#2694)
* feat: 🎸 add logging to notifyError decorator

✅ Closes: https://hashicorp.atlassian.net/browse/ICU-16334

* refactor: 💡 update reference to global electronLog

✅ Closes: https://hashicorp.atlassian.net/browse/ICU-16334

* refactor: 💡 update __electronLog global references

✅ Closes: https://hashicorp.atlassian.net/browse/ICU-16334

* refactor: 💡 add log to other cluster URL actions

✅ Closes: https://hashicorp.atlassian.net/browse/ICU-16334

* refactor: 💡 update how we trigger electron log in notifyError

✅ Closes: https://hashicorp.atlassian.net/browse/ICU-16334

* refactor: 💡 minor log change

✅ Closes: https://hashicorp.atlassian.net/browse/ICU-16334
2025-02-21 10:01:48 -06:00

36 lines
966 B
JavaScript

/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: BUSL-1.1
*/
import Controller from '@ember/controller';
import { inject as service } from '@ember/service';
import { action } from '@ember/object';
import { loading } from 'ember-loading';
import { notifyError } from 'core/decorators/notify';
export default class ClusterUrlController extends Controller {
// =services
@service router;
@service('cluster-url') clusterUrlService;
// =actions
/**
* Points the API to the specified clusterUrl. When the main process receives
* the clusterUrl, it is expected that the renderer will be restarted.
* @param {string} clusterUrl
*/
@action
@loading
@notifyError(() => 'errors.cluster-url-verification-failed.description', {
catch: true,
log: { origin: 'setClusterUrl' },
})
async setClusterUrl(clusterUrl) {
await this.clusterUrlService.setClusterUrl(clusterUrl);
this.router.replaceWith('index');
}
}