From a0eb215fce3d41849554ce131dff60b915cd0be0 Mon Sep 17 00:00:00 2001 From: Thibault Barske Date: Tue, 17 Dec 2024 16:48:05 +0100 Subject: [PATCH] fixup! feat(nutanix): add nutanix node popin Signed-off-by: Thibault Barske --- .../src/dashboard/general-info/controller.js | 13 ++++++++++++- .../src/dashboard/general-info/template.html | 6 +++++- .../general-info/translations/Messages_fr_FR.json | 3 ++- .../nutanix/src/dashboard/nodes/list/controller.js | 7 +++++++ .../nutanix/src/dashboard/nodes/list/template.html | 5 ++++- .../nodes/list/translations/Messages_fr_FR.json | 3 ++- 6 files changed, 32 insertions(+), 5 deletions(-) diff --git a/packages/manager/modules/nutanix/src/dashboard/general-info/controller.js b/packages/manager/modules/nutanix/src/dashboard/general-info/controller.js index 49275c18e8ac..cab6d8caaca9 100644 --- a/packages/manager/modules/nutanix/src/dashboard/general-info/controller.js +++ b/packages/manager/modules/nutanix/src/dashboard/general-info/controller.js @@ -1,4 +1,8 @@ -import { CLUSTER_STATUS, NUTANIX_AUTHORIZATION_TYPE } from '../../constants'; +import { + CLUSTER_STATUS, + NUTANIX_AUTHORIZATION_TYPE, + MAX_NODES_BY_CLUSTER, +} from '../../constants'; import { GENERAL_INFO_TILE_TITLE, NUTANIX_PERSONAL_LICENSE_EDITION, @@ -29,6 +33,7 @@ export default class NutanixGeneralInfoCtrl { this.NUTANIX_PERSONAL_LICENSE_EDITION = NUTANIX_PERSONAL_LICENSE_EDITION; this.GENERAL_INFO_TILE_TITLE = GENERAL_INFO_TILE_TITLE; this.nodesDetails = []; + this.addNodeTooltipContent = null; } $onInit() { @@ -68,6 +73,12 @@ export default class NutanixGeneralInfoCtrl { return this.NutanixService.getNodesWithState(this.serviceName) .then((nodesDetails) => { this.nodesDetails = nodesDetails; + this.isMaxNodesReached = nodesDetails.length >= MAX_NODES_BY_CLUSTER; + this.addNodeTooltipContent = this.isMaxNodesReached + ? this.$translate.instant( + 'nutanix_dashboard_cluster_add_node_max_node_tooltip', + ) + : null; }) .finally(() => { this.loadingNodesStatus = false; diff --git a/packages/manager/modules/nutanix/src/dashboard/general-info/template.html b/packages/manager/modules/nutanix/src/dashboard/general-info/template.html index 0b496776116a..7b3783edd4ef 100644 --- a/packages/manager/modules/nutanix/src/dashboard/general-info/template.html +++ b/packages/manager/modules/nutanix/src/dashboard/general-info/template.html @@ -183,7 +183,11 @@ - + diff --git a/packages/manager/modules/nutanix/src/dashboard/general-info/translations/Messages_fr_FR.json b/packages/manager/modules/nutanix/src/dashboard/general-info/translations/Messages_fr_FR.json index c52d750f6f60..c7012f2c140e 100644 --- a/packages/manager/modules/nutanix/src/dashboard/general-info/translations/Messages_fr_FR.json +++ b/packages/manager/modules/nutanix/src/dashboard/general-info/translations/Messages_fr_FR.json @@ -28,5 +28,6 @@ "nutanix_dashboard_cluster_one_node_to_deploy": "1 noeud à configurer", "nutanix_dashboard_cluster_several_nodes_to_deploy": "{{numberOfNodes}} noeuds à configurer", "nutanix_dashboard_cluster_one_node_deployed": "1 noeud installé", - "nutanix_dashboard_cluster_several_nodes_deployed": "{{numberOfNodes}} noeuds installés" + "nutanix_dashboard_cluster_several_nodes_deployed": "{{numberOfNodes}} noeuds installés", + "nutanix_dashboard_cluster_add_node_max_node_tooltip": "Vous avez atteint le nombre maximum de noeuds autorisés dans un cluster" } diff --git a/packages/manager/modules/nutanix/src/dashboard/nodes/list/controller.js b/packages/manager/modules/nutanix/src/dashboard/nodes/list/controller.js index 570e5cf0be05..121ca1dd724f 100644 --- a/packages/manager/modules/nutanix/src/dashboard/nodes/list/controller.js +++ b/packages/manager/modules/nutanix/src/dashboard/nodes/list/controller.js @@ -1,4 +1,5 @@ import { NODE_BADGE_STATE } from './constants'; +import { MAX_NODES_BY_CLUSTER } from '../../../constants'; export default class NutanixAllNodesCtrl { /* @ngInject */ @@ -13,6 +14,12 @@ export default class NutanixAllNodesCtrl { const uniqueStates = [...new Set(this.nodes.map(({ state }) => state))]; this.mapNodes = this.mapAllNodes(); + this.isMaxNodesReached = this.nodes.length >= MAX_NODES_BY_CLUSTER; + this.addNodeTooltipContent = this.isMaxNodesReached + ? this.$translate.instant( + 'nutanix_dashboard_nodes_add_node_max_node_tooltip', + ) + : null; this.stateColumnOptions = { hideOperators: true, values: uniqueStates.reduce( diff --git a/packages/manager/modules/nutanix/src/dashboard/nodes/list/template.html b/packages/manager/modules/nutanix/src/dashboard/nodes/list/template.html index f4651a73858d..0b9c73f661d9 100644 --- a/packages/manager/modules/nutanix/src/dashboard/nodes/list/template.html +++ b/packages/manager/modules/nutanix/src/dashboard/nodes/list/template.html @@ -1,6 +1,9 @@ -