mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
refactor
Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
parent
7e3f7ecbbd
commit
93cabfcdf1
@ -134,11 +134,20 @@ export class WorkspaceStore extends BaseStore<WorkspaceStoreModel> {
|
|||||||
static readonly defaultId: WorkspaceId = "default";
|
static readonly defaultId: WorkspaceId = "default";
|
||||||
private static stateRequestChannel = "workspace:states";
|
private static stateRequestChannel = "workspace:states";
|
||||||
|
|
||||||
|
@observable currentWorkspaceId = WorkspaceStore.defaultId;
|
||||||
|
@observable workspaces = observable.map<WorkspaceId, Workspace>();
|
||||||
|
|
||||||
private constructor() {
|
private constructor() {
|
||||||
super({
|
super({
|
||||||
configName: "lens-workspace-store",
|
configName: "lens-workspace-store",
|
||||||
});
|
});
|
||||||
this.workspaces.get(WorkspaceStore.defaultId).enabled = true;
|
const defaultWorkspace = new Workspace({
|
||||||
|
id: WorkspaceStore.defaultId,
|
||||||
|
name: "default"
|
||||||
|
});
|
||||||
|
|
||||||
|
defaultWorkspace.enabled = true;
|
||||||
|
this.workspaces.set(WorkspaceStore.defaultId, defaultWorkspace);
|
||||||
}
|
}
|
||||||
|
|
||||||
async load() {
|
async load() {
|
||||||
@ -187,15 +196,6 @@ export class WorkspaceStore extends BaseStore<WorkspaceStoreModel> {
|
|||||||
ipcRenderer.removeAllListeners("workspace:state");
|
ipcRenderer.removeAllListeners("workspace:state");
|
||||||
}
|
}
|
||||||
|
|
||||||
@observable currentWorkspaceId = WorkspaceStore.defaultId;
|
|
||||||
|
|
||||||
@observable workspaces = observable.map<WorkspaceId, Workspace>({
|
|
||||||
[WorkspaceStore.defaultId]: new Workspace({
|
|
||||||
id: WorkspaceStore.defaultId,
|
|
||||||
name: "default"
|
|
||||||
})
|
|
||||||
});
|
|
||||||
|
|
||||||
@computed get currentWorkspace(): Workspace {
|
@computed get currentWorkspace(): Workspace {
|
||||||
return this.getById(this.currentWorkspaceId);
|
return this.getById(this.currentWorkspaceId);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user