diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-05-31 12:10:22 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-05-31 12:10:22 +0300 |
commit | e5f7ee6673f47290d860565f13a5a26391822260 (patch) | |
tree | f0e7c7bdd83bb8bc6ed783acdba961ce71fcfcf7 /app/assets/javascripts/clusters | |
parent | d6ae5ba9dfaf8a39bf570a72e2152fc23501ed34 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/clusters')
5 files changed, 1 insertions, 335 deletions
diff --git a/app/assets/javascripts/clusters/clusters_bundle.js b/app/assets/javascripts/clusters/clusters_bundle.js index 5cb3d913210..2a2f3ff2dc1 100644 --- a/app/assets/javascripts/clusters/clusters_bundle.js +++ b/app/assets/javascripts/clusters/clusters_bundle.js @@ -55,7 +55,6 @@ export default class Clusters { helmHelpPath, ingressHelpPath, ingressDnsHelpPath, - ingressModSecurityHelpPath, environmentsHelpPath, clustersHelpPath, deployBoardsHelpPath, @@ -74,7 +73,6 @@ export default class Clusters { helmHelpPath, ingressHelpPath, ingressDnsHelpPath, - ingressModSecurityHelpPath, environmentsHelpPath, clustersHelpPath, deployBoardsHelpPath, @@ -168,7 +166,6 @@ export default class Clusters { ingressHelpPath: this.state.ingressHelpPath, managePrometheusPath: this.state.managePrometheusPath, ingressDnsHelpPath: this.state.ingressDnsHelpPath, - ingressModSecurityHelpPath: this.state.ingressModSecurityHelpPath, cloudRunHelpPath: this.state.cloudRunHelpPath, providerType: this.state.providerType, preInstalledKnative: this.state.preInstalledKnative, @@ -253,9 +250,6 @@ export default class Clusters { eventHub.$on('setKnativeDomain', (data) => this.setKnativeDomain(data)); eventHub.$on('uninstallApplication', (data) => this.uninstallApplication(data)); eventHub.$on('setCrossplaneProviderStack', (data) => this.setCrossplaneProviderStack(data)); - eventHub.$on('setIngressModSecurityEnabled', (data) => this.setIngressModSecurityEnabled(data)); - eventHub.$on('setIngressModSecurityMode', (data) => this.setIngressModSecurityMode(data)); - eventHub.$on('resetIngressModSecurityChanges', (id) => this.resetIngressModSecurityChanges(id)); eventHub.$on('setFluentdSettings', (data) => this.setFluentdSettings(data)); // Add event listener to all the banner close buttons this.addBannerCloseHandler(this.unreachableContainer, 'unreachable'); @@ -274,12 +268,6 @@ export default class Clusters { // eslint-disable-next-line @gitlab/no-global-event-off eventHub.$off('uninstallApplication'); // eslint-disable-next-line @gitlab/no-global-event-off - eventHub.$off('setIngressModSecurityEnabled'); - // eslint-disable-next-line @gitlab/no-global-event-off - eventHub.$off('setIngressModSecurityMode'); - // eslint-disable-next-line @gitlab/no-global-event-off - eventHub.$off('resetIngressModSecurityChanges'); - // eslint-disable-next-line @gitlab/no-global-event-off eventHub.$off('setFluentdSettings'); } @@ -519,21 +507,6 @@ export default class Clusters { this.store.updateAppProperty(appId, 'validationError', null); } - setIngressModSecurityEnabled({ id, modSecurityEnabled }) { - this.store.updateAppProperty(id, 'isEditingModSecurityEnabled', true); - this.store.updateAppProperty(id, 'modsecurity_enabled', modSecurityEnabled); - } - - setIngressModSecurityMode({ id, modSecurityMode }) { - this.store.updateAppProperty(id, 'isEditingModSecurityMode', true); - this.store.updateAppProperty(id, 'modsecurity_mode', modSecurityMode); - } - - resetIngressModSecurityChanges(id) { - this.store.updateAppProperty(id, 'isEditingModSecurityEnabled', false); - this.store.updateAppProperty(id, 'isEditingModSecurityMode', false); - } - destroy() { this.destroyed = true; diff --git a/app/assets/javascripts/clusters/components/applications.vue b/app/assets/javascripts/clusters/components/applications.vue index 8ef3169dc65..e589b67fba0 100644 --- a/app/assets/javascripts/clusters/components/applications.vue +++ b/app/assets/javascripts/clusters/components/applications.vue @@ -16,7 +16,6 @@ import { CLUSTER_TYPE, PROVIDER_TYPE, APPLICATION_STATUS, INGRESS } from '../con import applicationRow from './application_row.vue'; import CrossplaneProviderStack from './crossplane_provider_stack.vue'; import FluentdOutputSettings from './fluentd_output_settings.vue'; -import IngressModsecuritySettings from './ingress_modsecurity_settings.vue'; import KnativeDomainEditor from './knative_domain_editor.vue'; export default { @@ -28,7 +27,6 @@ export default { GlLink, KnativeDomainEditor, CrossplaneProviderStack, - IngressModsecuritySettings, FluentdOutputSettings, GlAlert, }, @@ -63,11 +61,7 @@ export default { required: false, default: '', }, - ingressModSecurityHelpPath: { - type: String, - required: false, - default: '', - }, + cloudRunHelpPath: { type: String, required: false, @@ -219,10 +213,6 @@ export default { :request-reason="applications.ingress.requestReason" :installed="applications.ingress.installed" :install-failed="applications.ingress.installFailed" - :install-application-request-params="{ - modsecurity_enabled: applications.ingress.modsecurity_enabled, - modsecurity_mode: applications.ingress.modsecurity_mode, - }" :uninstallable="applications.ingress.uninstallable" :uninstall-successful="applications.ingress.uninstallSuccessful" :uninstall-failed="applications.ingress.uninstallFailed" @@ -238,11 +228,6 @@ export default { }} </p> - <ingress-modsecurity-settings - :ingress="ingress" - :ingress-mod-security-help-path="ingressModSecurityHelpPath" - /> - <template v-if="ingressInstalled"> <div class="form-group"> <label for="ingress-endpoint">{{ s__('ClusterIntegration|Ingress Endpoint') }}</label> @@ -658,7 +643,6 @@ export default { host: applications.fluentd.host, port: applications.fluentd.port, protocol: applications.fluentd.protocol, - waf_log_enabled: applications.fluentd.wafLogEnabled, cilium_log_enabled: applications.fluentd.ciliumLogEnabled, }" :uninstallable="applications.fluentd.uninstallable" @@ -680,7 +664,6 @@ export default { :port="applications.fluentd.port" :protocol="applications.fluentd.protocol" :host="applications.fluentd.host" - :waf-log-enabled="applications.fluentd.wafLogEnabled" :cilium-log-enabled="applications.fluentd.ciliumLogEnabled" :status="applications.fluentd.status" :update-failed="applications.fluentd.updateFailed" diff --git a/app/assets/javascripts/clusters/components/fluentd_output_settings.vue b/app/assets/javascripts/clusters/components/fluentd_output_settings.vue index aaad0009ef3..d167b8f89dd 100644 --- a/app/assets/javascripts/clusters/components/fluentd_output_settings.vue +++ b/app/assets/javascripts/clusters/components/fluentd_output_settings.vue @@ -45,10 +45,6 @@ export default { required: false, default: '', }, - wafLogEnabled: { - type: Boolean, - required: false, - }, ciliumLogEnabled: { type: Boolean, required: false, @@ -60,7 +56,6 @@ export default { host: null, port: null, protocol: null, - wafLogEnabled: null, ciliumLogEnabled: null, }, }; @@ -109,7 +104,6 @@ export default { port: this.port, protocol: this.protocol, host: this.host, - waf_log_enabled: this.wafLogEnabled, cilium_log_enabled: this.ciliumLogEnabled, }, }); @@ -151,9 +145,6 @@ export default { portChanged(port) { this.setFluentdSettings({ port: Number(port) }); }, - wafLogChanged(wafLogEnabled) { - this.setFluentdSettings({ wafLogEnabled }); - }, ciliumLogChanged(ciliumLogEnabled) { this.setFluentdSettings({ ciliumLogEnabled }); }, @@ -210,9 +201,6 @@ export default { </gl-dropdown> </div> <div class="form-group flex flex-wrap"> - <gl-form-checkbox :checked="wafLogEnabled" @input="wafLogChanged"> - <strong>{{ s__('ClusterIntegration|Send Web Application Firewall Logs') }}</strong> - </gl-form-checkbox> <gl-form-checkbox :checked="ciliumLogEnabled" @input="ciliumLogChanged"> <strong>{{ s__('ClusterIntegration|Send Container Network Policies Logs') }}</strong> </gl-form-checkbox> diff --git a/app/assets/javascripts/clusters/components/ingress_modsecurity_settings.vue b/app/assets/javascripts/clusters/components/ingress_modsecurity_settings.vue deleted file mode 100644 index 1ba28660e5c..00000000000 --- a/app/assets/javascripts/clusters/components/ingress_modsecurity_settings.vue +++ /dev/null @@ -1,266 +0,0 @@ -<script> -import { - GlAlert, - GlSprintf, - GlLink, - GlToggle, - GlButton, - GlDropdown, - GlDropdownItem, - GlIcon, -} from '@gitlab/ui'; -import { escape } from 'lodash'; -import modSecurityLogo from 'images/cluster_app_logos/gitlab.png'; -import { APPLICATION_STATUS, INGRESS, LOGGING_MODE, BLOCKING_MODE } from '~/clusters/constants'; -import eventHub from '~/clusters/event_hub'; -import { s__, __ } from '../../locale'; - -const { UPDATING, UNINSTALLING, INSTALLING, INSTALLED, UPDATED } = APPLICATION_STATUS; - -export default { - i18n: { - modSecurityEnabled: s__('ClusterIntegration|ModSecurity enabled'), - }, - title: __('Web Application Firewall'), - modsecurityUrl: 'https://modsecurity.org/about.html', - components: { - GlAlert, - GlSprintf, - GlLink, - GlToggle, - GlButton, - GlDropdown, - GlDropdownItem, - GlIcon, - }, - props: { - ingress: { - type: Object, - required: true, - }, - ingressModSecurityHelpPath: { - type: String, - required: false, - default: '', - }, - modes: { - type: Object, - required: false, - default: () => ({ - [LOGGING_MODE]: { - name: s__('ClusterIntegration|Logging mode'), - }, - [BLOCKING_MODE]: { - name: s__('ClusterIntegration|Blocking mode'), - }, - }), - }, - }, - data() { - return { - modSecurityLogo, - initialValue: null, - initialMode: null, - }; - }, - computed: { - modSecurityEnabled: { - get() { - return this.ingress.modsecurity_enabled; - }, - set(isEnabled) { - if (this.initialValue === null) { - this.initialValue = this.ingress.modsecurity_enabled; - } - eventHub.$emit('setIngressModSecurityEnabled', { - id: INGRESS, - modSecurityEnabled: isEnabled, - }); - }, - }, - hasValueChanged() { - return this.modSecurityEnabledChanged || this.modSecurityModeChanged; - }, - modSecurityEnabledChanged() { - return this.initialValue !== null && this.initialValue !== this.ingress.modsecurity_enabled; - }, - modSecurityModeChanged() { - return ( - this.ingress.modsecurity_enabled && - this.initialMode !== null && - this.initialMode !== this.ingress.modsecurity_mode - ); - }, - ingressModSecurityDescription() { - return escape(this.ingressModSecurityHelpPath); - }, - saving() { - return [UPDATING].includes(this.ingress.status); - }, - saveButtonDisabled() { - return ( - [UNINSTALLING, UPDATING, INSTALLING].includes(this.ingress.status) || - this.ingress.updateAvailable - ); - }, - saveButtonLabel() { - return this.saving ? __('Saving') : __('Save changes'); - }, - /** - * Returns true either when: - * - The application is getting updated. - * - The user has changed some of the settings for an application which is - * neither getting installed nor updated. - */ - showButtons() { - return this.saving || this.valuesChangedByUser; - }, - modSecurityModeName() { - return this.modes[this.ingress.modsecurity_mode].name; - }, - valuesChangedByUser() { - return this.hasValueChanged && [INSTALLED, UPDATED].includes(this.ingress.status); - }, - }, - methods: { - updateApplication() { - eventHub.$emit('updateApplication', { - id: INGRESS, - params: { - modsecurity_enabled: this.ingress.modsecurity_enabled, - modsecurity_mode: this.ingress.modsecurity_mode, - }, - }); - this.resetStatus(); - }, - resetStatus() { - if (this.initialMode !== null) { - // eslint-disable-next-line vue/no-mutating-props - this.ingress.modsecurity_mode = this.initialMode; - } - if (this.initialValue !== null) { - // eslint-disable-next-line vue/no-mutating-props - this.ingress.modsecurity_enabled = this.initialValue; - } - this.initialValue = null; - this.initialMode = null; - eventHub.$emit('resetIngressModSecurityChanges', INGRESS); - }, - selectMode(modeKey) { - if (this.initialMode === null) { - this.initialMode = this.ingress.modsecurity_mode; - } - eventHub.$emit('setIngressModSecurityMode', { - id: INGRESS, - modSecurityMode: modeKey, - }); - }, - }, -}; -</script> - -<template> - <div> - <gl-alert - v-if="ingress.updateFailed" - class="mb-3" - variant="danger" - :dismissible="false" - @dismiss="alert = null" - > - {{ - s__( - 'ClusterIntegration|Something went wrong while trying to save your settings. Please try again.', - ) - }} - </gl-alert> - <div class="gl-responsive-table-row-layout" role="row"> - <div class="table-section gl-mr-3 section-align-top" role="gridcell"> - <img - :src="modSecurityLogo" - :alt="`${$options.title} logo`" - class="cluster-application-logo avatar s40" - /> - </div> - <div class="table-section section-wrap" role="gridcell"> - <strong> - <gl-link :href="$options.modsecurityUrl" target="_blank">{{ $options.title }} </gl-link> - </strong> - <div class="form-group"> - <p class="form-text text-muted"> - <strong> - <gl-sprintf - :message=" - s__( - 'ClusterIntegration|Real-time web application monitoring, logging and access control. %{linkStart}More information%{linkEnd}', - ) - " - > - <template #link="{ content }"> - <gl-link :href="ingressModSecurityDescription" target="_blank" - >{{ content }} - </gl-link> - </template> - </gl-sprintf> - </strong> - </p> - <div class="form-check form-check-inline mt-3"> - <gl-toggle - v-model="modSecurityEnabled" - :disabled="saveButtonDisabled" - :label="$options.i18n.modSecurityEnabled" - label-position="hidden" - /> - </div> - <div - v-if="ingress.modsecurity_enabled" - class="gl-responsive-table-row-layout mt-3" - role="row" - > - <div class="table-section section-wrap" role="gridcell"> - <strong> - {{ s__('ClusterIntegration|Global default') }} - <gl-icon name="earth" class="align-text-bottom" /> - </strong> - <div class="form-group"> - <p class="form-text text-muted"> - <strong> - {{ - s__( - 'ClusterIntegration|Set the global mode for the WAF in this cluster. This can be overridden at the environmental level.', - ) - }} - </strong> - </p> - </div> - <gl-dropdown :text="modSecurityModeName" :disabled="saveButtonDisabled"> - <gl-dropdown-item v-for="(mode, key) in modes" :key="key" @click="selectMode(key)"> - {{ mode.name }} - </gl-dropdown-item> - </gl-dropdown> - </div> - </div> - <div v-if="showButtons" class="gl-mt-5 gl-display-flex"> - <gl-button - variant="success" - category="primary" - data-qa-selector="save_ingress_modsecurity_settings" - :loading="saving" - :disabled="saveButtonDisabled" - @click="updateApplication" - > - {{ saveButtonLabel }} - </gl-button> - <gl-button - data-qa-selector="cancel_ingress_modsecurity_settings" - :disabled="saveButtonDisabled" - @click="resetStatus" - > - {{ __('Cancel') }} - </gl-button> - </div> - </div> - </div> - </div> - </div> -</template> diff --git a/app/assets/javascripts/clusters/stores/clusters_store.js b/app/assets/javascripts/clusters/stores/clusters_store.js index d45696c98c2..88a1d648451 100644 --- a/app/assets/javascripts/clusters/stores/clusters_store.js +++ b/app/assets/javascripts/clusters/stores/clusters_store.js @@ -55,12 +55,8 @@ export default class ClusterStore { ingress: { ...applicationInitialState, title: s__('ClusterIntegration|Ingress'), - modsecurity_enabled: false, - modsecurity_mode: null, externalIp: null, externalHostname: null, - isEditingModSecurityEnabled: false, - isEditingModSecurityMode: false, updateFailed: false, updateAvailable: false, }, @@ -112,7 +108,6 @@ export default class ClusterStore { host: null, port: null, protocol: null, - wafLogEnabled: null, ciliumLogEnabled: null, isEditingSettings: false, }, @@ -219,12 +214,6 @@ export default class ClusterStore { this.state.applications.ingress.externalIp = serverAppEntry.external_ip; this.state.applications.ingress.externalHostname = serverAppEntry.external_hostname; this.state.applications.ingress.updateAvailable = updateAvailable; - if (!this.state.applications.ingress.isEditingModSecurityEnabled) { - this.state.applications.ingress.modsecurity_enabled = serverAppEntry.modsecurity_enabled; - } - if (!this.state.applications.ingress.isEditingModSecurityMode) { - this.state.applications.ingress.modsecurity_mode = serverAppEntry.modsecurity_mode; - } } else if (appId === CERT_MANAGER) { this.state.applications.cert_manager.email = this.state.applications.cert_manager.email || serverAppEntry.email; @@ -262,7 +251,6 @@ export default class ClusterStore { this.state.applications.fluentd.port = serverAppEntry.port; this.state.applications.fluentd.host = serverAppEntry.host; this.state.applications.fluentd.protocol = serverAppEntry.protocol; - this.state.applications.fluentd.wafLogEnabled = serverAppEntry.waf_log_enabled; this.state.applications.fluentd.ciliumLogEnabled = serverAppEntry.cilium_log_enabled; } } |