diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-19 12:08:42 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-19 12:08:42 +0300 |
commit | b76ae638462ab0f673e5915986070518dd3f9ad3 (patch) | |
tree | bdab0533383b52873be0ec0eb4d3c66598ff8b91 /app/assets/javascripts/graphql_shared | |
parent | 434373eabe7b4be9593d18a585fb763f1e5f1a6f (diff) |
Add latest changes from gitlab-org/gitlab@14-2-stable-eev14.2.0-rc42
Diffstat (limited to 'app/assets/javascripts/graphql_shared')
6 files changed, 73 insertions, 0 deletions
diff --git a/app/assets/javascripts/graphql_shared/constants.js b/app/assets/javascripts/graphql_shared/constants.js index aad7712a9f0..312dd0c88dd 100644 --- a/app/assets/javascripts/graphql_shared/constants.js +++ b/app/assets/javascripts/graphql_shared/constants.js @@ -1,10 +1,12 @@ export const TYPE_CI_RUNNER = 'Ci::Runner'; +export const TYPE_EPIC = 'Epic'; export const TYPE_GROUP = 'Group'; export const TYPE_ISSUE = 'Issue'; export const TYPE_ITERATION = 'Iteration'; export const TYPE_ITERATIONS_CADENCE = 'Iterations::Cadence'; export const TYPE_MERGE_REQUEST = 'MergeRequest'; export const TYPE_MILESTONE = 'Milestone'; +export const TYPE_PROJECT = 'Project'; export const TYPE_SCANNER_PROFILE = 'DastScannerProfile'; export const TYPE_SITE_PROFILE = 'DastSiteProfile'; export const TYPE_USER = 'User'; diff --git a/app/assets/javascripts/graphql_shared/fragments/issuable_timelogs.fragment.graphql b/app/assets/javascripts/graphql_shared/fragments/issuable_timelogs.fragment.graphql index 6ed3be84cd8..3551394ff97 100644 --- a/app/assets/javascripts/graphql_shared/fragments/issuable_timelogs.fragment.graphql +++ b/app/assets/javascripts/graphql_shared/fragments/issuable_timelogs.fragment.graphql @@ -7,4 +7,5 @@ fragment TimelogFragment on Timelog { note { body } + summary } diff --git a/app/assets/javascripts/graphql_shared/mutations/create_merge_request.mutation.graphql b/app/assets/javascripts/graphql_shared/mutations/create_merge_request.mutation.graphql new file mode 100644 index 00000000000..79c56448b3f --- /dev/null +++ b/app/assets/javascripts/graphql_shared/mutations/create_merge_request.mutation.graphql @@ -0,0 +1,8 @@ +mutation createMergeRequest($input: MergeRequestCreateInput!) { + mergeRequestCreate(input: $input) { + mergeRequest { + iid + } + errors + } +} diff --git a/app/assets/javascripts/graphql_shared/queries/get_users_projects.query.graphql b/app/assets/javascripts/graphql_shared/queries/get_users_projects.query.graphql new file mode 100644 index 00000000000..58b7b4c898d --- /dev/null +++ b/app/assets/javascripts/graphql_shared/queries/get_users_projects.query.graphql @@ -0,0 +1,28 @@ +#import "~/graphql_shared/fragments/pageInfo.fragment.graphql" + +query getProjects( + $search: String! + $after: String = "" + $first: Int! + $searchNamespaces: Boolean = false + $sort: String + $membership: Boolean = true +) { + projects( + search: $search + after: $after + first: $first + membership: $membership + searchNamespaces: $searchNamespaces + sort: $sort + ) { + nodes { + id + name + nameWithNamespace + } + pageInfo { + ...PageInfo + } + } +} diff --git a/app/assets/javascripts/graphql_shared/queries/group_users_search.query.graphql b/app/assets/javascripts/graphql_shared/queries/group_users_search.query.graphql new file mode 100644 index 00000000000..e345fe97281 --- /dev/null +++ b/app/assets/javascripts/graphql_shared/queries/group_users_search.query.graphql @@ -0,0 +1,15 @@ +#import "../fragments/user.fragment.graphql" +#import "~/graphql_shared/fragments/user_availability.fragment.graphql" + +query usersSearch($search: String!, $fullPath: ID!) { + workspace: group(fullPath: $fullPath) { + users: groupMembers(search: $search, relations: [DIRECT, INHERITED]) { + nodes { + user { + ...User + ...UserAvailability + } + } + } + } +} diff --git a/app/assets/javascripts/graphql_shared/utils.js b/app/assets/javascripts/graphql_shared/utils.js index 18f9a50bbce..828ddd95ffc 100644 --- a/app/assets/javascripts/graphql_shared/utils.js +++ b/app/assets/javascripts/graphql_shared/utils.js @@ -2,6 +2,21 @@ import { isArray } from 'lodash'; /** * Ids generated by GraphQL endpoints are usually in the format + * gid://gitlab/Environments/123. This method checks if the passed id follows that format + * + * @param {String|Number} id The id value + * @returns {Boolean} + */ +export const isGid = (id) => { + if (typeof id === 'string' && id.startsWith('gid://gitlab/')) { + return true; + } + + return false; +}; + +/** + * Ids generated by GraphQL endpoints are usually in the format * gid://gitlab/Environments/123. This method extracts Id number * from the Id path * @@ -35,6 +50,10 @@ export const convertToGraphQLId = (type, id) => { throw new TypeError(`id must be a number or string; got ${typeof id}`); } + if (isGid(id)) { + return id; + } + return `gid://gitlab/${type}/${id}`; }; |