-
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 node to nutanix cluster
ref: MANAGER-14556 Signed-off-by: Thibault Barske <[email protected]>
- Loading branch information
Showing
27 changed files
with
482 additions
and
14 deletions.
There are no files selected for viewing
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
17 changes: 17 additions & 0 deletions
17
packages/manager/modules/nutanix/src/dashboard/component/add-nodes-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,17 @@ | ||
import template from './template.html'; | ||
import controller from './controller'; | ||
|
||
export default { | ||
bindings: { | ||
goBack: '<', | ||
nodeTechnicalDetails: '<', | ||
cluster: '<', | ||
server: '<', | ||
nodePricing: '<', | ||
nodeOrderLinkGenerator: '<', | ||
expressOrderLink: '<', | ||
handleSuccess: '<', | ||
}, | ||
template, | ||
controller, | ||
}; |
39 changes: 39 additions & 0 deletions
39
packages/manager/modules/nutanix/src/dashboard/component/add-nodes-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,39 @@ | ||
import { MAX_NODES_BY_CLUSTER } from '../../../constants'; | ||
|
||
export default class { | ||
/* @ngInject */ | ||
constructor($window, $translate) { | ||
this.$translate = $translate; | ||
this.$window = $window; | ||
this.numberOfNodes = 1; | ||
} | ||
|
||
get maxNodeToBuy() { | ||
return MAX_NODES_BY_CLUSTER - this.cluster.targetSpec.nodes.length; | ||
} | ||
|
||
get nodePriceText() { | ||
return this.nodePricing.price.text; | ||
} | ||
|
||
generateOrderExpressLink() { | ||
this.nodeOrderLinkGenerator.setQuantity(this.numberOfNodes); | ||
const expressOrderParams = this.nodeOrderLinkGenerator.generateLinkParams(); | ||
|
||
return `${this.expressOrderLink}${expressOrderParams}`; | ||
} | ||
|
||
onSubmit() { | ||
this.openExpressOrderTab(); | ||
|
||
this.handleSuccess( | ||
`${this.$translate.instant( | ||
'nutanix_dashboard_add_nodes_success_banner', | ||
)}<a href="${this.generateOrderExpressLink()}" target="_blank">${this.generateOrderExpressLink()}</a>`, | ||
); | ||
} | ||
|
||
openExpressOrderTab() { | ||
this.$window.open(this.generateOrderExpressLink(), '_blank'); | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
packages/manager/modules/nutanix/src/dashboard/component/add-nodes-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 = 'ovhManagerNutanixAddNutanixNodesModal'; | ||
|
||
angular | ||
.module(moduleName, [ | ||
'oui', | ||
'ovhManagerCore', | ||
'pascalprecht.translate', | ||
'ui.router', | ||
]) | ||
.component('addNutanixNodesModal', component) | ||
.run(/* @ngTranslationsInject:json ./translations */); | ||
|
||
export default moduleName; |
67 changes: 67 additions & 0 deletions
67
packages/manager/modules/nutanix/src/dashboard/component/add-nodes-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,67 @@ | ||
<oui-modal | ||
data-on-dismiss="$ctrl.goBack()" | ||
data-primary-action="$ctrl.onSubmit()" | ||
data-primary-label="{{ !($ctrl.loading || $ctrl.terminationUnavailable) ? ('nutanix_dashboard_add_nodes_confirm' | translate) : '' }}" | ||
data-secondary-action="$ctrl.goBack()" | ||
data-secondary-disabled="$ctrl.loading" | ||
data-secondary-label="{{:: 'nutanix_dashboard_add_nodes_cancel' | translate }}" | ||
data-loading="$ctrl.cancelSubscriptionForm.isSubmiting || $ctrl.loading" | ||
data-heading="{{:: 'nutanix_dashboard_add_nodes_title' | translate }}" | ||
> | ||
<div> | ||
<p | ||
class="oui-heading_4" | ||
data-translate="nutanix_dashboard_add_nodes_actual_configuration" | ||
></p> | ||
<div> | ||
<strong | ||
data-translate="nutanix_dashboard_add_nodes_server_model" | ||
></strong> | ||
{{ $ctrl.server.description }} | ||
</div> | ||
<div> | ||
<strong data-translate="nutanix_dashboard_add_nodes_cpu"></strong> | ||
{{ $ctrl.nodeTechnicalDetails.cpu }} | ||
</div> | ||
<div> | ||
<strong | ||
data-translate="nutanix_dashboard_add_nodes_memory" | ||
></strong> | ||
{{$ctrl.nodeTechnicalDetails.memoryCapacity}} | ||
</div> | ||
<div> | ||
<strong | ||
data-translate="nutanix_dashboard_add_nodes_stokage" | ||
></strong> | ||
{{ $ctrl.nodeTechnicalDetails.storageCapacity }} | ||
</div> | ||
|
||
<form class="mt-4" name="cancelSubscriptionForm" novalidate> | ||
<p | ||
class="oui-heading_4" | ||
data-translate="nutanix_dashboard_add_nodes_informations" | ||
></p> | ||
|
||
<div> | ||
<span | ||
data-translate="nutanix_dashboard_add_nodes_price_preffix" | ||
></span> | ||
<span class="font-weight-bold">{{$ctrl.nodePriceText}}</span> | ||
<span | ||
data-translate="nutanix_dashboard_add_nodes_price_suffix" | ||
></span> | ||
|
||
<oui-field> | ||
<oui-numeric | ||
name="numberOfNodes" | ||
model="$ctrl.numberOfNodes" | ||
min="1" | ||
max="$ctrl.maxNodeToBuy" | ||
on-change="$ctrl.onChange(modelValue)" | ||
> | ||
</oui-numeric> | ||
</oui-field> | ||
</div> | ||
</form> | ||
</div> | ||
</oui-modal> |
16 changes: 16 additions & 0 deletions
16
.../modules/nutanix/src/dashboard/component/add-nodes-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,16 @@ | ||
{ | ||
"nutanix_dashboard_add_nodes_title": "Commande de noeud(s)", | ||
"nutanix_dashboard_add_nodes_actual_configuration": "Configuration actuelle des noeuds de votre cluster", | ||
"nutanix_dashboard_add_nodes_server_model": "Modèle de serveurs :", | ||
"nutanix_dashboard_add_nodes_cpu": "CPU :", | ||
"nutanix_dashboard_add_nodes_memory": "Mémoire :", | ||
"nutanix_dashboard_add_nodes_stokage": "Stokage :", | ||
"nutanix_dashboard_add_nodes_informations": "Informations", | ||
"nutanix_dashboard_add_nodes_price_preffix": "Le prix du noeud est de", | ||
"nutanix_dashboard_add_nodes_price_suffix": "HT/mois", | ||
"nutanix_dashboard_add_nodes_number_of_nodes_available": "Votre cluster est composé de {{numberOfNodes}} noeuds actuellement et vous pouvez l'étendre jusqu'à 15 noeuds.", | ||
"nutanix_dashboard_add_nodes_number_of_nodes_to_command": "Nombre de noeuds supplémentaires à commander.", | ||
"nutanix_dashboard_add_nodes_confirm": "Commander", | ||
"nutanix_dashboard_add_nodes_cancel": "Annuler", | ||
"nutanix_dashboard_add_nodes_success_banner": "Votre commande de nœud(s) a été initiée. Si vous ne l'avez pas encore finalisée, vous pouvez la compléter en cliquant sur le lien suivant : " | ||
} |
24 changes: 24 additions & 0 deletions
24
packages/manager/modules/nutanix/src/dashboard/general-info/add-nodes/add-nodes.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 addNodeComponent from '../../component/add-nodes-modal/module'; | ||
|
||
import '@ovh-ux/ng-translate-async-loader'; | ||
import '@uirouter/angularjs'; | ||
import 'angular-translate'; | ||
import '@ovh-ux/ui-kit'; | ||
|
||
import routing from './add-nodes.routing'; | ||
|
||
const moduleName = 'ovhManagerDedicatedServerDashboardTerminate'; | ||
|
||
angular | ||
.module(moduleName, [ | ||
atInternet, | ||
'oui', | ||
'pascalprecht.translate', | ||
'ui.router', | ||
addNodeComponent, | ||
]) | ||
.config(routing); | ||
|
||
export default moduleName; |
37 changes: 37 additions & 0 deletions
37
packages/manager/modules/nutanix/src/dashboard/general-info/add-nodes/add-nodes.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,37 @@ | ||
import { getOrderExpressUrl } from '../../../constants'; | ||
import NodeExpressOrderLinkGenerator from '../../node-express-order-link-generator'; | ||
|
||
export default /* @ngInject */ ($stateProvider) => { | ||
$stateProvider.state('nutanix.dashboard.general-info.add-nodes', { | ||
url: '/add-nodes', | ||
views: { | ||
modal: { | ||
component: 'addNutanixNodesModal', | ||
}, | ||
}, | ||
layout: 'modal', | ||
resolve: { | ||
goBack: /* @ngInject */ (goToDashboard) => goToDashboard, | ||
nodeTechnicalDetails: /* @ngInject */ (NutanixService, cluster) => | ||
NutanixService.getNodeHardwareInfo(cluster.targetSpec.nodes[0].server), | ||
nodePricing: /* ngInject */ (clusterAddOns) => { | ||
return clusterAddOns[0].billing.pricing; | ||
}, | ||
handleError: /* @ngInject */ (Alerter, goBack) => (error) => { | ||
Alerter.error( | ||
error.message || error.data?.message, | ||
'nutanix_dashboard_alert', | ||
); | ||
goBack(); | ||
}, | ||
nodeOrderLinkGenerator: /* @ngInject */ (serviceName, clusterAddOns) => | ||
new NodeExpressOrderLinkGenerator(serviceName, clusterAddOns[0]), | ||
expressOrderLink: /* @ngInject */ (coreConfig) => | ||
getOrderExpressUrl(coreConfig.getUser().ovhSubsidiary), | ||
handleSuccess: /* @ngInject */ (Alerter, goBack) => (message) => { | ||
Alerter.success(message, 'nutanix_dashboard_alert'); | ||
goBack(); | ||
}, | ||
}, | ||
}); | ||
}; |
22 changes: 22 additions & 0 deletions
22
packages/manager/modules/nutanix/src/dashboard/general-info/add-nodes/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 = 'ovhManagerNutanixAddNodesLazyLoading'; | ||
|
||
angular.module(moduleName, ['ui.router', 'oc.lazyLoad']).config( | ||
/* @ngInject */ ($stateProvider) => { | ||
$stateProvider.state('nutanix.dashboard.general-info.add-nodes.**', { | ||
url: '/add-nodes', | ||
lazyLoad: ($transition$) => { | ||
const $ocLazyLoad = $transition$.injector().get('$ocLazyLoad'); | ||
return import('./add-nodes.module').then((mod) => | ||
$ocLazyLoad.inject(mod.default || mod), | ||
); | ||
}, | ||
}); | ||
}, | ||
); | ||
|
||
export default moduleName; |
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
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
Oops, something went wrong.