2018-03-27 19:54:05 +05:30
|
|
|
<script>
|
2018-11-08 19:23:39 +05:30
|
|
|
import { mapActions, mapGetters } from 'vuex';
|
2018-12-13 13:39:08 +05:30
|
|
|
import Icon from '~/vue_shared/components/icon.vue';
|
2019-01-03 12:48:30 +05:30
|
|
|
import { pluralize } from '../../lib/utils/text_utility';
|
2018-11-18 11:00:15 +05:30
|
|
|
import discussionNavigation from '../mixins/discussion_navigation';
|
2019-01-03 12:48:30 +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: {
|
2019-01-03 12:48:30 +05:30
|
|
|
tooltip,
|
2018-05-09 12:01:36 +05:30
|
|
|
},
|
2018-12-13 13:39:08 +05:30
|
|
|
components: {
|
|
|
|
Icon,
|
|
|
|
},
|
2018-11-18 11:00:15 +05:30
|
|
|
mixins: [discussionNavigation],
|
2018-05-09 12:01:36 +05:30
|
|
|
computed: {
|
|
|
|
...mapGetters([
|
|
|
|
'getUserData',
|
|
|
|
'getNoteableData',
|
2019-01-03 12:48:30 +05:30
|
|
|
'discussionCount',
|
2018-11-18 11:00:15 +05:30
|
|
|
'firstUnresolvedDiscussionId',
|
2019-01-03 12:48:30 +05:30
|
|
|
'resolvedDiscussionCount',
|
2018-05-09 12:01:36 +05:30
|
|
|
]),
|
|
|
|
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;
|
|
|
|
},
|
2019-01-03 12:48:30 +05:30
|
|
|
countText() {
|
|
|
|
return pluralize('discussion', this.discussionCount);
|
|
|
|
},
|
2018-05-09 12:01:36 +05:30
|
|
|
allResolved() {
|
2019-01-03 12:48:30 +05:30
|
|
|
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;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
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>
|
2019-01-03 12:48:30 +05:30
|
|
|
<div
|
|
|
|
v-if="discussionCount > 0"
|
|
|
|
class="line-resolve-all-container prepend-top-8">
|
2018-03-27 19:54:05 +05:30
|
|
|
<div>
|
2019-01-03 12:48:30 +05:30
|
|
|
<div
|
|
|
|
:class="{ 'has-next-btn': hasNextButton }"
|
|
|
|
class="line-resolve-all">
|
2018-03-27 19:54:05 +05:30
|
|
|
<span
|
|
|
|
:class="{ 'is-active': allResolved }"
|
|
|
|
class="line-resolve-btn is-disabled"
|
2018-12-13 13:39:08 +05:30
|
|
|
type="button"
|
|
|
|
>
|
|
|
|
<icon name="check-circle" />
|
2018-03-27 19:54:05 +05:30
|
|
|
</span>
|
2018-10-15 14:42:47 +05:30
|
|
|
<span class="line-resolve-text">
|
2019-01-03 12:48:30 +05:30
|
|
|
{{ resolvedDiscussionCount }}/{{ discussionCount }} {{ countText }} resolved
|
2018-03-27 19:54:05 +05:30
|
|
|
</span>
|
|
|
|
</div>
|
2019-01-03 12:48:30 +05:30
|
|
|
<div
|
|
|
|
v-if="resolveAllDiscussionsIssuePath && !allResolved"
|
|
|
|
class="btn-group"
|
|
|
|
role="group">
|
2018-03-27 19:54:05 +05:30
|
|
|
<a
|
2019-01-03 12:48:30 +05:30
|
|
|
v-tooltip
|
2018-11-08 19:23:39 +05:30
|
|
|
:href="resolveAllDiscussionsIssuePath"
|
|
|
|
:title="s__('Resolve all discussions in new issue')"
|
2019-01-03 12:48:30 +05:30
|
|
|
data-container="body"
|
|
|
|
class="new-issue-for-discussion btn btn-default discussion-create-issue-btn">
|
2018-12-13 13:39:08 +05:30
|
|
|
<icon name="issue-new" />
|
2018-03-27 19:54:05 +05:30
|
|
|
</a>
|
|
|
|
</div>
|
2019-01-03 12:48:30 +05:30
|
|
|
<div
|
|
|
|
v-if="isLoggedIn && !allResolved"
|
|
|
|
class="btn-group"
|
|
|
|
role="group">
|
2018-03-27 19:54:05 +05:30
|
|
|
<button
|
2019-01-03 12:48:30 +05:30
|
|
|
v-tooltip
|
2018-03-27 19:54:05 +05:30
|
|
|
title="Jump to first unresolved discussion"
|
2019-01-03 12:48:30 +05:30
|
|
|
data-container="body"
|
2018-11-08 19:23:39 +05:30
|
|
|
class="btn btn-default discussion-next-btn"
|
2019-01-03 12:48:30 +05:30
|
|
|
@click="jumpToFirstUnresolvedDiscussion">
|
2018-12-13 13:39:08 +05:30
|
|
|
<icon name="comment-next" />
|
2018-03-27 19:54:05 +05:30
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|