Commit c70d390b authored by Phil Hughes's avatar Phil Hughes

Merge branch 'ee-10087-settings-pannel' into 'master'

EE: Moves EE differences for app/assets/javascripts/pages/projects/shared/permissions/components/settings_panel.vue

See merge request gitlab-org/gitlab-ee!14449
parents 34b1640f 0175da90
<script> <script>
import settingsMixin from 'ee_else_ce/pages/projects/shared/permissions/mixins/settings_pannel_mixin';
import projectFeatureSetting from './project_feature_setting.vue'; import projectFeatureSetting from './project_feature_setting.vue';
import projectFeatureToggle from '../../../../../vue_shared/components/toggle_button.vue'; import projectFeatureToggle from '~/vue_shared/components/toggle_button.vue';
import projectSettingRow from './project_setting_row.vue'; import projectSettingRow from './project_setting_row.vue';
import { visibilityOptions, visibilityLevelDescriptions } from '../constants'; import { visibilityOptions, visibilityLevelDescriptions } from '../constants';
import { toggleHiddenClassBySelector } from '../external'; import { toggleHiddenClassBySelector } from '../external';
...@@ -11,6 +12,7 @@ export default { ...@@ -11,6 +12,7 @@ export default {
projectFeatureToggle, projectFeatureToggle,
projectSettingRow, projectSettingRow,
}, },
mixins: [settingsMixin],
props: { props: {
currentSettings: { currentSettings: {
...@@ -78,7 +80,6 @@ export default { ...@@ -78,7 +80,6 @@ export default {
default: '', default: '',
}, },
}, },
data() { data() {
const defaults = { const defaults = {
visibilityOptions, visibilityOptions,
...@@ -92,7 +93,6 @@ export default { ...@@ -92,7 +93,6 @@ export default {
pagesAccessLevel: 20, pagesAccessLevel: 20,
containerRegistryEnabled: true, containerRegistryEnabled: true,
lfsEnabled: true, lfsEnabled: true,
packagesEnabled: true,
requestAccessEnabled: true, requestAccessEnabled: true,
highlightChangesClass: false, highlightChangesClass: false,
}; };
...@@ -159,26 +159,6 @@ export default { ...@@ -159,26 +159,6 @@ export default {
} }
}, },
repositoryAccessLevel(value, oldValue) {
if (value < oldValue) {
// sub-features cannot have more premissive access level
this.mergeRequestsAccessLevel = Math.min(this.mergeRequestsAccessLevel, value);
this.buildsAccessLevel = Math.min(this.buildsAccessLevel, value);
if (value === 0) {
this.containerRegistryEnabled = false;
this.lfsEnabled = false;
this.packagesEnabled = false;
}
} else if (oldValue === 0) {
this.mergeRequestsAccessLevel = value;
this.buildsAccessLevel = value;
this.containerRegistryEnabled = true;
this.lfsEnabled = true;
this.packagesEnabled = true;
}
},
issuesAccessLevel(value, oldValue) { issuesAccessLevel(value, oldValue) {
if (value === 0) toggleHiddenClassBySelector('.issues-feature', true); if (value === 0) toggleHiddenClassBySelector('.issues-feature', true);
else if (oldValue === 0) toggleHiddenClassBySelector('.issues-feature', false); else if (oldValue === 0) toggleHiddenClassBySelector('.issues-feature', false);
...@@ -220,23 +200,20 @@ export default { ...@@ -220,23 +200,20 @@ export default {
<option <option
:value="visibilityOptions.PRIVATE" :value="visibilityOptions.PRIVATE"
:disabled="!visibilityAllowed(visibilityOptions.PRIVATE)" :disabled="!visibilityAllowed(visibilityOptions.PRIVATE)"
>Private</option
> >
Private
</option>
<option <option
:value="visibilityOptions.INTERNAL" :value="visibilityOptions.INTERNAL"
:disabled="!visibilityAllowed(visibilityOptions.INTERNAL)" :disabled="!visibilityAllowed(visibilityOptions.INTERNAL)"
>Internal</option
> >
Internal
</option>
<option <option
:value="visibilityOptions.PUBLIC" :value="visibilityOptions.PUBLIC"
:disabled="!visibilityAllowed(visibilityOptions.PUBLIC)" :disabled="!visibilityAllowed(visibilityOptions.PUBLIC)"
>Public</option
> >
Public
</option>
</select> </select>
<i aria-hidden="true" data-hidden="true" class="fa fa-chevron-down"> </i> <i aria-hidden="true" data-hidden="true" class="fa fa-chevron-down"></i>
</div> </div>
</div> </div>
<span class="form-text text-muted">{{ visibilityLevelDescription }}</span> <span class="form-text text-muted">{{ visibilityLevelDescription }}</span>
......
export default {
data() {
return {
packagesEnabled: false,
};
},
watch: {
repositoryAccessLevel(value, oldValue) {
if (value < oldValue) {
// sub-features cannot have more premissive access level
this.mergeRequestsAccessLevel = Math.min(this.mergeRequestsAccessLevel, value);
this.buildsAccessLevel = Math.min(this.buildsAccessLevel, value);
if (value === 0) {
this.containerRegistryEnabled = false;
this.lfsEnabled = false;
}
} else if (oldValue === 0) {
this.mergeRequestsAccessLevel = value;
this.buildsAccessLevel = value;
this.containerRegistryEnabled = true;
this.lfsEnabled = true;
}
},
},
};
export default {
data() {
return {
packagesEnabled: true,
};
},
watch: {
repositoryAccessLevel(value, oldValue) {
if (value < oldValue) {
// sub-features cannot have more premissive access level
this.mergeRequestsAccessLevel = Math.min(this.mergeRequestsAccessLevel, value);
this.buildsAccessLevel = Math.min(this.buildsAccessLevel, value);
if (value === 0) {
this.containerRegistryEnabled = false;
this.lfsEnabled = false;
this.packagesEnabled = false;
}
} else if (oldValue === 0) {
this.mergeRequestsAccessLevel = value;
this.buildsAccessLevel = value;
this.containerRegistryEnabled = true;
this.lfsEnabled = true;
this.packagesEnabled = true;
}
},
},
};
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment