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
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets/javascripts/pages/projects/shared/permissions/components/settings_panel.vue')
-rw-r--r--app/assets/javascripts/pages/projects/shared/permissions/components/settings_panel.vue189
1 files changed, 147 insertions, 42 deletions
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 c7c331c7de5..a82f485bf44 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
@@ -5,7 +5,11 @@ import settingsMixin from 'ee_else_ce/pages/projects/shared/permissions/mixins/s
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
import { __, s__ } from '~/locale';
import {
- visibilityOptions,
+ VISIBILITY_LEVEL_PRIVATE_INTEGER,
+ VISIBILITY_LEVEL_INTERNAL_INTEGER,
+ VISIBILITY_LEVEL_PUBLIC_INTEGER,
+} from '~/visibility_level/constants';
+import {
visibilityLevelDescriptions,
featureAccessLevelMembers,
featureAccessLevelEveryone,
@@ -14,8 +18,8 @@ import {
featureAccessLevelDescriptions,
} from '../constants';
import { toggleHiddenClassBySelector } from '../external';
-import projectFeatureSetting from './project_feature_setting.vue';
-import projectSettingRow from './project_setting_row.vue';
+import ProjectFeatureSetting from './project_feature_setting.vue';
+import ProjectSettingRow from './project_setting_row.vue';
const FEATURE_ACCESS_LEVEL_ANONYMOUS = [30, s__('ProjectSettings|Everyone')];
@@ -33,6 +37,11 @@ export default {
environmentsHelpText: s__(
'ProjectSettings|Every project can make deployments to environments either via CI/CD or API calls. Non-project members have read-only access.',
),
+ featureFlagsLabel: s__('ProjectSettings|Feature flags'),
+ featureFlagsHelpText: s__(
+ 'ProjectSettings|Roll out new features without redeploying with feature flags.',
+ ),
+ monitorLabel: s__('ProjectSettings|Monitor'),
packagesHelpText: s__(
'ProjectSettings|Every project can have its own space to store its packages. Note: The Package Registry is always visible when a project is public.',
),
@@ -45,6 +54,10 @@ export default {
ciCdLabel: __('CI/CD'),
repositoryLabel: s__('ProjectSettings|Repository'),
requirementsLabel: s__('ProjectSettings|Requirements'),
+ releasesLabel: s__('ProjectSettings|Releases'),
+ releasesHelpText: s__(
+ 'ProjectSettings|Combine git tags with release notes, release evidence, and assets to create a release.',
+ ),
securityAndComplianceLabel: s__('ProjectSettings|Security & Compliance'),
snippetsLabel: s__('ProjectSettings|Snippets'),
wikiLabel: s__('ProjectSettings|Wiki'),
@@ -54,10 +67,13 @@ export default {
),
confirmButtonText: __('Save changes'),
},
+ VISIBILITY_LEVEL_PRIVATE_INTEGER,
+ VISIBILITY_LEVEL_INTERNAL_INTEGER,
+ VISIBILITY_LEVEL_PUBLIC_INTEGER,
components: {
- projectFeatureSetting,
- projectSettingRow,
+ ProjectFeatureSetting,
+ ProjectSettingRow,
GlButton,
GlIcon,
GlSprintf,
@@ -65,7 +81,7 @@ export default {
GlFormCheckbox,
GlToggle,
ConfirmDanger,
- otherProjectSettings: () =>
+ OtherProjectSettings: () =>
import(
'jh_component/pages/projects/shared/permissions/components/other_project_settings.vue'
),
@@ -96,9 +112,9 @@ export default {
type: Array,
required: false,
default: () => [
- visibilityOptions.PRIVATE,
- visibilityOptions.INTERNAL,
- visibilityOptions.PUBLIC,
+ VISIBILITY_LEVEL_PRIVATE_INTEGER,
+ VISIBILITY_LEVEL_INTERNAL_INTEGER,
+ VISIBILITY_LEVEL_PUBLIC_INTEGER,
],
},
lfsAvailable: {
@@ -131,6 +147,21 @@ export default {
required: false,
default: '',
},
+ environmentsHelpPath: {
+ type: String,
+ required: false,
+ default: '',
+ },
+ featureFlagsHelpPath: {
+ type: String,
+ required: false,
+ default: '',
+ },
+ releasesHelpPath: {
+ type: String,
+ required: false,
+ default: '',
+ },
lfsHelpPath: {
type: String,
required: false,
@@ -197,8 +228,7 @@ export default {
},
data() {
const defaults = {
- visibilityOptions,
- visibilityLevel: visibilityOptions.PUBLIC,
+ visibilityLevel: VISIBILITY_LEVEL_PUBLIC_INTEGER,
issuesAccessLevel: featureAccessLevel.EVERYONE,
repositoryAccessLevel: featureAccessLevel.EVERYONE,
forkingAccessLevel: featureAccessLevel.EVERYONE,
@@ -214,6 +244,9 @@ export default {
securityAndComplianceAccessLevel: featureAccessLevel.PROJECT_MEMBERS,
operationsAccessLevel: featureAccessLevel.EVERYONE,
environmentsAccessLevel: featureAccessLevel.EVERYONE,
+ featureFlagsAccessLevel: featureAccessLevel.PROJECT_MEMBERS,
+ releasesAccessLevel: featureAccessLevel.EVERYONE,
+ monitorAccessLevel: featureAccessLevel.EVERYONE,
containerRegistryAccessLevel: featureAccessLevel.EVERYONE,
warnAboutPotentiallyUnwantedCharacters: true,
lfsEnabled: true,
@@ -234,7 +267,7 @@ export default {
computed: {
featureAccessLevelOptions() {
const options = [featureAccessLevelMembers];
- if (this.visibilityLevel !== visibilityOptions.PRIVATE) {
+ if (this.visibilityLevel !== VISIBILITY_LEVEL_PRIVATE_INTEGER) {
options.push(featureAccessLevelEveryone);
}
return options;
@@ -246,18 +279,12 @@ export default {
);
},
- operationsFeatureAccessLevelOptions() {
- return this.featureAccessLevelOptions.filter(
- ([value]) => value <= this.operationsAccessLevel,
- );
- },
-
packageRegistryFeatureAccessLevelOptions() {
const options = [FEATURE_ACCESS_LEVEL_ANONYMOUS];
- if (this.visibilityLevel === visibilityOptions.PRIVATE) {
+ if (this.visibilityLevel === VISIBILITY_LEVEL_PRIVATE_INTEGER) {
options.unshift(featureAccessLevelMembers);
- } else if (this.visibilityLevel === visibilityOptions.INTERNAL) {
+ } else if (this.visibilityLevel === VISIBILITY_LEVEL_INTERNAL_INTEGER) {
options.unshift(featureAccessLevelEveryone);
}
@@ -268,15 +295,15 @@ export default {
const options = [featureAccessLevelMembers];
if (this.pagesAccessControlForced) {
- if (this.visibilityLevel === visibilityOptions.INTERNAL) {
+ if (this.visibilityLevel === VISIBILITY_LEVEL_INTERNAL_INTEGER) {
options.push(featureAccessLevelEveryone);
}
} else {
- if (this.visibilityLevel !== visibilityOptions.PRIVATE) {
+ if (this.visibilityLevel !== VISIBILITY_LEVEL_PRIVATE_INTEGER) {
options.push(featureAccessLevelEveryone);
}
- if (this.visibilityLevel !== visibilityOptions.PUBLIC) {
+ if (this.visibilityLevel !== VISIBILITY_LEVEL_PUBLIC_INTEGER) {
options.push(FEATURE_ACCESS_LEVEL_ANONYMOUS);
}
}
@@ -290,6 +317,11 @@ export default {
environmentsEnabled() {
return this.environmentsAccessLevel > featureAccessLevel.NOT_ENABLED;
},
+
+ monitorEnabled() {
+ return this.monitorAccessLevel > featureAccessLevel.NOT_ENABLED;
+ },
+
repositoryEnabled() {
return this.repositoryAccessLevel > featureAccessLevel.NOT_ENABLED;
},
@@ -300,13 +332,13 @@ export default {
showContainerRegistryPublicNote() {
return (
- this.visibilityLevel === visibilityOptions.PUBLIC &&
+ this.visibilityLevel === VISIBILITY_LEVEL_PUBLIC_INTEGER &&
this.containerRegistryAccessLevel === featureAccessLevel.EVERYONE
);
},
repositoryHelpText() {
- if (this.visibilityLevel === visibilityOptions.PRIVATE) {
+ if (this.visibilityLevel === VISIBILITY_LEVEL_PRIVATE_INTEGER) {
return s__('ProjectSettings|View and edit files in this project.');
}
@@ -315,7 +347,7 @@ export default {
);
},
cveIdRequestIsDisabled() {
- return this.visibilityLevel !== visibilityOptions.PUBLIC;
+ return this.visibilityLevel !== VISIBILITY_LEVEL_PUBLIC_INTEGER;
},
isVisibilityReduced() {
return (
@@ -329,11 +361,19 @@ export default {
splitOperationsEnabled() {
return this.glFeatures.splitOperationsVisibilityPermissions;
},
+ monitorOperationsFeatureAccessLevelOptions() {
+ if (this.splitOperationsEnabled) {
+ return this.featureAccessLevelOptions.filter(([value]) => value <= this.monitorAccessLevel);
+ }
+ return this.featureAccessLevelOptions.filter(
+ ([value]) => value <= this.operationsAccessLevel,
+ );
+ },
},
watch: {
visibilityLevel(value, oldValue) {
- if (value === visibilityOptions.PRIVATE) {
+ if (value === VISIBILITY_LEVEL_PRIVATE_INTEGER) {
// when private, features are restricted to "only team members"
this.issuesAccessLevel = Math.min(
featureAccessLevel.PROJECT_MEMBERS,
@@ -355,7 +395,7 @@ export default {
if (
this.packageRegistryAccessLevel === featureAccessLevel.EVERYONE ||
(this.packageRegistryAccessLevel > featureAccessLevel.EVERYONE &&
- oldValue === visibilityOptions.PUBLIC)
+ oldValue === VISIBILITY_LEVEL_PUBLIC_INTEGER)
) {
this.packageRegistryAccessLevel = featureAccessLevel.PROJECT_MEMBERS;
}
@@ -389,6 +429,18 @@ export default {
featureAccessLevel.PROJECT_MEMBERS,
this.environmentsAccessLevel,
);
+ this.featureFlagsAccessLevel = Math.min(
+ featureAccessLevel.PROJECT_MEMBERS,
+ this.featureFlagsAccessLevel,
+ );
+ this.releasesAccessLevel = Math.min(
+ featureAccessLevel.PROJECT_MEMBERS,
+ this.releasesAccessLevel,
+ );
+ this.monitorAccessLevel = Math.min(
+ featureAccessLevel.PROJECT_MEMBERS,
+ this.monitorAccessLevel,
+ );
this.containerRegistryAccessLevel = Math.min(
featureAccessLevel.PROJECT_MEMBERS,
this.containerRegistryAccessLevel,
@@ -398,7 +450,7 @@ export default {
this.pagesAccessLevel = featureAccessLevel.PROJECT_MEMBERS;
}
this.highlightChanges();
- } else if (oldValue === visibilityOptions.PRIVATE) {
+ } else if (oldValue === VISIBILITY_LEVEL_PRIVATE_INTEGER) {
// if changing away from private, make enabled features more permissive
if (this.issuesAccessLevel > featureAccessLevel.NOT_ENABLED)
this.issuesAccessLevel = featureAccessLevel.EVERYONE;
@@ -432,19 +484,21 @@ export default {
this.operationsAccessLevel = featureAccessLevel.EVERYONE;
if (this.environmentsAccessLevel === featureAccessLevel.PROJECT_MEMBERS)
this.environmentsAccessLevel = featureAccessLevel.EVERYONE;
+ if (this.monitorAccessLevel === featureAccessLevel.PROJECT_MEMBERS)
+ this.monitorAccessLevel = featureAccessLevel.EVERYONE;
if (this.containerRegistryAccessLevel === featureAccessLevel.PROJECT_MEMBERS)
this.containerRegistryAccessLevel = featureAccessLevel.EVERYONE;
this.highlightChanges();
} else if (this.packageRegistryAccessLevelEnabled) {
if (
- value === visibilityOptions.PUBLIC &&
+ value === VISIBILITY_LEVEL_PUBLIC_INTEGER &&
this.packageRegistryAccessLevel === featureAccessLevel.EVERYONE
) {
// eslint-disable-next-line prefer-destructuring
this.packageRegistryAccessLevel = FEATURE_ACCESS_LEVEL_ANONYMOUS[0];
} else if (
- value === visibilityOptions.INTERNAL &&
+ value === VISIBILITY_LEVEL_INTERNAL_INTEGER &&
this.packageRegistryAccessLevel === FEATURE_ACCESS_LEVEL_ANONYMOUS[0]
) {
this.packageRegistryAccessLevel = featureAccessLevel.EVERYONE;
@@ -467,6 +521,16 @@ export default {
},
operationsAccessLevel(value, oldValue) {
+ this.updateSubFeatureAccessLevel(value, oldValue);
+ },
+
+ monitorAccessLevel(value, oldValue) {
+ this.updateSubFeatureAccessLevel(value, oldValue);
+ },
+ },
+
+ methods: {
+ updateSubFeatureAccessLevel(value, oldValue) {
if (value < oldValue) {
// sub-features cannot have more permissive access level
this.metricsDashboardAccessLevel = Math.min(this.metricsDashboardAccessLevel, value);
@@ -474,9 +538,7 @@ export default {
this.metricsDashboardAccessLevel = value;
}
},
- },
- methods: {
highlightChanges() {
this.highlightChangesClass = true;
this.$nextTick(() => {
@@ -514,20 +576,20 @@ export default {
data-qa-selector="project_visibility_dropdown"
>
<option
- :value="visibilityOptions.PRIVATE"
- :disabled="!visibilityAllowed(visibilityOptions.PRIVATE)"
+ :value="$options.VISIBILITY_LEVEL_PRIVATE_INTEGER"
+ :disabled="!visibilityAllowed($options.VISIBILITY_LEVEL_PRIVATE_INTEGER)"
>
{{ s__('ProjectSettings|Private') }}
</option>
<option
- :value="visibilityOptions.INTERNAL"
- :disabled="!visibilityAllowed(visibilityOptions.INTERNAL)"
+ :value="$options.VISIBILITY_LEVEL_INTERNAL_INTEGER"
+ :disabled="!visibilityAllowed($options.VISIBILITY_LEVEL_INTERNAL_INTEGER)"
>
{{ s__('ProjectSettings|Internal') }}
</option>
<option
- :value="visibilityOptions.PUBLIC"
- :disabled="!visibilityAllowed(visibilityOptions.PUBLIC)"
+ :value="$options.VISIBILITY_LEVEL_PUBLIC_INTEGER"
+ :disabled="!visibilityAllowed($options.VISIBILITY_LEVEL_PUBLIC_INTEGER)"
>
{{ s__('ProjectSettings|Public') }}
</option>
@@ -558,7 +620,7 @@ export default {
<div class="gl-mt-4">
<strong class="gl-display-block">{{ s__('ProjectSettings|Additional options') }}</strong>
<label
- v-if="visibilityLevel !== visibilityOptions.PRIVATE"
+ v-if="visibilityLevel !== $options.VISIBILITY_LEVEL_PRIVATE_INTEGER"
class="gl-line-height-28 gl-font-weight-normal gl-mb-0"
>
<input
@@ -570,7 +632,7 @@ export default {
{{ s__('ProjectSettings|Users can request access') }}
</label>
<label
- v-if="visibilityLevel !== visibilityOptions.PUBLIC"
+ v-if="visibilityLevel !== $options.VISIBILITY_LEVEL_PUBLIC_INTEGER"
class="gl-line-height-28 gl-font-weight-normal gl-display-block gl-mb-0"
>
<input
@@ -847,6 +909,22 @@ export default {
/>
</project-setting-row>
<project-setting-row
+ v-if="splitOperationsEnabled"
+ ref="monitor-settings"
+ :label="$options.i18n.monitorLabel"
+ :help-text="
+ s__('ProjectSettings|Configure your project resources and monitor their health.')
+ "
+ >
+ <project-feature-setting
+ v-model="monitorAccessLevel"
+ :label="$options.i18n.monitorLabel"
+ :options="featureAccessLevelOptions"
+ name="project[project_feature_attributes][monitor_access_level]"
+ />
+ </project-setting-row>
+ <project-setting-row
+ v-else
ref="operations-settings"
:label="$options.i18n.operationsLabel"
:help-text="
@@ -869,7 +947,7 @@ export default {
<project-feature-setting
v-model="metricsDashboardAccessLevel"
:show-toggle="false"
- :options="operationsFeatureAccessLevelOptions"
+ :options="monitorOperationsFeatureAccessLevelOptions"
name="project[project_feature_attributes][metrics_dashboard_access_level]"
/>
</project-setting-row>
@@ -879,6 +957,7 @@ export default {
ref="environments-settings"
:label="$options.i18n.environmentsLabel"
:help-text="$options.i18n.environmentsHelpText"
+ :help-path="environmentsHelpPath"
>
<project-feature-setting
v-model="environmentsAccessLevel"
@@ -887,6 +966,32 @@ export default {
name="project[project_feature_attributes][environments_access_level]"
/>
</project-setting-row>
+ <project-setting-row
+ ref="feature-flags-settings"
+ :label="$options.i18n.featureFlagsLabel"
+ :help-text="$options.i18n.featureFlagsHelpText"
+ :help-path="featureFlagsHelpPath"
+ >
+ <project-feature-setting
+ v-model="featureFlagsAccessLevel"
+ :label="$options.i18n.featureFlagsLabel"
+ :options="featureAccessLevelOptions"
+ name="project[project_feature_attributes][feature_flags_access_level]"
+ />
+ </project-setting-row>
+ <project-setting-row
+ ref="releases-settings"
+ :label="$options.i18n.releasesLabel"
+ :help-text="$options.i18n.releasesHelpText"
+ :help-path="releasesHelpPath"
+ >
+ <project-feature-setting
+ v-model="releasesAccessLevel"
+ :label="$options.i18n.releasesLabel"
+ :options="featureAccessLevelOptions"
+ name="project[project_feature_attributes][releases_access_level]"
+ />
+ </project-setting-row>
</template>
</div>
<project-setting-row v-if="canDisableEmails" ref="email-settings" class="mb-3">