diff --git a/ee/app/assets/javascripts/threat_monitoring/components/app.vue b/ee/app/assets/javascripts/threat_monitoring/components/app.vue index 9b7728204b9bbc1c49fb2be055f3aae7569526e2..9b1a793380e48279c549133c7a48753e51d828fc 100644 --- a/ee/app/assets/javascripts/threat_monitoring/components/app.vue +++ b/ee/app/assets/javascripts/threat_monitoring/components/app.vue @@ -1,7 +1,6 @@ <script> -import { GlAlert, GlIcon, GlLink, GlPopover, GlTabs, GlTab } from '@gitlab/ui'; +import { GlIcon, GlLink, GlPopover, GlTabs, GlTab } from '@gitlab/ui'; import { mapActions } from 'vuex'; -import axios from '~/lib/utils/axios_utils'; import { s__ } from '~/locale'; import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; import Alerts from './alerts/alerts.vue'; @@ -13,7 +12,6 @@ import ThreatMonitoringSection from './threat_monitoring_section.vue'; export default { name: 'ThreatMonitoring', components: { - GlAlert, GlIcon, GlLink, GlPopover, @@ -40,18 +38,6 @@ export default { type: String, required: true, }, - showUserCallout: { - type: Boolean, - required: true, - }, - userCalloutId: { - type: String, - required: true, - }, - userCalloutsPath: { - type: String, - required: true, - }, newPolicyPath: { type: String, required: true, @@ -59,8 +45,6 @@ export default { }, data() { return { - showAlert: this.showUserCallout, - // We require the project to have at least one available environment. // An invalid default environment id means there there are no available // environments, therefore infrastructure cannot be set up. A valid default @@ -84,13 +68,6 @@ export default { isValidEnvironmentId(id) { return Number.isInteger(id) && id >= 0; }, - dismissAlert() { - this.showAlert = false; - - axios.post(this.userCalloutsPath, { - feature_name: this.userCalloutId, - }); - }, }, chartEmptyStateDescription: s__( `ThreatMonitoring|While it's rare to have no traffic coming to your @@ -105,29 +82,12 @@ export default { `ThreatMonitoring|Container Network Policies are not installed or have been disabled. To view this data, ensure your Network Policies are installed and enabled for your cluster.`, ), - alertText: s__( - `ThreatMonitoring|The graph below is an overview of traffic coming to your - application as tracked by the Web Application Firewall (WAF). View the docs - for instructions on how to access the WAF logs to see what type of - malicious traffic is trying to access your app. The docs link is also - accessible by clicking the "?" icon next to the title below.`, - ), helpPopoverText: s__('ThreatMonitoring|View documentation'), }; </script> <template> <section> - <gl-alert - v-if="showAlert" - class="my-3" - variant="info" - :secondary-button-link="documentationPath" - :secondary-button-text="__('View documentation')" - @dismiss="dismissAlert" - > - {{ $options.alertText }} - </gl-alert> <header class="my-3"> <h2 class="h3 mb-1"> {{ s__('ThreatMonitoring|Threat Monitoring') }} diff --git a/ee/app/assets/javascripts/threat_monitoring/index.js b/ee/app/assets/javascripts/threat_monitoring/index.js index 66832c02732dfae52d9ea10d294ae3070baf3332..473de20b298e277aaf4520e3595cb553bf7ef9eb 100644 --- a/ee/app/assets/javascripts/threat_monitoring/index.js +++ b/ee/app/assets/javascripts/threat_monitoring/index.js @@ -1,7 +1,6 @@ import Vue from 'vue'; import VueApollo from 'vue-apollo'; import createDefaultClient from '~/lib/graphql'; -import { parseBoolean } from '~/lib/utils/common_utils'; import ThreatMonitoringApp from './components/app.vue'; import createStore from './store'; @@ -25,9 +24,6 @@ export default () => { documentationPath, defaultEnvironmentId, projectPath, - showUserCallout, - userCalloutId, - userCalloutsPath, } = el.dataset; const store = createStore(); @@ -55,9 +51,6 @@ export default () => { wafNoDataSvgPath, networkPolicyNoDataSvgPath, defaultEnvironmentId: parseInt(defaultEnvironmentId, 10), - showUserCallout: parseBoolean(showUserCallout), - userCalloutId, - userCalloutsPath, newPolicyPath, }, }); diff --git a/ee/app/helpers/ee/user_callouts_helper.rb b/ee/app/helpers/ee/user_callouts_helper.rb index 34d0581793f6b920e555ea0d9455845e7c2a8474..e71f164dd51aead28f42a6ee72a754f163279b47 100644 --- a/ee/app/helpers/ee/user_callouts_helper.rb +++ b/ee/app/helpers/ee/user_callouts_helper.rb @@ -11,7 +11,6 @@ module UserCalloutsHelper ULTIMATE_TRIAL = 'ultimate_trial' NEW_USER_SIGNUPS_CAP_REACHED = 'new_user_signups_cap_reached' PERSONAL_ACCESS_TOKEN_EXPIRY = 'personal_access_token_expiry' - THREAT_MONITORING_INFO = 'threat_monitoring_info' EOA_BRONZE_PLAN_BANNER = 'eoa_bronze_plan_banner' def render_enable_hashed_storage_warning @@ -62,10 +61,6 @@ def render_account_recovery_regular_check render 'shared/check_recovery_settings' end - def show_threat_monitoring_info? - !user_dismissed?(THREAT_MONITORING_INFO) - end - def show_token_expiry_notification? return false unless current_user diff --git a/ee/app/views/projects/threat_monitoring/show.html.haml b/ee/app/views/projects/threat_monitoring/show.html.haml index 2a2d7e2ee194fde1b9f8a8766b02e39b23093953..83fdffca52146a67312d9b639c87719797a2d136 100644 --- a/ee/app/views/projects/threat_monitoring/show.html.haml +++ b/ee/app/views/projects/threat_monitoring/show.html.haml @@ -14,7 +14,4 @@ new_policy_path: new_project_threat_monitoring_policy_path(@project), default_environment_id: default_environment_id, project_path: @project.full_path, - user_callouts_path: user_callouts_path, - user_callout_id: UserCalloutsHelper::THREAT_MONITORING_INFO, - show_user_callout: false, } } diff --git a/ee/spec/frontend/threat_monitoring/components/__snapshots__/app_spec.js.snap b/ee/spec/frontend/threat_monitoring/components/__snapshots__/app_spec.js.snap index 8669606d2311d53ea366b1ae598549e9c3afcdb7..2aba65808927ff89dddefd611c73dd9f131a9f9b 100644 --- a/ee/spec/frontend/threat_monitoring/components/__snapshots__/app_spec.js.snap +++ b/ee/spec/frontend/threat_monitoring/components/__snapshots__/app_spec.js.snap @@ -43,21 +43,3 @@ exports[`ThreatMonitoringApp component given there is a default environment with ylegend="Requests" /> `; - -exports[`ThreatMonitoringApp component given there is a default environment with data shows the alert 1`] = ` -<gl-alert-stub - class="my-3" - dismissible="true" - dismisslabel="Dismiss" - primarybuttonlink="" - primarybuttontext="" - secondarybuttonlink="/docs" - secondarybuttontext="View documentation" - title="" - variant="info" -> - - The graph below is an overview of traffic coming to your application as tracked by the Web Application Firewall (WAF). View the docs for instructions on how to access the WAF logs to see what type of malicious traffic is trying to access your app. The docs link is also accessible by clicking the "?" icon next to the title below. - -</gl-alert-stub> -`; diff --git a/ee/spec/frontend/threat_monitoring/components/app_spec.js b/ee/spec/frontend/threat_monitoring/components/app_spec.js index 7c31f9559d09860e444d0c64bdfff21d82bbfd7e..466b2c97c7c090ac32a14463b9f15e33b13a5817 100644 --- a/ee/spec/frontend/threat_monitoring/components/app_spec.js +++ b/ee/spec/frontend/threat_monitoring/components/app_spec.js @@ -1,6 +1,4 @@ -import { GlAlert } from '@gitlab/ui'; import { shallowMount } from '@vue/test-utils'; -import MockAdapter from 'axios-mock-adapter'; import ThreatMonitoringAlerts from 'ee/threat_monitoring/components/alerts/alerts.vue'; import ThreatMonitoringApp from 'ee/threat_monitoring/components/app.vue'; import NetworkPolicyList from 'ee/threat_monitoring/components/network_policy_list.vue'; @@ -9,7 +7,6 @@ import ThreatMonitoringFilters from 'ee/threat_monitoring/components/threat_moni import createStore from 'ee/threat_monitoring/store'; import { TEST_HOST } from 'helpers/test_constants'; import { extendedWrapper } from 'helpers/vue_test_utils_helper'; -import axios from '~/lib/utils/axios_utils'; const defaultEnvironmentId = 3; const documentationPath = '/docs'; @@ -20,8 +17,6 @@ const networkPolicyNoDataSvgPath = '/network-policy-no-data-svg'; const environmentsEndpoint = `${TEST_HOST}/environments`; const wafStatisticsEndpoint = `${TEST_HOST}/waf`; const networkPolicyStatisticsEndpoint = `${TEST_HOST}/network_policy`; -const userCalloutId = 'threat_monitoring_info'; -const userCalloutsPath = `${TEST_HOST}/user_callouts`; describe('ThreatMonitoringApp component', () => { let store; @@ -46,9 +41,6 @@ describe('ThreatMonitoringApp component', () => { wafNoDataSvgPath, networkPolicyNoDataSvgPath, newPolicyPath, - showUserCallout: true, - userCalloutId, - userCalloutsPath, ...propsData, }, provide: { @@ -62,7 +54,6 @@ describe('ThreatMonitoringApp component', () => { ); }; - const findAlert = () => wrapper.find(GlAlert); const findAlertsView = () => wrapper.find(ThreatMonitoringAlerts); const findNetworkPolicyList = () => wrapper.find(NetworkPolicyList); const findFilters = () => wrapper.find(ThreatMonitoringFilters); @@ -125,10 +116,6 @@ describe('ThreatMonitoringApp component', () => { ]); }); - it('shows the alert', () => { - expect(findAlert().element).toMatchSnapshot(); - }); - it('shows the filter bar', () => { expect(findFilters().exists()).toBe(true); }); @@ -148,44 +135,6 @@ describe('ThreatMonitoringApp component', () => { it('does not show the alert tab', () => { expect(findAlertTab().exists()).toBe(false); }); - - describe('dismissing the alert', () => { - let mockAxios; - - beforeEach(() => { - mockAxios = new MockAdapter(axios); - mockAxios.onPost(userCalloutsPath, { feature_name: userCalloutId }).reply(200); - - findAlert().vm.$emit('dismiss'); - return wrapper.vm.$nextTick(); - }); - - afterEach(() => { - mockAxios.restore(); - }); - - it('hides the alert', () => { - expect(findAlert().exists()).toBe(false); - }); - - it('posts the dismissal to the user callouts endpoint', () => { - expect(mockAxios.history.post).toHaveLength(1); - }); - }); - }); - - describe('given showUserCallout is false', () => { - beforeEach(() => { - factory({ - propsData: { - showUserCallout: false, - }, - }); - }); - - it('does not render the alert', () => { - expect(findAlert().exists()).toBe(false); - }); }); describe('alerts tab', () => { diff --git a/ee/spec/helpers/ee/user_callouts_helper_spec.rb b/ee/spec/helpers/ee/user_callouts_helper_spec.rb index ec097d1a561eb41157ecd4452485b2e1efa4eeac..9a5467b60e75c7f357dadfce2696ea80d55a175e 100644 --- a/ee/spec/helpers/ee/user_callouts_helper_spec.rb +++ b/ee/spec/helpers/ee/user_callouts_helper_spec.rb @@ -215,28 +215,6 @@ end end - describe '.show_threat_monitoring_info?' do - subject { helper.show_threat_monitoring_info? } - - let(:user) { create(:user) } - - before do - allow(helper).to receive(:current_user).and_return(user) - end - - context 'when the threat monitoring info has not been dismissed' do - it { is_expected.to be_truthy } - end - - context 'when the threat monitoring info was dismissed' do - before do - create(:user_callout, user: user, feature_name: described_class::THREAT_MONITORING_INFO) - end - - it { is_expected.to be_falsy } - end - end - describe '.show_token_expiry_notification?' do subject { helper.show_token_expiry_notification? } diff --git a/locale/gitlab.pot b/locale/gitlab.pot index 18eae551b0c6d71777f14e0769995d818bd0c192..7f2e2d7da27369cece37be76e067f377a26ac99f 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -30946,9 +30946,6 @@ msgstr "" msgid "ThreatMonitoring|The firewall is not installed or has been disabled. To view this data, ensure the web application firewall is installed and enabled for your cluster." msgstr "" -msgid "ThreatMonitoring|The graph below is an overview of traffic coming to your application as tracked by the Web Application Firewall (WAF). View the docs for instructions on how to access the WAF logs to see what type of malicious traffic is trying to access your app. The docs link is also accessible by clicking the \"?\" icon next to the title below." -msgstr "" - msgid "ThreatMonitoring|There was an error displaying the alerts. Confirm your endpoint's configuration details to ensure alerts appear." msgstr ""