Skip to content

Commit

Permalink
fixup! feat(nutanix): add nutanix node popin
Browse files Browse the repository at this point in the history
  • Loading branch information
tibs245 committed Dec 17, 2024
1 parent fc6d9e3 commit cbff5b8
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,11 @@
</div>
</oui-tile-description>
<oui-action-menu data-compact data-placement="end">
<oui-action-menu-item on-click="$ctrl.goToAddNode()">
<oui-action-menu-item
data-on-click="$ctrl.goToAddNode()"
data-disabled="$ctrl.isMaxNodesReached"
data-oui-tooltip="{{ $ctrl.addNodeTooltipContent }}"
>
<span
data-translate="nutanix_dashboard_cluster_buy_node"
></span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { NODE_BADGE_STATE } from './constants';
import { MAX_NODES_BY_CLUSTER } from '../../../constants';

export default class NutanixAllNodesCtrl {
/* @ngInject */
Expand All @@ -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(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<oui-datagrid rows="$ctrl.nodesMapped" data-page-size="25" class="mt-5">
<oui-datagrid-topbar>
<oui-button on-click="$ctrl.goToAddNode()"
<oui-button
data-on-click="$ctrl.goToAddNode()"
data-disabled="$ctrl.isMaxNodesReached"
data-oui-tooltip="{{ $ctrl.addNodeTooltipContent }}"
><span
data-translate="nutanix_dashboard_nodes_list_add_nodes"
></span
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@
"nutanix_dashboard_nodes_list_status_HACKED_BLOCKED": "Hacké et bloqué",
"nutanix_dashboard_nodes_list_localisation_value": "{{dcName}} (Baie {{rackName}})",
"nutanix_dashboard_nodes_list_data_hidden": "CACHÉ",
"nutanix_dashboard_nodes_list_add_nodes": "Ajouter des noeuds"
"nutanix_dashboard_nodes_list_add_nodes": "Ajouter des noeuds",
"nutanix_dashboard_nodes_add_node_max_node_tooltip": "Vous avez atteint le nombre maximum de noeuds autorisés dans un cluster"
}

0 comments on commit cbff5b8

Please sign in to comment.