diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-02-01 18:18:50 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-02-01 18:18:50 +0300 |
commit | 3bdc719293f08ed357ef452f3e2a11a9b29531e7 (patch) | |
tree | b5a03109fd3704194d5707759d5ec0e4650bf177 /app | |
parent | 1ae73e5bfcb2dc4a49f40886f729fc4797ba2a65 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
15 files changed, 176 insertions, 79 deletions
diff --git a/app/assets/javascripts/alert_management/components/alert_management_table.vue b/app/assets/javascripts/alert_management/components/alert_management_table.vue index 79a6bac3ba7..84c2b216859 100644 --- a/app/assets/javascripts/alert_management/components/alert_management_table.vue +++ b/app/assets/javascripts/alert_management/components/alert_management_table.vue @@ -15,7 +15,7 @@ import getAlertsQuery from '~/graphql_shared/queries/get_alerts.query.graphql'; import { fetchPolicies } from '~/lib/graphql'; import { convertToSnakeCase } from '~/lib/utils/text_utility'; import { joinPaths, visitUrl } from '~/lib/utils/url_utility'; -import { s__, __ } from '~/locale'; +import { s__, __, n__ } from '~/locale'; import AlertStatus from '~/vue_shared/alert_details/components/alert_status.vue'; import { tdClass, @@ -32,8 +32,11 @@ const TH_TEST_ID = { 'data-testid': 'alert-management-severity-sort' }; const TWELVE_HOURS_IN_MS = 12 * 60 * 60 * 1000; +const MAX_VISIBLE_ASSIGNEES = 4; + export default { trackAlertListViewsOptions, + MAX_VISIBLE_ASSIGNEES, i18n: { noAlertsMsg: s__( 'AlertManagement|No alerts available to display. See %{linkStart}enabling alert management%{linkEnd} for more information on adding alerts to the list.', @@ -258,6 +261,13 @@ export default { this.serverErrorMessage = ''; this.isErrorAlertDismissed = true; }, + assigneesBadgeSrOnlyText(item) { + return n__( + '%d additional assignee', + '%d additional assignees', + item.assignees.nodes.length - MAX_VISIBLE_ASSIGNEES, + ); + }, }, }; </script> @@ -365,10 +375,11 @@ export default { <gl-avatars-inline :avatars="item.assignees.nodes" :collapsed="true" - :max-visible="4" + :max-visible="$options.MAX_VISIBLE_ASSIGNEES" :avatar-size="24" badge-tooltip-prop="name" :badge-tooltip-max-chars="100" + :badge-sr-only-text="assigneesBadgeSrOnlyText(item)" > <template #avatar="{ avatar }"> <gl-avatar-link diff --git a/app/assets/javascripts/incidents/components/incidents_list.vue b/app/assets/javascripts/incidents/components/incidents_list.vue index 37597da3c8e..7a904bdb6ad 100644 --- a/app/assets/javascripts/incidents/components/incidents_list.vue +++ b/app/assets/javascripts/incidents/components/incidents_list.vue @@ -12,7 +12,7 @@ import { } from '@gitlab/ui'; import { isValidSlaDueAt } from 'ee_else_ce/vue_shared/components/incidents/utils'; import { visitUrl, mergeUrlParams, joinPaths } from '~/lib/utils/url_utility'; -import { s__ } from '~/locale'; +import { s__, n__ } from '~/locale'; import { INCIDENT_SEVERITY } from '~/sidebar/components/severity/constants'; import SeverityToken from '~/sidebar/components/severity/severity.vue'; import Tracking from '~/tracking'; @@ -38,6 +38,8 @@ import { import getIncidentsCountByStatus from '../graphql/queries/get_count_by_status.query.graphql'; import getIncidents from '../graphql/queries/get_incidents.query.graphql'; +const MAX_VISIBLE_ASSIGNEES = 4; + export default { trackIncidentCreateNewOptions, trackIncidentListViewsOptions, @@ -94,6 +96,7 @@ export default { thAttr: TH_PUBLISHED_TEST_ID, }, ], + MAX_VISIBLE_ASSIGNEES, components: { GlLoadingIcon, GlTable, @@ -295,6 +298,13 @@ export default { errorAlertDismissed() { this.isErrorAlertDismissed = true; }, + assigneesBadgeSrOnlyText(item) { + return n__( + '%d additional assignee', + '%d additional assignees', + item.assignees.nodes.length - MAX_VISIBLE_ASSIGNEES, + ); + }, isValidSlaDueAt, }, }; @@ -391,10 +401,11 @@ export default { <gl-avatars-inline :avatars="item.assignees.nodes" :collapsed="true" - :max-visible="4" + :max-visible="$options.MAX_VISIBLE_ASSIGNEES" :avatar-size="24" badge-tooltip-prop="name" :badge-tooltip-max-chars="100" + :badge-sr-only-text="assigneesBadgeSrOnlyText(item)" > <template #avatar="{ avatar }"> <gl-avatar-link diff --git a/app/assets/javascripts/issues/create_merge_request_dropdown.js b/app/assets/javascripts/issues/create_merge_request_dropdown.js index 5d36396bc6e..a3752c7043c 100644 --- a/app/assets/javascripts/issues/create_merge_request_dropdown.js +++ b/app/assets/javascripts/issues/create_merge_request_dropdown.js @@ -69,11 +69,11 @@ export default class CreateMergeRequestDropdown { this.regexps = { branch: { createBranchPath: new RegExp('(branch_name=)(.+?)(?=&issue)'), - createMrPath: new RegExp('(branch_name=)(.+?)(?=&ref)'), + createMrPath: new RegExp('(source_branch%5D=)(.+?)(?=&)'), }, ref: { createBranchPath: new RegExp('(ref=)(.+?)$'), - createMrPath: new RegExp('(ref=)(.+?)$'), + createMrPath: new RegExp('(target_branch%5D=)(.+?)$'), }, }; @@ -167,23 +167,18 @@ export default class CreateMergeRequestDropdown { } createMergeRequest() { - this.isCreatingMergeRequest = true; - - return axios - .post(this.createMrPath, { - target_project_id: canCreateConfidentialMergeRequest() - ? confidentialMergeRequestState.selectedProject.id - : null, - }) - .then(({ data }) => { - this.mergeRequestCreated = true; - window.location.href = data.url; - }) - .catch(() => - createFlash({ - message: __('Failed to create merge request. Please try again.'), - }), - ); + return new Promise(() => { + this.isCreatingMergeRequest = true; + + return this.createBranch().then(() => { + window.location.href = canCreateConfidentialMergeRequest() + ? this.createMrPath.replace( + this.projectPath, + confidentialMergeRequestState.selectedProject.pathWithNamespace, + ) + : this.createMrPath; + }); + }); } disable() { @@ -562,5 +557,7 @@ export default class CreateMergeRequestDropdown { this.regexps[target].createMrPath, pathReplacement, ); + + this.wrapperEl.dataset.createMrPath = this.createMrPath; } } diff --git a/app/assets/javascripts/jira_connect/subscriptions/components/app.vue b/app/assets/javascripts/jira_connect/subscriptions/components/app.vue index 32b22f5103c..905e242e977 100644 --- a/app/assets/javascripts/jira_connect/subscriptions/components/app.vue +++ b/app/assets/javascripts/jira_connect/subscriptions/components/app.vue @@ -1,12 +1,11 @@ <script> -import { GlAlert, GlLink, GlSprintf, GlEmptyState } from '@gitlab/ui'; +import { GlAlert, GlLink, GlSprintf } from '@gitlab/ui'; import { isEmpty } from 'lodash'; import { mapState, mapMutations } from 'vuex'; import { retrieveAlert } from '~/jira_connect/subscriptions/utils'; import { SET_ALERT } from '../store/mutation_types'; -import SubscriptionsList from './subscriptions_list.vue'; -import AddNamespaceButton from './add_namespace_button.vue'; -import SignInButton from './sign_in_button.vue'; +import SignInPage from '../pages/sign_in.vue'; +import SubscriptionsPage from '../pages/subscriptions.vue'; import UserLink from './user_link.vue'; import CompatibilityAlert from './compatibility_alert.vue'; @@ -16,12 +15,10 @@ export default { GlAlert, GlLink, GlSprintf, - GlEmptyState, - SubscriptionsList, - AddNamespaceButton, - SignInButton, UserLink, CompatibilityAlert, + SignInPage, + SubscriptionsPage, }, inject: { usersPath: { @@ -84,43 +81,9 @@ export default { <user-link :user-signed-in="userSignedIn" :has-subscriptions="hasSubscriptions" /> <h2 class="gl-text-center gl-mb-7">{{ s__('JiraService|GitLab for Jira Configuration') }}</h2> - <div class="jira-connect-app-body gl-mx-auto gl-px-5 gl-mb-7"> - <template v-if="hasSubscriptions"> - <div class="gl-display-flex gl-justify-content-end"> - <sign-in-button v-if="!userSignedIn" :users-path="usersPath" /> - <add-namespace-button v-else /> - </div> - - <subscriptions-list /> - </template> - <template v-else> - <div v-if="!userSignedIn" class="gl-text-center"> - <p class="gl-mb-7">{{ s__('JiraService|Sign in to GitLab.com to get started.') }}</p> - <sign-in-button class="gl-mb-7" :users-path="usersPath"> - {{ __('Sign in to GitLab') }} - </sign-in-button> - <p> - {{ - s__( - 'Integrations|Note: this integration only works with accounts on GitLab.com (SaaS).', - ) - }} - </p> - </div> - <gl-empty-state - v-else - :title="s__('Integrations|No linked namespaces')" - :description=" - s__( - 'Integrations|Namespaces are the GitLab groups and subgroups you link to this Jira instance.', - ) - " - > - <template #actions> - <add-namespace-button /> - </template> - </gl-empty-state> - </template> + <div class="gl-layout-w-limited gl-mx-auto gl-px-5 gl-mb-7"> + <sign-in-page v-if="!userSignedIn" :has-subscriptions="hasSubscriptions" /> + <subscriptions-page v-else :has-subscriptions="hasSubscriptions" /> </div> </div> </template> diff --git a/app/assets/javascripts/jira_connect/subscriptions/components/sign_in_button.vue b/app/assets/javascripts/jira_connect/subscriptions/components/sign_in_button.vue index dc0a77e99c2..627abcdd4a0 100644 --- a/app/assets/javascripts/jira_connect/subscriptions/components/sign_in_button.vue +++ b/app/assets/javascripts/jira_connect/subscriptions/components/sign_in_button.vue @@ -1,6 +1,7 @@ <script> import { GlButton } from '@gitlab/ui'; import { getGitlabSignInURL } from '~/jira_connect/subscriptions/utils'; +import { s__ } from '~/locale'; export default { components: { @@ -25,12 +26,15 @@ export default { this.signInURL = await getGitlabSignInURL(this.usersPath); }, }, + i18n: { + defaultButtonText: s__('Integrations|Sign in to GitLab'), + }, }; </script> <template> <gl-button category="primary" variant="info" :href="signInURL" target="_blank"> <slot> - {{ s__('Integrations|Sign in to add namespaces') }} + {{ $options.i18n.defaultButtonText }} </slot> </gl-button> </template> diff --git a/app/assets/javascripts/jira_connect/subscriptions/pages/sign_in.vue b/app/assets/javascripts/jira_connect/subscriptions/pages/sign_in.vue new file mode 100644 index 00000000000..2bce5afc72b --- /dev/null +++ b/app/assets/javascripts/jira_connect/subscriptions/pages/sign_in.vue @@ -0,0 +1,40 @@ +<script> +import { s__ } from '~/locale'; +import SubscriptionsList from '../components/subscriptions_list.vue'; +import SignInButton from '../components/sign_in_button.vue'; + +export default { + name: 'SignInPage', + components: { + SubscriptionsList, + SignInButton, + }, + inject: ['usersPath'], + props: { + hasSubscriptions: { + type: Boolean, + required: true, + }, + }, + i18n: { + signinButtonTextWithSubscriptions: s__('Integrations|Sign in to add namespaces'), + signInText: s__('JiraService|Sign in to GitLab.com to get started.'), + }, +}; +</script> + +<template> + <div v-if="hasSubscriptions"> + <div class="gl-display-flex gl-justify-content-end"> + <sign-in-button :users-path="usersPath"> + {{ $options.i18n.signinButtonTextWithSubscriptions }} + </sign-in-button> + </div> + + <subscriptions-list /> + </div> + <div v-else class="gl-text-center"> + <p class="gl-mb-7">{{ $options.i18n.signInText }}</p> + <sign-in-button class="gl-mb-7" :users-path="usersPath" /> + </div> +</template> diff --git a/app/assets/javascripts/jira_connect/subscriptions/pages/subscriptions.vue b/app/assets/javascripts/jira_connect/subscriptions/pages/subscriptions.vue new file mode 100644 index 00000000000..426f2999370 --- /dev/null +++ b/app/assets/javascripts/jira_connect/subscriptions/pages/subscriptions.vue @@ -0,0 +1,43 @@ +<script> +import { GlEmptyState } from '@gitlab/ui'; +import SubscriptionsList from '../components/subscriptions_list.vue'; +import AddNamespaceButton from '../components/add_namespace_button.vue'; + +export default { + name: 'SubscriptionsPage', + components: { + GlEmptyState, + SubscriptionsList, + AddNamespaceButton, + }, + props: { + hasSubscriptions: { + type: Boolean, + required: true, + }, + }, +}; +</script> + +<template> + <div v-if="hasSubscriptions"> + <div class="gl-display-flex gl-justify-content-end"> + <add-namespace-button /> + </div> + + <subscriptions-list /> + </div> + <gl-empty-state + v-else + :title="s__('Integrations|No linked namespaces')" + :description=" + s__( + 'Integrations|Namespaces are the GitLab groups and subgroups you link to this Jira instance.', + ) + " + > + <template #actions> + <add-namespace-button /> + </template> + </gl-empty-state> +</template> diff --git a/app/assets/javascripts/repository/components/table/parent_row.vue b/app/assets/javascripts/repository/components/table/parent_row.vue index fb0e505a16e..8a081944600 100644 --- a/app/assets/javascripts/repository/components/table/parent_row.vue +++ b/app/assets/javascripts/repository/components/table/parent_row.vue @@ -1,10 +1,13 @@ <script> -import { GlLoadingIcon } from '@gitlab/ui'; +import { GlLoadingIcon, GlTooltipDirective } from '@gitlab/ui'; export default { components: { GlLoadingIcon, }, + directives: { + GlTooltip: GlTooltipDirective, + }, props: { commitRef: { type: String, @@ -41,7 +44,13 @@ export default { <template> <tr class="tree-item"> - <td colspan="3" class="tree-item-file-name" @click.self="clickRow"> + <td + v-gl-tooltip.left.viewport + :title="__('Go to parent directory')" + colspan="3" + class="tree-item-file-name" + @click.self="clickRow" + > <gl-loading-icon v-if="parentPath === loadingPath" size="sm" diff --git a/app/assets/stylesheets/page_bundles/jira_connect.scss b/app/assets/stylesheets/page_bundles/jira_connect.scss index 9fe0490571e..1c8fd7e2590 100644 --- a/app/assets/stylesheets/page_bundles/jira_connect.scss +++ b/app/assets/stylesheets/page_bundles/jira_connect.scss @@ -40,10 +40,6 @@ $header-height: 40px; max-width: 1000px; } -.jira-connect-app-body { - max-width: 768px; -} - // needed for external_link svg.s16 { width: 16px; diff --git a/app/controllers/projects/commit_controller.rb b/app/controllers/projects/commit_controller.rb index 62935e133c5..0ce0b8b8895 100644 --- a/app/controllers/projects/commit_controller.rb +++ b/app/controllers/projects/commit_controller.rb @@ -92,6 +92,8 @@ class Projects::CommitController < Projects::ApplicationController end def branches + return git_not_found! unless commit + # branch_names_contains/tag_names_contains can take a long time when there are thousands of # branches/tags - each `git branch --contains xxx` request can consume a cpu core. # so only do the query when there are a manageable number of branches/tags diff --git a/app/models/blob.rb b/app/models/blob.rb index 5731d38abe4..cc7758d9674 100644 --- a/app/models/blob.rb +++ b/app/models/blob.rb @@ -178,6 +178,10 @@ class Blob < SimpleDelegator end end + def symlink? + mode == MODE_SYMLINK + end + def extension @extension ||= extname.downcase.delete('.') end diff --git a/app/models/ci/runner.rb b/app/models/ci/runner.rb index d08cc71305e..d52129d73f3 100644 --- a/app/models/ci/runner.rb +++ b/app/models/ci/runner.rb @@ -162,6 +162,23 @@ module Ci ) end + scope :group_or_instance_wide, -> (group) do + group_and_ancestor_runners = + if ::Feature.enabled?(:ci_find_runners_by_ci_mirrors, group, default_enabled: :yaml) + belonging_to_group_and_ancestors(group.id) + else + legacy_belonging_to_group(group.id, include_ancestors: true) + end + + from_union( + [ + group_and_ancestor_runners, + instance_type + ], + remove_duplicates: false + ) + end + scope :assignable_for, ->(project) do # FIXME: That `to_sql` is needed to workaround a weird Rails bug. # Without that, placeholders would miss one and couldn't match. diff --git a/app/services/branches/create_service.rb b/app/services/branches/create_service.rb index b5faf2ec281..7300b31e3b3 100644 --- a/app/services/branches/create_service.rb +++ b/app/services/branches/create_service.rb @@ -21,7 +21,7 @@ module Branches error("Failed to create branch '#{branch_name}': invalid reference name '#{ref}'") end rescue Gitlab::Git::PreReceiveError => e - Gitlab::ErrorTracking.track_exception(e, pre_receive_message: e.raw_message, branch_name: branch_name, ref: ref) + Gitlab::ErrorTracking.log_exception(e, pre_receive_message: e.raw_message, branch_name: branch_name, ref: ref) error(e.message) end diff --git a/app/views/projects/blob/_header_content.html.haml b/app/views/projects/blob/_header_content.html.haml index f5e32e7f589..9cd2f583fdd 100644 --- a/app/views/projects/blob/_header_content.html.haml +++ b/app/views/projects/blob/_header_content.html.haml @@ -9,7 +9,7 @@ = copy_file_path_button(blob.path) %small.mr-1 - - if blob.mode == Blob::MODE_SYMLINK + - if blob.symlink? = _('Symbolic link') << ' ยท' = number_to_human_size(blob.raw_size) diff --git a/app/views/projects/issues/_new_branch.html.haml b/app/views/projects/issues/_new_branch.html.haml index 1cf0551535b..8d6c0e29b6a 100644 --- a/app/views/projects/issues/_new_branch.html.haml +++ b/app/views/projects/issues/_new_branch.html.haml @@ -6,8 +6,8 @@ - create_mr_text = can_create_confidential_merge_request? ? _('Create confidential merge request') : _('Create merge request') - can_create_path = can_create_branch_project_issue_path(@project, @issue) - - create_mr_path = create_merge_request_project_issue_path(@project, @issue, branch_name: @issue.to_branch_name, ref: @project.default_branch) - - create_branch_path = project_branches_path(@project, branch_name: @issue.to_branch_name, ref: @project.default_branch, issue_iid: @issue.iid) + - create_mr_path = project_new_merge_request_path(@project, merge_request: { source_branch: @issue.to_branch_name, target_branch: @project.default_branch }) + - create_branch_path = project_branches_path(@project, branch_name: @issue.to_branch_name, ref: @project.default_branch, issue_iid: @issue.iid, format: :json) - refs_path = refs_namespace_project_path(@project.namespace, @project, search: '') .create-mr-dropdown-wrap.d-inline-block.full-width-mobile.js-create-mr{ data: { project_path: @project.full_path, project_id: @project.id, can_create_path: can_create_path, create_mr_path: create_mr_path, create_branch_path: create_branch_path, refs_path: refs_path, is_confidential: can_create_confidential_merge_request?.to_s } } |