2023-03-01 09:39:41 -06:00
|
|
|
/**
|
|
|
|
|
* Copyright (c) HashiCorp, Inc.
|
2024-05-31 11:29:24 -07:00
|
|
|
* SPDX-License-Identifier: BUSL-1.1
|
2023-03-01 09:39:41 -06:00
|
|
|
*/
|
|
|
|
|
|
2020-11-13 15:20:26 -05:00
|
|
|
import Controller from '@ember/controller';
|
|
|
|
|
import { inject as service } from '@ember/service';
|
2024-09-17 16:36:47 -07:00
|
|
|
import { action } from '@ember/object';
|
2020-11-13 15:20:26 -05:00
|
|
|
|
|
|
|
|
export default class ApplicationController extends Controller {
|
|
|
|
|
// =services
|
|
|
|
|
|
2024-09-17 16:36:47 -07:00
|
|
|
@service ipc;
|
2020-11-13 15:20:26 -05:00
|
|
|
@service session;
|
2024-09-17 16:36:47 -07:00
|
|
|
@service clusterUrl;
|
2022-08-31 10:24:25 -07:00
|
|
|
@service flashMessages;
|
2024-09-17 16:36:47 -07:00
|
|
|
|
|
|
|
|
// =actions
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Delegates invalidation to the session service.
|
|
|
|
|
*/
|
|
|
|
|
@action
|
|
|
|
|
invalidateSession() {
|
|
|
|
|
this.session.invalidate();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Disconnects from clusterUrl and invalidates session, thereby resetting
|
|
|
|
|
* the client and reloading to the onboarding clusterUrl screen.
|
|
|
|
|
*/
|
|
|
|
|
@action
|
|
|
|
|
disconnect() {
|
|
|
|
|
this.clusterUrl.resetClusterUrl();
|
|
|
|
|
this.invalidateSession();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@action
|
|
|
|
|
minimize() {
|
|
|
|
|
this.ipc.invoke('minimizeWindow');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@action
|
|
|
|
|
toggleFullScreen() {
|
|
|
|
|
this.ipc.invoke('toggleFullscreenWindow');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@action
|
|
|
|
|
close() {
|
|
|
|
|
this.ipc.invoke('closeWindow');
|
|
|
|
|
}
|
2020-11-13 15:20:26 -05:00
|
|
|
}
|