2019-02-27 19:12:40 +00:00
|
|
|
<script>
|
2019-04-25 14:33:40 +00:00
|
|
|
import '~/commons/bootstrap';
|
2019-06-27 06:12:38 +00:00
|
|
|
import { GlTooltip, GlTooltipDirective } from '@gitlab/ui';
|
2019-04-05 00:15:56 +00:00
|
|
|
import { sprintf } from '~/locale';
|
|
|
|
import IssueMilestone from '../../components/issue/issue_milestone.vue';
|
|
|
|
import IssueAssignees from '../../components/issue/issue_assignees.vue';
|
|
|
|
import relatedIssuableMixin from '../../mixins/related_issuable_mixin';
|
|
|
|
import CiIcon from '../ci_icon.vue';
|
2019-02-27 19:12:40 +00:00
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'IssueItem',
|
|
|
|
components: {
|
|
|
|
IssueMilestone,
|
|
|
|
IssueAssignees,
|
2019-04-05 00:15:56 +00:00
|
|
|
CiIcon,
|
2019-06-27 06:12:38 +00:00
|
|
|
GlTooltip,
|
2019-02-27 19:12:40 +00:00
|
|
|
},
|
|
|
|
directives: {
|
|
|
|
GlTooltip: GlTooltipDirective,
|
|
|
|
},
|
|
|
|
mixins: [relatedIssuableMixin],
|
|
|
|
props: {
|
|
|
|
canReorder: {
|
|
|
|
type: Boolean,
|
|
|
|
required: false,
|
|
|
|
default: false,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
stateTitle() {
|
|
|
|
return sprintf(
|
|
|
|
'<span class="bold">%{state}</span> %{timeInWords}<br/><span class="text-tertiary">%{timestamp}</span>',
|
|
|
|
{
|
2019-04-05 00:15:56 +00:00
|
|
|
state: this.stateText,
|
|
|
|
timeInWords: this.stateTimeInWords,
|
|
|
|
timestamp: this.stateTimestamp,
|
2019-02-27 19:12:40 +00:00
|
|
|
},
|
|
|
|
);
|
|
|
|
},
|
2019-06-27 06:12:38 +00:00
|
|
|
heightStyle() {
|
|
|
|
return {
|
|
|
|
minHeight: '32px',
|
|
|
|
width: '0px',
|
|
|
|
visibility: 'hidden',
|
|
|
|
};
|
2019-06-03 21:35:39 +00:00
|
|
|
},
|
2019-02-27 19:12:40 +00:00
|
|
|
},
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<div
|
|
|
|
:class="{
|
|
|
|
'issuable-info-container': !canReorder,
|
|
|
|
'card-body': canReorder,
|
|
|
|
}"
|
2019-06-27 06:12:38 +00:00
|
|
|
class="item-body d-flex align-items-center p-2 p-lg-3 py-xl-2 px-xl-3"
|
2019-02-27 19:12:40 +00:00
|
|
|
>
|
2019-04-18 18:53:42 +00:00
|
|
|
<div class="item-contents d-flex align-items-center flex-wrap flex-grow-1 flex-xl-nowrap">
|
2019-06-27 06:12:38 +00:00
|
|
|
<!-- Title area: Status icon (XL) and title -->
|
|
|
|
<div class="item-title d-flex align-items-center mb-xl-0">
|
|
|
|
<span ref="iconElementXL">
|
|
|
|
<icon
|
|
|
|
v-if="hasState"
|
|
|
|
ref="iconElementXL"
|
2019-10-02 21:06:22 +00:00
|
|
|
:class="iconClass"
|
2019-06-27 06:12:38 +00:00
|
|
|
:name="iconName"
|
|
|
|
:size="16"
|
|
|
|
:title="stateTitle"
|
|
|
|
:aria-label="state"
|
|
|
|
/>
|
|
|
|
</span>
|
|
|
|
<gl-tooltip :target="() => $refs.iconElementXL">
|
|
|
|
<span v-html="stateTitle"></span>
|
|
|
|
</gl-tooltip>
|
2019-02-27 19:12:40 +00:00
|
|
|
<icon
|
|
|
|
v-if="confidential"
|
|
|
|
v-gl-tooltip
|
|
|
|
name="eye-slash"
|
|
|
|
:size="16"
|
|
|
|
:title="__('Confidential')"
|
2019-04-18 18:53:42 +00:00
|
|
|
class="confidential-icon append-right-4 align-self-baseline align-self-md-auto mt-xl-0"
|
2019-02-27 19:12:40 +00:00
|
|
|
:aria-label="__('Confidential')"
|
|
|
|
/>
|
2019-06-27 06:12:38 +00:00
|
|
|
<a :href="computedPath" class="sortable-link">{{ title }}</a>
|
2019-02-27 19:12:40 +00:00
|
|
|
</div>
|
2019-06-27 06:12:38 +00:00
|
|
|
|
|
|
|
<!-- Info area: meta, path, and assignees -->
|
|
|
|
<div class="item-info-area d-flex flex-xl-grow-1 flex-shrink-0">
|
|
|
|
<!-- Meta area: path and attributes -->
|
|
|
|
<!-- If there is no room beside the path, meta attributes are put ABOVE it (flex-wrap-reverse). -->
|
|
|
|
<!-- See design: https://gitlab-org.gitlab.io/gitlab-design/hosted/pedro/%2383-issue-mr-rows-cards-spec-previews/#artboard16 -->
|
2019-04-18 18:53:42 +00:00
|
|
|
<div
|
2019-06-27 06:12:38 +00:00
|
|
|
class="item-meta d-flex flex-wrap-reverse justify-content-start justify-content-md-between"
|
2019-04-18 18:53:42 +00:00
|
|
|
>
|
2019-06-27 06:12:38 +00:00
|
|
|
<!-- Path area: status icon (<XL), path, issue # -->
|
|
|
|
<div
|
|
|
|
class="item-path-area item-path-id d-flex align-items-center mr-2 mt-2 mt-xl-0 ml-xl-2"
|
|
|
|
>
|
|
|
|
<span ref="iconElement">
|
|
|
|
<icon
|
|
|
|
v-if="hasState"
|
2019-10-02 21:06:22 +00:00
|
|
|
:class="iconClass"
|
2019-06-27 06:12:38 +00:00
|
|
|
:name="iconName"
|
|
|
|
:title="stateTitle"
|
|
|
|
:aria-label="state"
|
|
|
|
data-html="true"
|
|
|
|
class="d-xl-none"
|
|
|
|
/>
|
|
|
|
</span>
|
|
|
|
<gl-tooltip :target="() => this.$refs.iconElement">
|
|
|
|
<span v-html="stateTitle"></span>
|
|
|
|
</gl-tooltip>
|
|
|
|
<span v-gl-tooltip :title="itemPath" class="path-id-text d-inline-block">{{
|
|
|
|
itemPath
|
|
|
|
}}</span>
|
|
|
|
<span>{{ pathIdSeparator }}{{ itemId }}</span>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<!-- Attributes area: CI, epic count, weight, milestone -->
|
|
|
|
<!-- They have a different order on large screen sizes -->
|
|
|
|
<div class="item-attributes-area d-flex align-items-center mt-2 mt-xl-0">
|
|
|
|
<span v-if="hasPipeline" class="mr-ci-status order-md-last">
|
|
|
|
<a :href="pipelineStatus.details_path">
|
|
|
|
<ci-icon v-gl-tooltip :status="pipelineStatus" :title="pipelineStatusTooltip" />
|
|
|
|
</a>
|
|
|
|
</span>
|
|
|
|
|
|
|
|
<issue-milestone
|
|
|
|
v-if="hasMilestone"
|
|
|
|
:milestone="milestone"
|
|
|
|
class="d-flex align-items-center item-milestone order-md-first ml-md-0"
|
|
|
|
/>
|
|
|
|
|
|
|
|
<!-- Flex order for slots is defined in the parent component: e.g. related_issues_block.vue -->
|
|
|
|
<slot name="dueDate"></slot>
|
|
|
|
<slot name="weight"></slot>
|
|
|
|
|
|
|
|
<issue-assignees
|
|
|
|
v-if="hasAssignees"
|
|
|
|
:assignees="assignees"
|
|
|
|
class="item-assignees align-items-center align-self-end flex-shrink-0 order-md-2 d-none d-md-flex"
|
|
|
|
/>
|
|
|
|
</div>
|
2019-02-27 19:12:40 +00:00
|
|
|
</div>
|
2019-06-27 06:12:38 +00:00
|
|
|
|
|
|
|
<!-- Assignees. On small layouts, these are put here, at the end of the card. -->
|
2019-02-27 19:12:40 +00:00
|
|
|
<issue-assignees
|
2019-06-27 06:12:38 +00:00
|
|
|
v-if="assignees.length !== 0"
|
2019-02-27 19:12:40 +00:00
|
|
|
:assignees="assignees"
|
2019-06-27 06:12:38 +00:00
|
|
|
class="item-assignees d-flex align-items-center align-self-end flex-shrink-0 d-md-none ml-2"
|
2019-02-27 19:12:40 +00:00
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</div>
|
2019-06-27 06:12:38 +00:00
|
|
|
|
2019-02-27 19:12:40 +00:00
|
|
|
<button
|
|
|
|
v-if="canRemove"
|
|
|
|
ref="removeButton"
|
2019-06-27 06:12:38 +00:00
|
|
|
v-gl-tooltip
|
2019-02-27 19:12:40 +00:00
|
|
|
:disabled="removeDisabled"
|
|
|
|
type="button"
|
2019-10-02 18:06:20 +00:00
|
|
|
class="btn btn-default btn-svg btn-item-remove js-issue-item-remove-button mr-xl-0 align-self-xl-center"
|
|
|
|
data-qa-selector="remove_related_issue_button"
|
2019-07-08 08:26:37 +00:00
|
|
|
:title="__('Remove')"
|
|
|
|
:aria-label="__('Remove')"
|
2019-02-27 19:12:40 +00:00
|
|
|
@click="onRemoveRequest"
|
|
|
|
>
|
|
|
|
<icon :size="16" class="btn-item-remove-icon" name="close" />
|
|
|
|
</button>
|
2019-06-27 06:12:38 +00:00
|
|
|
|
|
|
|
<!-- This element serves to set the issue card's height at a minimum of 32 px. -->
|
|
|
|
<!-- It fixes #59594: when the remove button is missing, issues have inconsistent heights. -->
|
|
|
|
<span :style="heightStyle"></span>
|
2019-02-27 19:12:40 +00:00
|
|
|
</div>
|
|
|
|
</template>
|