Skip to content
Snippets Groups Projects
Commit 846a5662 authored by 🤖 GitLab Bot 🤖's avatar 🤖 GitLab Bot 🤖
Browse files

Automatic merge of gitlab-org/gitlab master

parents 795c0a44 b7fa94af
No related branches found
No related tags found
No related merge requests found
Showing
with 281 additions and 327 deletions
<script>
import { GlSprintf, GlToggle, GlFormGroup, GlFormInput } from '@gitlab/ui';
import { GlToggle, GlFormGroup, GlFormInput } from '@gitlab/ui';
import { isEqual } from 'lodash';
import {
DUPLICATES_TOGGLE_LABEL,
DUPLICATES_ALLOWED_DISABLED,
DUPLICATES_ALLOWED_ENABLED,
DUPLICATES_SETTING_EXCEPTION_TITLE,
DUPLICATES_SETTINGS_EXCEPTION_LEGEND,
} from '~/packages_and_registries/settings/group/constants';
......@@ -18,7 +16,6 @@ export default {
DUPLICATES_SETTINGS_EXCEPTION_LEGEND,
},
components: {
GlSprintf,
GlToggle,
GlFormGroup,
GlFormInput,
......@@ -63,9 +60,6 @@ export default {
},
},
computed: {
enabledButtonLabel() {
return this.duplicatesAllowed ? DUPLICATES_ALLOWED_ENABLED : DUPLICATES_ALLOWED_DISABLED;
},
isExceptionRegexValid() {
return !this.duplicateExceptionRegexError;
},
......@@ -80,41 +74,30 @@ export default {
<template>
<form>
<div class="gl-display-flex">
<gl-toggle
:data-qa-selector="toggleQaSelector"
:label="$options.i18n.DUPLICATES_TOGGLE_LABEL"
label-position="hidden"
:value="duplicatesAllowed"
<gl-toggle
:data-qa-selector="toggleQaSelector"
:label="$options.i18n.DUPLICATES_TOGGLE_LABEL"
:value="duplicatesAllowed"
:disabled="loading"
@change="update(modelNames.allowed, $event)"
/>
<gl-form-group
v-if="!duplicatesAllowed"
class="gl-mt-4"
:label="$options.i18n.DUPLICATES_SETTING_EXCEPTION_TITLE"
label-size="sm"
:state="isExceptionRegexValid"
:invalid-feedback="duplicateExceptionRegexError"
:description="$options.i18n.DUPLICATES_SETTINGS_EXCEPTION_LEGEND"
label-for="maven-duplicated-settings-regex-input"
>
<gl-form-input
id="maven-duplicated-settings-regex-input"
:disabled="loading"
@change="update(modelNames.allowed, $event)"
size="lg"
:value="duplicateExceptionRegex"
@change="update(modelNames.exception, $event)"
/>
<div class="gl-ml-5">
<div data-testid="toggle-label" :data-qa-selector="labelQaSelector">
<gl-sprintf :message="enabledButtonLabel">
<template #bold="{ content }">
<strong>{{ content }}</strong>
</template>
</gl-sprintf>
</div>
<gl-form-group
v-if="!duplicatesAllowed"
class="gl-mt-4"
:label="$options.i18n.DUPLICATES_SETTING_EXCEPTION_TITLE"
label-size="sm"
:state="isExceptionRegexValid"
:invalid-feedback="duplicateExceptionRegexError"
:description="$options.i18n.DUPLICATES_SETTINGS_EXCEPTION_LEGEND"
label-for="maven-duplicated-settings-regex-input"
>
<gl-form-input
id="maven-duplicated-settings-regex-input"
:disabled="loading"
:value="duplicateExceptionRegex"
@change="update(modelNames.exception, $event)"
/>
</gl-form-group>
</div>
</div>
</gl-form-group>
</form>
</template>
<script>
import { GlSprintf, GlLink } from '@gitlab/ui';
import DuplicatesSettings from '~/packages_and_registries/settings/group/components/duplicates_settings.vue';
import GenericSettings from '~/packages_and_registries/settings/group/components/generic_settings.vue';
import MavenSettings from '~/packages_and_registries/settings/group/components/maven_settings.vue';
import {
PACKAGE_SETTINGS_HEADER,
PACKAGE_SETTINGS_DESCRIPTION,
PACKAGES_DOCS_PATH,
} from '~/packages_and_registries/settings/group/constants';
import updateNamespacePackageSettings from '~/packages_and_registries/settings/group/graphql/mutations/update_group_packages_settings.mutation.graphql';
import { updateGroupPackageSettings } from '~/packages_and_registries/settings/group/graphql/utils/cache_update';
......@@ -19,12 +17,7 @@ export default {
PACKAGE_SETTINGS_HEADER,
PACKAGE_SETTINGS_DESCRIPTION,
},
links: {
PACKAGES_DOCS_PATH,
},
components: {
GlSprintf,
GlLink,
SettingsBlock,
MavenSettings,
GenericSettings,
......@@ -98,13 +91,7 @@ export default {
<template #title> {{ $options.i18n.PACKAGE_SETTINGS_HEADER }}</template>
<template #description>
<span data-testid="description">
<gl-sprintf :message="$options.i18n.PACKAGE_SETTINGS_DESCRIPTION">
<template #link="{ content }">
<gl-link :href="$options.links.PACKAGES_DOCS_PATH" target="_blank">{{
content
}}</gl-link>
</template>
</gl-sprintf>
{{ $options.i18n.PACKAGE_SETTINGS_DESCRIPTION }}
</span>
</template>
<template #default>
......
import { helpPagePath } from '~/helpers/help_page_helper';
import { s__, __ } from '~/locale';
export const PACKAGE_SETTINGS_HEADER = s__('PackageRegistry|Package Registry');
export const PACKAGE_SETTINGS_HEADER = s__('PackageRegistry|Duplicate packages');
export const PACKAGE_SETTINGS_DESCRIPTION = s__(
'PackageRegistry|Use GitLab as a private registry for common package formats. %{linkStart}Learn more.%{linkEnd}',
'PackageRegistry|Allow packages with the same name and version to be uploaded to the registry. The newest version of a package is always used when installing.',
);
export const DUPLICATES_TOGGLE_LABEL = s__('PackageRegistry|Allow duplicates');
export const DUPLICATES_ALLOWED_DISABLED = s__(
'PackageRegistry|%{boldStart}Do not allow duplicates%{boldEnd} - Reject packages with the same name and version.',
);
export const DUPLICATES_ALLOWED_ENABLED = s__(
'PackageRegistry|%{boldStart}Allow duplicates%{boldEnd} - Accept packages with the same name and version.',
export const DUPLICATES_TOGGLE_LABEL = s__(
'PackageRegistry|Reject packages with the same name and version',
);
export const DUPLICATES_SETTING_EXCEPTION_TITLE = __('Exceptions');
export const DUPLICATES_SETTINGS_EXCEPTION_LEGEND = s__(
......
......@@ -8,33 +8,28 @@
= render_if_exists 'shared/old_repository_size_limit_setting', form: f, type: :group
= render_if_exists 'admin/namespace_plan', f: f
.form-group.row.group-description-holder
.col-sm-2.col-form-label
= f.label :avatar, _("Group avatar")
.col-sm-10
= render 'shared/choose_avatar_button', f: f
.form-group.gl-form-group{ role: 'group' }
= f.label :avatar, _("Group avatar"), class: 'gl-display-block col-form-label'
= render 'shared/choose_avatar_button', f: f
= render 'shared/old_visibility_level', f: f, visibility_level: visibility_level, can_change_visibility_level: can_change_group_visibility_level?(@group), form_model: @group, with_label: false
.form-group.row
.offset-sm-2.col-sm-10
= render 'shared/allow_request_access', form: f
.form-group.gl-form-group{ role: 'group' }
= render 'shared/allow_request_access', form: f
= render 'groups/group_admin_settings', f: f
= render_if_exists 'namespaces/shared_runners_minutes_settings', group: @group, form: f
- if @group.new_record?
.form-group.row
.offset-sm-2.col-sm-10
= render Pajamas::AlertComponent.new(dismissible: false) do |c|
= c.body do
= render 'shared/group_tips'
.form-actions
= render Pajamas::AlertComponent.new(dismissible: false) do |c|
= c.body do
= render 'shared/group_tips'
.gl-mt-5
= f.submit _('Create group'), class: "gl-button btn btn-confirm"
= link_to _('Cancel'), admin_groups_path, class: "gl-button btn btn-default btn-cancel"
- else
.form-actions
.gl-mt-5
= f.submit _('Save changes'), class: "gl-button btn btn-confirm", data: { qa_selector: 'save_changes_button' }
= link_to _('Cancel'), admin_group_path(@group), class: "gl-button btn btn-cancel"
%fieldset
%legend.gl-border-bottom-0
= s_('AdminUsers|Access')
.form-group.row
.col-12
= f.label :projects_limit
= f.number_field :projects_limit, min: 0, max: Gitlab::Database::MAX_INT_VALUE, class: 'form-control gl-form-input'
.form-group.row
.col-12.gl-pt-0
= f.label :can_create_group
= f.gitlab_ui_checkbox_component :can_create_group, ''
.form-group.row
.col-12.gl-pt-0
= f.label :access_level
- editing_current_user = (current_user == @user)
= f.gitlab_ui_radio_component :access_level, :regular,
s_('AdminUsers|Regular'),
radio_options: { disabled: editing_current_user },
help_text: s_('AdminUsers|Regular users have access to their groups and projects.')
= render_if_exists 'admin/users/auditor_access_level_radio', f: f, disabled: editing_current_user
- help_text = s_('AdminUsers|The user has unlimited access to all groups, projects, users, and features.')
- help_text += ' ' + s_('AdminUsers|You cannot remove your own administrator access.') if editing_current_user
= f.gitlab_ui_radio_component :access_level, :admin,
s_('AdminUsers|Administrator'),
radio_options: { disabled: editing_current_user },
help_text: help_text
.form-group.row
.col-12.gl-pt-0
= f.label :external
.hidden{ data: user_internal_regex_data }
.col-12.gl-display-flex.gl-align-items-baseline
= f.gitlab_ui_checkbox_component :external, s_('AdminUsers|External users cannot see internal or private projects unless access is explicitly granted. Also, external users cannot create projects, groups, or personal snippets.')
%row.hidden#warning_external_automatically_set
= gl_badge_tag s_('AdminUsers|Automatically marked as default internal user'), variant: :warning
.form-group.row
- @user.credit_card_validation || @user.build_credit_card_validation
= f.fields_for :credit_card_validation do |ff|
.col-12.gl-pt-0
= ff.label s_('AdminUsers|Validate user account')
.col-12.gl-display-flex.gl-align-items-baseline
= ff.gitlab_ui_checkbox_component :credit_card_validated_at,
s_('AdminUsers|User is validated and can use free CI minutes on shared runners.'),
help_text: s_('AdminUsers|A user can validate themselves by inputting a credit/debit card, or an admin can manually validate a user.'),
checkbox_options: { checked: @user.credit_card_validated_at.present? }
.gl-border-b.gl-pb-3.gl-mb-6
.row
.col-lg-4
%h4.gl-mt-0
= s_('AdminUsers|Access')
.col-lg-8
.form-group.gl-form-group{ role: 'group' }
= f.label :projects_limit, class: 'gl-display-block col-form-label'
= f.number_field :projects_limit, min: 0, max: Gitlab::Database::MAX_INT_VALUE, class: 'form-control gl-form-input'
.form-group.gl-form-group{ role: 'group' }
= f.gitlab_ui_checkbox_component :can_create_group, s_('AdminUsers|Can create group')
%fieldset.form-group.gl-form-group
%legend.col-form-label.col-form-label
= s_('AdminUsers|Access level')
- editing_current_user = (current_user == @user)
= f.gitlab_ui_radio_component :access_level, :regular,
s_('AdminUsers|Regular'),
radio_options: { disabled: editing_current_user },
help_text: s_('AdminUsers|Regular users have access to their groups and projects.')
= render_if_exists 'admin/users/auditor_access_level_radio', f: f, disabled: editing_current_user
- help_text = s_('AdminUsers|The user has unlimited access to all groups, projects, users, and features.')
- help_text += ' ' + s_('AdminUsers|You cannot remove your own administrator access.') if editing_current_user
= f.gitlab_ui_radio_component :access_level, :admin,
s_('AdminUsers|Administrator'),
radio_options: { disabled: editing_current_user },
help_text: help_text
.form-group.gl-form-group{ role: 'group' }
= f.gitlab_ui_checkbox_component :external,
s_('AdminUsers|External'),
help_text: s_('AdminUsers|External users cannot see internal or private projects unless access is explicitly granted. Also, external users cannot create projects, groups, or personal snippets.')
.hidden{ data: user_internal_regex_data }
.gl-display-flex.gl-align-items-baseline
%row.hidden#warning_external_automatically_set
= gl_badge_tag s_('AdminUsers|Automatically marked as default internal user'), variant: :warning
.form-group.gl-form-group{ role: 'group' }
- @user.credit_card_validation || @user.build_credit_card_validation
= f.fields_for :credit_card_validation do |ff|
= ff.gitlab_ui_checkbox_component :credit_card_validated_at,
s_('AdminUsers|Validate user account'),
help_text: s_('AdminUsers|A user can validate themselves by inputting a credit/debit card, or an admin can manually validate a user. Validated users can use free CI minutes on shared runners.'),
checkbox_options: { checked: @user.credit_card_validated_at.present? }
%fieldset
%legend.gl-border-bottom-0= _('Admin notes')
.form-group.row
.col-12
= f.label :note, s_('Admin|Note')
= f.text_area :note, class: 'form-control gl-form-input gl-form-textarea'
.gl-mb-3
.row
.col-lg-4
%h4.gl-mt-0
= _('Admin notes')
.col-lg-8
.form-group.gl-form-group{ role: 'group' }
= f.label :note, s_('Admin|Note')
= f.text_area :note, class: 'form-control gl-form-input gl-form-textarea'
......@@ -2,41 +2,41 @@
= gitlab_ui_form_for [:admin, @user], html: { class: 'fieldset-form' } do |f|
= form_errors(@user, pajamas_alert: true)
%fieldset
%legend.gl-border-bottom-0= _('Account')
.form-group.row
.col-12
= f.label "#{:name} (required)"
= f.text_field :name, required: true, autocomplete: 'off', class: 'form-control gl-form-input'
.form-group.row
.col-12
= f.label "#{:username} (required)"
= f.text_field :username, required: true, autocomplete: 'off', autocorrect: 'off', autocapitalize: 'off', spellcheck: false, class: 'form-control gl-form-input'
.form-group.row
.col-12
= f.label "#{:email} (required)"
= f.text_field :email, required: true, autocomplete: 'off', class: 'form-control gl-form-input'
.gl-border-b.gl-pb-3.gl-mb-6
.row
.col-lg-4
%h4.gl-mt-0
= _('Account')
.col-lg-8
.form-group.gl-form-group{ role: 'group' }
= f.label :name, _('Name'), class: 'gl-display-block col-form-label'
= f.text_field :name, required: true, autocomplete: 'off', class: 'form-control gl-form-input'
- if @user.new_record?
%fieldset
%legend.gl-border-bottom-0= _('Password')
.form-group.row
.col-12
%strong
= _('Reset link will be generated and sent to the user. %{break} User will be forced to set the password on first sign in.').html_safe % { break: '<br />'.html_safe }
- else
%fieldset
%legend.gl-border-bottom-0= _('Password')
.form-group.row
.col-12
= f.label :password
.col-12
= f.password_field :password, disabled: f.object.force_random_password, autocomplete: 'new-password', class: 'form-control gl-form-input'
.form-group.row
.col-12
= f.label :password_confirmation
.col-12
= f.password_field :password_confirmation, disabled: f.object.force_random_password, autocomplete: 'new-password', class: 'form-control gl-form-input'
.form-group.gl-form-group{ role: 'group' }
= f.label :username, _('Username'), class: 'gl-display-block col-form-label'
= f.text_field :username, required: true, autocomplete: 'off', autocorrect: 'off', autocapitalize: 'off', spellcheck: false, class: 'form-control gl-form-input'
.form-group.gl-form-group{ role: 'group' }
= f.label :email, _('Email'), class: 'gl-display-block col-form-label'
= f.text_field :email, required: true, autocomplete: 'off', class: 'form-control gl-form-input'
.gl-border-b.gl-pb-3.gl-mb-6
.row
.col-lg-4
%h4.gl-mt-0
= _('Password')
.col-lg-8
- if @user.new_record?
= render Pajamas::AlertComponent.new(variant: :info, dismissible: false, alert_options: { class: 'gl-mb-5' }) do |c|
= c.body do
= s_('AdminUsers|Reset link will be generated and sent to the user. User will be forced to set the password on first sign in.')
- else
.form-group.gl-form-group{ role: 'group' }
= f.label :password, _('Password'), class: 'gl-display-block col-form-label'
= f.password_field :password, disabled: f.object.force_random_password, autocomplete: 'new-password', class: 'form-control gl-form-input'
.form-group.gl-form-group{ role: 'group' }
= f.label :password_confirmation, _('Password confirmation'), class: 'gl-display-block col-form-label'
= f.password_field :password_confirmation, disabled: f.object.force_random_password, autocomplete: 'new-password', class: 'form-control gl-form-input'
= render partial: 'access_levels', locals: { f: f }
......@@ -44,30 +44,31 @@
= render_if_exists 'admin/users/limits', f: f
%fieldset
%legend.gl-border-bottom-0= _('Profile')
.form-group.row
.col-12
= f.label :avatar
.col-12
= f.file_field :avatar
.gl-border-b.gl-pb-6.gl-mb-6
.row
.col-lg-4
%h4.gl-mt-0
= _('Profile')
.col-lg-8
.form-group.gl-form-group{ role: 'group' }
= f.label :avatar, s_('AdminUsers|Avatar'), class: 'gl-display-block col-form-label'
= f.file_field :avatar
.form-group.gl-form-group{ role: 'group' }
= f.label :skype, s_('AdminUsers|Skype'), class: 'gl-display-block col-form-label'
= f.text_field :skype, class: 'form-control gl-form-input'
.form-group.gl-form-group{ role: 'group' }
= f.label :linkedin, s_('AdminUsers|Linkedin'), class: 'gl-display-block col-form-label'
= f.text_field :linkedin, class: 'form-control gl-form-input'
.form-group.gl-form-group{ role: 'group' }
= f.label :twitter, _('Twitter'), class: 'gl-display-block col-form-label'
= f.text_field :twitter, class: 'form-control gl-form-input'
.form-group.row
.col-12
= f.label :skype
= f.text_field :skype, class: 'form-control gl-form-input'
.form-group.row
.col-12
= f.label :linkedin
= f.text_field :linkedin, class: 'form-control gl-form-input'
.form-group.row
.col-12
= f.label :twitter
= f.text_field :twitter, class: 'form-control gl-form-input'
.form-group.row
.col-12
= f.label :website_url
= f.text_field :website_url, class: 'form-control gl-form-input'
.form-group.gl-form-group{ role: 'group' }
= f.label :website_url, s_('AdminUsers|Website URL'), class: 'gl-display-block col-form-label'
= f.text_field :website_url, class: 'form-control gl-form-input'
= render 'admin/users/admin_notes', f: f
......
.form-group.row
.col-sm-2.col-form-label.pt-0
= f.label :lfs_enabled, _('Large File Storage')
.col-sm-10
= f.gitlab_ui_checkbox_component :lfs_enabled, checkbox_options: { checked: @group.lfs_enabled? } do |c|
= c.label do
= _('Projects in this group can use Git LFS')
= link_to sprite_icon('question-o'), help_page_path('topics/git/lfs/index'), class: 'gl-ml-2'
= c.help_text do
= _('This setting can be overridden in each project.')
.form-group.row
.col-sm-2.col-form-label
= f.label s_('ProjectCreationLevel|Allowed to create projects')
.col-sm-10
= f.select :project_creation_level, options_for_select(::Gitlab::Access.project_creation_options, @group.project_creation_level), {}, class: 'form-control'
%fieldset.form-group.gl-form-group
%legend.col-form-label.col-form-label
= _('Large File Storage')
= f.gitlab_ui_checkbox_component :lfs_enabled, checkbox_options: { checked: @group.lfs_enabled? } do |c|
= c.label do
= _('Projects in this group can use Git LFS')
= link_to sprite_icon('question-o'), help_page_path('topics/git/lfs/index'), class: 'gl-ml-2'
= c.help_text do
= _('This setting can be overridden in each project.')
.form-group.gl-form-group{ role: 'group' }
= f.label s_('ProjectCreationLevel|Allowed to create projects'), class: 'gl-display-block col-form-label'
= f.select :project_creation_level, options_for_select(::Gitlab::Access.project_creation_options, @group.project_creation_level), {}, class: 'gl-form-select custom-select'
.form-group.row
.col-sm-2.col-form-label
= f.label s_('SubgroupCreationlevel|Allowed to create subgroups')
.col-sm-10
= f.select :subgroup_creation_level, options_for_select(::Gitlab::Access.subgroup_creation_options, @group.subgroup_creation_level), {}, class: 'form-control'
.form-group.gl-form-group{ role: 'group' }
= f.label s_('SubgroupCreationlevel|Allowed to create subgroups'), class: 'gl-display-block col-form-label'
= f.select :subgroup_creation_level, options_for_select(::Gitlab::Access.subgroup_creation_options, @group.subgroup_creation_level), {}, class: 'gl-form-select custom-select'
.form-group.row
.col-sm-2.col-form-label.pt-0
= f.label :require_two_factor_authentication, _('Two-factor authentication')
.col-sm-10
- label = _("All users in this group must set up two-factor authentication")
- help_link = link_to sprite_icon('question-o'), help_page_path('security/two_factor_authentication', anchor: 'enforce-2fa-for-all-users-in-a-group'), class: 'gl-ml-2'
= f.gitlab_ui_checkbox_component :require_two_factor_authentication, '%{label}%{help_link}'.html_safe % { label: label, help_link: help_link }
.form-group.row
.offset-sm-2.col-sm-10
.form-check
= f.text_field :two_factor_grace_period, class: 'form-control'
.form-text.text-muted= _("Time (in hours) that users are allowed to skip forced configuration of two-factor authentication.")
%fieldset.form-group.gl-form-group
%legend.col-form-label.col-form-label
= _('Two-factor authentication')
- label = _("All users in this group must set up two-factor authentication")
- help_link = link_to sprite_icon('question-o'), help_page_path('security/two_factor_authentication', anchor: 'enforce-2fa-for-all-users-in-a-group'), class: 'gl-ml-2'
= f.gitlab_ui_checkbox_component :require_two_factor_authentication, '%{label}%{help_link}'.html_safe % { label: label, help_link: help_link }
.form-group.gl-form-group{ role: 'group' }
= f.label :two_factor_grace_period, _('Two-factor authentication grace period'), class: 'gl-display-block col-form-label'
= f.text_field :two_factor_grace_period, class: 'form-control gl-form-input'
%small.form-text.text-gl-muted
= _("Time (in hours) that users are allowed to skip forced configuration of two-factor authentication.")
.form-group.row
.col-sm-2.col-form-label
%fieldset.form-group.gl-form-group
%legend.col-form-label.col-form-label
= _('Visibility level')
= link_to sprite_icon('question-o'), help_page_path('user/public_access'), target: '_blank', rel: 'noopener noreferrer'
.col-sm-10
= render 'shared/visibility_level', f: f, visibility_level: visibility_level, can_change_visibility_level: can_change_visibility_level, form_model: form_model, with_label: with_label
= render 'shared/visibility_level', f: f, visibility_level: visibility_level, can_change_visibility_level: can_change_visibility_level, form_model: form_model, with_label: with_label
.form-group.row
.form-group.gl-form-group{ role: 'group' }
= f.fields_for :admin_note do |an|
.col-sm-2.col-form-label.gl-text-right
= an.label :note, s_('Admin|Admin notes')
.col-sm-10
= an.text_area :note, class: 'form-control'
= an.label :note, s_('Admin|Admin notes'), class: 'gl-display-block col-form-label'
= an.text_area :note, class: 'form-control gl-form-input gl-form-textarea'
......@@ -5,7 +5,7 @@ import ResetButton from './reset_button.vue';
Vue.use(GlToast);
export function pipelineMinutes() {
const el = document.getElementById('pipeline-minutes-vue');
const el = document.getElementById('js-pipeline-minutes-vue');
if (el) {
const { resetMinutesPath } = el.dataset;
......
<script>
import { GlButton } from '@gitlab/ui';
import { GlAlert, GlButton } from '@gitlab/ui';
import axios from '~/lib/utils/axios_utils';
import statusCodes from '~/lib/utils/http_status';
import { __ } from '~/locale';
export default {
components: {
GlAlert,
GlButton,
},
inject: {
......@@ -13,34 +14,43 @@ export default {
default: '',
},
},
data() {
return {
loading: false,
};
},
methods: {
resetPipelineMinutes() {
axios
.post(this.resetMinutesPath)
.then((resp) => {
if (resp.status === statusCodes.OK) {
this.$toast.show(__('User pipeline minutes were successfully reset.'));
}
})
.catch(() => this.$toast.show(__('There was an error resetting user pipeline minutes.')));
async resetPipelineMinutes() {
this.loading = true;
try {
const response = await axios.post(this.resetMinutesPath);
if (response.status === statusCodes.OK) {
this.$toast.show(__('User pipeline minutes were successfully reset.'));
}
} catch (e) {
this.$toast.show(__('There was an error resetting user pipeline minutes.'));
} finally {
this.loading = false;
}
},
},
};
</script>
<template>
<div class="bs-callout clearfix gl-mt-0 gl-mb-0">
<h4>
{{ s__('SharedRunnersMinutesSettings|Reset used pipeline minutes') }}
</h4>
<p>
{{
s__(
'SharedRunnersMinutesSettings|By resetting the pipeline minutes for this namespace, the currently used minutes will be set to zero.',
)
}}
</p>
<gl-button @click="resetPipelineMinutes">
{{ s__('SharedRunnersMinutesSettings|Reset pipeline minutes') }}
</gl-button>
</div>
<gl-alert
variant="info"
:title="s__('SharedRunnersMinutesSettings|Reset used pipeline minutes')"
:dismissible="false"
>
{{
s__(
'SharedRunnersMinutesSettings|By resetting the pipeline minutes for this namespace, the currently used minutes will be set to zero.',
)
}}
<template #actions>
<gl-button variant="confirm" :loading="loading" @click="resetPipelineMinutes">
{{ s__('SharedRunnersMinutesSettings|Reset pipeline minutes') }}
</gl-button>
</template>
</gl-alert>
</template>
-# rubocop: disable CodeReuse/ActiveRecord
- return unless Gitlab::CurrentSettings.should_check_namespace_plan?
.form-group.row
.col-12
= f.label :plan
.col-12
= f.fields_for :gitlab_subscription do |f|
= f.select :hosted_plan_id, Plan.pluck(:title, :id),
{ include_blank: _('No plan') },
class: 'form-control', data: { qa_selector: 'plan_dropdown' }
.form-group.gl-form-group{ role: 'group' }
= f.label :plan, class: 'gl-display-block col-form-label'
= f.fields_for :gitlab_subscription do |f|
= f.select :hosted_plan_id, Plan.pluck(:title, :id),
{ include_blank: _('No plan') },
class: 'gl-form-select custom-select', data: { qa_selector: 'plan_dropdown' }
- return unless @user.persisted?
= f.fields_for :namespace do |namespace_form|
= namespace_form.hidden_field :id
%fieldset
%legend.gl-border-bottom-0 Limits
= render 'namespaces/shared_runners_minutes_setting', form: namespace_form
.form-group.gl-mb-0
.col-12
#pipeline-minutes-vue{ data: { reset_minutes_path: reset_runners_minutes_admin_user_path(@user) } }
.gl-border-b.gl-pb-6.gl-mb-6
.row
.col-lg-4
%h4.gl-mt-0
= s_('AdminUsers|Limits')
.col-lg-8
= f.fields_for :namespace do |namespace_form|
= namespace_form.hidden_field :id
= render 'namespaces/shared_runners_minutes_setting', form: namespace_form
#js-pipeline-minutes-vue{ data: { reset_minutes_path: reset_runners_minutes_admin_user_path(@user) } }
- if Gitlab::CurrentSettings.should_check_namespace_plan?
= f.fields_for :namespace do |namespace_form|
%fieldset
%legend.gl-border-bottom-0= _('Licensed Features')
= render 'admin/namespace_plan', f: namespace_form
.gl-border-b.gl-pb-3.gl-mb-6
.row
.col-lg-4
%h4.gl-mt-0
= _('Licensed Features')
.col-lg-8
= render 'admin/namespace_plan', f: namespace_form
- if @group.ldap_sync_started?
%span.btn.gl-button.disabled
= sprite_icon("retry", css_class: 'spin gl-mr-2')
= render Pajamas::ButtonComponent.new(icon: 'retry', icon_classes: 'gl-spin', button_options: { class: 'gl-mr-3', disabled: true }) do
= _('Syncing…')
- elsif @group.ldap_sync_pending?
%span.btn.gl-button.disabled
= sprite_icon("retry", css_class: 'spin gl-mr-2')
= render Pajamas::ButtonComponent.new(icon: 'retry', icon_classes: 'gl-spin', button_options: { class: 'gl-mr-3', disabled: true }) do
= _('Pending sync…')
- else
%button.js-ldap-sync-now-button.btn.btn-default.gl-button.qa-sync-now-button{ data: ldap_sync_now_button_data(@group) }
= sprite_icon("retry", css_class: "gl-mr-2")
= render Pajamas::ButtonComponent.new(icon: 'retry', button_options: { class: 'gl-mr-3 js-ldap-sync-now-button qa-sync-now-button', data: ldap_sync_now_button_data(@group) }) do
= _('Sync now')
- if @group.ldap_sync_ready? && @group.ldap_sync_last_successful_update_at
%p.inline.gl-ml-3
......
......@@ -2,12 +2,9 @@
- form = local_assigns.fetch(:form)
.form-group.row
.col-12
= form.label :shared_runners_minutes_limit, "Quota of CI/CD minutes"
= form.number_field :shared_runners_minutes_limit, class: 'form-control', min: 0
%span.form-text.text-muted#shared_runners_minutes_limit_help_block
The maximum number of CI/CD minutes on shared runners that a group can use each month.
Set 0 for unlimited.
Set empty to inherit the global setting of #{Gitlab::CurrentSettings.shared_runners_minutes}.
= link_to sprite_icon('question-o'), help_page_path('ci/pipelines/cicd_minutes'), target: '_blank', rel: 'noopener noreferrer'
.form-group.gl-form-group{ role: 'group' }
= form.label :shared_runners_minutes_limit, s_('AdminUsers|Quota of CI/CD minutes')
= form.number_field :shared_runners_minutes_limit, class: 'gl-form-input form-control', min: 0
%small.form-text.text-gl-muted
= s_('AdminUsers|The maximum number of CI/CD minutes on shared runners that a group can use each month. Set 0 for unlimited. Set empty to inherit the global setting of %{minutes}') % { minutes: Gitlab::CurrentSettings.shared_runners_minutes }
= link_to sprite_icon('question-o'), help_page_path('ci/pipelines/cicd_minutes'), target: '_blank', rel: 'noopener noreferrer'
......@@ -5,6 +5,4 @@
= render 'namespaces/shared_runners_minutes_setting', form: form
- unless group.new_record?
.form-group.row
.offset-sm-2.col-sm-10
#pipeline-minutes-vue{ data: { reset_minutes_path: admin_group_reset_runners_minutes_path(group) } }
#js-pipeline-minutes-vue{ data: { reset_minutes_path: admin_group_reset_runners_minutes_path(group) } }
- return unless current_user.admin? && repo_size_limit_feature_available?
- form = local_assigns.fetch(:form)
- type = local_assigns.fetch(:type)
- label_class = (type == :project) ? 'label-bold' : 'col-form-label col-sm-2'
.form-group.row
= form.label :repository_size_limit, class: label_class do
Repository size limit (MB)
- if type == :project
= form.number_field :repository_size_limit, value: form.object.repository_size_limit.try(:to_mb), class: 'form-control', min: 0
%span.form-text.text-muted#repository_size_limit_help_block
= size_limit_message(@project)
- elsif type == :group
.col-sm-10
= form.number_field :repository_size_limit, value: form.object.repository_size_limit.try(:to_mb), class: 'form-control', min: 0
%span.form-text.text-muted#repository_size_limit_help_block
= size_limit_message_for_group(@group)
.form-group.gl-form-group{ role: 'group' }
= form.label :repository_size_limit, _('Repository size limit (MB)'), class: 'gl-display-block col-form-label'
= form.number_field :repository_size_limit, value: form.object.repository_size_limit.try(:to_mb), class: 'form-control', min: 0
%small.form-text.text-gl-muted
= size_limit_message_for_group(@group)
import { nextTick } from 'vue';
import { GlButton } from '@gitlab/ui';
import { shallowMount } from '@vue/test-utils';
import { mount } from '@vue/test-utils';
import MockAdapter from 'axios-mock-adapter';
import ResetButton from 'ee/pages/admin/users/pipeline_minutes/reset_button.vue';
import axios from '~/lib/utils/axios_utils';
......@@ -15,7 +16,7 @@ describe('Reset pipeline minutes button', () => {
let mock;
beforeEach(() => {
wrapper = shallowMount(ResetButton, {
wrapper = mount(ResetButton, {
provide: {
...defaultProps,
},
......@@ -51,17 +52,21 @@ describe('Reset pipeline minutes button', () => {
mock.restore();
});
it('should create a network request when the reset button is clicked', () => {
it('should create a network request when the reset button is clicked', async () => {
const axiosSpy = jest.spyOn(axios, 'post');
const button = findResetButton();
button.vm.$emit('click');
await nextTick();
return axios.waitForAll().then(() => {
expect(axiosSpy).toHaveBeenCalled();
expect($toast.show).toHaveBeenCalledWith('User pipeline minutes were successfully reset.');
});
expect(button.props('loading')).toBe(true);
await axios.waitForAll();
expect(axiosSpy).toHaveBeenCalled();
expect($toast.show).toHaveBeenCalledWith('User pipeline minutes were successfully reset.');
expect(button.props('loading')).toBe(false);
});
});
......@@ -76,19 +81,19 @@ describe('Reset pipeline minutes button', () => {
mock.restore();
});
it('should show a toast error message', () => {
it('should show a toast error message', async () => {
const axiosSpy = jest.spyOn(axios, 'post');
const button = findResetButton();
button.vm.$emit('click');
return axios.waitForAll().then(() => {
expect(axiosSpy).toHaveBeenCalled();
expect($toast.show).toHaveBeenCalledWith(
'There was an error resetting user pipeline minutes.',
);
});
await axios.waitForAll();
expect(axiosSpy).toHaveBeenCalled();
expect($toast.show).toHaveBeenCalledWith(
'There was an error resetting user pipeline minutes.',
);
});
});
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment