diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-01-14 09:11:16 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-01-14 09:11:16 +0300 |
commit | 298ae510cefeae8a8ffb9a868fefd9eceeac4122 (patch) | |
tree | 874a874b5d4117b97c9fd8475d76b9aa7dc966ce /app | |
parent | 04698e448a10aedea2f3ed37ffd0327e9b91426e (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/boards/boards_util.js | 6 | ||||
-rw-r--r-- | app/assets/javascripts/boards/stores/actions.js | 3 | ||||
-rw-r--r-- | app/assets/javascripts/pipeline_new/components/pipeline_new_form.vue | 15 | ||||
-rw-r--r-- | app/assets/javascripts/set_status_modal/set_status_modal_wrapper.vue | 5 | ||||
-rw-r--r-- | app/enums/.keep | 0 | ||||
-rw-r--r-- | app/graphql/types/base_enum.rb | 19 | ||||
-rw-r--r-- | app/models/application_record.rb | 5 | ||||
-rw-r--r-- | app/presenters/ci/build_runner_presenter.rb | 21 | ||||
-rw-r--r-- | app/views/projects/mirrors/_instructions.html.haml | 4 | ||||
-rw-r--r-- | app/views/projects/mirrors/_mirror_repos.html.haml | 10 | ||||
-rw-r--r-- | app/views/projects/mirrors/_mirror_repos_push.html.haml | 4 |
11 files changed, 64 insertions, 28 deletions
diff --git a/app/assets/javascripts/boards/boards_util.js b/app/assets/javascripts/boards/boards_util.js index 16c833c8aa2..6143beeae45 100644 --- a/app/assets/javascripts/boards/boards_util.js +++ b/app/assets/javascripts/boards/boards_util.js @@ -1,4 +1,5 @@ import { sortBy } from 'lodash'; +import { __ } from '~/locale'; import { ListType } from './constants'; import { getIdFromGraphQLId } from '~/graphql_shared/utils'; @@ -8,14 +9,15 @@ export function getMilestone() { export function updateListPosition(listObj) { const { listType } = listObj; - let { position } = listObj; + let { position, title } = listObj; if (listType === ListType.closed) { position = Infinity; } else if (listType === ListType.backlog) { position = -Infinity; + title = __('Open'); } - return { ...listObj, position }; + return { ...listObj, title, position }; } export function formatBoardLists(lists) { diff --git a/app/assets/javascripts/boards/stores/actions.js b/app/assets/javascripts/boards/stores/actions.js index e64c82f0342..46d551eb50c 100644 --- a/app/assets/javascripts/boards/stores/actions.js +++ b/app/assets/javascripts/boards/stores/actions.js @@ -12,6 +12,7 @@ import { fullBoardId, formatListsPageInfo, formatIssue, + updateListPosition, } from '../boards_util'; import createFlash from '~/flash'; import { __ } from '~/locale'; @@ -131,7 +132,7 @@ export default { }, addList: ({ commit }, list) => { - commit(types.RECEIVE_ADD_LIST_SUCCESS, list); + commit(types.RECEIVE_ADD_LIST_SUCCESS, updateListPosition(list)); }, fetchLabels: ({ state, commit }, searchTerm) => { diff --git a/app/assets/javascripts/pipeline_new/components/pipeline_new_form.vue b/app/assets/javascripts/pipeline_new/components/pipeline_new_form.vue index d25c9a788e0..70c5713b216 100644 --- a/app/assets/javascripts/pipeline_new/components/pipeline_new_form.vue +++ b/app/assets/javascripts/pipeline_new/components/pipeline_new_form.vue @@ -16,6 +16,7 @@ import { GlSearchBoxByType, GlSprintf, GlLoadingIcon, + GlSafeHtmlDirective as SafeHtml, } from '@gitlab/ui'; import * as Sentry from '~/sentry/wrapper'; import { s__, __, n__ } from '~/locale'; @@ -34,7 +35,7 @@ export default { 'Pipeline|Specify variable values to be used in this run. The values specified in %{linkStart}CI/CD settings%{linkEnd} will be used by default.', ), formElementClasses: 'gl-mr-3 gl-mb-3 gl-flex-basis-quarter gl-flex-shrink-0 gl-flex-grow-0', - errorTitle: __('The form contains the following error:'), + errorTitle: __('Pipeline cannot be run.'), warningTitle: __('The form contains the following warning:'), maxWarningsSummary: __('%{total} warnings found: showing first %{warningsDisplayed}'), components: { @@ -53,6 +54,7 @@ export default { GlSprintf, GlLoadingIcon, }, + directives: { SafeHtml }, props: { pipelinesPath: { type: String, @@ -335,8 +337,9 @@ export default { variant="danger" class="gl-mb-4" data-testid="run-pipeline-error-alert" - >{{ error }}</gl-alert > + <span v-safe-html="error"></span> + </gl-alert> <gl-alert v-if="shouldShowWarning" :title="$options.warningTitle" @@ -365,7 +368,7 @@ export default { </p> </details> </gl-alert> - <gl-form-group :label="s__('Pipeline|Run for')"> + <gl-form-group :label="s__('Pipeline|Run for branch name or tag')"> <gl-dropdown :text="refShortName" block> <gl-search-box-by-type v-model.trim="searchTerm" :placeholder="__('Search refs')" /> <gl-dropdown-section-header>{{ __('Branches') }}</gl-dropdown-section-header> @@ -391,12 +394,6 @@ export default { {{ tag.shortName }} </gl-dropdown-item> </gl-dropdown> - - <template #description> - <div> - {{ s__('Pipeline|Existing branch name or tag') }} - </div></template - > </gl-form-group> <gl-loading-icon v-if="isLoading" class="gl-mb-5" size="lg" /> diff --git a/app/assets/javascripts/set_status_modal/set_status_modal_wrapper.vue b/app/assets/javascripts/set_status_modal/set_status_modal_wrapper.vue index f2685dfbcdb..30e0e552165 100644 --- a/app/assets/javascripts/set_status_modal/set_status_modal_wrapper.vue +++ b/app/assets/javascripts/set_status_modal/set_status_modal_wrapper.vue @@ -172,10 +172,7 @@ export default { .catch(this.onUpdateFail); }, onUpdateSuccess() { - this.$toast.show(s__('SetStatusModal|Status updated'), { - type: 'success', - position: 'top-center', - }); + this.$toast.show(s__('SetStatusModal|Status updated')); this.closeModal(); window.location.reload(); }, diff --git a/app/enums/.keep b/app/enums/.keep new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/app/enums/.keep diff --git a/app/graphql/types/base_enum.rb b/app/graphql/types/base_enum.rb index 159443641bc..cbd45b46dd6 100644 --- a/app/graphql/types/base_enum.rb +++ b/app/graphql/types/base_enum.rb @@ -5,6 +5,25 @@ module Types extend GitlabStyleDeprecations class << self + # Registers enum definition by the given DeclarativeEnum module + # + # @param enum_mod [Module] The enum module to be used + # @param use_name [Boolean] Does not override the name if set `false` + # @param use_description [Boolean] Does not override the description if set `false` + # + # Example: + # + # class MyEnum < BaseEnum + # declarative_enum MyDeclarativeEnum + # end + # + def declarative_enum(enum_mod, use_name: true, use_description: true) + graphql_name(enum_mod.name) if use_name + description(enum_mod.description) if use_description + + enum_mod.definition.each { |key, content| value(key.to_s.upcase, content) } + end + def value(*args, **kwargs, &block) enum[args[0].downcase] = kwargs[:value] || args[0] kwargs = gitlab_deprecation(kwargs) diff --git a/app/models/application_record.rb b/app/models/application_record.rb index 71235ed1002..44d1b6cf907 100644 --- a/app/models/application_record.rb +++ b/app/models/application_record.rb @@ -77,4 +77,9 @@ class ApplicationRecord < ActiveRecord::Base def self.where_exists(query) where('EXISTS (?)', query.select(1)) end + + def self.declarative_enum(enum_mod) + values = enum_mod.definition.transform_values { |v| v[:value] } + enum(enum_mod.key => values) + end end diff --git a/app/presenters/ci/build_runner_presenter.rb b/app/presenters/ci/build_runner_presenter.rb index 64461fa9193..ffa33dc9f15 100644 --- a/app/presenters/ci/build_runner_presenter.rb +++ b/app/presenters/ci/build_runner_presenter.rb @@ -93,7 +93,22 @@ module Ci end def refspec_for_persistent_ref - "+#{persistent_ref_path}:#{persistent_ref_path}" + # + # End-to-end test coverage for CI fetching seems to not be strong, so we + # are using a feature flag here to close the confidence gap. My (JV) + # confidence about the change is very high but if something is wrong + # with it after all, this would cause all CI jobs on gitlab.com to fail. + # + # The roll-out will be tracked in + # https://gitlab.com/gitlab-com/gl-infra/scalability/-/issues/746. + # + if Feature.enabled?(:scalability_ci_fetch_sha, type: :ops) + # Use persistent_ref.sha because it causes 'git fetch' to do less work. + # See https://gitlab.com/gitlab-com/gl-infra/scalability/-/issues/746. + "+#{pipeline.persistent_ref.sha}:#{pipeline.persistent_ref.path}" + else + "+#{pipeline.persistent_ref.path}:#{pipeline.persistent_ref.path}" + end end def persistent_ref_exist? @@ -107,10 +122,6 @@ module Ci pipeline.persistent_ref.exist? end - def persistent_ref_path - pipeline.persistent_ref.path - end - def git_depth_variable strong_memoize(:git_depth_variable) do variables&.find { |variable| variable[:key] == 'GIT_DEPTH' } diff --git a/app/views/projects/mirrors/_instructions.html.haml b/app/views/projects/mirrors/_instructions.html.haml index 97b04acea31..a91751da0aa 100644 --- a/app/views/projects/mirrors/_instructions.html.haml +++ b/app/views/projects/mirrors/_instructions.html.haml @@ -3,12 +3,12 @@ %li = html_escape(_('The repository must be accessible over %{code_open}http://%{code_close}, %{code_open}https://%{code_close}, %{code_open}ssh://%{code_close} or %{code_open}git://%{code_close}.')) % { code_open: '<code>'.html_safe, code_close: '</code>'.html_safe } - %li= html_escape(_('When using the %{code_open}http://%{code_close} or %{code_open}https://%{code_close} protocols, please provide the exact URL to the repository. HTTP redirects will not be followed.')) % { code_open: '<code>'.html_safe, code_close: '</code>'.html_safe } + %li= html_escape(_('When using the %{code_open}http://%{code_close} or %{code_open}https://%{code_close} protocols, provide the exact URL to the repository. HTTP redirects will not be followed.')) % { code_open: '<code>'.html_safe, code_close: '</code>'.html_safe } %li= html_escape(_('Include the username in the URL if required: %{code_open}https://username@gitlab.company.com/group/project.git%{code_close}.')) % { code_open: '<code>'.html_safe, code_close: '</code>'.html_safe } %li - minutes = Gitlab.config.gitlab_shell.git_timeout / 60 = _("The update action will time out after %{number_of_minutes} minutes. For big repositories, use a clone/push combination.") % { number_of_minutes: minutes } %li= mirror_lfs_sync_message %li - = _('This user will be the author of all events in the activity feed that are the result of an update, + = _('In case of pull mirroring, your user will be the author of all events in the activity feed that are the result of an update, like new branches being created or new commits being pushed to existing branches.') diff --git a/app/views/projects/mirrors/_mirror_repos.html.haml b/app/views/projects/mirrors/_mirror_repos.html.haml index 5b074ff8a28..98d35845b31 100644 --- a/app/views/projects/mirrors/_mirror_repos.html.haml +++ b/app/views/projects/mirrors/_mirror_repos.html.haml @@ -10,7 +10,7 @@ = expanded ? _('Collapse') : _('Expand') %p = _('Set up your project to automatically push and/or pull changes to/from another repository. Branches, tags, and commits will be synced automatically.') - = link_to _('Read more'), help_page_path('user/project/repository/repository_mirroring.md'), target: '_blank' + = link_to _('How do I mirror repositories?'), help_page_path('user/project/repository/repository_mirroring'), target: '_blank', rel: 'noopener noreferrer' .settings-content - if mirror_settings_enabled @@ -21,7 +21,7 @@ .form-group.has-feedback = label_tag :url, _('Git repository URL'), class: 'label-light' - = text_field_tag :url, nil, class: 'form-control js-mirror-url js-repo-url qa-mirror-repository-url-input', placeholder: _('Input your repository URL'), required: true, pattern: "(#{protocols}):\/\/.+", autocomplete: 'new-password' + = text_field_tag :url, nil, class: 'form-control js-mirror-url js-repo-url qa-mirror-repository-url-input', placeholder: _('Input the remote repository URL'), required: true, pattern: "(#{protocols}):\/\/.+", autocomplete: 'new-password' = render 'projects/mirrors/instructions' @@ -29,8 +29,10 @@ .form-check.gl-mb-3 = check_box_tag :only_protected_branches, '1', false, class: 'js-mirror-protected form-check-input' - = label_tag :only_protected_branches, _('Only mirror protected branches'), class: 'form-check-label' - = link_to sprite_icon('question-o'), help_page_path('user/project/protected_branches'), target: '_blank' + = label_tag :only_protected_branches, _('Mirror only protected branches'), class: 'form-check-label' + .form-text.text-muted + = _('If enabled, only protected branches will be mirrored.') + = link_to _('Learn more.'), help_page_path('user/project/repository/repository_mirroring', anchor: 'mirror-only-protected-branches'), target: '_blank', rel: 'noopener noreferrer' .panel-footer = f.submit _('Mirror repository'), class: 'gl-button btn btn-success js-mirror-submit qa-mirror-repository-button', name: :update_remote_mirror diff --git a/app/views/projects/mirrors/_mirror_repos_push.html.haml b/app/views/projects/mirrors/_mirror_repos_push.html.haml index 03839146f3b..04f44f4748e 100644 --- a/app/views/projects/mirrors/_mirror_repos_push.html.haml +++ b/app/views/projects/mirrors/_mirror_repos_push.html.haml @@ -10,4 +10,6 @@ .form-check.gl-mb-3 = check_box_tag :keep_divergent_refs, '1', false, class: 'js-mirror-keep-divergent-refs form-check-input' = label_tag :keep_divergent_refs, _('Keep divergent refs'), class: 'form-check-label' - = link_to sprite_icon('question-o'), help_page_path('user/project/repository/repository_mirroring', anchor: 'keep-divergent-refs'), target: '_blank' + .form-text.text-muted + = _('By default, if any ref (branch, tag, or commit) on the remote mirror has diverged from the local repository, the entire push will fail, and nothing will be updated. Choose this option to override this behavior. After the mirror is created, this can only be modified via the API.') + = link_to _('Learn more.'), help_page_path('user/project/repository/repository_mirroring', anchor: 'keep-divergent-refs'), target: '_blank', rel: 'noopener noreferrer' |