2018-02-27 19:10:43 -05:00
|
|
|
<script>
|
2018-06-21 08:22:40 -04:00
|
|
|
import { mapActions, mapGetters } from 'vuex';
|
2018-11-09 04:44:07 -05:00
|
|
|
import { GlTooltipDirective } from '@gitlab/ui';
|
2018-11-08 02:58:45 -05:00
|
|
|
import Icon from '~/vue_shared/components/icon.vue';
|
2018-07-31 22:21:14 -04:00
|
|
|
import discussionNavigation from '../mixins/discussion_navigation';
|
2018-02-27 19:10:43 -05:00
|
|
|
|
2018-03-16 16:16:21 -04:00
|
|
|
export default {
|
|
|
|
directives: {
|
2018-11-09 04:44:07 -05:00
|
|
|
GlTooltip: GlTooltipDirective,
|
2018-03-16 16:16:21 -04:00
|
|
|
},
|
2018-11-08 02:58:45 -05:00
|
|
|
components: {
|
|
|
|
Icon,
|
|
|
|
},
|
2018-07-31 22:21:14 -04:00
|
|
|
mixins: [discussionNavigation],
|
2018-03-16 16:16:21 -04:00
|
|
|
computed: {
|
|
|
|
...mapGetters([
|
|
|
|
'getUserData',
|
|
|
|
'getNoteableData',
|
2018-11-09 04:44:07 -05:00
|
|
|
'resolvableDiscussionsCount',
|
2018-07-31 22:21:14 -04:00
|
|
|
'firstUnresolvedDiscussionId',
|
2018-11-09 04:44:07 -05:00
|
|
|
'unresolvedDiscussionsCount',
|
2018-03-16 16:16:21 -04:00
|
|
|
]),
|
|
|
|
isLoggedIn() {
|
|
|
|
return this.getUserData.id;
|
2018-02-27 19:10:43 -05:00
|
|
|
},
|
2018-03-16 16:16:21 -04:00
|
|
|
hasNextButton() {
|
|
|
|
return this.isLoggedIn && !this.allResolved;
|
|
|
|
},
|
|
|
|
allResolved() {
|
2018-11-09 04:44:07 -05:00
|
|
|
return this.unresolvedDiscussionsCount === 0;
|
2018-02-27 19:10:43 -05:00
|
|
|
},
|
2018-03-16 16:16:21 -04:00
|
|
|
resolveAllDiscussionsIssuePath() {
|
|
|
|
return this.getNoteableData.create_issue_to_resolve_discussions_path;
|
|
|
|
},
|
2018-11-09 04:44:07 -05:00
|
|
|
resolvedDiscussionsCount() {
|
|
|
|
return this.resolvableDiscussionsCount - this.unresolvedDiscussionsCount;
|
|
|
|
},
|
2018-03-16 16:16:21 -04:00
|
|
|
},
|
|
|
|
methods: {
|
2018-06-21 08:22:40 -04:00
|
|
|
...mapActions(['expandDiscussion']),
|
|
|
|
jumpToFirstUnresolvedDiscussion() {
|
2018-07-31 22:21:14 -04:00
|
|
|
const diffTab = window.mrTabs.currentAction === 'diffs';
|
|
|
|
const discussionId = this.firstUnresolvedDiscussionId(diffTab);
|
2018-02-27 19:10:43 -05:00
|
|
|
|
2018-07-31 22:21:14 -04:00
|
|
|
this.jumpToDiscussion(discussionId);
|
2018-02-27 19:10:43 -05:00
|
|
|
},
|
2018-03-16 16:16:21 -04:00
|
|
|
},
|
|
|
|
};
|
2018-02-27 19:10:43 -05:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
2019-06-06 10:44:13 -04:00
|
|
|
<div v-if="resolvableDiscussionsCount > 0" class="line-resolve-all-container full-width-mobile">
|
|
|
|
<div class="full-width-mobile d-flex d-sm-block">
|
2018-11-16 15:07:38 -05:00
|
|
|
<div :class="{ 'has-next-btn': hasNextButton }" class="line-resolve-all">
|
2018-02-27 19:10:43 -05:00
|
|
|
<span
|
|
|
|
:class="{ 'is-active': allResolved }"
|
|
|
|
class="line-resolve-btn is-disabled"
|
2018-11-08 02:58:45 -05:00
|
|
|
type="button"
|
|
|
|
>
|
2019-05-22 21:12:30 -04:00
|
|
|
<icon :name="allResolved ? 'check-circle-filled' : 'check-circle'" />
|
2018-02-27 19:10:43 -05:00
|
|
|
</span>
|
2018-04-30 11:43:08 -04:00
|
|
|
<span class="line-resolve-text">
|
2018-11-09 04:44:07 -05:00
|
|
|
{{ resolvedDiscussionsCount }}/{{ resolvableDiscussionsCount }}
|
2019-06-12 08:22:03 -04:00
|
|
|
{{ n__('thread resolved', 'threads resolved', resolvableDiscussionsCount) }}
|
2018-02-27 19:10:43 -05:00
|
|
|
</span>
|
|
|
|
</div>
|
2019-06-06 10:44:13 -04:00
|
|
|
<div
|
|
|
|
v-if="resolveAllDiscussionsIssuePath && !allResolved"
|
|
|
|
class="btn-group btn-group-sm"
|
|
|
|
role="group"
|
|
|
|
>
|
2018-02-27 19:10:43 -05:00
|
|
|
<a
|
2018-11-09 04:44:07 -05:00
|
|
|
v-gl-tooltip
|
2018-06-11 05:49:47 -04:00
|
|
|
:href="resolveAllDiscussionsIssuePath"
|
2019-06-12 08:22:03 -04:00
|
|
|
:title="s__('Resolve all threads in new issue')"
|
2018-11-16 15:07:38 -05:00
|
|
|
class="new-issue-for-discussion btn btn-default discussion-create-issue-btn"
|
|
|
|
>
|
2018-11-08 02:58:45 -05:00
|
|
|
<icon name="issue-new" />
|
2018-02-27 19:10:43 -05:00
|
|
|
</a>
|
|
|
|
</div>
|
2019-06-06 10:44:13 -04:00
|
|
|
<div v-if="isLoggedIn && !allResolved" class="btn-group btn-group-sm" role="group">
|
2018-02-27 19:10:43 -05:00
|
|
|
<button
|
2018-11-09 04:44:07 -05:00
|
|
|
v-gl-tooltip
|
2019-06-12 08:22:03 -04:00
|
|
|
title="Jump to first unresolved thread"
|
2018-06-11 05:49:47 -04:00
|
|
|
class="btn btn-default discussion-next-btn"
|
2018-11-16 15:07:38 -05:00
|
|
|
@click="jumpToFirstUnresolvedDiscussion"
|
|
|
|
>
|
2018-11-08 02:58:45 -05:00
|
|
|
<icon name="comment-next" />
|
2018-02-27 19:10:43 -05:00
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|