Commit 902280f3 authored by Ezekiel Kigbo's avatar Ezekiel Kigbo

Merge branch '218007-fix-incomplete-kubernetes-cluster-status-list' into 'master'

Resolve "Fix Incomplete Kubernetes Cluster Status List"

See merge request gitlab-org/gitlab!33344
parents a7fe3895 9a6faca8
...@@ -72,10 +72,7 @@ export default { ...@@ -72,10 +72,7 @@ export default {
}, },
methods: { methods: {
...mapActions(['fetchClusters', 'setPage']), ...mapActions(['fetchClusters', 'setPage']),
statusClass(status) {
const iconClass = STATUSES[status] || STATUSES.default;
return iconClass.className;
},
statusTitle(status) { statusTitle(status) {
const iconTitle = STATUSES[status] || STATUSES.default; const iconTitle = STATUSES[status] || STATUSES.default;
return sprintf(__('Status: %{title}'), { title: iconTitle.title }, false); return sprintf(__('Status: %{title}'), { title: iconTitle.title }, false);
...@@ -96,19 +93,12 @@ export default { ...@@ -96,19 +93,12 @@ export default {
</gl-link> </gl-link>
<gl-loading-icon <gl-loading-icon
v-if="item.status === 'deleting'" v-if="item.status === 'deleting' || item.status === 'creating'"
v-tooltip v-tooltip
:title="statusTitle(item.status)" :title="statusTitle(item.status)"
size="sm" size="sm"
class="mr-2 ml-md-2" class="mr-2 ml-md-2"
/> />
<div
v-else
v-tooltip
class="cluster-status-indicator rounded-circle align-self-center gl-w-4 gl-h-4 mr-2 ml-md-2"
:class="statusClass(item.status)"
:title="statusTitle(item.status)"
></div>
</div> </div>
</template> </template>
......
...@@ -15,4 +15,5 @@ export const STATUSES = { ...@@ -15,4 +15,5 @@ export const STATUSES = {
unreachable: { className: 'bg-danger', title: __('Unreachable') }, unreachable: { className: 'bg-danger', title: __('Unreachable') },
authentication_failure: { className: 'bg-warning', title: __('Authentication Failure') }, authentication_failure: { className: 'bg-warning', title: __('Authentication Failure') },
deleting: { title: __('Deleting') }, deleting: { title: __('Deleting') },
creating: { title: __('Creating') },
}; };
---
title: Resolve Fix Incomplete Kubernetes Cluster Status List
merge_request: 33344
author:
type: fixed
...@@ -6636,6 +6636,9 @@ msgstr "" ...@@ -6636,6 +6636,9 @@ msgstr ""
msgid "Creates branch '%{branch_name}' and a merge request to resolve this issue." msgid "Creates branch '%{branch_name}' and a merge request to resolve this issue."
msgstr "" msgstr ""
msgid "Creating"
msgstr ""
msgid "Creating epic" msgid "Creating epic"
msgstr "" msgstr ""
......
...@@ -83,24 +83,21 @@ describe('Clusters', () => { ...@@ -83,24 +83,21 @@ describe('Clusters', () => {
describe('cluster status', () => { describe('cluster status', () => {
it.each` it.each`
statusName | className | lineNumber statusName | lineNumber | result
${'disabled'} | ${'disabled'} | ${0} ${'creating'} | ${0} | ${true}
${'unreachable'} | ${'bg-danger'} | ${1} ${null} | ${1} | ${false}
${'authentication_failure'} | ${'bg-warning'} | ${2} ${null} | ${2} | ${false}
${'deleting'} | ${null} | ${3} ${'deleting'} | ${3} | ${true}
${'created'} | ${'bg-success'} | ${4} ${null} | ${4} | ${false}
${'default'} | ${'bg-white'} | ${5} ${null} | ${5} | ${false}
`('renders a status for each cluster', ({ statusName, className, lineNumber }) => { `(
const statuses = findStatuses(); 'renders $result when status=$statusName and lineNumber=$lineNumber',
const status = statuses.at(lineNumber); ({ lineNumber, result }) => {
if (statusName !== 'deleting') { const statuses = findStatuses();
const statusIndicator = status.find('.cluster-status-indicator'); const status = statuses.at(lineNumber);
expect(statusIndicator.exists()).toBe(true); expect(status.find(GlLoadingIcon).exists()).toBe(result);
expect(statusIndicator.classes()).toContain(className); },
} else { );
expect(status.find(GlLoadingIcon).exists()).toBe(true);
}
});
}); });
describe('nodes present', () => { describe('nodes present', () => {
......
...@@ -3,7 +3,7 @@ export const clusterList = [ ...@@ -3,7 +3,7 @@ export const clusterList = [
name: 'My Cluster 1', name: 'My Cluster 1',
environment_scope: '*', environment_scope: '*',
cluster_type: 'group_type', cluster_type: 'group_type',
status: 'disabled', status: 'creating',
nodes: null, nodes: null,
}, },
{ {
......
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