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:
parent
93cabfcdf1
commit
8b5c652641
@ -58,14 +58,7 @@ export class Workspace implements WorkspaceModel, WorkspaceState {
|
||||
* @observable
|
||||
*/
|
||||
@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
|
||||
*
|
||||
@ -73,6 +66,9 @@ export class Workspace implements WorkspaceModel, WorkspaceState {
|
||||
*/
|
||||
@observable lastActiveClusterId?: ClusterId;
|
||||
|
||||
|
||||
@observable private _enabled: boolean;
|
||||
|
||||
constructor(data: WorkspaceModel) {
|
||||
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
|
||||
*/
|
||||
@ -141,13 +152,11 @@ export class WorkspaceStore extends BaseStore<WorkspaceStoreModel> {
|
||||
super({
|
||||
configName: "lens-workspace-store",
|
||||
});
|
||||
const defaultWorkspace = new Workspace({
|
||||
|
||||
this.workspaces.set(WorkspaceStore.defaultId, new Workspace({
|
||||
id: WorkspaceStore.defaultId,
|
||||
name: "default"
|
||||
});
|
||||
|
||||
defaultWorkspace.enabled = true;
|
||||
this.workspaces.set(WorkspaceStore.defaultId, defaultWorkspace);
|
||||
}));
|
||||
}
|
||||
|
||||
async load() {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user