Commit e65c0770 authored by Nathan Friend's avatar Nathan Friend

Begin using new release progress links

And also rename all references to open* to opened* to align with the
field names in the GraphQL endpoint.
parent 7f2e4e22
...@@ -26,7 +26,7 @@ export default { ...@@ -26,7 +26,7 @@ export default {
required: false, required: false,
default: null, default: null,
}, },
openPath: { openedPath: {
type: String, type: String,
required: false, required: false,
default: '', default: '',
...@@ -43,7 +43,7 @@ export default { ...@@ -43,7 +43,7 @@ export default {
}, },
}, },
computed: { computed: {
open() { opened() {
return this.total - (this.closed + (this.merged || 0)); return this.total - (this.closed + (this.merged || 0));
}, },
showMerged() { showMerged() {
...@@ -63,8 +63,8 @@ export default { ...@@ -63,8 +63,8 @@ export default {
<span class="gl-white-space-pre-wrap" data-testid="open-stat"> <span class="gl-white-space-pre-wrap" data-testid="open-stat">
<gl-sprintf :message="__('Open: %{open}')"> <gl-sprintf :message="__('Open: %{open}')">
<template #open> <template #open>
<gl-link v-if="openPath" :href="openPath">{{ open }}</gl-link> <gl-link v-if="openedPath" :href="openedPath">{{ opened }}</gl-link>
<template v-else>{{ open }}</template> <template v-else>{{ opened }}</template>
</template> </template>
</gl-sprintf> </gl-sprintf>
</span> </span>
......
...@@ -87,9 +87,14 @@ export default { ...@@ -87,9 +87,14 @@ export default {
<release-block-header :release="release" /> <release-block-header :release="release" />
<div class="card-body"> <div class="card-body">
<div v-if="shouldRenderMilestoneInfo"> <div v-if="shouldRenderMilestoneInfo">
<!-- TODO: Switch open* links to opened* once fields have been updated in GraphQL -->
<release-block-milestone-info <release-block-milestone-info
:milestones="milestones" :milestones="milestones"
:open-issues-path="release._links.issuesUrl" :opened-issues-path="release._links.openedIssuesUrl"
:closed-issues-path="release._links.closedIssuesUrl"
:opened-merge-requests-path="release._links.openedMergeRequestsUrl"
:merged-merge-requests-path="release._links.mergedMergeRequestsUrl"
:closed-merge-requests-path="release._links.closedMergeRequestsUrl"
/> />
<hr class="mb-3 mt-0" /> <hr class="mb-3 mt-0" />
</div> </div>
......
...@@ -20,7 +20,7 @@ export default { ...@@ -20,7 +20,7 @@ export default {
type: Array, type: Array,
required: true, required: true,
}, },
openIssuesPath: { openedIssuesPath: {
type: String, type: String,
required: false, required: false,
default: '', default: '',
...@@ -30,7 +30,7 @@ export default { ...@@ -30,7 +30,7 @@ export default {
required: false, required: false,
default: '', default: '',
}, },
openMergeRequestsPath: { openedMergeRequestsPath: {
type: String, type: String,
required: false, required: false,
default: '', default: '',
...@@ -173,7 +173,7 @@ export default { ...@@ -173,7 +173,7 @@ export default {
:label="__('Issues')" :label="__('Issues')"
:total="issueCounts.total" :total="issueCounts.total"
:closed="issueCounts.closed" :closed="issueCounts.closed"
:open-path="openIssuesPath" :opened-path="openedIssuesPath"
:closed-path="closedIssuesPath" :closed-path="closedIssuesPath"
data-testid="issue-stats" data-testid="issue-stats"
/> />
...@@ -183,7 +183,7 @@ export default { ...@@ -183,7 +183,7 @@ export default {
:total="mergeRequestCounts.total" :total="mergeRequestCounts.total"
:merged="mergeRequestCounts.merged" :merged="mergeRequestCounts.merged"
:closed="mergeRequestCounts.closed" :closed="mergeRequestCounts.closed"
:open-path="openMergeRequestsPath" :opened-path="openedMergeRequestsPath"
:merged-path="mergedMergeRequestsPath" :merged-path="mergedMergeRequestsPath"
:closed-path="closedMergeRequestsPath" :closed-path="closedMergeRequestsPath"
data-testid="merge-request-stats" data-testid="merge-request-stats"
......
...@@ -33,9 +33,12 @@ fragment Release on Release { ...@@ -33,9 +33,12 @@ fragment Release on Release {
} }
links { links {
editUrl editUrl
issuesUrl
mergeRequestsUrl
selfUrl selfUrl
openedIssuesUrl
closedIssuesUrl
openedMergeRequestsUrl
mergedMergeRequestsUrl
closedMergeRequestsUrl
} }
commit { commit {
sha sha
......
...@@ -5,9 +5,12 @@ Object { ...@@ -5,9 +5,12 @@ Object {
"data": Array [ "data": Array [
Object { Object {
"_links": Object { "_links": Object {
"closedIssuesUrl": "http://localhost/releases-namespace/releases-project/-/issues?release_tag=v1.1&scope=all&state=closed",
"closedMergeRequestsUrl": "http://localhost/releases-namespace/releases-project/-/merge_requests?release_tag=v1.1&scope=all&state=closed",
"editUrl": "http://localhost/releases-namespace/releases-project/-/releases/v1.1/edit", "editUrl": "http://localhost/releases-namespace/releases-project/-/releases/v1.1/edit",
"issuesUrl": "http://localhost/releases-namespace/releases-project/-/issues?release_tag=v1.1&scope=all&state=opened", "mergedMergeRequestsUrl": "http://localhost/releases-namespace/releases-project/-/merge_requests?release_tag=v1.1&scope=all&state=merged",
"mergeRequestsUrl": "http://localhost/releases-namespace/releases-project/-/merge_requests?release_tag=v1.1&scope=all&state=opened", "openedIssuesUrl": "http://localhost/releases-namespace/releases-project/-/issues?release_tag=v1.1&scope=all&state=opened",
"openedMergeRequestsUrl": "http://localhost/releases-namespace/releases-project/-/merge_requests?release_tag=v1.1&scope=all&state=opened",
"self": "http://localhost/releases-namespace/releases-project/-/releases/v1.1", "self": "http://localhost/releases-namespace/releases-project/-/releases/v1.1",
"selfUrl": "http://localhost/releases-namespace/releases-project/-/releases/v1.1", "selfUrl": "http://localhost/releases-namespace/releases-project/-/releases/v1.1",
}, },
...@@ -130,9 +133,12 @@ exports[`releases/util.js convertOneReleaseGraphQLResponse matches snapshot 1`] ...@@ -130,9 +133,12 @@ exports[`releases/util.js convertOneReleaseGraphQLResponse matches snapshot 1`]
Object { Object {
"data": Object { "data": Object {
"_links": Object { "_links": Object {
"closedIssuesUrl": "http://localhost/releases-namespace/releases-project/-/issues?release_tag=v1.1&scope=all&state=closed",
"closedMergeRequestsUrl": "http://localhost/releases-namespace/releases-project/-/merge_requests?release_tag=v1.1&scope=all&state=closed",
"editUrl": "http://localhost/releases-namespace/releases-project/-/releases/v1.1/edit", "editUrl": "http://localhost/releases-namespace/releases-project/-/releases/v1.1/edit",
"issuesUrl": "http://localhost/releases-namespace/releases-project/-/issues?release_tag=v1.1&scope=all&state=opened", "mergedMergeRequestsUrl": "http://localhost/releases-namespace/releases-project/-/merge_requests?release_tag=v1.1&scope=all&state=merged",
"mergeRequestsUrl": "http://localhost/releases-namespace/releases-project/-/merge_requests?release_tag=v1.1&scope=all&state=opened", "openedIssuesUrl": "http://localhost/releases-namespace/releases-project/-/issues?release_tag=v1.1&scope=all&state=opened",
"openedMergeRequestsUrl": "http://localhost/releases-namespace/releases-project/-/merge_requests?release_tag=v1.1&scope=all&state=opened",
"self": "http://localhost/releases-namespace/releases-project/-/releases/v1.1", "self": "http://localhost/releases-namespace/releases-project/-/releases/v1.1",
"selfUrl": "http://localhost/releases-namespace/releases-project/-/releases/v1.1", "selfUrl": "http://localhost/releases-namespace/releases-project/-/releases/v1.1",
}, },
......
...@@ -4,6 +4,6 @@ exports[`~/releases/components/issuable_stats.vue matches snapshot 1`] = ` ...@@ -4,6 +4,6 @@ exports[`~/releases/components/issuable_stats.vue matches snapshot 1`] = `
"<div class=\\"gl-display-flex gl-flex-direction-column gl-flex-shrink-0 gl-mr-6 gl-mb-5\\"><span class=\\"gl-mb-2\\"> "<div class=\\"gl-display-flex gl-flex-direction-column gl-flex-shrink-0 gl-mr-6 gl-mb-5\\"><span class=\\"gl-mb-2\\">
Items Items
<span class=\\"badge badge-muted badge-pill gl-badge sm\\"><!----> 10</span></span> <span class=\\"badge badge-muted badge-pill gl-badge sm\\"><!----> 10</span></span>
<div class=\\"gl-display-flex\\"><span data-testid=\\"open-stat\\" class=\\"gl-white-space-pre-wrap\\">Open: <a href=\\"path/to/open/items\\" class=\\"gl-link\\">1</a></span> <span class=\\"gl-mx-2\\">•</span> <span data-testid=\\"merged-stat\\" class=\\"gl-white-space-pre-wrap\\">Merged: <a href=\\"path/to/merged/items\\" class=\\"gl-link\\">7</a></span> <span class=\\"gl-mx-2\\">•</span> <span data-testid=\\"closed-stat\\" class=\\"gl-white-space-pre-wrap\\">Closed: <a href=\\"path/to/closed/items\\" class=\\"gl-link\\">2</a></span></div> <div class=\\"gl-display-flex\\"><span data-testid=\\"open-stat\\" class=\\"gl-white-space-pre-wrap\\">Open: <a href=\\"path/to/opened/items\\" class=\\"gl-link\\">1</a></span> <span class=\\"gl-mx-2\\">•</span> <span data-testid=\\"merged-stat\\" class=\\"gl-white-space-pre-wrap\\">Merged: <a href=\\"path/to/merged/items\\" class=\\"gl-link\\">7</a></span> <span class=\\"gl-mx-2\\">•</span> <span data-testid=\\"closed-stat\\" class=\\"gl-white-space-pre-wrap\\">Closed: <a href=\\"path/to/closed/items\\" class=\\"gl-link\\">2</a></span></div>
</div>" </div>"
`; `;
...@@ -26,7 +26,7 @@ describe('~/releases/components/issuable_stats.vue', () => { ...@@ -26,7 +26,7 @@ describe('~/releases/components/issuable_stats.vue', () => {
total: 10, total: 10,
closed: 2, closed: 2,
merged: 7, merged: 7,
openPath: 'path/to/open/items', openedPath: 'path/to/opened/items',
closedPath: 'path/to/closed/items', closedPath: 'path/to/closed/items',
mergedPath: 'path/to/merged/items', mergedPath: 'path/to/merged/items',
}; };
...@@ -72,7 +72,7 @@ describe('~/releases/components/issuable_stats.vue', () => { ...@@ -72,7 +72,7 @@ describe('~/releases/components/issuable_stats.vue', () => {
const link = findOpenStatLink(); const link = findOpenStatLink();
expect(link.exists()).toBe(true); expect(link.exists()).toBe(true);
expect(link.attributes('href')).toBe(defaultProps.openPath); expect(link.attributes('href')).toBe(defaultProps.openedPath);
}); });
it('renders the "merged" stat as a link', () => { it('renders the "merged" stat as a link', () => {
...@@ -93,7 +93,7 @@ describe('~/releases/components/issuable_stats.vue', () => { ...@@ -93,7 +93,7 @@ describe('~/releases/components/issuable_stats.vue', () => {
describe('when path parameters are not provided', () => { describe('when path parameters are not provided', () => {
beforeEach(() => { beforeEach(() => {
createComponent({ createComponent({
openPath: undefined, openedPath: undefined,
closedPath: undefined, closedPath: undefined,
mergedPath: undefined, mergedPath: undefined,
}); });
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment