diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-08-15 00:10:39 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-08-15 00:10:39 +0300 |
commit | 490269f098a972406c002c57ac0863c8521bc679 (patch) | |
tree | c35cb8bd8bb512b057d5bcd7cdc336d081629e8a /app/assets | |
parent | c083e823cea8e0036866d0286773c5f211a53dfe (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets')
8 files changed, 150 insertions, 23 deletions
diff --git a/app/assets/javascripts/contribution_events/components/contribution_event/contribution_event_commented.vue b/app/assets/javascripts/contribution_events/components/contribution_event/contribution_event_commented.vue new file mode 100644 index 00000000000..ee433c17792 --- /dev/null +++ b/app/assets/javascripts/contribution_events/components/contribution_event/contribution_event_commented.vue @@ -0,0 +1,71 @@ +<script> +import { GlSprintf, GlLink } from '@gitlab/ui'; +import { + EVENT_COMMENTED_I18N, + EVENT_COMMENTED_SNIPPET_I18N, +} from 'ee_else_ce/contribution_events/constants'; +import { SNIPPET_NOTEABLE_TYPE, COMMIT_NOTEABLE_TYPE } from '~/notes/constants'; +import SafeHtml from '~/vue_shared/directives/safe_html'; +import ResourceParentLink from '../resource_parent_link.vue'; +import ContributionEventBase from './contribution_event_base.vue'; + +export default { + name: 'ContributionEventCommented', + components: { ContributionEventBase, GlSprintf, GlLink, ResourceParentLink }, + directives: { + SafeHtml, + }, + props: { + event: { + type: Object, + required: true, + }, + }, + computed: { + resourceParent() { + return this.event.resource_parent; + }, + noteable() { + return this.event.noteable; + }, + noteableType() { + return this.noteable.type; + }, + message() { + if (this.noteableType === SNIPPET_NOTEABLE_TYPE) { + return ( + EVENT_COMMENTED_SNIPPET_I18N[this.resourceParent?.type] || + EVENT_COMMENTED_SNIPPET_I18N.fallback + ); + } + + return EVENT_COMMENTED_I18N[this.noteableType] || EVENT_COMMENTED_I18N.fallback; + }, + noteableLinkClass() { + if (this.noteableType === COMMIT_NOTEABLE_TYPE) { + return ['gl-font-monospace']; + } + + return []; + }, + }, +}; +</script> + +<template> + <contribution-event-base :event="event" icon-name="comment" icon-class="gl-text-blue-600"> + <gl-sprintf :message="message"> + <template #noteableLink> + <gl-link :class="noteableLinkClass" :href="noteable.web_url">{{ + noteable.reference_link_text + }}</gl-link> + </template> + <template #resourceParentLink> + <resource-parent-link :event="event" /> + </template> + </gl-sprintf> + <template v-if="noteable.first_line_in_markdown" #additional-info> + <div v-safe-html="noteable.first_line_in_markdown" class="md"></div> + </template> + </contribution-event-base> +</template> diff --git a/app/assets/javascripts/contribution_events/components/contribution_events.vue b/app/assets/javascripts/contribution_events/components/contribution_events.vue index f161afa6048..8b42d77675f 100644 --- a/app/assets/javascripts/contribution_events/components/contribution_events.vue +++ b/app/assets/javascripts/contribution_events/components/contribution_events.vue @@ -11,6 +11,7 @@ import { EVENT_TYPE_CREATED, EVENT_TYPE_CLOSED, EVENT_TYPE_REOPENED, + EVENT_TYPE_COMMENTED, } from '../constants'; import ContributionEventApproved from './contribution_event/contribution_event_approved.vue'; import ContributionEventExpired from './contribution_event/contribution_event_expired.vue'; @@ -22,6 +23,7 @@ import ContributionEventMerged from './contribution_event/contribution_event_mer import ContributionEventCreated from './contribution_event/contribution_event_created.vue'; import ContributionEventClosed from './contribution_event/contribution_event_closed.vue'; import ContributionEventReopened from './contribution_event/contribution_event_reopened.vue'; +import ContributionEventCommented from './contribution_event/contribution_event_commented.vue'; export default { props: { @@ -146,6 +148,9 @@ export default { case EVENT_TYPE_REOPENED: return ContributionEventReopened; + case EVENT_TYPE_COMMENTED: + return ContributionEventCommented; + default: return EmptyComponent; } diff --git a/app/assets/javascripts/contribution_events/constants.js b/app/assets/javascripts/contribution_events/constants.js index 6d1c5aa1b4c..b5eddbf7e25 100644 --- a/app/assets/javascripts/contribution_events/constants.js +++ b/app/assets/javascripts/contribution_events/constants.js @@ -1,4 +1,10 @@ import { s__ } from '~/locale'; +import { + ISSUE_NOTEABLE_TYPE, + MERGE_REQUEST_NOTEABLE_TYPE, + DESIGN_NOTEABLE_TYPE, + COMMIT_NOTEABLE_TYPE, +} from '~/notes/constants'; // From app/models/event.rb#L16 export const EVENT_TYPE_CREATED = 'created'; @@ -36,7 +42,7 @@ export const WORK_ITEM_ISSUE_TYPE_INCIDENT = 'incident'; export const TYPE_FALLBACK = 'fallback'; -export const EVENT_CREATED_I18N = { +export const EVENT_CREATED_I18N = Object.freeze({ [RESOURCE_PARENT_TYPE_PROJECT]: s__('ContributionEvent|Created project %{resourceParentLink}.'), [TARGET_TYPE_MILESTONE]: s__( 'ContributionEvent|Opened milestone %{targetLink} in %{resourceParentLink}.', @@ -60,9 +66,9 @@ export const EVENT_CREATED_I18N = { 'ContributionEvent|Opened incident %{targetLink} in %{resourceParentLink}.', ), [TYPE_FALLBACK]: s__('ContributionEvent|Created resource.'), -}; +}); -export const EVENT_CLOSED_I18N = { +export const EVENT_CLOSED_I18N = Object.freeze({ [TARGET_TYPE_MILESTONE]: s__( 'ContributionEvent|Closed milestone %{targetLink} in %{resourceParentLink}.', ), @@ -79,9 +85,9 @@ export const EVENT_CLOSED_I18N = { 'ContributionEvent|Closed incident %{targetLink} in %{resourceParentLink}.', ), [TYPE_FALLBACK]: s__('ContributionEvent|Closed resource.'), -}; +}); -export const EVENT_REOPENED_I18N = { +export const EVENT_REOPENED_I18N = Object.freeze({ [TARGET_TYPE_MILESTONE]: s__( 'ContributionEvent|Reopened milestone %{targetLink} in %{resourceParentLink}.', ), @@ -98,15 +104,38 @@ export const EVENT_REOPENED_I18N = { 'ContributionEvent|Reopened incident %{targetLink} in %{resourceParentLink}.', ), [TYPE_FALLBACK]: s__('ContributionEvent|Reopened resource.'), -}; +}); -export const EVENT_CLOSED_ICONS = { +export const EVENT_COMMENTED_I18N = Object.freeze({ + [ISSUE_NOTEABLE_TYPE]: s__( + 'ContributionEvent|Commented on issue %{noteableLink} in %{resourceParentLink}.', + ), + [MERGE_REQUEST_NOTEABLE_TYPE]: s__( + 'ContributionEvent|Commented on merge request %{noteableLink} in %{resourceParentLink}.', + ), + [DESIGN_NOTEABLE_TYPE]: s__( + 'ContributionEvent|Commented on design %{noteableLink} in %{resourceParentLink}.', + ), + [COMMIT_NOTEABLE_TYPE]: s__( + 'ContributionEvent|Commented on commit %{noteableLink} in %{resourceParentLink}.', + ), + fallback: s__('ContributionEvent|Commented on %{noteableLink}.'), +}); + +export const EVENT_COMMENTED_SNIPPET_I18N = Object.freeze({ + [RESOURCE_PARENT_TYPE_PROJECT]: s__( + 'ContributionEvent|Commented on snippet %{noteableLink} in %{resourceParentLink}.', + ), + fallback: s__('ContributionEvent|Commented on snippet %{noteableLink}.'), +}); + +export const EVENT_CLOSED_ICONS = Object.freeze({ [WORK_ITEM_ISSUE_TYPE_ISSUE]: 'issue-closed', [TARGET_TYPE_MERGE_REQUEST]: 'merge-request-close', [TYPE_FALLBACK]: 'status_closed', -}; +}); -export const EVENT_REOPENED_ICONS = { +export const EVENT_REOPENED_ICONS = Object.freeze({ [TARGET_TYPE_MERGE_REQUEST]: 'merge-request-open', [TYPE_FALLBACK]: 'status_open', -}; +}); diff --git a/app/assets/javascripts/deploy_tokens/components/new_deploy_token.vue b/app/assets/javascripts/deploy_tokens/components/new_deploy_token.vue index 7ec3ec3f84d..a56fce98f85 100644 --- a/app/assets/javascripts/deploy_tokens/components/new_deploy_token.vue +++ b/app/assets/javascripts/deploy_tokens/components/new_deploy_token.vue @@ -8,7 +8,9 @@ import { GlFormInputGroup, GlSprintf, GlLink, + GlAlert, } from '@gitlab/ui'; +import { MountingPortal } from 'portal-vue'; import { createAlert, VARIANT_INFO } from '~/alert'; import axios from '~/lib/utils/axios_utils'; import { formatDate } from '~/lib/utils/datetime_utility'; @@ -26,6 +28,8 @@ export default { ClipboardButton, GlSprintf, GlLink, + GlAlert, + MountingPortal, }, props: { @@ -170,12 +174,17 @@ export default { </script> <template> <div> - <div v-if="newTokenDetails" class="created-deploy-token-container info-well"> - <div class="well-segment"> - <h5>{{ $options.translations.newTokenMessage }}</h5> + <mounting-portal append mount-to="#new-deploy-token-alert"> + <gl-alert + v-if="newTokenDetails" + variant="success" + class="gl-mb-4" + @dismiss="newTokenDetails = null" + > + <h5 class="gl-mt-0!">{{ $options.translations.newTokenMessage }}</h5> <gl-form-group> <template #description> - <div class="deploy-token-help-block gl-mt-2 text-success"> + <div class="deploy-token-help-block gl-mt-2"> <gl-sprintf :message="$options.translations.newTokenUsernameDescription" :placeholders="placeholders.link" @@ -200,9 +209,9 @@ export default { </template> </gl-form-input-group> </gl-form-group> - <gl-form-group> + <gl-form-group class="gl-mb-0"> <template #description> - <div class="deploy-token-help-block gl-mt-2 text-danger"> + <div class="deploy-token-help-block gl-mt-2"> <gl-sprintf :message="$options.translations.newTokenDescription" :placeholders="placeholders.i" @@ -222,9 +231,9 @@ export default { </template> </gl-form-input-group> </gl-form-group> - </div> - </div> - <h5>{{ $options.translations.addTokenHeader }}</h5> + </gl-alert> + </mounting-portal> + <h4 class="gl-mt-0">{{ $options.translations.addTokenHeader }}</h4> <p> <gl-sprintf :message="$options.translations.addTokenDescription" @@ -296,6 +305,9 @@ export default { <gl-button variant="confirm" @click="createDeployToken"> {{ $options.translations.addTokenButton }} </gl-button> + <gl-button class="gl-ml-3 js-toggle-button"> + {{ $options.translations.cancelTokenCreation }} + </gl-button> </div> <gl-datepicker v-model="expiresAt" target="#deploy_token_expires_at" container="body" /> </div> diff --git a/app/assets/javascripts/deploy_tokens/components/revoke_button.vue b/app/assets/javascripts/deploy_tokens/components/revoke_button.vue index 7879357a042..52d94e65e72 100644 --- a/app/assets/javascripts/deploy_tokens/components/revoke_button.vue +++ b/app/assets/javascripts/deploy_tokens/components/revoke_button.vue @@ -35,9 +35,9 @@ export default { <div> <gl-button v-gl-modal="modalId" - category="primary" + category="secondary" variant="danger" - class="gl-float-right" + size="small" data-testid="revoke-button" >{{ s__('DeployTokens|Revoke') }}</gl-button > diff --git a/app/assets/javascripts/deploy_tokens/deploy_token_translations.js b/app/assets/javascripts/deploy_tokens/deploy_token_translations.js index 410864a83a2..0d3f92b2347 100644 --- a/app/assets/javascripts/deploy_tokens/deploy_token_translations.js +++ b/app/assets/javascripts/deploy_tokens/deploy_token_translations.js @@ -2,6 +2,7 @@ import { s__ } from '~/locale'; const translations = { addTokenButton: s__('DeployTokens|Create deploy token'), + cancelTokenCreation: s__('DeployTokens|Cancel'), addTokenExpiryLabel: s__('DeployTokens|Expiration date (optional)'), addTokenExpiryDescription: s__( 'DeployTokens|Enter an expiration date for your token. Defaults to never expire.', @@ -23,7 +24,7 @@ const translations = { newTokenDescription: s__( 'DeployTokens|Use this token as a password. Save it. This password can %{i_start}not%{i_end} be recovered.', ), - newTokenMessage: s__('DeployTokens|Your New Deploy Token'), + newTokenMessage: s__('DeployTokens|Your new deploy token'), newTokenUsernameCopy: s__('DeployTokens|Copy username'), newTokenUsernameDescription: s__( 'DeployTokens|This username supports access. %{link_start}What kind of access?%{link_end}', diff --git a/app/assets/javascripts/notes/constants.js b/app/assets/javascripts/notes/constants.js index 419b427682e..999ef8ff905 100644 --- a/app/assets/javascripts/notes/constants.js +++ b/app/assets/javascripts/notes/constants.js @@ -10,6 +10,9 @@ export const COMMENT = 'comment'; export const ISSUE_NOTEABLE_TYPE = 'Issue'; export const EPIC_NOTEABLE_TYPE = 'Epic'; export const MERGE_REQUEST_NOTEABLE_TYPE = 'MergeRequest'; +export const SNIPPET_NOTEABLE_TYPE = 'Snippet'; +export const DESIGN_NOTEABLE_TYPE = 'DesignManagement::Design'; +export const COMMIT_NOTEABLE_TYPE = 'Commit'; export const INCIDENT_NOTEABLE_TYPE = 'INCIDENT'; // TODO: check if value can be converted to `Incident` export const UNRESOLVE_NOTE_METHOD_NAME = 'delete'; export const RESOLVE_NOTE_METHOD_NAME = 'post'; diff --git a/app/assets/javascripts/super_sidebar/components/global_search/command_palette/command_palette_items.vue b/app/assets/javascripts/super_sidebar/components/global_search/command_palette/command_palette_items.vue index a1d0e400b5f..bd79962f1a1 100644 --- a/app/assets/javascripts/super_sidebar/components/global_search/command_palette/command_palette_items.vue +++ b/app/assets/javascripts/super_sidebar/components/global_search/command_palette/command_palette_items.vue @@ -133,6 +133,12 @@ export default { }, immediate: true, }, + handle: { + handler() { + this.debouncedSearch(); + }, + immediate: false, + }, }, updated() { this.$emit('updated'); @@ -180,7 +186,7 @@ export default { } }, async getScopedItems() { - if (this.searchQuery && this.searchQuery.length < 3) return; + if (this.searchQuery?.length < 3) return; this.loading = true; |