2018-03-27 19:54:05 +05:30
|
|
|
<script>
|
2018-11-08 19:23:39 +05:30
|
|
|
import { mapActions, mapGetters } from 'vuex';
|
2018-05-09 12:01:36 +05:30
|
|
|
import resolveSvg from 'icons/_icon_resolve_discussion.svg';
|
|
|
|
import resolvedSvg from 'icons/_icon_status_success_solid.svg';
|
|
|
|
import mrIssueSvg from 'icons/_icon_mr_issue.svg';
|
|
|
|
import nextDiscussionSvg from 'icons/_next_discussion.svg';
|
|
|
|
import { pluralize } from '../../lib/utils/text_utility';
|
2018-11-18 11:00:15 +05:30
|
|
|
import discussionNavigation from '../mixins/discussion_navigation';
|
2018-05-09 12:01:36 +05:30
|
|
|
import tooltip from '../../vue_shared/directives/tooltip';
|
2018-03-27 19:54:05 +05:30
|
|
|
|
2018-05-09 12:01:36 +05:30
|
|
|
export default {
|
|
|
|
directives: {
|
|
|
|
tooltip,
|
|
|
|
},
|
2018-11-18 11:00:15 +05:30
|
|
|
mixins: [discussionNavigation],
|
2018-05-09 12:01:36 +05:30
|
|
|
computed: {
|
|
|
|
...mapGetters([
|
|
|
|
'getUserData',
|
|
|
|
'getNoteableData',
|
|
|
|
'discussionCount',
|
2018-11-18 11:00:15 +05:30
|
|
|
'firstUnresolvedDiscussionId',
|
2018-05-09 12:01:36 +05:30
|
|
|
'resolvedDiscussionCount',
|
|
|
|
]),
|
|
|
|
isLoggedIn() {
|
|
|
|
return this.getUserData.id;
|
2018-03-27 19:54:05 +05:30
|
|
|
},
|
2018-05-09 12:01:36 +05:30
|
|
|
hasNextButton() {
|
|
|
|
return this.isLoggedIn && !this.allResolved;
|
|
|
|
},
|
|
|
|
countText() {
|
|
|
|
return pluralize('discussion', this.discussionCount);
|
|
|
|
},
|
|
|
|
allResolved() {
|
|
|
|
return this.resolvedDiscussionCount === this.discussionCount;
|
2018-03-27 19:54:05 +05:30
|
|
|
},
|
2018-05-09 12:01:36 +05:30
|
|
|
resolveAllDiscussionsIssuePath() {
|
|
|
|
return this.getNoteableData.create_issue_to_resolve_discussions_path;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
created() {
|
|
|
|
this.resolveSvg = resolveSvg;
|
|
|
|
this.resolvedSvg = resolvedSvg;
|
|
|
|
this.mrIssueSvg = mrIssueSvg;
|
|
|
|
this.nextDiscussionSvg = nextDiscussionSvg;
|
|
|
|
},
|
|
|
|
methods: {
|
2018-11-08 19:23:39 +05:30
|
|
|
...mapActions(['expandDiscussion']),
|
|
|
|
jumpToFirstUnresolvedDiscussion() {
|
2018-11-18 11:00:15 +05:30
|
|
|
const diffTab = window.mrTabs.currentAction === 'diffs';
|
|
|
|
const discussionId = this.firstUnresolvedDiscussionId(diffTab);
|
2018-03-27 19:54:05 +05:30
|
|
|
|
2018-11-18 11:00:15 +05:30
|
|
|
this.jumpToDiscussion(discussionId);
|
2018-03-27 19:54:05 +05:30
|
|
|
},
|
2018-05-09 12:01:36 +05:30
|
|
|
},
|
|
|
|
};
|
2018-03-27 19:54:05 +05:30
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<div class="line-resolve-all-container prepend-top-10">
|
|
|
|
<div>
|
|
|
|
<div
|
|
|
|
v-if="discussionCount > 0"
|
|
|
|
:class="{ 'has-next-btn': hasNextButton }"
|
|
|
|
class="line-resolve-all">
|
|
|
|
<span
|
|
|
|
:class="{ 'is-active': allResolved }"
|
|
|
|
class="line-resolve-btn is-disabled"
|
|
|
|
type="button">
|
|
|
|
<span
|
|
|
|
v-if="allResolved"
|
|
|
|
v-html="resolvedSvg"
|
|
|
|
></span>
|
|
|
|
<span
|
|
|
|
v-else
|
|
|
|
v-html="resolveSvg"
|
|
|
|
></span>
|
|
|
|
</span>
|
2018-10-15 14:42:47 +05:30
|
|
|
<span class="line-resolve-text">
|
2018-03-27 19:54:05 +05:30
|
|
|
{{ resolvedDiscussionCount }}/{{ discussionCount }} {{ countText }} resolved
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
<div
|
|
|
|
v-if="resolveAllDiscussionsIssuePath && !allResolved"
|
|
|
|
class="btn-group"
|
|
|
|
role="group">
|
|
|
|
<a
|
|
|
|
v-tooltip
|
2018-11-08 19:23:39 +05:30
|
|
|
:href="resolveAllDiscussionsIssuePath"
|
|
|
|
:title="s__('Resolve all discussions in new issue')"
|
2018-03-27 19:54:05 +05:30
|
|
|
data-container="body"
|
|
|
|
class="new-issue-for-discussion btn btn-default discussion-create-issue-btn">
|
|
|
|
<span v-html="mrIssueSvg"></span>
|
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
<div
|
|
|
|
v-if="isLoggedIn && !allResolved"
|
|
|
|
class="btn-group"
|
|
|
|
role="group">
|
|
|
|
<button
|
|
|
|
v-tooltip
|
|
|
|
title="Jump to first unresolved discussion"
|
|
|
|
data-container="body"
|
2018-11-08 19:23:39 +05:30
|
|
|
class="btn btn-default discussion-next-btn"
|
|
|
|
@click="jumpToFirstUnresolvedDiscussion">
|
2018-03-27 19:54:05 +05:30
|
|
|
<span v-html="nextDiscussionSvg"></span>
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|