diff options
author | Vijay Raghavan Aravamudhan <vraravam@users.noreply.github.com> | 2021-09-01 09:29:49 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-01 09:29:49 +0530 |
commit | d0bad11661cb93756891e7fafe729b7f4e415fb1 (patch) | |
tree | 80faf451477cd9ae216ff5a8f92958c4ab23065a /src/features/workspaces | |
parent | build(deps): bump tar from 4.4.15 to 4.4.18 (#1852) (diff) | |
download | ferdium-app-d0bad11661cb93756891e7fafe729b7f4e415fb1.tar.gz ferdium-app-d0bad11661cb93756891e7fafe729b7f4e415fb1.tar.zst ferdium-app-d0bad11661cb93756891e7fafe729b7f4e415fb1.zip |
* fix issue with workspace feature not being turned on, and then randomly turning on somehow.
* when deleting the active workspace, auto-select the default workspace.
* consolidated the toggling of features into a single place in the config file.
Co-authored-by: Sadetdin EYILI <sadetdin.eyili@ekino.com>
Signed-off-by: Vijay A <avijayr@protonmail.com>
Diffstat (limited to 'src/features/workspaces')
-rw-r--r-- | src/features/workspaces/components/EditWorkspaceForm.js | 1 | ||||
-rw-r--r-- | src/features/workspaces/store.js | 38 |
2 files changed, 14 insertions, 25 deletions
diff --git a/src/features/workspaces/components/EditWorkspaceForm.js b/src/features/workspaces/components/EditWorkspaceForm.js index 0ff836cba..c97d4bd9c 100644 --- a/src/features/workspaces/components/EditWorkspaceForm.js +++ b/src/features/workspaces/components/EditWorkspaceForm.js | |||
@@ -224,6 +224,7 @@ class EditWorkspaceForm extends Component { | |||
224 | busy={isSaving} | 224 | busy={isSaving} |
225 | buttonType={isSaving ? 'secondary' : 'primary'} | 225 | buttonType={isSaving ? 'secondary' : 'primary'} |
226 | onClick={this.save.bind(this, form)} | 226 | onClick={this.save.bind(this, form)} |
227 | // TODO: Need to disable if no services have been added to this workspace | ||
227 | disabled={isSaving} | 228 | disabled={isSaving} |
228 | /> | 229 | /> |
229 | </div> | 230 | </div> |
diff --git a/src/features/workspaces/store.js b/src/features/workspaces/store.js index 8c73516bc..ec9d7ee7f 100644 --- a/src/features/workspaces/store.js +++ b/src/features/workspaces/store.js | |||
@@ -155,38 +155,26 @@ export default class WorkspacesStore extends FeatureStore { | |||
155 | }; | 155 | }; |
156 | 156 | ||
157 | @action _create = async ({ name }) => { | 157 | @action _create = async ({ name }) => { |
158 | // eslint-disable-next-line no-useless-catch | 158 | const workspace = await createWorkspaceRequest.execute(name); |
159 | try { | 159 | await getUserWorkspacesRequest.result.push(workspace); |
160 | const workspace = await createWorkspaceRequest.execute(name); | 160 | this._edit({ workspace }); |
161 | await getUserWorkspacesRequest.result.push(workspace); | ||
162 | this._edit({ workspace }); | ||
163 | } catch (error) { | ||
164 | throw error; | ||
165 | } | ||
166 | }; | 161 | }; |
167 | 162 | ||
168 | @action _delete = async ({ workspace }) => { | 163 | @action _delete = async ({ workspace }) => { |
169 | // eslint-disable-next-line no-useless-catch | 164 | await deleteWorkspaceRequest.execute(workspace); |
170 | try { | 165 | await getUserWorkspacesRequest.result.remove(workspace); |
171 | await deleteWorkspaceRequest.execute(workspace); | 166 | this.stores.router.push('/settings/workspaces'); |
172 | await getUserWorkspacesRequest.result.remove(workspace); | 167 | if (this.activeWorkspace === workspace) { |
173 | this.stores.router.push('/settings/workspaces'); | 168 | this._deactivateActiveWorkspace(); |
174 | } catch (error) { | ||
175 | throw error; | ||
176 | } | 169 | } |
177 | }; | 170 | }; |
178 | 171 | ||
179 | @action _update = async ({ workspace }) => { | 172 | @action _update = async ({ workspace }) => { |
180 | // eslint-disable-next-line no-useless-catch | 173 | await updateWorkspaceRequest.execute(workspace); |
181 | try { | 174 | // Path local result optimistically |
182 | await updateWorkspaceRequest.execute(workspace); | 175 | const localWorkspace = this._getWorkspaceById(workspace.id); |
183 | // Path local result optimistically | 176 | Object.assign(localWorkspace, workspace); |
184 | const localWorkspace = this._getWorkspaceById(workspace.id); | 177 | this.stores.router.push('/settings/workspaces'); |
185 | Object.assign(localWorkspace, workspace); | ||
186 | this.stores.router.push('/settings/workspaces'); | ||
187 | } catch (error) { | ||
188 | throw error; | ||
189 | } | ||
190 | }; | 178 | }; |
191 | 179 | ||
192 | @action _setActiveWorkspace = ({ workspace }) => { | 180 | @action _setActiveWorkspace = ({ workspace }) => { |