Fixing workspaces adding/editing (#1405)

* Fix creating new workspace

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>

* Show not yet enabled workspaces in list

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>

* Not showing disabled workspaces

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
Alex Andreev authored and GitHub committed 2020-11-17 16:35:59 +03:00
1 parent 7489e5ff7b
commit 6fd0bebdd6
3 files changed
+23 -16

No files matched your search

@@ -20,7 +20,7 @@ export class Workspaces extends React.Component {
@computed get workspaces(): Workspace[] {
const currentWorkspaces: Map<WorkspaceId, Workspace> = new Map()
workspaceStore.enabledWorkspacesList.forEach((w) => {
workspaceStore.workspacesList.forEach((w) => {
currentWorkspaces.set(w.id, w)
})
const allWorkspaces = new Map([
@@ -45,9 +45,13 @@ export class Workspaces extends React.Component {
}
saveWorkspace = (id: WorkspaceId) => {
const draft = toJS(this.editingWorkspaces.get(id));
const workspace = workspaceStore.addWorkspace(draft);
if (workspace) {
const workspace = new Workspace(this.editingWorkspaces.get(id));
if (workspaceStore.getById(id)) {
workspaceStore.updateWorkspace(workspace);
this.clearEditing(id);
return;
}
if (workspaceStore.addWorkspace(workspace)) {
this.clearEditing(id);
}
}
@@ -127,7 +131,7 @@ export class Workspaces extends React.Component {
validate: value => !workspaceStore.getByName(value.trim())
}
return (
<div key={workspaceId} className={className}>
<div key={workspaceId} className={cssNames(className)}>
{!isEditing && (
<Fragment>
<span className="name flex gaps align-center">