Skip to content

Commit

Permalink
feat(nutanix): reinstall node popin
Browse files Browse the repository at this point in the history
ref: MANAGER-15715

Signed-off-by: Thibault Barske <[email protected]>
  • Loading branch information
tibs245 committed Jan 8, 2025
1 parent 0dc39da commit 73e28a8
Show file tree
Hide file tree
Showing 9 changed files with 200 additions and 0 deletions.
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,
};
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;
});
}
}
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;
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>
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."
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import addNodes from './add-nodes';
import poweronNode from './poweron-node';
import poweroffNode from './poweroff-node';
import installNode from './install-node';
import reinstallNode from './reinstall-node';
import uninstallNode from './uninstall-node';
import resiliateNode from './resiliate-node';

Expand All @@ -31,6 +32,7 @@ angular
poweronNode,
poweroffNode,
installNode,
reinstallNode,
uninstallNode,
resiliateNode,
])
Expand Down
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;
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;
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,
},
});
};

0 comments on commit 73e28a8

Please sign in to comment.