summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Friend <nathan@gitlab.com>2019-08-29 14:09:21 -0300
committerNathan Friend <nathan@gitlab.com>2019-09-04 14:30:09 -0300
commit2ec833a993465c6ca7522f2e05d60aa5b29ca500 (patch)
tree9a1519b217d4d68cd9d6fddfeacc3c43583c5cd3
parentbddaee749a51a83161ab3ff96bf7d17f1537fdcf (diff)
downloadgitlab-ce-ce-nfriend-add-milestones-to-release-blocks.tar.gz
Update release blocks to support association of milestones (CE)ce-nfriend-add-milestones-to-release-blocks
This commit updates the release blocks that appear on the releases page to show the list of milestones associated with the release (if any). Note this association will only ever occur in EE.
-rw-r--r--app/assets/javascripts/releases/components/release_block.vue17
-rw-r--r--spec/javascripts/releases/components/release_block_spec.js70
-rw-r--r--spec/javascripts/releases/mock_data.js22
3 files changed, 28 insertions, 81 deletions
diff --git a/app/assets/javascripts/releases/components/release_block.vue b/app/assets/javascripts/releases/components/release_block.vue
index 88b6b4732b1..1461fee6e48 100644
--- a/app/assets/javascripts/releases/components/release_block.vue
+++ b/app/assets/javascripts/releases/components/release_block.vue
@@ -14,6 +14,7 @@ export default {
GlBadge,
Icon,
UserAvatarLink,
+ MilestoneList: () => import('ee_component/releases/components/milestone_list.vue'),
},
directives: {
GlTooltip: GlTooltipDirective,
@@ -49,6 +50,16 @@ export default {
hasAuthor() {
return !_.isEmpty(this.author);
},
+ shouldRenderMilestones() {
+ return Boolean(this.release.milestone);
+ },
+ milestones() {
+ // At the moment, a release can only be associated to
+ // one milestone. This will be expanded to be many-to-many
+ // in the near future, so we pass the milestone as an
+ // array here in anticipation of this change.
+ return [this.release.milestone];
+ },
},
};
</script>
@@ -73,6 +84,12 @@ export default {
<span v-gl-tooltip.bottom :title="__('Tag')">{{ release.tag_name }}</span>
</div>
+ <milestone-list
+ v-if="shouldRenderMilestones"
+ class="append-right-4 js-milestone-list"
+ :milestones="milestones"
+ />
+
<div class="append-right-4">
&bull;
<span v-gl-tooltip.bottom :title="tooltipTitle(release.released_at)">
diff --git a/spec/javascripts/releases/components/release_block_spec.js b/spec/javascripts/releases/components/release_block_spec.js
index fdf23f3f69d..ef0b5340e1f 100644
--- a/spec/javascripts/releases/components/release_block_spec.js
+++ b/spec/javascripts/releases/components/release_block_spec.js
@@ -1,81 +1,13 @@
import Vue from 'vue';
import component from '~/releases/components/release_block.vue';
import timeagoMixin from '~/vue_shared/mixins/timeago';
+import { release } from '../mock_data';
import mountComponent from '../../helpers/vue_mount_component_helper';
describe('Release block', () => {
const Component = Vue.extend(component);
- const release = {
- name: 'Bionic Beaver',
- tag_name: '18.04',
- description: '## changelog\n\n* line 1\n* line2',
- description_html: '<div><h2>changelog</h2><ul><li>line1</li<li>line 2</li></ul></div>',
- author_name: 'Release bot',
- author_email: 'release-bot@example.com',
- released_at: '2012-05-28T05:00:00-07:00',
- author: {
- avatar_url: 'uploads/-/system/user/avatar/johndoe/avatar.png',
- id: 482476,
- name: 'John Doe',
- path: '/johndoe',
- state: 'active',
- status_tooltip_html: null,
- username: 'johndoe',
- web_url: 'https://gitlab.com/johndoe',
- },
- commit: {
- id: '2695effb5807a22ff3d138d593fd856244e155e7',
- short_id: '2695effb',
- title: 'Initial commit',
- created_at: '2017-07-26T11:08:53.000+02:00',
- parent_ids: ['2a4b78934375d7f53875269ffd4f45fd83a84ebe'],
- message: 'Initial commit',
- author_name: 'John Smith',
- author_email: 'john@example.com',
- authored_date: '2012-05-28T04:42:42-07:00',
- committer_name: 'Jack Smith',
- committer_email: 'jack@example.com',
- committed_date: '2012-05-28T04:42:42-07:00',
- },
- assets: {
- count: 6,
- sources: [
- {
- format: 'zip',
- url: 'https://gitlab.com/gitlab-org/gitlab-ce/-/archive/v11.3.12/gitlab-ce-v11.3.12.zip',
- },
- {
- format: 'tar.gz',
- url:
- 'https://gitlab.com/gitlab-org/gitlab-ce/-/archive/v11.3.12/gitlab-ce-v11.3.12.tar.gz',
- },
- {
- format: 'tar.bz2',
- url:
- 'https://gitlab.com/gitlab-org/gitlab-ce/-/archive/v11.3.12/gitlab-ce-v11.3.12.tar.bz2',
- },
- {
- format: 'tar',
- url: 'https://gitlab.com/gitlab-org/gitlab-ce/-/archive/v11.3.12/gitlab-ce-v11.3.12.tar',
- },
- ],
- links: [
- {
- name: 'release-18.04.dmg',
- url: 'https://my-external-hosting.example.com/scrambled-url/',
- external: true,
- },
- {
- name: 'binary-linux-amd64',
- url:
- 'https://gitlab.com/gitlab-org/gitlab-ce/-/jobs/artifacts/v11.6.0-rc4/download?job=rspec-mysql+41%2F50',
- external: false,
- },
- ],
- },
- };
let vm;
const factory = props => mountComponent(Component, { release: props });
diff --git a/spec/javascripts/releases/mock_data.js b/spec/javascripts/releases/mock_data.js
index 2855eca1711..85b3d3dfa15 100644
--- a/spec/javascripts/releases/mock_data.js
+++ b/spec/javascripts/releases/mock_data.js
@@ -3,9 +3,17 @@ export const release = {
tag_name: '18.04',
description: '## changelog\n\n* line 1\n* line2',
description_html: '<div><h2>changelog</h2><ul><li>line1</li<li>line 2</li></ul></div>',
- author_name: 'Release bot',
- author_email: 'release-bot@example.com',
created_at: '2012-05-28T05:00:00-07:00',
+ author: {
+ avatar_url: 'uploads/-/system/user/avatar/johndoe/avatar.png',
+ id: 482476,
+ name: 'John Doe',
+ path: '/johndoe',
+ state: 'active',
+ status_tooltip_html: null,
+ username: 'johndoe',
+ web_url: 'https://gitlab.com/johndoe',
+ },
commit: {
id: '2695effb5807a22ff3d138d593fd856244e155e7',
short_id: '2695effb',
@@ -13,16 +21,6 @@ export const release = {
created_at: '2017-07-26T11:08:53.000+02:00',
parent_ids: ['2a4b78934375d7f53875269ffd4f45fd83a84ebe'],
message: 'Initial commit',
- author: {
- avatar_url: 'uploads/-/system/user/avatar/johndoe/avatar.png',
- id: 482476,
- name: 'John Doe',
- path: '/johndoe',
- state: 'active',
- status_tooltip_html: null,
- username: 'johndoe',
- web_url: 'https://gitlab.com/johndoe',
- },
authored_date: '2012-05-28T04:42:42-07:00',
committer_name: 'Jack Smith',
committer_email: 'jack@example.com',