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 | |
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')
-rw-r--r-- | src/config.ts | 5 | ||||
-rw-r--r-- | src/features/workspaces/components/EditWorkspaceForm.js | 1 | ||||
-rw-r--r-- | src/features/workspaces/store.js | 38 | ||||
-rw-r--r-- | src/internal-server/app/Controllers/Http/StaticController.js | 16 |
4 files changed, 22 insertions, 38 deletions
diff --git a/src/config.ts b/src/config.ts index 0647b8f52..835d130da 100644 --- a/src/config.ts +++ b/src/config.ts | |||
@@ -134,10 +134,11 @@ export const ICON_SIZES = { | |||
134 | export const iconSizeBias = 20; | 134 | export const iconSizeBias = 20; |
135 | 135 | ||
136 | export const DEFAULT_FEATURES_CONFIG = { | 136 | export const DEFAULT_FEATURES_CONFIG = { |
137 | isServiceProxyEnabled: false, | 137 | isServiceProxyEnabled: true, |
138 | isAnnouncementsEnabled: true, | 138 | isAnnouncementsEnabled: true, |
139 | isWorkspaceEnabled: false, | 139 | isWorkspaceEnabled: true, |
140 | isTodosEnabled: true, | 140 | isTodosEnabled: true, |
141 | isSettingsWSEnabled: false, | ||
141 | }; | 142 | }; |
142 | 143 | ||
143 | export const DEFAULT_WINDOW_OPTIONS = { | 144 | export const DEFAULT_WINDOW_OPTIONS = { |
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 }) => { |
diff --git a/src/internal-server/app/Controllers/Http/StaticController.js b/src/internal-server/app/Controllers/Http/StaticController.js index b9a145061..28c5389a9 100644 --- a/src/internal-server/app/Controllers/Http/StaticController.js +++ b/src/internal-server/app/Controllers/Http/StaticController.js | |||
@@ -2,21 +2,15 @@ | |||
2 | * Controller for routes with static responses | 2 | * Controller for routes with static responses |
3 | */ | 3 | */ |
4 | 4 | ||
5 | import { DEFAULT_FEATURES_CONFIG } from '../../../../config'; | ||
6 | |||
7 | // TODO: This endpoint and associated code needs to be remoeved as cleanup | ||
5 | class StaticController { | 8 | class StaticController { |
6 | // Enable all features | 9 | // Enable all features |
7 | features({ | 10 | features({ |
8 | response, | 11 | response, |
9 | }) { | 12 | }) { |
10 | return response.send({ | 13 | return response.send(DEFAULT_FEATURES_CONFIG); |
11 | isServiceProxyEnabled: true, | ||
12 | isWorkspaceEnabled: true, | ||
13 | isAnnouncementsEnabled: true, | ||
14 | isSettingsWSEnabled: false, | ||
15 | isMagicBarEnabled: true, | ||
16 | isTodosEnabled: true, | ||
17 | subscribeURL: 'https://getferdi.com', | ||
18 | hasInlineCheckout: true, | ||
19 | }); | ||
20 | } | 14 | } |
21 | 15 | ||
22 | // Return an empty array | 16 | // Return an empty array |
@@ -34,4 +28,4 @@ class StaticController { | |||
34 | } | 28 | } |
35 | } | 29 | } |
36 | 30 | ||
37 | module.exports = StaticController; | 31 | export default StaticController; |