mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
revert addWorkspace, change to unexported symbol function
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
18758bffc2
commit
c3467abe34
@ -26,6 +26,8 @@ export interface WorkspaceState {
|
|||||||
enabled: boolean;
|
enabled: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const updateFromModel = Symbol("updateFromModel");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Workspace
|
* Workspace
|
||||||
*
|
*
|
||||||
@ -130,7 +132,7 @@ export class Workspace implements WorkspaceModel, WorkspaceState {
|
|||||||
Object.assign(this, state);
|
Object.assign(this, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
@action updateModel(model: WorkspaceModel) {
|
@action [updateFromModel](model: WorkspaceModel) {
|
||||||
Object.assign(this, model);
|
Object.assign(this, model);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -251,10 +253,9 @@ export class WorkspaceStore extends BaseStore<WorkspaceStoreModel> {
|
|||||||
|
|
||||||
@action
|
@action
|
||||||
addWorkspace(workspace: Workspace) {
|
addWorkspace(workspace: Workspace) {
|
||||||
workspace.name = workspace.name.trim();
|
|
||||||
const { id, name } = workspace;
|
const { id, name } = workspace;
|
||||||
|
|
||||||
if (!name || this.getByName(name)) {
|
if (!name.trim() || this.getByName(name.trim())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.workspaces.set(id, workspace);
|
this.workspaces.set(id, workspace);
|
||||||
@ -312,7 +313,7 @@ export class WorkspaceStore extends BaseStore<WorkspaceStoreModel> {
|
|||||||
const oldWorkspace = this.workspaces.get(workspaceModel.id);
|
const oldWorkspace = this.workspaces.get(workspaceModel.id);
|
||||||
|
|
||||||
if (oldWorkspace) {
|
if (oldWorkspace) {
|
||||||
oldWorkspace.updateModel(workspaceModel);
|
oldWorkspace[updateFromModel](workspaceModel);
|
||||||
} else {
|
} else {
|
||||||
this.workspaces.set(workspaceModel.id, new Workspace(workspaceModel));
|
this.workspaces.set(workspaceModel.id, new Workspace(workspaceModel));
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user