diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-12-22 12:17:04 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-12-22 12:17:04 +0300 |
commit | 6b0293c14dce817f72310127dd38562313321b1b (patch) | |
tree | cb2254757b496664957a2b5d90c21d7d76e4bdeb /app/assets | |
parent | 968a9dd39b77628b541e0788488bad2493fefbee (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets')
3 files changed, 60 insertions, 53 deletions
diff --git a/app/assets/javascripts/commit/components/signature_badge.vue b/app/assets/javascripts/commit/components/signature_badge.vue index edc7c9d2f96..dc6d2df22b7 100644 --- a/app/assets/javascripts/commit/components/signature_badge.vue +++ b/app/assets/javascripts/commit/components/signature_badge.vue @@ -1,7 +1,7 @@ <script> import { GlBadge, GlLink, GlPopover } from '@gitlab/ui'; import { helpPagePath } from '~/helpers/help_page_helper'; -import { typeConfig, statusConfig } from '../constants'; +import { typeConfig, statusConfig } from 'ee_else_ce/commit/constants'; import X509CertificateDetails from './x509_certificate_details.vue'; export default { diff --git a/app/assets/javascripts/commit/constants.js b/app/assets/javascripts/commit/constants.js index e28009ab996..9eba316b371 100644 --- a/app/assets/javascripts/commit/constants.js +++ b/app/assets/javascripts/commit/constants.js @@ -11,6 +11,7 @@ export const verificationStatuses = { SAME_USER_DIFFERENT_EMAIL: 'SAME_USER_DIFFERENT_EMAIL', MULTIPLE_SIGNATURES: 'MULTIPLE_SIGNATURES', REVOKED_KEY: 'REVOKED_KEY', + VERIFIED_SYSTEM: 'VERIFIED_SYSTEM', }; export const signatureTypes = { @@ -28,15 +29,25 @@ const UNVERIFIED_CONFIG = { description: __('This commit was signed with an unverified signature.'), }; +export const VERIFIED_CONFIG = { + variant: 'success', + label: __('Verified'), + title: __('Verified commit'), +}; + export const statusConfig = { [verificationStatuses.VERIFIED]: { - variant: 'success', - label: __('Verified'), - title: __('Verified commit'), + ...VERIFIED_CONFIG, description: __( 'This commit was signed with a verified signature and the committer email was verified to belong to the same user.', ), }, + [verificationStatuses.VERIFIED_SYSTEM]: { + ...VERIFIED_CONFIG, + description: __( + 'This commit was created in the GitLab UI, and signed with a GitLab-verified signature.', + ), + }, [verificationStatuses.UNVERIFIED]: { ...UNVERIFIED_CONFIG, }, diff --git a/app/assets/javascripts/work_items/components/shared/work_item_token_input.vue b/app/assets/javascripts/work_items/components/shared/work_item_token_input.vue index f7f9ca4315a..719507d1341 100644 --- a/app/assets/javascripts/work_items/components/shared/work_item_token_input.vue +++ b/app/assets/javascripts/work_items/components/shared/work_item_token_input.vue @@ -59,19 +59,15 @@ export default { }, }, apollo: { - availableWorkItems: { + workspaceWorkItems: { query() { return this.isGroup ? groupWorkItemsQuery : projectWorkItemsQuery; }, variables() { - return { - fullPath: this.fullPath, - searchTerm: '', - types: this.childrenType ? [this.childrenType] : [], - }; + return this.queryVariables; }, skip() { - return !this.searchStarted; + return !this.searchStarted || this.isSearchingByReference; }, update(data) { return [ @@ -83,11 +79,29 @@ export default { this.error = sprintfWorkItem(I18N_WORK_ITEM_SEARCH_ERROR, this.childrenTypeName); }, }, + workItemsByReference: { + query: workItemsByReferencesQuery, + variables() { + return { + contextNamespacePath: this.fullPath, + refs: [this.searchTerm], + }; + }, + skip() { + return !this.isSearchingByReference; + }, + update(data) { + return data.workItemsByReference.nodes; + }, + error() { + this.error = sprintfWorkItem(I18N_WORK_ITEM_SEARCH_ERROR, this.childrenTypeName); + }, + }, }, data() { return { - availableWorkItems: [], - query: '', + workspaceWorkItems: [], + searchTerm: '', searchStarted: false, error: '', textInputAttrs: { @@ -96,6 +110,12 @@ export default { }; }, computed: { + availableWorkItems() { + return this.isSearchingByReference ? this.workItemsByReference : this.workspaceWorkItems; + }, + isSearchingByReference() { + return isReference(this.searchTerm) || isSafeURL(this.searchTerm); + }, workItemsToAdd: { get() { return this.value; @@ -105,7 +125,10 @@ export default { }, }, isLoading() { - return this.$apollo.queries.availableWorkItems.loading; + return ( + this.$apollo.queries.workspaceWorkItems.loading || + this.$apollo.queries.workItemsByReference.loading + ); }, childrenTypeName() { return WORK_ITEMS_TYPE_MAP[this.childrenType]?.name; @@ -113,6 +136,17 @@ export default { tokenSelectorContainerClass() { return !this.areWorkItemsToAddValid ? 'gl-inset-border-1-red-500!' : ''; }, + queryVariables() { + return { + fullPath: this.fullPath, + searchTerm: this.searchTerm, + types: this.childrenType ? [this.childrenType] : [], + in: this.searchTerm ? 'TITLE' : undefined, + iid: isNumeric(this.searchTerm) ? this.searchTerm : null, + searchByIid: isNumeric(this.searchTerm), + searchByText: true, + }; + }, }, created() { this.debouncedSearchKeyUpdate = debounce(this.setSearchKey, DEFAULT_DEBOUNCE_AND_THROTTLE_MS); @@ -121,44 +155,6 @@ export default { getIdFromGraphQLId, async setSearchKey(value) { this.searchTerm = value; - - // Check if it is a URL or reference - if (isReference(value) || isSafeURL(value)) { - const { - data: { - workItemsByReference: { nodes }, - }, - } = await this.$apollo.query({ - query: workItemsByReferencesQuery, - variables: { - contextNamespacePath: this.fullPath, - refs: [value], - }, - }); - - this.availableWorkItems = nodes; - } else { - // Query parameters for searching by text - let variables = { - searchTerm: this.searchTerm, - in: this.searchTerm ? 'TITLE' : undefined, - iid: null, - searchByIid: false, - searchByText: true, - }; - - // Check if it is a number, add iid as query parameter - if (this.searchTerm && isNumeric(this.searchTerm)) { - variables = { - ...variables, - iid: this.searchTerm, - searchByIid: true, - }; - } - - // Fetch combined results of search by iid and search by title. - this.$apollo.queries.availableWorkItems.refetch(variables); - } }, handleFocus() { this.searchStarted = true; @@ -178,7 +174,7 @@ export default { focusInputText() { this.$nextTick(() => { if (this.areWorkItemsToAddValid) { - this.$refs.tokenSelector.$el.querySelector('input[type="text"]').focus(); + this.$refs.tokenSelector.focusTextInput(); } }); }, |