File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed
Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -57,6 +57,10 @@ export default class WorkspacesStore extends FeatureStore {
5757 return ! this . isPremiumUpgradeRequired ;
5858 }
5959
60+ @computed get isAnyWorkspaceActive ( ) {
61+ return ! ! this . activeWorkspace ;
62+ }
63+
6064 // ========== PRIVATE PROPERTIES ========= //
6165
6266 _wasDrawerOpenBeforeSettingsRoute = null ;
@@ -229,6 +233,14 @@ export default class WorkspacesStore extends FeatureStore {
229233 this . actions . ui . openSettings ( { path : 'workspaces' } ) ;
230234 } ;
231235
236+ @action reorderServicesOfActiveWorkspace = async ( { oldIndex, newIndex } ) => {
237+ const { activeWorkspace } = this ;
238+ const { services } = activeWorkspace ;
239+ // Move services from the old to the new position
240+ services . splice ( newIndex , 0 , services . splice ( oldIndex , 1 ) [ 0 ] ) ;
241+ await updateWorkspaceRequest . execute ( activeWorkspace ) ;
242+ } ;
243+
232244 // Reactions
233245
234246 _setFeatureEnabledReaction = ( ) => {
Original file line number Diff line number Diff line change @@ -517,7 +517,16 @@ export default class ServicesStore extends Store {
517517 this . actions . ui . toggleServiceUpdatedInfoBar ( { visible : false } ) ;
518518 }
519519
520- @action _reorder ( { oldIndex, newIndex } ) {
520+ @action _reorder ( params ) {
521+ const { workspaces } = this . stores ;
522+ if ( workspaces . isAnyWorkspaceActive ) {
523+ workspaces . reorderServicesOfActiveWorkspace ( params ) ;
524+ } else {
525+ this . _reorderService ( params ) ;
526+ }
527+ }
528+
529+ @action _reorderService ( { oldIndex, newIndex } ) {
521530 const showDisabledServices = this . stores . settings . all . app . showDisabledServices ;
522531 const oldEnabledSortIndex = showDisabledServices ? oldIndex : this . all . indexOf ( this . enabled [ oldIndex ] ) ;
523532 const newEnabledSortIndex = showDisabledServices ? newIndex : this . all . indexOf ( this . enabled [ newIndex ] ) ;
You can’t perform that action at this time.
0 commit comments