Commit a338088b authored by Brandon Labuschagne's avatar Brandon Labuschagne

Merge branch '322755-fix-small-issues' into 'master'

Fix and improve minor issues in issues page refactor

See merge request gitlab-org/gitlab!68065
parents fc8a3fb3 2571c022
...@@ -205,7 +205,7 @@ export default { ...@@ -205,7 +205,7 @@ export default {
>{{ issuableSymbol }}{{ issuable.iid }}</span >{{ issuableSymbol }}{{ issuable.iid }}</span
> >
<span class="issuable-authored gl-display-none gl-sm-display-inline-block! gl-mr-3"> <span class="issuable-authored gl-display-none gl-sm-display-inline-block! gl-mr-3">
&middot; <span aria-hidden="true">&middot;</span>
<span <span
v-gl-tooltip:tooltipcontainer.bottom v-gl-tooltip:tooltipcontainer.bottom
data-testid="issuable-created-at" data-testid="issuable-created-at"
...@@ -229,17 +229,19 @@ export default { ...@@ -229,17 +229,19 @@ export default {
</span> </span>
<slot name="timeframe"></slot> <slot name="timeframe"></slot>
&nbsp; &nbsp;
<gl-label <span v-if="labels.length" role="group" :aria-label="__('Labels')">
v-for="(label, index) in labels" <gl-label
:key="index" v-for="(label, index) in labels"
:background-color="label.color" :key="index"
:title="labelTitle(label)" :background-color="label.color"
:description="label.description" :title="labelTitle(label)"
:scoped="scopedLabel(label)" :description="label.description"
:target="labelTarget(label)" :scoped="scopedLabel(label)"
:class="{ 'gl-ml-2': index }" :target="labelTarget(label)"
size="sm" :class="{ 'gl-ml-2': index }"
/> size="sm"
/>
</span>
</div> </div>
</div> </div>
<div class="issuable-meta"> <div class="issuable-meta">
......
...@@ -9,6 +9,7 @@ import { ...@@ -9,6 +9,7 @@ import {
GlTooltipDirective, GlTooltipDirective,
} from '@gitlab/ui'; } from '@gitlab/ui';
import fuzzaldrinPlus from 'fuzzaldrin-plus'; import fuzzaldrinPlus from 'fuzzaldrin-plus';
import { cloneDeep } from 'lodash';
import getIssuesQuery from 'ee_else_ce/issues_list/queries/get_issues.query.graphql'; import getIssuesQuery from 'ee_else_ce/issues_list/queries/get_issues.query.graphql';
import createFlash from '~/flash'; import createFlash from '~/flash';
import { TYPE_USER } from '~/graphql_shared/constants'; import { TYPE_USER } from '~/graphql_shared/constants';
...@@ -163,14 +164,17 @@ export default { ...@@ -163,14 +164,17 @@ export default {
}, },
}, },
data() { data() {
const filterTokens = getFilterTokens(window.location.search);
const state = getParameterByName(PARAM_STATE); const state = getParameterByName(PARAM_STATE);
const sortKey = getSortKey(getParameterByName(PARAM_SORT)); const sortKey = getSortKey(getParameterByName(PARAM_SORT));
const defaultSortKey = state === IssuableStates.Closed ? UPDATED_DESC : CREATED_DESC; const defaultSortKey = state === IssuableStates.Closed ? UPDATED_DESC : CREATED_DESC;
this.initialFilterTokens = cloneDeep(filterTokens);
return { return {
dueDateFilter: getDueDateValue(getParameterByName(PARAM_DUE_DATE)), dueDateFilter: getDueDateValue(getParameterByName(PARAM_DUE_DATE)),
exportCsvPathWithQuery: this.getExportCsvPathWithQuery(), exportCsvPathWithQuery: this.getExportCsvPathWithQuery(),
filterTokens: getFilterTokens(window.location.search), filterTokens,
issues: [], issues: [],
pageInfo: {}, pageInfo: {},
pageParams: getInitialPageParams(sortKey), pageParams: getInitialPageParams(sortKey),
...@@ -609,7 +613,7 @@ export default { ...@@ -609,7 +613,7 @@ export default {
recent-searches-storage-key="issues" recent-searches-storage-key="issues"
:search-input-placeholder="$options.i18n.searchPlaceholder" :search-input-placeholder="$options.i18n.searchPlaceholder"
:search-tokens="searchTokens" :search-tokens="searchTokens"
:initial-filter-value="filterTokens" :initial-filter-value="initialFilterTokens"
:sort-options="sortOptions" :sort-options="sortOptions"
:initial-sort-by="sortKey" :initial-sort-by="sortKey"
:issuables="issues" :issuables="issues"
......
...@@ -99,7 +99,7 @@ export default { ...@@ -99,7 +99,7 @@ export default {
// We don't have any information about selected token except for its // We don't have any information about selected token except for its
// group path and iid joined by separator, so we need to manually // group path and iid joined by separator, so we need to manually
// compose epic path from it. // compose epic path from it.
if (data.includes(this.$options.separator)) { if (data.includes?.(this.$options.separator)) {
const [groupPath, epicIid] = data.split(this.$options.separator); const [groupPath, epicIid] = data.split(this.$options.separator);
epicPath = `/groups/${groupPath}/-/epics/${epicIid}`; epicPath = `/groups/${groupPath}/-/epics/${epicIid}`;
} }
......
...@@ -207,7 +207,7 @@ module IssuesHelper ...@@ -207,7 +207,7 @@ module IssuesHelper
initial_email: project.new_issuable_address(current_user, 'issue'), initial_email: project.new_issuable_address(current_user, 'issue'),
is_signed_in: current_user.present?.to_s, is_signed_in: current_user.present?.to_s,
issues_path: project_issues_path(project), issues_path: project_issues_path(project),
jira_integration_path: help_page_url('integration/jira/', anchor: 'view-jira-issues'), jira_integration_path: help_page_url('integration/jira/issues', anchor: 'view-jira-issues'),
markdown_help_path: help_page_path('user/markdown'), markdown_help_path: help_page_path('user/markdown'),
max_attachment_size: number_to_human_size(Gitlab::CurrentSettings.max_attachment_size.megabytes), max_attachment_size: number_to_human_size(Gitlab::CurrentSettings.max_attachment_size.megabytes),
new_issue_path: new_project_issue_path(project, issue: { milestone_id: finder.milestones.first.try(:id) }), new_issue_path: new_project_issue_path(project, issue: { milestone_id: finder.milestones.first.try(:id) }),
......
<script> <script>
import { GlTooltipDirective } from '@gitlab/ui';
import { issueHealthStatus, issueHealthStatusCSSMapping } from '../constants'; import { issueHealthStatus, issueHealthStatusCSSMapping } from '../constants';
export default { export default {
directives: {
GlTooltip: GlTooltipDirective,
},
props: { props: {
healthStatus: { healthStatus: {
type: String, type: String,
required: true, required: true,
default: '',
}, },
}, },
computed: { computed: {
getFormattedStatus() { statusText() {
return issueHealthStatus[this.healthStatus]; return issueHealthStatus[this.healthStatus];
}, },
statusClass() {
cssMapping() {
return issueHealthStatusCSSMapping[this.healthStatus]; return issueHealthStatusCSSMapping[this.healthStatus];
}, },
}, },
...@@ -23,9 +25,9 @@ export default { ...@@ -23,9 +25,9 @@ export default {
<template> <template>
<div class="health-status"> <div class="health-status">
<span class="gl-label gl-label-sm" :class="cssMapping"> <span class="gl-label gl-label-sm" :class="statusClass">
<span class="gl-label-text"> <span v-gl-tooltip class="gl-label-text" :title="__('Health status')">
{{ getFormattedStatus }} {{ statusText }}
</span> </span>
</span> </span>
</div> </div>
......
import { shallowMount } from '@vue/test-utils';
import IssueHealthStatus from 'ee/related_items_tree/components/issue_health_status.vue'; import IssueHealthStatus from 'ee/related_items_tree/components/issue_health_status.vue';
import { issueHealthStatus, issueHealthStatusCSSMapping } from 'ee/related_items_tree/constants'; import { issueHealthStatus, issueHealthStatusCSSMapping } from 'ee/related_items_tree/constants';
import { createMockDirective, getBinding } from 'helpers/vue_mock_directive';
import { shallowMountExtended } from 'helpers/vue_test_utils_helper';
import { mockIssue1 } from '../mock_data'; import { mockIssue1 } from '../mock_data';
const createComponent = () => { describe('IssueHealthStatus', () => {
const { healthStatus } = mockIssue1; const { healthStatus } = mockIssue1;
let wrapper;
return shallowMount(IssueHealthStatus, { const createComponent = () =>
propsData: { shallowMountExtended(IssueHealthStatus, {
healthStatus, directives: {
}, GlTooltip: createMockDirective(),
}); },
}; propsData: {
healthStatus,
},
});
const findHealthStatus = () => wrapper.findByText(issueHealthStatus[healthStatus]);
describe('IssueHealthStatus', () => {
let wrapper;
const { healthStatus } = mockIssue1;
beforeEach(() => { beforeEach(() => {
wrapper = createComponent(); wrapper = createComponent();
}); });
...@@ -25,15 +28,20 @@ describe('IssueHealthStatus', () => { ...@@ -25,15 +28,20 @@ describe('IssueHealthStatus', () => {
wrapper.destroy(); wrapper.destroy();
}); });
it('renders passed in healthStatus', () => { it('renders health status text', () => {
const expectedValue = issueHealthStatus[healthStatus]; const expectedValue = issueHealthStatus[healthStatus];
expect(wrapper.text()).toBe(expectedValue); expect(wrapper.text()).toBe(expectedValue);
}); });
it('applies correct class for passed in healthStatus', () => { it('applies correct health status class', () => {
const expectedValue = issueHealthStatusCSSMapping[healthStatus]; const expectedValue = issueHealthStatusCSSMapping[healthStatus];
expect(wrapper.find(`.${expectedValue}`)).toExist(); expect(wrapper.find(`.${expectedValue}`)).toExist();
}); });
it('contains health status tooltip', () => {
expect(getBinding(findHealthStatus().element, 'gl-tooltip')).not.toBeUndefined();
expect(findHealthStatus().attributes('title')).toBe('Health status');
});
}); });
...@@ -319,7 +319,7 @@ RSpec.describe IssuesHelper do ...@@ -319,7 +319,7 @@ RSpec.describe IssuesHelper do
initial_email: project.new_issuable_address(current_user, 'issue'), initial_email: project.new_issuable_address(current_user, 'issue'),
is_signed_in: current_user.present?.to_s, is_signed_in: current_user.present?.to_s,
issues_path: project_issues_path(project), issues_path: project_issues_path(project),
jira_integration_path: help_page_url('integration/jira/', anchor: 'view-jira-issues'), jira_integration_path: help_page_url('integration/jira/issues', anchor: 'view-jira-issues'),
markdown_help_path: help_page_path('user/markdown'), markdown_help_path: help_page_path('user/markdown'),
max_attachment_size: number_to_human_size(Gitlab::CurrentSettings.max_attachment_size.megabytes), max_attachment_size: number_to_human_size(Gitlab::CurrentSettings.max_attachment_size.megabytes),
new_issue_path: new_project_issue_path(project, issue: { milestone_id: finder.milestones.first.id }), new_issue_path: new_project_issue_path(project, issue: { milestone_id: finder.milestones.first.id }),
......
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