Commit 11f7576a authored by Phil Hughes's avatar Phil Hughes

Merge branch '235856-display-more-columns-in-merge-request-analytics-data-table-fe' into 'master'

Add comment count to MR Analytics Throughput table

See merge request gitlab-org/gitlab!40589
parents 2cbad987 3cbf3460
...@@ -203,15 +203,18 @@ export default { ...@@ -203,15 +203,18 @@ export default {
/> />
</li> </li>
<li <li
v-if="item.labels.nodes.length" class="gl-mr-3 gl-display-flex gl-align-items-center"
class="gl-mr-3" :class="{ 'gl-opacity-5': !item.labels.nodes.length }"
:data-testid="$options.testIds.LABEL_DETAILS" :data-testid="$options.testIds.LABEL_DETAILS"
> >
<span class="gl-display-flex gl-align-items-center" <gl-icon name="label" class="gl-mr-1" /><span>{{ item.labels.nodes.length }}</span>
><gl-icon name="label" class="gl-mr-1" /><span>{{ </li>
item.labels.nodes.length <li
}}</span></span class="gl-mr-3 gl-display-flex gl-align-items-center"
> :class="{ 'gl-opacity-5': !item.userNotesCount }"
:data-testid="$options.testIds.COMMENT_COUNT"
>
<gl-icon name="comments" class="gl-mr-2" /><span>{{ item.userNotesCount }}</span>
</li> </li>
</ul> </ul>
</div> </div>
......
...@@ -41,6 +41,7 @@ export const THROUGHPUT_TABLE_TEST_IDS = { ...@@ -41,6 +41,7 @@ export const THROUGHPUT_TABLE_TEST_IDS = {
LINE_CHANGES: 'lineChangesCol', LINE_CHANGES: 'lineChangesCol',
ASSIGNEES: 'assigneesCol', ASSIGNEES: 'assigneesCol',
COMMITS: 'commitsCol', COMMITS: 'commitsCol',
COMMENT_COUNT: 'commentCount',
}; };
export const PIPELINE_STATUS_ICON_CLASSES = { export const PIPELINE_STATUS_ICON_CLASSES = {
......
...@@ -34,6 +34,7 @@ query($fullPath: ID!, $startDate: Time!, $endDate: Time!, $limit: Int!) { ...@@ -34,6 +34,7 @@ query($fullPath: ID!, $startDate: Time!, $endDate: Time!, $limit: Int!) {
} }
} }
commitCount commitCount
userNotesCount
} }
} }
} }
......
...@@ -140,16 +140,33 @@ describe('ThroughputTable', () => { ...@@ -140,16 +140,33 @@ describe('ThroughputTable', () => {
it('includes the correct title and IID', () => { it('includes the correct title and IID', () => {
const { title, iid } = throughputTableData[0]; const { title, iid } = throughputTableData[0];
expect(findCol(TEST_IDS.MERGE_REQUEST_DETAILS).text()).toBe(`${title} !${iid}`); expect(findCol(TEST_IDS.MERGE_REQUEST_DETAILS).text()).toContain(`${title} !${iid}`);
}); });
it('does not include any icons by default', () => { it('includes an inactive label icon by default', () => {
const icon = findColSubComponent(TEST_IDS.MERGE_REQUEST_DETAILS, GlIcon); const labels = findColSubItem(TEST_IDS.MERGE_REQUEST_DETAILS, TEST_IDS.LABEL_DETAILS);
const icon = labels.find(GlIcon);
expect(labels.text()).toBe('0');
expect(labels.classes()).toContain('gl-opacity-5');
expect(icon.exists()).toBe(true);
expect(icon.props('name')).toBe('label');
});
expect(icon.exists()).toBe(false); it('includes an inactive comment icon by default', () => {
const commentCount = findColSubItem(
TEST_IDS.MERGE_REQUEST_DETAILS,
TEST_IDS.COMMENT_COUNT,
);
const icon = commentCount.find(GlIcon);
expect(commentCount.text()).toBe('0');
expect(commentCount.classes()).toContain('gl-opacity-5');
expect(icon.exists()).toBe(true);
expect(icon.props('name')).toBe('comments');
}); });
it('includes a label icon and count when available', async () => { it('includes an active label icon and count when available', async () => {
additionalData({ additionalData({
labels: { labels: {
nodes: [{ title: 'Brinix' }], nodes: [{ title: 'Brinix' }],
...@@ -165,10 +182,30 @@ describe('ThroughputTable', () => { ...@@ -165,10 +182,30 @@ describe('ThroughputTable', () => {
const icon = labelDetails.find(GlIcon); const icon = labelDetails.find(GlIcon);
expect(labelDetails.text()).toBe('1'); expect(labelDetails.text()).toBe('1');
expect(labelDetails.classes()).not.toContain('gl-opacity-5');
expect(icon.exists()).toBe(true); expect(icon.exists()).toBe(true);
expect(icon.props('name')).toBe('label'); expect(icon.props('name')).toBe('label');
}); });
it('includes an active comment icon and count when available', async () => {
additionalData({
userNotesCount: 2,
});
await wrapper.vm.$nextTick();
const commentCount = findColSubItem(
TEST_IDS.MERGE_REQUEST_DETAILS,
TEST_IDS.COMMENT_COUNT,
);
const icon = commentCount.find(GlIcon);
expect(commentCount.text()).toBe('2');
expect(commentCount.classes()).not.toContain('gl-opacity-5');
expect(icon.exists()).toBe(true);
expect(icon.props('name')).toBe('comments');
});
it('includes a pipeline icon and when available', async () => { it('includes a pipeline icon and when available', async () => {
const iconName = 'status_canceled'; const iconName = 'status_canceled';
......
...@@ -83,5 +83,6 @@ export const throughputTableData = [ ...@@ -83,5 +83,6 @@ export const throughputTableData = [
nodes: [], nodes: [],
}, },
commitCount: 1, commitCount: 1,
userNotesCount: 0,
}, },
]; ];
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