Commit b324db38 authored by Natalia Tepluhina's avatar Natalia Tepluhina

Merge branch '326032-remove-the-regulated-tab-from-compliance-frameworks' into 'master'

Remove the 'Regulated' tab from compliance frameworks

See merge request gitlab-org/gitlab!64690
parents bf3439f5 d1d9cdb6
<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,29 +162,23 @@ export default { ...@@ -166,29 +162,23 @@ export default {
:add-framework-path="addFrameworkPath" :add-framework-path="addFrameworkPath"
/> />
<gl-tabs v-if="hasFrameworks"> <list-item
<gl-tab class="gl-mt-6" :title="$options.i18n.allTab"> v-for="framework in complianceFrameworks"
<list-item :key="framework.parsedId"
v-for="framework in complianceFrameworks" :framework="framework"
:key="framework.parsedId" :loading="isDeleting(framework.id)"
:framework="framework" @delete="markForDeletion"
:loading="isDeleting(framework.id)" />
@delete="markForDeletion"
/> <gl-button
</gl-tab> v-if="showAddButton"
<gl-tab disabled :title="$options.i18n.regulatedTab" /> class="gl-mt-3"
<template #tabs-end> category="primary"
<gl-button variant="confirm"
v-if="addFrameworkPath" :href="addFrameworkPath"
class="gl-align-self-center gl-ml-auto" >
category="primary" {{ $options.i18n.addBtn }}
variant="confirm" </gl-button>
:href="addFrameworkPath"
>
{{ $options.i18n.addBtn }}
</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();
......
...@@ -8055,9 +8055,6 @@ msgstr "" ...@@ -8055,9 +8055,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 ""
...@@ -8094,9 +8091,6 @@ msgstr "" ...@@ -8094,9 +8091,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