Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-05-21 03:08:00 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-05-21 03:08:00 +0300
commit0fd09fff507a22e2059bcfe11cfc4e657590c72c (patch)
tree2468ba28f97c59a9a4729bc7734cfdc5600f27b8 /app
parent22fe7d7df6b91040d6cecbfd78f24c563afed463 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
-rw-r--r--app/assets/javascripts/lib/utils/dom_utils.js6
-rw-r--r--app/assets/javascripts/packages_and_registries/settings/group/components/dependency_proxy_settings.vue6
-rw-r--r--app/assets/javascripts/security_configuration/components/app.vue44
-rw-r--r--app/assets/javascripts/security_configuration/components/constants.js4
-rw-r--r--app/assets/javascripts/security_configuration/graphql/current_license.query.graphql6
-rw-r--r--app/assets/javascripts/security_configuration/index.js1
-rw-r--r--app/models/project.rb4
-rw-r--r--app/presenters/projects/security/configuration_presenter.rb3
8 files changed, 24 insertions, 50 deletions
diff --git a/app/assets/javascripts/lib/utils/dom_utils.js b/app/assets/javascripts/lib/utils/dom_utils.js
index 4262329aae7..d7f0877837c 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 presense represent
- * a truthiness, no matter the value of the attribute. The absense of the
- * attribute represents falsiness.
+ * 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 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/packages_and_registries/settings/group/components/dependency_proxy_settings.vue b/app/assets/javascripts/packages_and_registries/settings/group/components/dependency_proxy_settings.vue
index a5189201112..130d6977936 100644
--- a/app/assets/javascripts/packages_and_registries/settings/group/components/dependency_proxy_settings.vue
+++ b/app/assets/javascripts/packages_and_registries/settings/group/components/dependency_proxy_settings.vue
@@ -77,9 +77,6 @@ export default {
this.updateDependencyProxyImageTtlGroupPolicy(payload);
},
},
- helpText() {
- return this.enabled ? this.$options.i18n.enabledProxyHelpText : '';
- },
},
methods: {
mutationVariables(payload) {
@@ -144,11 +141,10 @@ export default {
v-model="enabled"
:disabled="isLoading"
:label="$options.i18n.enabledProxyLabel"
- :help="helpText"
data-qa-selector="dependency_proxy_setting_toggle"
data-testid="dependency-proxy-setting-toggle"
>
- <template #help>
+ <template v-if="enabled" #help>
<span class="gl-overflow-break-word gl-max-w-100vw gl-display-inline-block">
<gl-sprintf :message="$options.i18n.enabledProxyHelpText">
<template #link="{ content }">
diff --git a/app/assets/javascripts/security_configuration/components/app.vue b/app/assets/javascripts/security_configuration/components/app.vue
index d0c4ad3646c..c168d686053 100644
--- a/app/assets/javascripts/security_configuration/components/app.vue
+++ b/app/assets/javascripts/security_configuration/components/app.vue
@@ -4,10 +4,9 @@ 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, LICENSE_ULTIMATE } from './constants';
+import { AUTO_DEVOPS_ENABLED_ALERT_DISMISSED_STORAGE_KEY } from './constants';
import FeatureCard from './feature_card.vue';
import TrainingProviderList from './training_provider_list.vue';
import UpgradeBanner from './upgrade_banner.vue';
@@ -51,17 +50,6 @@ export default {
TrainingProviderList,
},
inject: ['projectFullPath', 'vulnerabilityTrainingDocsPath'],
- apollo: {
- currentLicensePlan: {
- query: currentLicenseQuery,
- update({ currentLicense }) {
- return currentLicense?.plan;
- },
- error() {
- this.hasCurrentLicenseFetchError = true;
- },
- },
- },
props: {
augmentedSecurityFeatures: {
type: Array,
@@ -96,13 +84,15 @@ export default {
required: false,
default: '',
},
+ securityTrainingEnabled: {
+ type: Boolean,
+ required: true,
+ },
},
data() {
return {
autoDevopsEnabledAlertDismissedProjects: [],
errorMessage: '',
- currentLicensePlan: '',
- hasCurrentLicenseFetchError: false,
};
},
computed: {
@@ -123,12 +113,6 @@ 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() {
@@ -253,9 +237,9 @@ export default {
{{ $options.i18n.description }}
</p>
<p v-if="canViewCiHistory">
- <gl-link data-testid="compliance-view-history-link" :href="gitlabCiHistoryPath">{{
- $options.i18n.configurationHistory
- }}</gl-link>
+ <gl-link data-testid="compliance-view-history-link" :href="gitlabCiHistoryPath">
+ {{ $options.i18n.configurationHistory }}
+ </gl-link>
</p>
</template>
<template #features>
@@ -270,20 +254,18 @@ export default {
</section-layout>
</gl-tab>
<gl-tab
- v-if="shouldShowVulnerabilityManagementTab"
+ v-if="securityTrainingEnabled"
data-testid="vulnerability-management-tab"
:title="$options.i18n.vulnerabilityManagement"
query-param-value="vulnerability-management"
>
<section-layout :heading="$options.i18n.securityTraining">
<template #description>
+ <p>{{ $options.i18n.securityTrainingDescription }}</p>
<p>
- {{ $options.i18n.securityTrainingDescription }}
- </p>
- <p>
- <gl-link :href="vulnerabilityTrainingDocsPath">{{
- $options.i18n.securityTrainingDoc
- }}</gl-link>
+ <gl-link :href="vulnerabilityTrainingDocsPath">
+ {{ $options.i18n.securityTrainingDoc }}
+ </gl-link>
</p>
</template>
<template #features>
diff --git a/app/assets/javascripts/security_configuration/components/constants.js b/app/assets/javascripts/security_configuration/components/constants.js
index 5b04ad6f9ba..e4d2bd08f50 100644
--- a/app/assets/javascripts/security_configuration/components/constants.js
+++ b/app/assets/javascripts/security_configuration/components/constants.js
@@ -310,7 +310,3 @@ export const TEMP_PROVIDER_URLS = {
Kontra: 'https://application.security/',
[__('Secure Code Warrior')]: 'https://www.securecodewarrior.com/',
};
-
-export const LICENSE_ULTIMATE = 'ultimate';
-export const LICENSE_FREE = 'free';
-export const LICENSE_PREMIUM = 'premium';
diff --git a/app/assets/javascripts/security_configuration/graphql/current_license.query.graphql b/app/assets/javascripts/security_configuration/graphql/current_license.query.graphql
deleted file mode 100644
index 9ab4f4d4347..00000000000
--- a/app/assets/javascripts/security_configuration/graphql/current_license.query.graphql
+++ /dev/null
@@ -1,6 +0,0 @@
-query getCurrentLicensePlan {
- currentLicense {
- id
- plan
- }
-}
diff --git a/app/assets/javascripts/security_configuration/index.js b/app/assets/javascripts/security_configuration/index.js
index dcc41a38067..637d510e684 100644
--- a/app/assets/javascripts/security_configuration/index.js
+++ b/app/assets/javascripts/security_configuration/index.js
@@ -56,6 +56,7 @@ export const initSecurityConfiguration = (el) => {
'gitlabCiPresent',
'autoDevopsEnabled',
'canEnableAutoDevops',
+ 'securityTrainingEnabled',
]),
},
});
diff --git a/app/models/project.rb b/app/models/project.rb
index e46f2a38cb0..15f20bff642 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -2906,6 +2906,10 @@ class Project < ApplicationRecord
build_artifacts_size_refresh&.started?
end
+ def security_training_available?
+ licensed_feature_available?(:security_training)
+ end
+
private
# overridden in EE
diff --git a/app/presenters/projects/security/configuration_presenter.rb b/app/presenters/projects/security/configuration_presenter.rb
index 772be0125a0..8a6569e7bf3 100644
--- a/app/presenters/projects/security/configuration_presenter.rb
+++ b/app/presenters/projects/security/configuration_presenter.rb
@@ -24,7 +24,8 @@ module Projects
gitlab_ci_history_path: gitlab_ci_history_path,
auto_fix_enabled: autofix_enabled,
can_toggle_auto_fix_settings: can_toggle_autofix,
- auto_fix_user_path: auto_fix_user_path
+ auto_fix_user_path: auto_fix_user_path,
+ security_training_enabled: project.security_training_available?
}
end