diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-08-07 21:10:22 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-08-07 21:10:22 +0300 |
commit | 4d18bba787186aeb5bf8a0463fd145fae48b3234 (patch) | |
tree | daa26f7daa8bf303ef0cfcc1bfe68d13eae74537 /app/assets/javascripts/group_settings | |
parent | 33c86930e0a657e1519082a9a00faae260a44882 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/group_settings')
-rw-r--r-- | app/assets/javascripts/group_settings/components/shared_runners_form.vue | 81 | ||||
-rw-r--r-- | app/assets/javascripts/group_settings/mount_shared_runners.js | 8 |
2 files changed, 62 insertions, 27 deletions
diff --git a/app/assets/javascripts/group_settings/components/shared_runners_form.vue b/app/assets/javascripts/group_settings/components/shared_runners_form.vue index a4ec48ffd2f..d396169c0a3 100644 --- a/app/assets/javascripts/group_settings/components/shared_runners_form.vue +++ b/app/assets/javascripts/group_settings/components/shared_runners_form.vue @@ -1,5 +1,5 @@ <script> -import { GlToggle, GlAlert } from '@gitlab/ui'; +import { GlAlert, GlLink, GlSprintf, GlToggle } from '@gitlab/ui'; import { sprintf } from '~/locale'; import { updateGroup } from '~/api/groups_api'; import { confirmAction } from '~/lib/utils/confirm_via_gl_modal/confirm_via_gl_modal'; @@ -14,19 +14,29 @@ import { export default { components: { - GlToggle, GlAlert, + GlLink, + GlSprintf, + GlToggle, + }, + inject: { + groupId: {}, + groupName: {}, + groupIsEmpty: {}, + sharedRunnersSetting: {}, + + runnerEnabledValue: {}, + runnerDisabledValue: {}, + runnerAllowOverrideValue: {}, + + // Parent group, only present in sub-groups + + parentSharedRunnersSetting: { default: null }, + + // Available when user can admin parent + parentName: { default: null }, + parentSettingsPath: { default: null }, }, - inject: [ - 'groupId', - 'groupName', - 'groupIsEmpty', - 'sharedRunnersSetting', - 'parentSharedRunnersSetting', - 'runnerEnabledValue', - 'runnerDisabledValue', - 'runnerAllowOverrideValue', - ], data() { return { isLoading: false, @@ -48,6 +58,9 @@ export default { overrideToggleValue() { return this.value === this.runnerAllowOverrideValue; }, + isParentAvailable() { + return this.parentSettingsPath && this.parentName; + }, }, methods: { async onSharedRunnersToggle(enabled) { @@ -109,26 +122,28 @@ export default { <gl-alert v-if="error" variant="danger" :dismissible="false" class="gl-mb-5"> {{ error }} </gl-alert> - - <gl-alert - v-if="isSharedRunnersToggleDisabled" - variant="warning" - :dismissible="false" - class="gl-mb-5" - > - {{ __('Shared runners are disabled for the parent group') }} - </gl-alert> - <section class="gl-mb-5"> <gl-toggle :value="sharedRunnersToggleValue" :is-loading="isLoading" :disabled="isSharedRunnersToggleDisabled" :label="__('Enable shared runners for this group')" - :help="__('Enable shared runners for all projects and subgroups in this group.')" + :description="__('Enable shared runners for all projects and subgroups in this group.')" data-testid="shared-runners-toggle" @change="onSharedRunnersToggle" - /> + > + <template v-if="isSharedRunnersToggleDisabled" #help> + {{ s__('Runners|Shared runners are disabled.') }} + <gl-sprintf + v-if="isParentAvailable" + :message="s__('Runners|Go to %{groupLink} to enable them.')" + > + <template #groupLink> + <gl-link :href="parentSettingsPath">{{ parentName }}</gl-link> + </template> + </gl-sprintf> + </template> + </gl-toggle> </section> <section class="gl-mb-5"> @@ -137,10 +152,24 @@ export default { :is-loading="isLoading" :disabled="isOverrideToggleDisabled" :label="__('Allow projects and subgroups to override the group setting')" - :help="__('Allows projects or subgroups in this group to override the global setting.')" + :description=" + __('Allows projects or subgroups in this group to override the global setting.') + " data-testid="override-runners-toggle" @change="onOverrideToggle" - /> + > + <template v-if="isSharedRunnersToggleDisabled" #help> + {{ s__('Runners|Shared runners are disabled.') }} + <gl-sprintf + v-if="isParentAvailable" + :message="s__('Runners|Go to %{groupLink} to enable them.')" + > + <template #groupLink> + <gl-link :href="parentSettingsPath">{{ parentName }}</gl-link> + </template> + </gl-sprintf> + </template> + </gl-toggle> </section> </div> </template> diff --git a/app/assets/javascripts/group_settings/mount_shared_runners.js b/app/assets/javascripts/group_settings/mount_shared_runners.js index 0767330cd54..334192a6f87 100644 --- a/app/assets/javascripts/group_settings/mount_shared_runners.js +++ b/app/assets/javascripts/group_settings/mount_shared_runners.js @@ -10,6 +10,8 @@ export default (containerId = 'update-shared-runners-form') => { groupName, groupIsEmpty, sharedRunnersSetting, + parentName, + parentSettingsPath, parentSharedRunnersSetting, runnerEnabledValue, runnerDisabledValue, @@ -23,10 +25,14 @@ export default (containerId = 'update-shared-runners-form') => { groupName, groupIsEmpty: parseBoolean(groupIsEmpty), sharedRunnersSetting, - parentSharedRunnersSetting, + runnerEnabledValue, runnerDisabledValue, runnerAllowOverrideValue, + + parentName, + parentSettingsPath, + parentSharedRunnersSetting, }, render(createElement) { return createElement(UpdateSharedRunnersForm); |