From e09f6bdfd191f0cf8e54f0bc272e4e0635990ed9 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Tue, 24 May 2022 21:09:08 +0000 Subject: [PATCH] Add latest changes from gitlab-org/gitlab@master --- app/assets/javascripts/lib/utils/dom_utils.js | 6 +- .../security_configuration/components/app.vue | 44 ++-- .../components/constants.js | 4 + .../graphql/current_license.query.graphql | 6 + .../security_configuration/index.js | 1 - .../components/extensions/base.vue | 8 +- .../components/extensions/container.js | 8 +- .../components/extensions/index.js | 16 +- .../components/extensions/status_icon.vue | 2 +- app/assets/stylesheets/pages/detail_page.scss | 3 +- app/helpers/merge_requests_helper.rb | 4 +- app/models/label.rb | 2 +- app/models/project.rb | 4 - .../security/configuration_presenter.rb | 3 +- doc/api/graphql/sample_issue_boards.md | 2 +- doc/api/runners.md | 8 +- doc/api/secure_files.md | 2 +- doc/ci/environments/environments_dashboard.md | 4 +- doc/ci/environments/incremental_rollouts.md | 2 +- doc/ci/pipelines/settings.md | 2 +- doc/ci/runners/configure_runners.md | 10 +- doc/ci/runners/runners_scope.md | 6 +- doc/ci/secure_files/index.md | 4 +- doc/cloud_seed/index.md | 2 +- doc/install/installation.md | 6 +- doc/integration/auth0.md | 2 +- doc/integration/elasticsearch.md | 6 +- doc/subscriptions/index.md | 16 +- doc/update/upgrading_from_source.md | 6 +- doc/user/asciidoc.md | 2 +- doc/user/clusters/environments.md | 2 +- doc/user/clusters/integrations.md | 4 +- .../group/contribution_analytics/index.md | 2 +- .../group/saml_sso/group_managed_accounts.md | 2 +- doc/user/group/saml_sso/index.md | 2 +- doc/user/group/saml_sso/scim_setup.md | 2 +- doc/user/operations_dashboard/index.md | 4 +- doc/user/packages/container_registry/index.md | 6 +- .../reduce_container_registry_storage.md | 4 +- doc/user/packages/maven_repository/index.md | 2 +- doc/user/packages/nuget_repository/index.md | 4 +- .../reduce_package_registry_storage.md | 2 +- .../global_search/advanced_search_syntax.md | 2 +- doc/user/search/index.md | 2 +- doc/user/upgrade_email_bypass.md | 2 +- lib/gitlab/regex.rb | 5 + .../groups/menus/customer_relations_menu.rb | 4 +- .../components/app_spec.js | 193 ++++++++++++------ .../security_configuration/mock_data.js | 9 + .../components/extensions/index_spec.js | 2 +- spec/models/project_spec.rb | 8 - .../quick_actions/interpret_service_spec.rb | 65 +++++- 52 files changed, 340 insertions(+), 179 deletions(-) create mode 100644 app/assets/javascripts/security_configuration/graphql/current_license.query.graphql diff --git a/app/assets/javascripts/lib/utils/dom_utils.js b/app/assets/javascripts/lib/utils/dom_utils.js index d7f0877837c..4262329aae7 100644 --- a/app/assets/javascripts/lib/utils/dom_utils.js +++ b/app/assets/javascripts/lib/utils/dom_utils.js @@ -38,9 +38,9 @@ export const toggleContainerClasses = (containerEl, classList) => { /** * Return a object mapping element dataset names to booleans. * - * This is useful for data- attributes whose presence represent - * a truthiness, no matter the value of the attribute. The absence of the - * attribute represents falsiness. + * This is useful for data- attributes whose presense represent + * a truthiness, no matter the value of the attribute. The absense of the + * attribute represents falsiness. * * This can be useful when Rails-provided boolean-like values are passed * directly to the HAML template, rather than cast to a string. diff --git a/app/assets/javascripts/security_configuration/components/app.vue b/app/assets/javascripts/security_configuration/components/app.vue index c168d686053..d0c4ad3646c 100644 --- a/app/assets/javascripts/security_configuration/components/app.vue +++ b/app/assets/javascripts/security_configuration/components/app.vue @@ -4,9 +4,10 @@ import { __, s__ } from '~/locale'; import LocalStorageSync from '~/vue_shared/components/local_storage_sync.vue'; import UserCalloutDismisser from '~/vue_shared/components/user_callout_dismisser.vue'; import SectionLayout from '~/vue_shared/security_configuration/components/section_layout.vue'; +import currentLicenseQuery from '~/security_configuration/graphql/current_license.query.graphql'; import AutoDevOpsAlert from './auto_dev_ops_alert.vue'; import AutoDevOpsEnabledAlert from './auto_dev_ops_enabled_alert.vue'; -import { AUTO_DEVOPS_ENABLED_ALERT_DISMISSED_STORAGE_KEY } from './constants'; +import { AUTO_DEVOPS_ENABLED_ALERT_DISMISSED_STORAGE_KEY, LICENSE_ULTIMATE } from './constants'; import FeatureCard from './feature_card.vue'; import TrainingProviderList from './training_provider_list.vue'; import UpgradeBanner from './upgrade_banner.vue'; @@ -50,6 +51,17 @@ export default { TrainingProviderList, }, inject: ['projectFullPath', 'vulnerabilityTrainingDocsPath'], + apollo: { + currentLicensePlan: { + query: currentLicenseQuery, + update({ currentLicense }) { + return currentLicense?.plan; + }, + error() { + this.hasCurrentLicenseFetchError = true; + }, + }, + }, props: { augmentedSecurityFeatures: { type: Array, @@ -84,15 +96,13 @@ export default { required: false, default: '', }, - securityTrainingEnabled: { - type: Boolean, - required: true, - }, }, data() { return { autoDevopsEnabledAlertDismissedProjects: [], errorMessage: '', + currentLicensePlan: '', + hasCurrentLicenseFetchError: false, }; }, computed: { @@ -113,6 +123,12 @@ export default { !this.autoDevopsEnabledAlertDismissedProjects.includes(this.projectFullPath) ); }, + shouldShowVulnerabilityManagementTab() { + // if the query fails (if the plan is `null` also means an error has occurred) we still want to show the feature + const hasQueryError = this.hasCurrentLicenseFetchError || this.currentLicensePlan === null; + + return hasQueryError || this.currentLicensePlan === LICENSE_ULTIMATE; + }, }, methods: { dismissAutoDevopsEnabledAlert() { @@ -237,9 +253,9 @@ export default { {{ $options.i18n.description }}

- - {{ $options.i18n.configurationHistory }} - + {{ + $options.i18n.configurationHistory + }}