Commit d1d9cdb6 authored by Robert Hunt's avatar Robert Hunt

Remove the regulated tab from compliance frameworks list

Removes the tab structure from the compliance frameworks list and moves
the Add framework button from the top to the bottom of the list.

Changelog: changed
MR: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/64690
EE: true
parent f39f7d41
<script> <script>
import { GlAlert, GlButton, GlLoadingIcon, GlTab, GlTabs } from '@gitlab/ui'; import { GlAlert, GlButton, GlLoadingIcon } from '@gitlab/ui';
import * as Sentry from '@sentry/browser'; import * as Sentry from '@sentry/browser';
import { getIdFromGraphQLId } from '~/graphql_shared/utils'; import { getIdFromGraphQLId } from '~/graphql_shared/utils';
...@@ -20,8 +20,6 @@ export default { ...@@ -20,8 +20,6 @@ export default {
GlButton, GlButton,
GlLoadingIcon, GlLoadingIcon,
ListItem, ListItem,
GlTab,
GlTabs,
}, },
props: { props: {
addFrameworkPath: { addFrameworkPath: {
...@@ -96,9 +94,6 @@ export default { ...@@ -96,9 +94,6 @@ export default {
hasFrameworks() { hasFrameworks() {
return this.hasLoaded && this.frameworksCount > 0; return this.hasLoaded && this.frameworksCount > 0;
}, },
regulatedCount() {
return 0;
},
alertDismissible() { alertDismissible() {
return !this.error; return !this.error;
}, },
...@@ -108,6 +103,9 @@ export default { ...@@ -108,6 +103,9 @@ export default {
alertMessage() { alertMessage() {
return this.error || this.message; return this.error || this.message;
}, },
showAddButton() {
return this.hasLoaded && this.addFrameworkPath && !this.isEmpty;
},
}, },
methods: { methods: {
dismissAlertMessage() { dismissAlertMessage() {
...@@ -142,14 +140,12 @@ export default { ...@@ -142,14 +140,12 @@ export default {
fetchError: s__( fetchError: s__(
'ComplianceFrameworks|Error fetching compliance frameworks data. Please refresh the page', 'ComplianceFrameworks|Error fetching compliance frameworks data. Please refresh the page',
), ),
allTab: s__('ComplianceFrameworks|All'),
regulatedTab: s__('ComplianceFrameworks|Regulated'),
addBtn: s__('ComplianceFrameworks|Add framework'), addBtn: s__('ComplianceFrameworks|Add framework'),
}, },
}; };
</script> </script>
<template> <template>
<div class="gl-border-t-1 gl-border-t-solid gl-border-t-gray-100"> <div :class="{ 'gl-border-t-1 gl-border-t-solid gl-border-t-gray-100': isEmpty }">
<gl-alert <gl-alert
v-if="alertMessage" v-if="alertMessage"
class="gl-mt-5" class="gl-mt-5"
...@@ -166,8 +162,6 @@ export default { ...@@ -166,8 +162,6 @@ export default {
:add-framework-path="addFrameworkPath" :add-framework-path="addFrameworkPath"
/> />
<gl-tabs v-if="hasFrameworks">
<gl-tab class="gl-mt-6" :title="$options.i18n.allTab">
<list-item <list-item
v-for="framework in complianceFrameworks" v-for="framework in complianceFrameworks"
:key="framework.parsedId" :key="framework.parsedId"
...@@ -175,20 +169,16 @@ export default { ...@@ -175,20 +169,16 @@ export default {
:loading="isDeleting(framework.id)" :loading="isDeleting(framework.id)"
@delete="markForDeletion" @delete="markForDeletion"
/> />
</gl-tab>
<gl-tab disabled :title="$options.i18n.regulatedTab" />
<template #tabs-end>
<gl-button <gl-button
v-if="addFrameworkPath" v-if="showAddButton"
class="gl-align-self-center gl-ml-auto" class="gl-mt-3"
category="primary" category="primary"
variant="confirm" variant="confirm"
:href="addFrameworkPath" :href="addFrameworkPath"
> >
{{ $options.i18n.addBtn }} {{ $options.i18n.addBtn }}
</gl-button> </gl-button>
</template>
</gl-tabs>
<delete-modal <delete-modal
v-if="hasFrameworks" v-if="hasFrameworks"
:id="markedForDeletion.id" :id="markedForDeletion.id"
......
import { GlAlert, GlButton, GlLoadingIcon, GlTab, GlTabs } from '@gitlab/ui'; import { GlAlert, GlButton, GlLoadingIcon } from '@gitlab/ui';
import * as Sentry from '@sentry/browser'; import * as Sentry from '@sentry/browser';
import { createLocalVue, shallowMount } from '@vue/test-utils'; import { createLocalVue, shallowMount } from '@vue/test-utils';
import { nextTick } from 'vue'; import { nextTick } from 'vue';
...@@ -30,9 +30,7 @@ describe('List', () => { ...@@ -30,9 +30,7 @@ describe('List', () => {
const findDeleteModal = () => wrapper.findComponent(DeleteModal); const findDeleteModal = () => wrapper.findComponent(DeleteModal);
const findLoadingIcon = () => wrapper.findComponent(GlLoadingIcon); const findLoadingIcon = () => wrapper.findComponent(GlLoadingIcon);
const findEmptyState = () => wrapper.findComponent(EmptyState); const findEmptyState = () => wrapper.findComponent(EmptyState);
const findTabs = () => wrapper.findAllComponents(GlTab);
const findAddBtn = () => wrapper.findComponent(GlButton); const findAddBtn = () => wrapper.findComponent(GlButton);
const findTabsContainer = () => wrapper.findComponent(GlTabs);
const findListItems = () => wrapper.findAllComponents(ListItem); const findListItems = () => wrapper.findAllComponents(ListItem);
function createMockApolloProvider(resolverMock) { function createMockApolloProvider(resolverMock) {
...@@ -56,8 +54,6 @@ describe('List', () => { ...@@ -56,8 +54,6 @@ describe('List', () => {
}, },
stubs: { stubs: {
GlLoadingIcon, GlLoadingIcon,
GlTab,
GlTabs,
}, },
}); });
} }
...@@ -77,7 +73,8 @@ describe('List', () => { ...@@ -77,7 +73,8 @@ describe('List', () => {
it('does not show the other parts of the app', () => { it('does not show the other parts of the app', () => {
expect(findAlert().exists()).toBe(false); expect(findAlert().exists()).toBe(false);
expect(findTabsContainer().exists()).toBe(false); expect(findListItems().exists()).toBe(false);
expect(findAddBtn().exists()).toBe(false);
expect(findEmptyState().exists()).toBe(false); expect(findEmptyState().exists()).toBe(false);
}); });
}); });
...@@ -97,7 +94,8 @@ describe('List', () => { ...@@ -97,7 +94,8 @@ describe('List', () => {
it('does not show the other parts of the app', () => { it('does not show the other parts of the app', () => {
expect(findLoadingIcon().exists()).toBe(false); expect(findLoadingIcon().exists()).toBe(false);
expect(findTabsContainer().exists()).toBe(false); expect(findListItems().exists()).toBe(false);
expect(findAddBtn().exists()).toBe(false);
expect(findEmptyState().exists()).toBe(false); expect(findEmptyState().exists()).toBe(false);
}); });
...@@ -128,7 +126,8 @@ describe('List', () => { ...@@ -128,7 +126,8 @@ describe('List', () => {
it('does not show the other parts of the app', () => { it('does not show the other parts of the app', () => {
expect(findAlert().exists()).toBe(false); expect(findAlert().exists()).toBe(false);
expect(findLoadingIcon().exists()).toBe(false); expect(findLoadingIcon().exists()).toBe(false);
expect(findTabsContainer().exists()).toBe(false); expect(findListItems().exists()).toBe(false);
expect(findAddBtn().exists()).toBe(false);
expect(findDeleteModal().exists()).toBe(false); expect(findDeleteModal().exists()).toBe(false);
}); });
}); });
...@@ -144,22 +143,6 @@ describe('List', () => { ...@@ -144,22 +143,6 @@ describe('List', () => {
expect(findEmptyState().exists()).toBe(false); expect(findEmptyState().exists()).toBe(false);
}); });
it('shows the tabs', () => {
expect(findTabsContainer().exists()).toBe(true);
expect(findTabs()).toHaveLength(2);
});
it('shows the all tab', () => {
expect(findTabs().at(0).attributes('title')).toBe('All');
});
it('shows the disabled regulated tab', () => {
const tab = findTabs().at(1);
expect(tab.attributes('title')).toBe('Regulated');
expect(tab.attributes('disabled')).toBe('true');
});
it('shows the add framework button', () => { it('shows the add framework button', () => {
const addBtn = findAddBtn(); const addBtn = findAddBtn();
......
...@@ -8052,9 +8052,6 @@ msgstr "" ...@@ -8052,9 +8052,6 @@ msgstr ""
msgid "ComplianceFrameworks|Add framework" msgid "ComplianceFrameworks|Add framework"
msgstr "" msgstr ""
msgid "ComplianceFrameworks|All"
msgstr ""
msgid "ComplianceFrameworks|Combines with the CI configuration at runtime." msgid "ComplianceFrameworks|Combines with the CI configuration at runtime."
msgstr "" msgstr ""
...@@ -8091,9 +8088,6 @@ msgstr "" ...@@ -8091,9 +8088,6 @@ msgstr ""
msgid "ComplianceFrameworks|Once a compliance framework is added it will appear here." msgid "ComplianceFrameworks|Once a compliance framework is added it will appear here."
msgstr "" msgstr ""
msgid "ComplianceFrameworks|Regulated"
msgstr ""
msgid "ComplianceFrameworks|There are no compliance frameworks set up yet" msgid "ComplianceFrameworks|There are no compliance frameworks set up yet"
msgstr "" msgstr ""
......
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