From 17f3a22e4193dfcf8dfd5cbd5aa2e812f2cbd6ae Mon Sep 17 00:00:00 2001 From: Dominik Guzei Date: Wed, 8 May 2019 13:57:03 +0200 Subject: fix(Workspaces): Service reordering within workspaces --- src/features/workspaces/store.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/features/workspaces/store.js') diff --git a/src/features/workspaces/store.js b/src/features/workspaces/store.js index e11513d1f..e0bef8aea 100644 --- a/src/features/workspaces/store.js +++ b/src/features/workspaces/store.js @@ -57,6 +57,10 @@ export default class WorkspacesStore extends FeatureStore { return !this.isPremiumUpgradeRequired; } + @computed get isAnyWorkspaceActive() { + return !!this.activeWorkspace; + } + // ========== PRIVATE PROPERTIES ========= // _wasDrawerOpenBeforeSettingsRoute = null; @@ -229,6 +233,14 @@ export default class WorkspacesStore extends FeatureStore { this.actions.ui.openSettings({ path: 'workspaces' }); }; + @action reorderServicesOfActiveWorkspace = async ({ oldIndex, newIndex }) => { + const { activeWorkspace } = this; + const { services } = activeWorkspace; + // Move services from the old to the new position + services.splice(newIndex, 0, services.splice(oldIndex, 1)[0]); + await updateWorkspaceRequest.execute(activeWorkspace); + }; + // Reactions _setFeatureEnabledReaction = () => { -- cgit v1.2.3-54-g00ecf