Commit 06fb70fc authored by Emily Ring's avatar Emily Ring

Added default cluster status

Added default cluster status to /clusters_list/constants.js
parent 1282559c
...@@ -54,12 +54,12 @@ export default { ...@@ -54,12 +54,12 @@ export default {
methods: { methods: {
...mapActions(['fetchClusters']), ...mapActions(['fetchClusters']),
statusClass(status) { statusClass(status) {
const { className } = STATUSES[status]; const iconClass = STATUSES[status] || STATUSES.default;
return className || 'disabled'; return iconClass.className;
}, },
statusTitle(status) { statusTitle(status) {
const { title } = STATUSES[status]; const iconTitle = STATUSES[status] || STATUSES.default;
return sprintf(__('Status: %{title}'), { title }, false); return sprintf(__('Status: %{title}'), { title: iconTitle.title }, false);
}, },
}, },
}; };
......
...@@ -7,6 +7,7 @@ export const CLUSTER_TYPES = { ...@@ -7,6 +7,7 @@ export const CLUSTER_TYPES = {
}; };
export const STATUSES = { export const STATUSES = {
default: { className: 'bg-white', title: __('Unknown') },
disabled: { className: 'disabled', title: __('Disabled') }, disabled: { className: 'disabled', title: __('Disabled') },
created: { className: 'bg-success', title: __('Connected') }, created: { className: 'bg-success', title: __('Connected') },
unreachable: { className: 'bg-danger', title: __('Unreachable') }, unreachable: { className: 'bg-danger', title: __('Unreachable') },
......
...@@ -80,6 +80,7 @@ describe('Clusters', () => { ...@@ -80,6 +80,7 @@ describe('Clusters', () => {
${'authentication_failure'} | ${'bg-warning'} | ${2} ${'authentication_failure'} | ${'bg-warning'} | ${2}
${'deleting'} | ${null} | ${3} ${'deleting'} | ${null} | ${3}
${'created'} | ${'bg-success'} | ${4} ${'created'} | ${'bg-success'} | ${4}
${'default'} | ${'bg-white'} | ${5}
`('renders a status for each cluster', ({ statusName, className, lineNumber }) => { `('renders a status for each cluster', ({ statusName, className, lineNumber }) => {
const statuses = findStatuses(); const statuses = findStatuses();
const status = statuses.at(lineNumber); const status = statuses.at(lineNumber);
......
...@@ -44,6 +44,15 @@ export const clusterList = [ ...@@ -44,6 +44,15 @@ export const clusterList = [
cpu: '6 (100% free)', cpu: '6 (100% free)',
memory: '20.12 (35% free)', memory: '20.12 (35% free)',
}, },
{
name: 'My Cluster 6',
environmentScope: '*',
size: '1',
clusterType: 'project_type',
status: 'cleanup_ongoing',
cpu: '6 (100% free)',
memory: '20.12 (35% free)',
},
]; ];
export const apiData = { export const apiData = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment