Skip to content

Commit

Permalink
feat(nutanix): add error page on suspended services
Browse files Browse the repository at this point in the history
ref: MANAGER-15294

Signed-off-by: Thibault Barske <[email protected]>
  • Loading branch information
tibs245 committed Dec 20, 2024
1 parent e93f762 commit 5086461
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,33 @@ export default /* @ngInject */ ($stateProvider) => {
component: 'nutanixNode',
},
},
redirectTo: 'nutanix.dashboard.nodes.node.general-info',
redirectTo: (transition) => {
const $translatePromise = transition.injector().getAsync('$translate');
const serviceInfoPromise = transition.injector().getAsync('serviceInfo');

return Promise.all([$translatePromise, serviceInfoPromise]).then(
([$translate, serviceInfo]) => {
if (serviceInfo.isResiliated()) {
return {
state: 'error',
params: {
detail: {
message: $translate.instant(
'nutanix_dashboard_service_suspended',
),
status: 'EXPIRED',
code: 404,
},
to: {
state: 'nutanix.index',
},
},
};
}
return 'nutanix.dashboard.nodes.node.general-info';
},
);
},
resolve: {
nodeId: /* @ngInject */ ($transition$) => $transition$.params().nodeId,
node: /* @ngInject */ (nodeId, NutanixService) =>
Expand Down
28 changes: 27 additions & 1 deletion packages/manager/modules/nutanix/src/dashboard/nodes/routing.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,33 @@
export default /* @ngInject */ ($stateProvider) => {
$stateProvider.state('nutanix.dashboard.nodes', {
url: '/nodes',
redirectTo: 'nutanix.dashboard.nodes.all',
redirectTo: (transition) => {
const $translatePromise = transition.injector().getAsync('$translate');
const serviceInfoPromise = transition.injector().getAsync('serviceInfo');

return Promise.all([$translatePromise, serviceInfoPromise]).then(
([$translate, serviceInfo]) => {
if (serviceInfo.isResiliated()) {
return {
state: 'error',
params: {
detail: {
message: $translate.instant(
'nutanix_dashboard_service_suspended',
),
status: 'EXPIRED',
code: 404,
},
to: {
state: 'nutanix.dashboard.nodes.all',
},
},
};
}
return 'nutanix.dashboard.nodes.node.general-info';
},
);
},
resolve: {
breadcrumb: /* @ngInject */ ($translate) =>
$translate.instant('nutanix_dashboard_nodes'),
Expand Down
29 changes: 28 additions & 1 deletion packages/manager/modules/nutanix/src/dashboard/routing.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,34 @@ import { OLD_CLUSTER_PLAN_CODE } from './constants';
export default /* @ngInject */ ($stateProvider) => {
$stateProvider.state('nutanix.dashboard', {
url: '/:serviceName',
redirectTo: 'nutanix.dashboard.general-info',
redirectTo: (transition) => {
const $translatePromise = transition.injector().getAsync('$translate');
const serviceInfoPromise = transition.injector().getAsync('serviceInfo');

return Promise.all([$translatePromise, serviceInfoPromise]).then(
([$translate, serviceInfo]) => {
if (serviceInfo.isResiliated()) {
return {
state: 'error',
params: {
detail: {
message: $translate.instant(
'nutanix_dashboard_service_suspended',
),
status: 'EXPIRED',
code: 404,
},
to: {
state: 'nutanix.index',
},
},
};
}

return 'nutanix.dashboard.general-info';
},
);
},
component: 'nutanixDashboard',
resolve: {
trackingPrefix: /* @ngInject */ () => 'hpc::nutanix::cluster',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
"nutanix_dashboard_guides_header": "Guides",
"nutanix_dashboard_guides_header_all_guides": "Tous les guides",
"nutanix_dashboard_cluster_warning1": "Vous devez enregistrer votre licence Nutanix sur votre cluster dans Prism Central avant le [{{endDate}}]",
"nutanix_dashboard_cluster_warning2": "Enregistrez votre licence"
"nutanix_dashboard_cluster_warning2": "Enregistrez votre licence",
"nutanix_dashboard_service_suspended": "Le service a été résilié."
}

0 comments on commit 5086461

Please sign in to comment.