-
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(nutanix): add uninstall node nutanix popin
ref: MANAGER-15717 Signed-off-by: Thibault Barske <[email protected]>
- Loading branch information
Showing
11 changed files
with
265 additions
and
0 deletions.
There are no files selected for viewing
14 changes: 14 additions & 0 deletions
14
packages/manager/modules/nutanix/src/dashboard/component/uninstall-modal/component.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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import template from './template.html'; | ||
import controller from './controller'; | ||
|
||
export default { | ||
bindings: { | ||
goBack: '<', | ||
handleSuccess: '<', | ||
nodeId: '<', | ||
uninstallNode: '<', | ||
userSubsidiary: '<', | ||
}, | ||
template, | ||
controller, | ||
}; |
52 changes: 52 additions & 0 deletions
52
packages/manager/modules/nutanix/src/dashboard/component/uninstall-modal/constants.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 |
---|---|---|
@@ -0,0 +1,52 @@ | ||
export const UNINSTALL_PATTERN = 'UNINSTALL'; | ||
|
||
export const UNINSTALL_GUIDE_LINKS = { | ||
FR: | ||
'https://help.ovhcloud.com/csm/fr-documentation-hosted-private-cloud-nutanix-on-ovhcloud?id=kb_browse_cat&kb_id=62e4cfed55d574502d4c6e78b7421953&kb_category=7e50f429985469141e115d75fb840c3f', | ||
DE: | ||
'https://help.ovhcloud.com/csm/de-documentation-hosted-private-cloud-nutanix-on-ovhcloud?id=kb_browse_cat&kb_id=62e4cfed55d574502d4c6e78b7421953&kb_category=7e50f429985469141e115d75fb840c3f', | ||
SP: | ||
'https://help.ovhcloud.com/csm/es-es-documentation-hosted-private-cloud-nutanix-on-ovhcloud?id=kb_browse_cat&kb_id=62e4cfed55d574502d4c6e78b7421953&kb_category=7e50f429985469141e115d75fb840c3f', | ||
IE: | ||
'https://help.ovhcloud.com/csm/en-ie-documentation-hosted-private-cloud-nutanix-on-ovhcloud?id=kb_browse_cat&kb_id=62e4cfed55d574502d4c6e78b7421953&kb_category=7e50f429985469141e115d75fb840c3f', | ||
IT: | ||
'https://help.ovhcloud.com/csm/it-documentation-hosted-private-cloud-nutanix-on-ovhcloud?id=kb_browse_cat&kb_id=62e4cfed55d574502d4c6e78b7421953&kb_category=7e50f429985469141e115d75fb840c3f', | ||
EL: | ||
'https://help.ovhcloud.com/csm/en-nl-documentation-hosted-private-cloud?id=kb_browse_cat&kb_id=62e4cfed55d574502d4c6e78b7421953', | ||
PL: | ||
'https://help.ovhcloud.com/csm/pl-documentation-hosted-private-cloud?id=kb_browse_cat&kb_id=62e4cfed55d574502d4c6e78b7421953', | ||
PT: | ||
'https://help.ovhcloud.com/csm/pt-documentation-hosted-private-cloud?id=kb_browse_cat&kb_id=62e4cfed55d574502d4c6e78b7421953', | ||
GB: | ||
'https://help.ovhcloud.com/csm/en-gb-documentation-hosted-private-cloud?id=kb_browse_cat&kb_id=62e4cfed55d574502d4c6e78b7421953', | ||
CA: | ||
'https://help.ovhcloud.com/csm/en-ca-documentation-hosted-private-cloud?id=kb_browse_cat&kb_id=62e4cfed55d574502d4c6e78b7421953', | ||
QC: | ||
'https://help.ovhcloud.com/csm/fr-ca-documentation-hosted-private-cloud?id=kb_browse_cat&kb_id=62e4cfed55d574502d4c6e78b7421953', | ||
USA: 'https://us.ovhcloud.com/support/', | ||
ES: | ||
'https://help.ovhcloud.com/csm/es-documentation-hosted-private-cloud?id=kb_browse_cat&kb_id=62e4cfed55d574502d4c6e78b7421953', | ||
MA: | ||
'https://help.ovhcloud.com/csm/fr-ma-documentation-hosted-private-cloud?id=kb_browse_cat&kb_id=62e4cfed55d574502d4c6e78b7421953', | ||
SN: | ||
'https://help.ovhcloud.com/csm/fr-sn-documentation-hosted-private-cloud?id=kb_browse_cat&kb_id=62e4cfed55d574502d4c6e78b7421953', | ||
TN: | ||
'https://help.ovhcloud.com/csm/fr-tn-documentation-hosted-private-cloud?id=kb_browse_cat&kb_id=62e4cfed55d574502d4c6e78b7421953', | ||
AU: | ||
'https://help.ovhcloud.com/csm/en-au-documentation-hosted-private-cloud?id=kb_browse_cat&kb_id=62e4cfed55d574502d4c6e78b7421953', | ||
IN: | ||
'https://help.ovhcloud.com/csm/en-in-documentation-hosted-private-cloud?id=kb_browse_cat&kb_id=62e4cfed55d574502d4c6e78b7421953', | ||
SG: | ||
'https://help.ovhcloud.com/csm/en-sg-documentation-hosted-private-cloud?id=kb_browse_cat&kb_id=62e4cfed55d574502d4c6e78b7421953', | ||
ASIA: | ||
'https://help.ovhcloud.com/csm/asia-documentation-hosted-private-cloud?id=kb_browse_cat&kb_id=62e4cfed55d574502d4c6e78b7421953', | ||
EN: | ||
'https://help.ovhcloud.com/csm/world-documentation-hosted-private-cloud?id=kb_browse_cat&kb_id=62e4cfed55d574502d4c6e78b7421953', | ||
WE: | ||
'https://help.ovhcloud.com/csm/en-ie-documentation-hosted-private-cloud?id=kb_browse_cat&kb_id=62e4cfed55d574502d4c6e78b7421953', | ||
}; | ||
|
||
export default { | ||
UNINSTALL_PATTERN, | ||
UNINSTALL_GUIDE_LINKS, | ||
}; |
38 changes: 38 additions & 0 deletions
38
packages/manager/modules/nutanix/src/dashboard/component/uninstall-modal/controller.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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { UNINSTALL_GUIDE_LINKS, UNINSTALL_PATTERN } from './constants'; | ||
|
||
export default class { | ||
/* @ngInject */ | ||
constructor($translate) { | ||
this.$translate = $translate; | ||
this.UNINSTALL_PATTERN = UNINSTALL_PATTERN; | ||
this.isLoading = false; | ||
} | ||
|
||
get uninstallGuidelink() { | ||
return ( | ||
UNINSTALL_GUIDE_LINKS[this.userSubsidiary] ?? UNINSTALL_GUIDE_LINKS.EN | ||
); | ||
} | ||
|
||
onSubmit() { | ||
this.isLoading = true; | ||
this.uninstallNode() | ||
.then(() => { | ||
this.handleSuccess( | ||
`${this.$translate.instant( | ||
'nutanix_dashboard_uninstall_node_success_banner', | ||
)}`, | ||
); | ||
}) | ||
.catch((error) => { | ||
this.handleError( | ||
`${this.$translate.instant( | ||
'nutanix_dashboard_uninstall_node_error_banner', | ||
)} ${error.message}`, | ||
); | ||
}) | ||
.finally(() => { | ||
this.isLoading = false; | ||
}); | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
packages/manager/modules/nutanix/src/dashboard/component/uninstall-modal/module.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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import angular from 'angular'; | ||
import '@ovh-ux/manager-core'; | ||
import '@uirouter/angularjs'; | ||
import 'angular-translate'; | ||
import '@ovh-ux/ui-kit'; | ||
|
||
import component from './component'; | ||
|
||
const moduleName = 'ovhManagerNutanixUninstallNutanixNodeModal'; | ||
|
||
angular | ||
.module(moduleName, [ | ||
'oui', | ||
'ovhManagerCore', | ||
'pascalprecht.translate', | ||
'ui.router', | ||
]) | ||
.component('uninstallNutanixNodeModal', component) | ||
.run(/* @ngTranslationsInject:json ./translations */); | ||
|
||
export default moduleName; |
46 changes: 46 additions & 0 deletions
46
packages/manager/modules/nutanix/src/dashboard/component/uninstall-modal/template.html
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 |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<oui-modal | ||
data-on-dismiss="$ctrl.goBack()" | ||
data-primary-action="$ctrl.onSubmit()" | ||
data-primary-label="{{:: 'nutanix_dashboard_uninstall_node_confirm' | translate }}" | ||
data-loading="$ctrl.isLoading" | ||
data-primary-disabled="$ctrl.confirmUninstallForm.$invalid" | ||
data-secondary-action="$ctrl.goBack()" | ||
data-secondary-label="{{:: 'nutanix_dashboard_uninstall_node_cancel' | translate }}" | ||
data-heading="{{:: 'nutanix_dashboard_uninstall_node_title' | translate }}" | ||
> | ||
<form name="$ctrl.confirmUninstallForm" novalidate> | ||
<oui-message data-type="warning" class="mb-2"> | ||
<div | ||
data-translate="nutanix_dashboard_uninstall_node_description" | ||
></div> | ||
<a | ||
class="oui-link_icon" | ||
data-ng-href="{{$ctrl.uninstallGuidelink}}" | ||
> | ||
<span | ||
data-translate="nutanix_dashboard_uninstall_node_uninstall_guidelink" | ||
></span> | ||
<span | ||
class="oui-icon oui-icon-arrow-right" | ||
aria-hidden="true" | ||
></span> | ||
</a> | ||
</oui-message> | ||
<p | ||
data-translate="nutanix_dashboard_uninstall_node_confirmation" | ||
data-translate-values="{ serviceName: $ctrl.nodeId}" | ||
></p> | ||
<oui-field | ||
data-label="{{:: 'nutanix_dasboard_uninstall_node_input_label' | translate:{ magicword: $ctrl.UNINSTALL_PATTERN} }}" | ||
> | ||
<input | ||
type="text" | ||
class="oui-input" | ||
name="uninstallInput" | ||
data-ng-model="$ctrl.uninstallConfirmation" | ||
data-ng-pattern="$ctrl.UNINSTALL_PATTERN" | ||
required | ||
/> | ||
</oui-field> | ||
</form> | ||
</oui-modal> |
11 changes: 11 additions & 0 deletions
11
.../modules/nutanix/src/dashboard/component/uninstall-modal/translations/Messages_fr_FR.json
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"nutanix_dashboard_uninstall_node_title": "Eteindre le noeud", | ||
"nutanix_dashboard_uninstall_node_description": "L'extinction d'un noeud Nutanix peut avoir un impact sur votre cluster, vérifiez les pré-requis sur le portail de Nutanix pour réaliser cette action", | ||
"nutanix_dashboard_uninstall_node_uninstall_guidelink": "Accéder au portail", | ||
"nutanix_dashboard_uninstall_node_confirmation": "Voulez-vous vraiment éteindre votre noeud {{serviceName}} ?", | ||
"nutanix_dashboard_uninstall_node_confirm": "Détâcher", | ||
"nutanix_dashboard_uninstall_node_cancel": "Annuler", | ||
"nutanix_dasboard_uninstall_node_input_label": "Entrez \"{{magicword}}\" pour configurer votre choix", | ||
"nutanix_dashboard_uninstall_node_success_banner": "Votre demande de désinstallation a été prise en compte. Cette opération peut prendre jusqu'à 10 minutes", | ||
"nutanix_dashboard_uninstall_node_error_banner": "Votre demande de désinstallation n'a pas été prise en compte :" | ||
} |
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
22 changes: 22 additions & 0 deletions
22
packages/manager/modules/nutanix/src/dashboard/nodes/list/uninstall-node/index.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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import angular from 'angular'; | ||
|
||
import '@uirouter/angularjs'; | ||
import 'oclazyload'; | ||
|
||
const moduleName = 'ovhManagerNutanixNodeUninstallLazyLoading'; | ||
|
||
angular.module(moduleName, ['ui.router', 'oc.lazyLoad']).config( | ||
/* @ngInject */ ($stateProvider) => { | ||
$stateProvider.state('nutanix.dashboard.nodes.all.uninstall-node.**', { | ||
url: '/uninstall/:node', | ||
lazyLoad: ($transition$) => { | ||
const $ocLazyLoad = $transition$.injector().get('$ocLazyLoad'); | ||
return import('./uninstall-node.module').then((mod) => | ||
$ocLazyLoad.inject(mod.default || mod), | ||
); | ||
}, | ||
}); | ||
}, | ||
); | ||
|
||
export default moduleName; |
24 changes: 24 additions & 0 deletions
24
.../manager/modules/nutanix/src/dashboard/nodes/list/uninstall-node/uninstall-node.module.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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import atInternet from '@ovh-ux/ng-at-internet'; | ||
import angular from 'angular'; | ||
import uninstallModal from '../../../component/uninstall-modal/module'; | ||
|
||
import '@ovh-ux/ng-translate-async-loader'; | ||
import '@uirouter/angularjs'; | ||
import 'angular-translate'; | ||
import '@ovh-ux/ui-kit'; | ||
|
||
import routing from './uninstall-node.routing'; | ||
|
||
const moduleName = 'ovhManagerNutanixNodePowerOff'; | ||
|
||
angular | ||
.module(moduleName, [ | ||
atInternet, | ||
'oui', | ||
'pascalprecht.translate', | ||
'ui.router', | ||
uninstallModal, | ||
]) | ||
.config(routing); | ||
|
||
export default moduleName; |
31 changes: 31 additions & 0 deletions
31
...manager/modules/nutanix/src/dashboard/nodes/list/uninstall-node/uninstall-node.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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
export default /* @ngInject */ ($stateProvider) => { | ||
$stateProvider.state('nutanix.dashboard.nodes.all.uninstall', { | ||
url: '/uninstall/:node', | ||
views: { | ||
modal: { | ||
component: 'uninstallNutanixNodeModal', | ||
}, | ||
}, | ||
layout: 'modal', | ||
resolve: { | ||
nodeId: /* @ngInject */ ($transition$) => $transition$.params().node, | ||
goBack: /* @ngInject */ ($state) => () => | ||
$state.go('nutanix.dashboard.nodes.all'), | ||
handleSuccess: /* @ngInject */ (Alerter, goBack) => (message) => { | ||
Alerter.success(message, 'nutanix_dashboard_alert'); | ||
goBack(); | ||
}, | ||
handleError: /* @ngInject */ (Alerter, goBack) => (message) => { | ||
Alerter.error(message, 'nutanix_dashboard_alert'); | ||
goBack(); | ||
}, | ||
uninstallNode: /* ngInject */ ( | ||
NutanixService, | ||
serviceName, | ||
nodeId, | ||
) => () => NutanixService.uninstallClusterNode(serviceName, nodeId), | ||
userSubsidiary: /* ngInject */ (coreConfig) => | ||
coreConfig.getUser().ovhSubsidiary, | ||
}, | ||
}); | ||
}; |
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