Commit bf39ae0a authored by Suzanne Selhorn's avatar Suzanne Selhorn Committed by Andrew Fontaine
parent 622b0386
<script> <script>
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
import { GlLoadingIcon, GlTooltipDirective, GlIcon } from '@gitlab/ui'; import { GlTooltipDirective, GlIcon, GlButton, GlDropdownItem } from '@gitlab/ui';
import { __, sprintf } from '~/locale'; import { __, sprintf } from '~/locale';
import resolvedStatusMixin from '~/batch_comments/mixins/resolved_status'; import resolvedStatusMixin from '~/batch_comments/mixins/resolved_status';
import ReplyButton from './note_actions/reply_button.vue'; import ReplyButton from './note_actions/reply_button.vue';
...@@ -14,7 +14,8 @@ export default { ...@@ -14,7 +14,8 @@ export default {
components: { components: {
GlIcon, GlIcon,
ReplyButton, ReplyButton,
GlLoadingIcon, GlButton,
GlDropdownItem,
}, },
directives: { directives: {
GlTooltip: GlTooltipDirective, GlTooltip: GlTooltipDirective,
...@@ -170,6 +171,15 @@ export default { ...@@ -170,6 +171,15 @@ export default {
name: this.projectName, name: this.projectName,
}); });
}, },
resolveIcon() {
if (!this.isResolving) {
return this.isResolved ? 'check-circle-filled' : 'check-circle';
}
return null;
},
resolveVariant() {
return this.isResolved ? 'success' : 'default';
},
}, },
methods: { methods: {
onEdit() { onEdit() {
...@@ -233,24 +243,23 @@ export default { ...@@ -233,24 +243,23 @@ export default {
:title="displayContributorBadgeText" :title="displayContributorBadgeText"
>{{ __('Contributor') }}</span >{{ __('Contributor') }}</span
> >
<div v-if="canResolve" class="note-actions-item"> <div v-if="canResolve" class="gl-ml-2">
<button <gl-button
ref="resolveButton" ref="resolveButton"
v-gl-tooltip v-gl-tooltip
size="small"
category="tertiary"
:variant="resolveVariant"
:class="{ 'is-disabled': !resolvable, 'is-active': isResolved }" :class="{ 'is-disabled': !resolvable, 'is-active': isResolved }"
:title="resolveButtonTitle" :title="resolveButtonTitle"
:aria-label="resolveButtonTitle" :aria-label="resolveButtonTitle"
type="button" :icon="resolveIcon"
:loading="isResolving"
class="line-resolve-btn note-action-button" class="line-resolve-btn note-action-button"
@click="onResolve" @click="onResolve"
> />
<template v-if="!isResolving">
<gl-icon :name="isResolved ? 'check-circle-filled' : 'check-circle'" />
</template>
<gl-loading-icon v-else inline />
</button>
</div> </div>
<div v-if="canAwardEmoji" class="note-actions-item"> <div v-if="canAwardEmoji" class="gl-ml-3 gl-mr-2">
<a <a
v-gl-tooltip v-gl-tooltip
:class="{ 'js-user-authored': isAuthoredByCurrentUser }" :class="{ 'js-user-authored': isAuthoredByCurrentUser }"
...@@ -261,7 +270,7 @@ export default { ...@@ -261,7 +270,7 @@ export default {
> >
<gl-icon class="link-highlight award-control-icon-neutral" name="slight-smile" /> <gl-icon class="link-highlight award-control-icon-neutral" name="slight-smile" />
<gl-icon class="link-highlight award-control-icon-positive" name="smiley" /> <gl-icon class="link-highlight award-control-icon-positive" name="smiley" />
<gl-icon class="link-highlight award-control-icon-super-positive" name="smiley" /> <gl-icon class="link-highlight award-control-icon-super-positive" name="smile" />
</a> </a>
</div> </div>
<reply-button <reply-button
...@@ -270,72 +279,57 @@ export default { ...@@ -270,72 +279,57 @@ export default {
class="js-reply-button" class="js-reply-button"
@startReplying="$emit('startReplying')" @startReplying="$emit('startReplying')"
/> />
<div v-if="canEdit" class="note-actions-item"> <div v-if="canEdit" class="gl-ml-2">
<button <gl-button
v-gl-tooltip v-gl-tooltip
type="button"
title="Edit comment" title="Edit comment"
icon="pencil"
size="small"
category="tertiary"
class="note-action-button js-note-edit btn btn-transparent" class="note-action-button js-note-edit btn btn-transparent"
data-qa-selector="note_edit_button" data-qa-selector="note_edit_button"
@click="onEdit" @click="onEdit"
> />
<gl-icon name="pencil" class="link-highlight" />
</button>
</div> </div>
<div v-if="showDeleteAction" class="note-actions-item"> <div v-if="showDeleteAction" class="gl-ml-2">
<button <gl-button
v-gl-tooltip v-gl-tooltip
type="button"
title="Delete comment" title="Delete comment"
size="small"
icon="remove"
category="tertiary"
class="note-action-button js-note-delete btn btn-transparent" class="note-action-button js-note-delete btn btn-transparent"
@click="onDelete" @click="onDelete"
> />
<gl-icon name="remove" class="link-highlight" />
</button>
</div> </div>
<div v-else-if="shouldShowActionsDropdown" class="dropdown more-actions note-actions-item"> <div v-else-if="shouldShowActionsDropdown" class="dropdown more-actions gl-ml-2">
<button <gl-button
v-gl-tooltip v-gl-tooltip
type="button"
title="More actions" title="More actions"
icon="ellipsis_v"
size="small"
category="tertiary"
class="note-action-button more-actions-toggle btn btn-transparent" class="note-action-button more-actions-toggle btn btn-transparent"
data-toggle="dropdown" data-toggle="dropdown"
@click="closeTooltip" @click="closeTooltip"
> />
<gl-icon class="icon" name="ellipsis_v" />
</button>
<ul class="dropdown-menu more-actions-dropdown dropdown-open-left"> <ul class="dropdown-menu more-actions-dropdown dropdown-open-left">
<li v-if="canReportAsAbuse"> <gl-dropdown-item v-if="canReportAsAbuse" :href="reportAbusePath">
<a :href="reportAbusePath">{{ __('Report abuse to admin') }}</a> {{ __('Report abuse to admin') }}
</li> </gl-dropdown-item>
<li v-if="noteUrl"> <gl-dropdown-item
<button v-if="noteUrl"
class="js-btn-copy-note-link"
:data-clipboard-text="noteUrl" :data-clipboard-text="noteUrl"
type="button"
class="btn-default btn-transparent js-btn-copy-note-link"
> >
{{ __('Copy link') }} {{ __('Copy link') }}
</button> </gl-dropdown-item>
</li> <gl-dropdown-item v-if="canAssign" data-testid="assign-user" @click="assignUser">
<li v-if="canAssign">
<button
class="btn-default btn-transparent"
data-testid="assign-user"
type="button"
@click="assignUser"
>
{{ displayAssignUserText }} {{ displayAssignUserText }}
</button> </gl-dropdown-item>
</li> <gl-dropdown-item v-if="canEdit" class="js-note-delete" @click.prevent="onDelete">
<li v-if="canEdit">
<button
class="btn btn-transparent js-note-delete js-note-delete"
type="button"
@click.prevent="onDelete"
>
<span class="text-danger">{{ __('Delete comment') }}</span> <span class="text-danger">{{ __('Delete comment') }}</span>
</button> </gl-dropdown-item>
</li>
</ul> </ul>
</div> </div>
</div> </div>
......
...@@ -13,7 +13,7 @@ export default { ...@@ -13,7 +13,7 @@ export default {
</script> </script>
<template> <template>
<div class="note-actions-item"> <div class="gl-ml-2">
<gl-button <gl-button
ref="button" ref="button"
v-gl-tooltip v-gl-tooltip
......
...@@ -337,11 +337,11 @@ table.pipeline-project-metrics tr td { ...@@ -337,11 +337,11 @@ table.pipeline-project-metrics tr td {
} }
.user-access-role { .user-access-role {
@include gl-px-3;
display: inline-block; display: inline-block;
color: $gl-text-color-secondary; color: $gl-text-color-secondary;
font-size: 12px; font-size: 12px;
line-height: 20px; line-height: 20px;
padding: 0 $label-padding;
border: 1px solid $border-color; border: 1px solid $border-color;
border-radius: $label-border-radius; border-radius: $label-border-radius;
font-weight: $gl-font-weight-normal; font-weight: $gl-font-weight-normal;
......
...@@ -801,7 +801,7 @@ $note-form-margin-left: 72px; ...@@ -801,7 +801,7 @@ $note-form-margin-left: 72px;
} }
.note-role { .note-role {
margin: 0 3px; margin: 0 8px;
} }
/** /**
...@@ -892,6 +892,15 @@ $note-form-margin-left: 72px; ...@@ -892,6 +892,15 @@ $note-form-margin-left: 72px;
outline: 0; outline: 0;
transition: color $general-hover-transition-duration $general-hover-transition-curve; transition: color $general-hover-transition-duration $general-hover-transition-curve;
&[disabled] {
padding: 0 8px !important;
box-shadow: none !important;
.gl-button-loading-indicator {
margin-right: 0 !important;
}
}
&.is-disabled { &.is-disabled {
cursor: default; cursor: default;
} }
...@@ -899,18 +908,24 @@ $note-form-margin-left: 72px; ...@@ -899,18 +908,24 @@ $note-form-margin-left: 72px;
&:not(.is-disabled) { &:not(.is-disabled) {
&:hover, &:hover,
&:focus { &:focus {
svg {
color: $green-600; color: $green-600;
} }
} }
}
&.is-active { &.is-active {
color: $green-600; svg {
@include gl-text-green-500;
}
&:hover, &:hover,
&:focus { &:focus {
svg {
color: $green-700; color: $green-700;
} }
} }
}
.loading { .loading {
margin: 0; margin: 0;
......
import Vue from 'vue'; import Vue from 'vue';
import { shallowMount, createLocalVue, createWrapper } from '@vue/test-utils'; import { mount, createLocalVue, createWrapper } from '@vue/test-utils';
import { TEST_HOST } from 'spec/test_constants'; import { TEST_HOST } from 'spec/test_constants';
import AxiosMockAdapter from 'axios-mock-adapter'; import AxiosMockAdapter from 'axios-mock-adapter';
import createStore from '~/notes/stores'; import createStore from '~/notes/stores';
...@@ -14,9 +14,9 @@ describe('noteActions', () => { ...@@ -14,9 +14,9 @@ describe('noteActions', () => {
let actions; let actions;
let axiosMock; let axiosMock;
const shallowMountNoteActions = (propsData, computed) => { const mountNoteActions = (propsData, computed) => {
const localVue = createLocalVue(); const localVue = createLocalVue();
return shallowMount(localVue.extend(noteActions), { return mount(localVue.extend(noteActions), {
store, store,
propsData, propsData,
localVue, localVue,
...@@ -61,7 +61,7 @@ describe('noteActions', () => { ...@@ -61,7 +61,7 @@ describe('noteActions', () => {
beforeEach(() => { beforeEach(() => {
store.dispatch('setUserData', userDataMock); store.dispatch('setUserData', userDataMock);
wrapper = shallowMountNoteActions(props); wrapper = mountNoteActions(props);
}); });
it('should render noteable author badge', () => { it('should render noteable author badge', () => {
...@@ -178,7 +178,7 @@ describe('noteActions', () => { ...@@ -178,7 +178,7 @@ describe('noteActions', () => {
}; };
beforeEach(() => { beforeEach(() => {
wrapper = shallowMountNoteActions(props, { wrapper = mountNoteActions(props, {
targetType: () => 'issue', targetType: () => 'issue',
}); });
store.state.noteableData = { store.state.noteableData = {
...@@ -205,7 +205,7 @@ describe('noteActions', () => { ...@@ -205,7 +205,7 @@ describe('noteActions', () => {
}; };
beforeEach(() => { beforeEach(() => {
wrapper = shallowMountNoteActions(props, { wrapper = mountNoteActions(props, {
targetType: () => 'issue', targetType: () => 'issue',
}); });
}); });
...@@ -221,7 +221,7 @@ describe('noteActions', () => { ...@@ -221,7 +221,7 @@ describe('noteActions', () => {
describe('user is not logged in', () => { describe('user is not logged in', () => {
beforeEach(() => { beforeEach(() => {
store.dispatch('setUserData', {}); store.dispatch('setUserData', {});
wrapper = shallowMountNoteActions({ wrapper = mountNoteActions({
...props, ...props,
canDelete: false, canDelete: false,
canEdit: false, canEdit: false,
...@@ -241,7 +241,7 @@ describe('noteActions', () => { ...@@ -241,7 +241,7 @@ describe('noteActions', () => {
describe('for showReply = true', () => { describe('for showReply = true', () => {
beforeEach(() => { beforeEach(() => {
wrapper = shallowMountNoteActions({ wrapper = mountNoteActions({
...props, ...props,
showReply: true, showReply: true,
}); });
...@@ -256,7 +256,7 @@ describe('noteActions', () => { ...@@ -256,7 +256,7 @@ describe('noteActions', () => {
describe('for showReply = false', () => { describe('for showReply = false', () => {
beforeEach(() => { beforeEach(() => {
wrapper = shallowMountNoteActions({ wrapper = mountNoteActions({
...props, ...props,
showReply: false, showReply: false,
}); });
...@@ -273,7 +273,7 @@ describe('noteActions', () => { ...@@ -273,7 +273,7 @@ describe('noteActions', () => {
beforeEach(() => { beforeEach(() => {
store.dispatch('setUserData', userDataMock); store.dispatch('setUserData', userDataMock);
wrapper = shallowMountNoteActions({ ...props, canResolve: true, isDraft: true }); wrapper = mountNoteActions({ ...props, canResolve: true, isDraft: true });
}); });
it('should render the right resolve button title', () => { it('should render the right resolve button title', () => {
......
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