diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-04-26 21:09:45 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-04-26 21:09:45 +0300 |
commit | e7e40d45b066139707b3b851c6004e075da5226b (patch) | |
tree | cc99f48e2aaedbe9e8dac53fa4ca8d8f6f270bb4 /app/assets/javascripts/releases | |
parent | aad3ac9e5e59d47e389ff387e9fc2ae3a008de33 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/releases')
3 files changed, 60 insertions, 13 deletions
diff --git a/app/assets/javascripts/releases/queries/one_release_for_editing.query.graphql b/app/assets/javascripts/releases/queries/one_release_for_editing.query.graphql new file mode 100644 index 00000000000..55075c21053 --- /dev/null +++ b/app/assets/javascripts/releases/queries/one_release_for_editing.query.graphql @@ -0,0 +1,9 @@ +#import "./release_for_editing.fragment.graphql" + +query oneReleaseForEditing($fullPath: ID!, $tagName: String!) { + project(fullPath: $fullPath) { + release(tagName: $tagName) { + ...ReleaseForEditing + } + } +} diff --git a/app/assets/javascripts/releases/queries/release_for_editing.fragment.graphql b/app/assets/javascripts/releases/queries/release_for_editing.fragment.graphql new file mode 100644 index 00000000000..47c5afefd78 --- /dev/null +++ b/app/assets/javascripts/releases/queries/release_for_editing.fragment.graphql @@ -0,0 +1,23 @@ +fragment ReleaseForEditing on Release { + name + tagName + description + assets { + links { + nodes { + id + name + url + linkType + } + } + } + links { + selfUrl + } + milestones { + nodes { + title + } + } +} diff --git a/app/assets/javascripts/releases/util.js b/app/assets/javascripts/releases/util.js index 36c17b5b252..44d177bc260 100644 --- a/app/assets/javascripts/releases/util.js +++ b/app/assets/javascripts/releases/util.js @@ -52,24 +52,37 @@ const convertScalarProperties = (graphQLRelease) => 'name', 'tagName', 'tagPath', + 'description', 'descriptionHtml', 'releasedAt', 'upcomingRelease', ]); -const convertAssets = (graphQLRelease) => ({ - assets: { - count: graphQLRelease.assets.count, - sources: [...graphQLRelease.assets.sources.nodes], - links: graphQLRelease.assets.links.nodes.map((l) => ({ +const convertAssets = (graphQLRelease) => { + let sources = []; + if (graphQLRelease.assets.sources?.nodes) { + sources = [...graphQLRelease.assets.sources.nodes]; + } + + let links = []; + if (graphQLRelease.assets.links?.nodes) { + links = graphQLRelease.assets.links.nodes.map((l) => ({ ...l, linkType: l.linkType?.toLowerCase(), - })), - }, -}); + })); + } + + return { + assets: { + count: graphQLRelease.assets.count, + sources, + links, + }, + }; +}; const convertEvidences = (graphQLRelease) => ({ - evidences: graphQLRelease.evidences.nodes.map((e) => e), + evidences: (graphQLRelease.evidences?.nodes ?? []).map((e) => ({ ...e })), }); const convertLinks = (graphQLRelease) => ({ @@ -100,10 +113,12 @@ const convertMilestones = (graphQLRelease) => ({ ...m, webUrl: m.webPath, webPath: undefined, - issueStats: { - total: m.stats.totalIssuesCount, - closed: m.stats.closedIssuesCount, - }, + issueStats: m.stats + ? { + total: m.stats.totalIssuesCount, + closed: m.stats.closedIssuesCount, + } + : {}, stats: undefined, })), }); |