-
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 poweroff popins for node nutanix
ref: MANAGER-15714 Signed-off-by: Thibault Barske <[email protected]>
- Loading branch information
Showing
11 changed files
with
271 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/poweroff-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: '<', | ||
poweroffNode: '<', | ||
userSubsidiary: '<', | ||
}, | ||
template, | ||
controller, | ||
}; |
51 changes: 51 additions & 0 deletions
51
packages/manager/modules/nutanix/src/dashboard/component/poweroff-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,51 @@ | ||
export const POWEROFF_PATTERN = 'POWEROFF'; | ||
|
||
export default { | ||
POWEROFF_PATTERN, | ||
}; | ||
|
||
export const POWEROFF_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', | ||
ES: | ||
'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/', | ||
WS: | ||
'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/world-documentation-hosted-private-cloud?id=kb_browse_cat&kb_id=62e4cfed55d574502d4c6e78b7421953', | ||
}; |
36 changes: 36 additions & 0 deletions
36
packages/manager/modules/nutanix/src/dashboard/component/poweroff-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,36 @@ | ||
import { POWEROFF_GUIDE_LINKS, POWEROFF_PATTERN } from './constants'; | ||
|
||
export default class { | ||
/* @ngInject */ | ||
constructor($window, $translate) { | ||
this.$translate = $translate; | ||
this.POWEROFF_PATTERN = POWEROFF_PATTERN; | ||
this.isLoading = false; | ||
} | ||
|
||
get poweroffGuidelink() { | ||
return POWEROFF_GUIDE_LINKS[this.userSubsidiary] ?? POWEROFF_GUIDE_LINKS.EN; | ||
} | ||
|
||
onSubmit() { | ||
this.isLoading = true; | ||
this.poweroffNode() | ||
.then(() => { | ||
this.handleSuccess( | ||
`${this.$translate.instant( | ||
'nutanix_dashboard_poweroff_node_success_banner', | ||
)}`, | ||
); | ||
}) | ||
.catch((error) => { | ||
this.handleError( | ||
`${this.$translate.instant( | ||
'nutanix_dashboard_poweroff_node_error_banner', | ||
)} ${error.message}`, | ||
); | ||
}) | ||
.finally(() => { | ||
this.isLoading = false; | ||
}); | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
packages/manager/modules/nutanix/src/dashboard/component/poweroff-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 = 'ovhManagerNutanixPowerOffNutanixNodeModal'; | ||
|
||
angular | ||
.module(moduleName, [ | ||
'oui', | ||
'ovhManagerCore', | ||
'pascalprecht.translate', | ||
'ui.router', | ||
]) | ||
.component('powerOffNutanixNodeModal', component) | ||
.run(/* @ngTranslationsInject:json ./translations */); | ||
|
||
export default moduleName; |
43 changes: 43 additions & 0 deletions
43
packages/manager/modules/nutanix/src/dashboard/component/poweroff-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,43 @@ | ||
<oui-modal | ||
data-on-dismiss="$ctrl.goBack()" | ||
data-primary-action="$ctrl.onSubmit()" | ||
data-primary-label="{{:: 'nutanix_dashboard_poweroff_node_confirm' | translate }}" | ||
data-loading="$ctrl.isLoading" | ||
data-primary-disabled="$ctrl.confirmPoweroffForm.$invalid" | ||
data-secondary-action="$ctrl.goBack()" | ||
data-secondary-label="{{:: 'nutanix_dashboard_poweroff_node_cancel' | translate }}" | ||
data-heading="{{:: 'nutanix_dashboard_poweroff_node_title' | translate }}" | ||
> | ||
<form name="$ctrl.confirmPoweroffForm" novalidate> | ||
<oui-message data-type="warning" class="mb-2"> | ||
<div | ||
data-translate="nutanix_dashboard_poweroff_node_description" | ||
></div> | ||
<a class="oui-link_icon" data-ng-href="{{$ctrl.poweroffGuidelink}}"> | ||
<span | ||
data-translate="nutanix_dashboard_poweroff_node_poweroff_guidelink" | ||
></span> | ||
<span | ||
class="oui-icon oui-icon-arrow-right" | ||
aria-hidden="true" | ||
></span> | ||
</a> | ||
</oui-message> | ||
<p | ||
data-translate="nutanix_dashboard_poweroff_node_confirmation" | ||
data-translate-values="{ serviceName: $ctrl.nodeId}" | ||
></p> | ||
<oui-field | ||
data-label="{{:: 'nutanix_dasboard_poweroff_node_input_label' | translate:{ magicword: $ctrl.POWEROFF_PATTERN} }}" | ||
> | ||
<input | ||
type="text" | ||
class="oui-input" | ||
name="poweroffInput" | ||
data-ng-model="$ctrl.poweroffConfirmation" | ||
data-ng-pattern="$ctrl.POWEROFF_PATTERN" | ||
required | ||
/> | ||
</oui-field> | ||
</form> | ||
</oui-modal> |
11 changes: 11 additions & 0 deletions
11
...r/modules/nutanix/src/dashboard/component/poweroff-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_poweroff_node_title": "Eteindre le noeud", | ||
"nutanix_dashboard_poweroff_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_poweroff_node_poweroff_guidelink": "Accéder au portail", | ||
"nutanix_dashboard_poweroff_node_confirmation": "Voulez-vous vraiment éteindre votre noeud {{serviceName}} ?", | ||
"nutanix_dashboard_poweroff_node_confirm": "Eteindre", | ||
"nutanix_dashboard_poweroff_node_cancel": "Annuler", | ||
"nutanix_dasboard_poweroff_node_input_label": "Entrez \"{{magicword}}\" pour configurer votre choix", | ||
"nutanix_dashboard_poweroff_node_success_banner": "Votre demande d'extinction a été prise en compte. Cette opération peut prendre jusqu'à 15 minutes", | ||
"nutanix_dashboard_poweroff_node_error_banner": "Votre demande d'extinction 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/poweroff-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 = 'ovhManagerNutanixNodePowerOffLazyLoading'; | ||
|
||
angular.module(moduleName, ['ui.router', 'oc.lazyLoad']).config( | ||
/* @ngInject */ ($stateProvider) => { | ||
$stateProvider.state('nutanix.dashboard.nodes.all.poweroff-node.**', { | ||
url: '/poweroff/:node', | ||
lazyLoad: ($transition$) => { | ||
const $ocLazyLoad = $transition$.injector().get('$ocLazyLoad'); | ||
return import('./poweroff-node.module').then((mod) => | ||
$ocLazyLoad.inject(mod.default || mod), | ||
); | ||
}, | ||
}); | ||
}, | ||
); | ||
|
||
export default moduleName; |
24 changes: 24 additions & 0 deletions
24
...es/manager/modules/nutanix/src/dashboard/nodes/list/poweroff-node/poweroff-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 poweroffModal from '../../../component/poweroff-modal/module'; | ||
|
||
import '@ovh-ux/ng-translate-async-loader'; | ||
import '@uirouter/angularjs'; | ||
import 'angular-translate'; | ||
import '@ovh-ux/ui-kit'; | ||
|
||
import routing from './poweroff-node.routing'; | ||
|
||
const moduleName = 'ovhManagerNutanixNodePowerOff'; | ||
|
||
angular | ||
.module(moduleName, [ | ||
atInternet, | ||
'oui', | ||
'pascalprecht.translate', | ||
'ui.router', | ||
poweroffModal, | ||
]) | ||
.config(routing); | ||
|
||
export default moduleName; |
28 changes: 28 additions & 0 deletions
28
...s/manager/modules/nutanix/src/dashboard/nodes/list/poweroff-node/poweroff-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,28 @@ | ||
export default /* @ngInject */ ($stateProvider) => { | ||
$stateProvider.state('nutanix.dashboard.nodes.all.poweroff', { | ||
url: '/poweroff/:node', | ||
views: { | ||
modal: { | ||
component: 'powerOffNutanixNodeModal', | ||
}, | ||
}, | ||
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(); | ||
}, | ||
poweroffNode: /* ngInject */ (NutanixService, nodeId) => () => | ||
NutanixService.updateClusterNodePowerStateOff(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