diff options
Diffstat (limited to 'app/assets/javascripts/pages/projects/shared')
3 files changed, 61 insertions, 48 deletions
diff --git a/app/assets/javascripts/pages/projects/shared/permissions/components/project_feature_setting.vue b/app/assets/javascripts/pages/projects/shared/permissions/components/project_feature_setting.vue index eee666bea05..d62df77ad2c 100644 --- a/app/assets/javascripts/pages/projects/shared/permissions/components/project_feature_setting.vue +++ b/app/assets/javascripts/pages/projects/shared/permissions/components/project_feature_setting.vue @@ -1,12 +1,11 @@ <script> -import { GlIcon } from '@gitlab/ui'; -import projectFeatureToggle from '~/vue_shared/components/toggle_button.vue'; +import { GlIcon, GlToggle } from '@gitlab/ui'; import { featureAccessLevelNone } from '../constants'; export default { components: { GlIcon, - projectFeatureToggle, + GlToggle, }, model: { prop: 'value', @@ -78,11 +77,11 @@ export default { class="project-feature-controls gl-display-flex gl-align-items-center gl-my-3 gl-mx-0" > <input v-if="name" :name="name" :value="value" type="hidden" /> - <project-feature-toggle + <gl-toggle v-if="showToggle" - class="gl-flex-grow-0 gl-mr-3" + class="gl-mr-3" :value="featureEnabled" - :disabled-input="disabledInput" + :disabled="disabledInput" @change="toggleFeature" /> <div class="select-wrapper gl-flex-fill-1"> diff --git a/app/assets/javascripts/pages/projects/shared/permissions/components/settings_panel.vue b/app/assets/javascripts/pages/projects/shared/permissions/components/settings_panel.vue index 4af476fbd68..94a9bc168e5 100644 --- a/app/assets/javascripts/pages/projects/shared/permissions/components/settings_panel.vue +++ b/app/assets/javascripts/pages/projects/shared/permissions/components/settings_panel.vue @@ -1,11 +1,9 @@ <script> -import { GlIcon, GlSprintf, GlLink, GlFormCheckbox } from '@gitlab/ui'; +import { GlIcon, GlSprintf, GlLink, GlFormCheckbox, GlToggle } from '@gitlab/ui'; import settingsMixin from 'ee_else_ce/pages/projects/shared/permissions/mixins/settings_pannel_mixin'; import { s__ } from '~/locale'; -import projectFeatureSetting from './project_feature_setting.vue'; -import projectFeatureToggle from '~/vue_shared/components/toggle_button.vue'; -import projectSettingRow from './project_setting_row.vue'; +import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; import { visibilityOptions, visibilityLevelDescriptions, @@ -15,19 +13,20 @@ import { featureAccessLevelNone, } from '../constants'; import { toggleHiddenClassBySelector } from '../external'; -import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; +import projectFeatureSetting from './project_feature_setting.vue'; +import projectSettingRow from './project_setting_row.vue'; const PAGE_FEATURE_ACCESS_LEVEL = s__('ProjectSettings|Everyone'); export default { components: { projectFeatureSetting, - projectFeatureToggle, projectSettingRow, GlIcon, GlSprintf, GlLink, GlFormCheckbox, + GlToggle, }, mixins: [settingsMixin, glFeatureFlagsMixin()], @@ -75,6 +74,11 @@ export default { required: false, default: false, }, + securityAndComplianceAvailable: { + type: Boolean, + required: false, + default: false, + }, visibilityHelpPath: { type: String, required: false, @@ -141,6 +145,7 @@ export default { metricsDashboardAccessLevel: featureAccessLevel.PROJECT_MEMBERS, analyticsAccessLevel: featureAccessLevel.EVERYONE, requirementsAccessLevel: featureAccessLevel.EVERYONE, + securityAndComplianceAccessLevel: featureAccessLevel.PROJECT_MEMBERS, operationsAccessLevel: featureAccessLevel.EVERYONE, containerRegistryEnabled: true, lfsEnabled: true, @@ -218,11 +223,11 @@ export default { repositoryHelpText() { if (this.visibilityLevel === visibilityOptions.PRIVATE) { - return s__('ProjectSettings|View and edit files in this project'); + return s__('ProjectSettings|View and edit files in this project.'); } return s__( - 'ProjectSettings|View and edit files in this project. Non-project members will only have read access', + 'ProjectSettings|View and edit files in this project. Non-project members will only have read access.', ); }, }, @@ -264,6 +269,10 @@ export default { featureAccessLevel.PROJECT_MEMBERS, this.requirementsAccessLevel, ); + this.securityAndComplianceAccessLevel = Math.min( + featureAccessLevel.PROJECT_MEMBERS, + this.securityAndComplianceAccessLevel, + ); this.operationsAccessLevel = Math.min( featureAccessLevel.PROJECT_MEMBERS, this.operationsAccessLevel, @@ -390,7 +399,7 @@ export default { name="project[request_access_enabled]" /> <input v-model="requestAccessEnabled" type="checkbox" /> - {{ s__('ProjectSettings|Allow users to request access') }} + {{ s__('ProjectSettings|Users can request access') }} </label> </project-setting-row> </div> @@ -401,7 +410,7 @@ export default { <project-setting-row ref="issues-settings" :label="s__('ProjectSettings|Issues')" - :help-text="s__('ProjectSettings|Lightweight issue tracking system for this project')" + :help-text="s__('ProjectSettings|Lightweight issue tracking system.')" > <project-feature-setting v-model="issuesAccessLevel" @@ -424,7 +433,7 @@ export default { <project-setting-row ref="merge-request-settings" :label="s__('ProjectSettings|Merge requests')" - :help-text="s__('ProjectSettings|Submit changes to be merged upstream')" + :help-text="s__('ProjectSettings|Submit changes to be merged upstream.')" > <project-feature-setting v-model="mergeRequestsAccessLevel" @@ -436,9 +445,7 @@ export default { <project-setting-row ref="fork-settings" :label="s__('ProjectSettings|Forks')" - :help-text=" - s__('ProjectSettings|Allow users to make copies of your repository to a new project') - " + :help-text="s__('ProjectSettings|Users can copy the repository to a new project.')" > <project-feature-setting v-model="forkingAccessLevel" @@ -450,7 +457,7 @@ export default { <project-setting-row ref="pipeline-settings" :label="s__('ProjectSettings|Pipelines')" - :help-text="s__('ProjectSettings|Build, test, and deploy your changes')" + :help-text="s__('ProjectSettings|Build, test, and deploy your changes.')" > <project-feature-setting v-model="buildsAccessLevel" @@ -475,9 +482,10 @@ export default { ) }} </div> - <project-feature-toggle + <gl-toggle v-model="containerRegistryEnabled" - :disabled-input="!repositoryEnabled" + class="gl-my-2" + :disabled="!repositoryEnabled" name="project[container_registry_enabled]" /> </project-setting-row> @@ -487,19 +495,20 @@ export default { :help-path="lfsHelpPath" :label="s__('ProjectSettings|Git Large File Storage (LFS)')" :help-text=" - s__('ProjectSettings|Manages large files such as audio, video, and graphics files') + s__('ProjectSettings|Manages large files such as audio, video, and graphics files.') " > - <project-feature-toggle + <gl-toggle v-model="lfsEnabled" - :disabled-input="!repositoryEnabled" + class="gl-my-2" + :disabled="!repositoryEnabled" name="project[lfs_enabled]" /> <p v-if="!lfsEnabled && lfsObjectsExist"> <gl-sprintf :message=" s__( - 'ProjectSettings|LFS objects from this repository are still available to forks. %{linkStart}How do I remove them?%{linkEnd}', + 'ProjectSettings|LFS objects from this repository are available to forks. %{linkStart}How do I remove them?%{linkEnd}', ) " > @@ -519,12 +528,13 @@ export default { :help-path="packagesHelpPath" :label="s__('ProjectSettings|Packages')" :help-text=" - s__('ProjectSettings|Every project can have its own space to store its packages') + s__('ProjectSettings|Every project can have its own space to store its packages.') " > - <project-feature-toggle + <gl-toggle v-model="packagesEnabled" - :disabled-input="!repositoryEnabled" + class="gl-my-2" + :disabled="!repositoryEnabled" name="project[packages_enabled]" /> </project-setting-row> @@ -532,7 +542,7 @@ export default { <project-setting-row ref="analytics-settings" :label="s__('ProjectSettings|Analytics')" - :help-text="s__('ProjectSettings|View project analytics')" + :help-text="s__('ProjectSettings|View project analytics.')" > <project-feature-setting v-model="analyticsAccessLevel" @@ -544,7 +554,7 @@ export default { v-if="requirementsAvailable" ref="requirements-settings" :label="s__('ProjectSettings|Requirements')" - :help-text="s__('ProjectSettings|Requirements management system for this project')" + :help-text="s__('ProjectSettings|Requirements management system.')" > <project-feature-setting v-model="requirementsAccessLevel" @@ -553,9 +563,20 @@ export default { /> </project-setting-row> <project-setting-row + v-if="securityAndComplianceAvailable" + :label="s__('ProjectSettings|Security & Compliance')" + :help-text="s__('ProjectSettings|Security & Compliance for this project')" + > + <project-feature-setting + v-model="securityAndComplianceAccessLevel" + :options="featureAccessLevelOptions" + name="project[project_feature_attributes][security_and_compliance_access_level]" + /> + </project-setting-row> + <project-setting-row ref="wiki-settings" :label="s__('ProjectSettings|Wiki')" - :help-text="s__('ProjectSettings|Pages for project documentation')" + :help-text="s__('ProjectSettings|Pages for project documentation.')" > <project-feature-setting v-model="wikiAccessLevel" @@ -566,7 +587,7 @@ export default { <project-setting-row ref="snippet-settings" :label="s__('ProjectSettings|Snippets')" - :help-text="s__('ProjectSettings|Share code pastes with others out of Git repository')" + :help-text="s__('ProjectSettings|Share code with others outside the project.')" > <project-feature-setting v-model="snippetsAccessLevel" @@ -580,7 +601,7 @@ export default { :help-path="pagesHelpPath" :label="s__('ProjectSettings|Pages')" :help-text=" - s__('ProjectSettings|With GitLab Pages you can host your static websites on GitLab') + s__('ProjectSettings|With GitLab Pages you can host your static websites on GitLab.') " > <project-feature-setting @@ -592,7 +613,7 @@ export default { <project-setting-row ref="operations-settings" :label="s__('ProjectSettings|Operations')" - :help-text="s__('ProjectSettings|Environments, logs, cluster management, and more')" + :help-text="s__('ProjectSettings|Environments, logs, cluster management, and more.')" > <project-feature-setting v-model="operationsAccessLevel" @@ -604,11 +625,7 @@ export default { <project-setting-row ref="metrics-visibility-settings" :label="__('Metrics Dashboard')" - :help-text=" - s__( - 'ProjectSettings|With Metrics Dashboard you can visualize this project performance metrics', - ) - " + :help-text="s__('ProjectSettings|Visualize the project\'s performance metrics.')" > <project-feature-setting v-model="metricsDashboardAccessLevel" @@ -626,9 +643,7 @@ export default { {{ s__('ProjectSettings|Disable email notifications') }} </label> <span class="form-text text-muted">{{ - s__( - 'ProjectSettings|This setting will override user notification preferences for all project members.', - ) + s__('ProjectSettings|Override user notification preferences for all project members.') }}</span> </project-setting-row> <project-setting-row class="mb-3"> @@ -644,7 +659,7 @@ export default { {{ s__('ProjectSettings|Show default award emojis') }} <template #help>{{ s__( - 'ProjectSettings|When enabled, issues, merge requests, and snippets will always show thumbs-up and thumbs-down award emoji buttons.', + 'ProjectSettings|Always show thumbs-up and thumbs-down award emoji buttons on issues, merge requests, and snippets.', ) }}</template> </gl-form-checkbox> @@ -662,9 +677,7 @@ export default { <gl-form-checkbox v-model="allowEditingCommitMessages"> {{ s__('ProjectSettings|Allow editing commit messages') }} <template #help>{{ - s__( - 'ProjectSettings|When enabled, commit authors will be able to edit commit messages on unprotected branches.', - ) + s__('ProjectSettings|Commit authors can edit commit messages on unprotected branches.') }}</template> </gl-form-checkbox> </project-setting-row> diff --git a/app/assets/javascripts/pages/projects/shared/permissions/mixins/settings_pannel_mixin.js b/app/assets/javascripts/pages/projects/shared/permissions/mixins/settings_pannel_mixin.js index ae0936417ad..b52e30dae39 100644 --- a/app/assets/javascripts/pages/projects/shared/permissions/mixins/settings_pannel_mixin.js +++ b/app/assets/javascripts/pages/projects/shared/permissions/mixins/settings_pannel_mixin.js @@ -3,6 +3,7 @@ export default { return { packagesEnabled: false, requirementsEnabled: false, + securityAndComplianceEnabled: false, }; }, watch: { |