Commit a961ce0e authored by Alexander Turinske's avatar Alexander Turinske

Hide Policies tab when feature flag is enabled

- hide Security & Compliance => Threat Monitoring =>
  Policies tab when the
  :security_orchestration_policies_configuration
  feature flag is enabled because it is being
  replaced with the Security & Compliance =>
  Policies page
parent 6467a681
......@@ -2,6 +2,7 @@
import { GlIcon, GlLink, GlPopover, GlTabs, GlTab } from '@gitlab/ui';
import { mapActions } from 'vuex';
import { s__ } from '~/locale';
import glFeatureFlagMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
import Alerts from './alerts/alerts.vue';
import NoEnvironmentEmptyState from './no_environment_empty_state.vue';
import PolicyList from './policy_list.vue';
......@@ -22,6 +23,7 @@ export default {
PolicyList,
NoEnvironmentEmptyState,
},
mixins: [glFeatureFlagMixin()],
inject: ['documentationPath'],
props: {
defaultEnvironmentId: {
......@@ -46,6 +48,11 @@ export default {
isSetUpMaybe: this.isValidEnvironmentId(this.defaultEnvironmentId),
};
},
computed: {
shouldShowPolicies() {
return !this.glFeatures.securityOrchestrationPoliciesConfiguration;
},
},
created() {
if (this.isSetUpMaybe) {
this.setCurrentEnvironmentId(this.defaultEnvironmentId);
......@@ -95,6 +102,7 @@ export default {
<alerts />
</gl-tab>
<gl-tab
v-if="shouldShowPolicies"
ref="policyTab"
:title="s__('ThreatMonitoring|Policies')"
data-qa-selector="policies_tab"
......
......@@ -134,4 +134,14 @@ describe('ThreatMonitoringApp component', () => {
expect(findAlertsView().exists()).toBe(true);
});
});
describe('with "securityOrchestrationPoliciesConfiguration" feature flag enabled', () => {
beforeEach(() => {
factory({ provide: { glFeatures: { securityOrchestrationPoliciesConfiguration: true } } });
});
it('does not render the Policies tab', () => {
expect(findPolicyTab().exists()).toBe(false);
});
});
});
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