-
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.
ref: MANAGER-15715 Signed-off-by: Thibault Barske <[email protected]>
- Loading branch information
Showing
9 changed files
with
200 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/reinstall-node-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: '<', | ||
availableVersions: '<', | ||
installNode: '<', | ||
handleSuccess: '<', | ||
handleError: '<', | ||
}, | ||
template, | ||
controller, | ||
}; |
44 changes: 44 additions & 0 deletions
44
packages/manager/modules/nutanix/src/dashboard/component/reinstall-node-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,44 @@ | ||
export default class NutanixDashboardReinstallNodeCtrl { | ||
/* @ngInject */ | ||
constructor(NutanixService, $translate) { | ||
this.NutanixService = NutanixService; | ||
this.$translate = $translate; | ||
this.errorIpMessage = { | ||
notValidIp: $translate.instant( | ||
'nutanix_dashboard_reinstall_form_not_valid_ip_error', | ||
), | ||
notPrivateIp: $translate.instant( | ||
'nutanix_dashboard_reinstall_form_not_private_ip_error', | ||
), | ||
}; | ||
} | ||
|
||
onSubmit() { | ||
if (this.reinstallNodeForm.$invalid) { | ||
return; | ||
} | ||
|
||
this.isLoading = true; | ||
|
||
this.installNode({ | ||
version: this.version, | ||
}) | ||
.then(() => { | ||
this.handleSuccess( | ||
`${this.$translate.instant( | ||
'nutanix_dashboard_install_node_success_banner', | ||
)}`, | ||
); | ||
}) | ||
.catch((error) => { | ||
this.handleError( | ||
`${this.$translate.instant( | ||
'nutanix_dashboard_install_node_error_banner', | ||
)} ${error.message}`, | ||
); | ||
}) | ||
.finally(() => { | ||
this.isLoading = false; | ||
}); | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
packages/manager/modules/nutanix/src/dashboard/component/reinstall-node-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 = 'ovhManagerNutanixReinstallNodeModal'; | ||
|
||
angular | ||
.module(moduleName, [ | ||
'oui', | ||
'ovhManagerCore', | ||
'pascalprecht.translate', | ||
'ui.router', | ||
]) | ||
.component('nutanixReinstallNodeModal', component) | ||
.run(/* @ngTranslationsInject:json ./translations */); | ||
|
||
export default moduleName; |
30 changes: 30 additions & 0 deletions
30
packages/manager/modules/nutanix/src/dashboard/component/reinstall-node-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,30 @@ | ||
<oui-modal | ||
data-on-dismiss="$ctrl.goBack()" | ||
data-primary-action="$ctrl.onSubmit()" | ||
data-primary-label="{{:: 'nutanix_dashboard_reinstall_node_confirm' | translate }}" | ||
data-primary-disabled="$ctrl.reinstallNodeForm.$invalid" | ||
data-loading="$ctrl.isLoading" | ||
data-secondary-action="$ctrl.goBack()" | ||
data-secondary-label="{{:: 'nutanix_dashboard_reinstall_node_cancel' | translate }}" | ||
data-heading="{{:: 'nutanix_dashboard_reinstall_node_title' | translate }}" | ||
> | ||
<div> | ||
<p data-translate="nutanix_dashboard_reinstall_node_description"></p> | ||
|
||
<oui-message type="info" | ||
><span data-translate="nutanix_dashboard_reinstall_node_tips"></span | ||
></oui-message> | ||
|
||
<form class="mt-4" name="$ctrl.reinstallNodeForm" novalidate> | ||
<oui-field | ||
label="{{:: 'nutanix_dashboard_reinstall_node_label_version_aos' | translate }}" | ||
> | ||
<oui-select | ||
name="version" | ||
data-model="$ctrl.version" | ||
data-items=":: $ctrl.availableVersions" | ||
/> | ||
</oui-field> | ||
</form> | ||
</div> | ||
</oui-modal> |
15 changes: 15 additions & 0 deletions
15
...les/nutanix/src/dashboard/component/reinstall-node-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,15 @@ | ||
{ | ||
"nutanix_dashboard_reinstall_node_title": "Ré-installer le noeud", | ||
"nutanix_dashboard_reinstall_node_description": "Vous allez ré-installer AOS et AHV sur votre noeud. Indiquez des adresses IP inutilisées dans le réseau de votre cluster.", | ||
"nutanix_dashboard_reinstall_node_tips": "Pour une ré-installation simultanée sur plusieurs noeuds, veuillez utiliser l'API", | ||
"nutanix_dashboard_reinstall_node_label_ahv_ip": "IP du noeud", | ||
"nutanix_dashboard_reinstall_node_label_cvm_ip": "IP CVM", | ||
"nutanix_dashboard_reinstall_node_label_version_aos": "Version AOS", | ||
"nutanix_dashboard_reinstall_node_confirm": "Ré-installer", | ||
"nutanix_dashboard_reinstall_node_cancel": "Annuler", | ||
"nutanix_dashboard_reinstall_node_success_banner": "Votre demande d'une ré-installation a été prise en compte. Cette opération peut prendre jusqu'à 1h", | ||
"nutanix_dashboard_reinstall_node_error_banner": "Votre demande dune ré-installation n'a pas été prise en compte : ", | ||
"nutanix_dashboard_reinstall_form_not_valid_ip_error": "Adresse IPv4 invalide", | ||
"nutanix_dashboard_reinstall_form_not_private_ip_error": "Ce champ accepte uniquement les adresses IPv4 privées", | ||
"nutanix_dashboard_reinstall_ip_tooltip": "L'adresse IP doit être incluse dans le sous-réseau du cluster." | ||
} |
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/reinstall-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 = 'ovhManagerNutanixNodeReinstallLazyLoading'; | ||
|
||
angular.module(moduleName, ['ui.router', 'oc.lazyLoad']).config( | ||
/* @ngInject */ ($stateProvider) => { | ||
$stateProvider.state('nutanix.dashboard.nodes.all.reinstall-node.**', { | ||
url: '/reinstall/:node', | ||
lazyLoad: ($transition$) => { | ||
const $ocLazyLoad = $transition$.injector().get('$ocLazyLoad'); | ||
return import('./reinstall-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/reinstall-node/reinstall-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 reinstallModal from '../../../component/reinstall-node-modal/module'; | ||
|
||
import '@ovh-ux/ng-translate-async-loader'; | ||
import '@uirouter/angularjs'; | ||
import 'angular-translate'; | ||
import '@ovh-ux/ui-kit'; | ||
|
||
import routing from './reinstall-node.routing'; | ||
|
||
const moduleName = 'ovhManagerNutanixNodeReinstall'; | ||
|
||
angular | ||
.module(moduleName, [ | ||
atInternet, | ||
'oui', | ||
'pascalprecht.translate', | ||
'ui.router', | ||
reinstallModal, | ||
]) | ||
.config(routing); | ||
|
||
export default moduleName; |
28 changes: 28 additions & 0 deletions
28
...manager/modules/nutanix/src/dashboard/nodes/list/reinstall-node/reinstall-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.reinstall-node', { | ||
url: '/reinstall/:node', | ||
views: { | ||
modal: { | ||
component: 'nutanixReinstallNodeModal', | ||
}, | ||
}, | ||
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(); | ||
}, | ||
installNode: /* ngInject */ (NutanixService, serviceName, nodeId) => ( | ||
params, | ||
) => NutanixService.installClusterNode(serviceName, nodeId, params), | ||
availableVersions: /* ngInject */ (cluster) => cluster.availableVersions, | ||
}, | ||
}); | ||
}; |