1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

use get/set

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
Jari Kolehmainen 2021-01-18 11:31:54 +02:00
parent 93cabfcdf1
commit 8b5c652641

View File

@ -58,14 +58,7 @@ export class Workspace implements WorkspaceModel, WorkspaceState {
* @observable * @observable
*/ */
@observable ownerRef?: string; @observable ownerRef?: string;
/**
* Is workspace enabled
*
* Workspaces that don't have ownerRef will be enabled by default. Workspaces with ownerRef need to explicitly enable a workspace.
*
* @observable
*/
@observable enabled: boolean;
/** /**
* Last active cluster id * Last active cluster id
* *
@ -73,6 +66,9 @@ export class Workspace implements WorkspaceModel, WorkspaceState {
*/ */
@observable lastActiveClusterId?: ClusterId; @observable lastActiveClusterId?: ClusterId;
@observable private _enabled: boolean;
constructor(data: WorkspaceModel) { constructor(data: WorkspaceModel) {
Object.assign(this, data); Object.assign(this, data);
@ -83,6 +79,21 @@ export class Workspace implements WorkspaceModel, WorkspaceState {
} }
} }
/**
* Is workspace enabled
*
* Workspaces that don't have ownerRef will be enabled by default. Workspaces with ownerRef need to explicitly enable a workspace.
*
* @observable
*/
get enabled(): boolean {
return !this.isManaged || this._enabled;
}
set enabled(enabled: boolean) {
this._enabled = enabled;
}
/** /**
* Is workspace managed by an extension * Is workspace managed by an extension
*/ */
@ -141,13 +152,11 @@ export class WorkspaceStore extends BaseStore<WorkspaceStoreModel> {
super({ super({
configName: "lens-workspace-store", configName: "lens-workspace-store",
}); });
const defaultWorkspace = new Workspace({
this.workspaces.set(WorkspaceStore.defaultId, new Workspace({
id: WorkspaceStore.defaultId, id: WorkspaceStore.defaultId,
name: "default" name: "default"
}); }));
defaultWorkspace.enabled = true;
this.workspaces.set(WorkspaceStore.defaultId, defaultWorkspace);
} }
async load() { async load() {