-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(dedicated): hide backup storage when not available (#12665)
ref: MANAGER-14805, MANAGER-14698 Signed-off-by: Quentin Pavy <[email protected]>
- Loading branch information
Showing
4 changed files
with
46 additions
and
24 deletions.
There are no files selected for viewing
61 changes: 38 additions & 23 deletions
61
.../dedicated/client/app/dedicated/dedicated-server/servers/ftp-backup/ftp-backup.routing.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,41 @@ | ||
export default /* @ngInject */ ($stateProvider, coreConfigProvider) => { | ||
if (!coreConfigProvider.isRegion('US')) { | ||
$stateProvider.state('app.dedicated-server.server.ftpBackup', { | ||
url: '/backup', | ||
views: { | ||
'[email protected]': { | ||
component: 'dedicatedServerFtpBackupStorage', | ||
}, | ||
export default /* @ngInject */ ($stateProvider) => { | ||
$stateProvider.state('app.dedicated-server.server.ftpBackup', { | ||
url: '/backup', | ||
views: { | ||
'[email protected]': { | ||
component: 'dedicatedServerFtpBackupStorage', | ||
}, | ||
resolve: { | ||
breadcrumb: /* @ngInject */ ($translate) => | ||
$translate.instant('dedicated_server_ftp_backup'), | ||
goToFtpBackUpStorage: ($state, Alerter) => ( | ||
message = false, | ||
type = 'success', | ||
) => { | ||
const promise = $state.go('app.dedicated-server.server.ftpBackup'); | ||
if (message) { | ||
promise.then(() => Alerter[type](message)); | ||
} | ||
return promise; | ||
}, | ||
}, | ||
redirectTo: (transition) => { | ||
const injector = transition.injector(); | ||
const backupIAvailablePromise = injector.getAsync( | ||
'backupStorageAvailable', | ||
); | ||
const serverNamePromise = injector.getAsync('serverName'); | ||
|
||
return Promise.all([backupIAvailablePromise, serverNamePromise]).then( | ||
([backupIsAvailable, serverName]) => | ||
backupIsAvailable | ||
? null | ||
: { | ||
state: 'app.dedicated-server.server.dashboard', | ||
params: { productId: serverName }, | ||
}, | ||
); | ||
}, | ||
resolve: { | ||
breadcrumb: /* @ngInject */ ($translate) => | ||
$translate.instant('dedicated_server_ftp_backup'), | ||
goToFtpBackUpStorage: ($state, Alerter) => ( | ||
message = false, | ||
type = 'success', | ||
) => { | ||
const promise = $state.go('app.dedicated-server.server.ftpBackup'); | ||
if (message) { | ||
promise.then(() => Alerter[type](message)); | ||
} | ||
return promise; | ||
}, | ||
}); | ||
} | ||
}, | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters