Commit a85436d9 authored by Scott Stern's avatar Scott Stern Committed by Natalia Tepluhina

Add tooltips for wrk in progress limtis

Add tooltips for issues with and without
wrk in progress limits
parent 872f200d
...@@ -3,7 +3,7 @@ import Sortable from 'sortablejs'; ...@@ -3,7 +3,7 @@ import Sortable from 'sortablejs';
import Vue from 'vue'; import Vue from 'vue';
import { GlButtonGroup, GlButton, GlTooltip } from '@gitlab/ui'; import { GlButtonGroup, GlButton, GlTooltip } from '@gitlab/ui';
import isWipLimitsOn from 'ee_else_ce/boards/mixins/is_wip_limits'; import isWipLimitsOn from 'ee_else_ce/boards/mixins/is_wip_limits';
import { n__, s__ } from '~/locale'; import { s__, __, sprintf } from '~/locale';
import Icon from '~/vue_shared/components/icon.vue'; import Icon from '~/vue_shared/components/icon.vue';
import Tooltip from '~/vue_shared/directives/tooltip'; import Tooltip from '~/vue_shared/directives/tooltip';
import AccessorUtilities from '../../lib/utils/accessor'; import AccessorUtilities from '../../lib/utils/accessor';
...@@ -67,10 +67,13 @@ export default Vue.extend({ ...@@ -67,10 +67,13 @@ export default Vue.extend({
!this.disabled && this.list.type !== ListType.closed && this.list.type !== ListType.blank !this.disabled && this.list.type !== ListType.closed && this.list.type !== ListType.blank
); );
}, },
counterTooltip() { issuesTooltip() {
const { issuesSize } = this.list; const { issuesSize } = this.list;
return `${n__('%d issue', '%d issues', issuesSize)}`;
return sprintf(__('%{issuesSize} issues'), { issuesSize });
}, },
// Only needed to make karma pass.
weightCountToolTip() {}, // eslint-disable-line vue/return-in-computed-property
caretTooltip() { caretTooltip() {
return this.list.isExpanded ? s__('Boards|Collapse') : s__('Boards|Expand'); return this.list.isExpanded ? s__('Boards|Collapse') : s__('Boards|Expand');
}, },
......
...@@ -42,9 +42,10 @@ ...@@ -42,9 +42,10 @@
%button.board-delete.no-drag.p-0.border-0.has-tooltip.float-right{ type: "button", title: _("Delete list"), ":class": "{ 'd-none': !list.isExpanded }", "aria-label" => _("Delete list"), data: { placement: "bottom" }, "@click.stop" => "deleteBoard" } %button.board-delete.no-drag.p-0.border-0.has-tooltip.float-right{ type: "button", title: _("Delete list"), ":class": "{ 'd-none': !list.isExpanded }", "aria-label" => _("Delete list"), data: { placement: "bottom" }, "@click.stop" => "deleteBoard" }
= icon("trash") = icon("trash")
.issue-count-badge.pr-0.no-drag.text-secondary{ "v-if" => "showBoardListAndBoardInfo", ":title": "counterTooltip", "v-tooltip": true, data: { placement: "top" } } .issue-count-badge.pr-0.no-drag.text-secondary{ "v-if" => "showBoardListAndBoardInfo" }
%span.d-inline-flex %span.d-inline-flex
%span.issue-count-badge-count %gl-tooltip{ ":target" => "() => $refs.issueCount", ":title" => "issuesTooltip" }
%span.issue-count-badge-count{ "ref" => "issueCount" }
%icon.mr-1{ name: "issues" } %icon.mr-1{ name: "issues" }
%issue-count{ ":maxIssueCount" => "list.maxIssueCount", %issue-count{ ":maxIssueCount" => "list.maxIssueCount",
":issuesSize" => "list.issuesSize" } ":issuesSize" => "list.issuesSize" }
......
import { mapActions } from 'vuex'; import { mapActions } from 'vuex';
import boardPromotionState from 'ee/boards/components/board_promotion_state'; import boardPromotionState from 'ee/boards/components/board_promotion_state';
import { GlTooltip } from '@gitlab/ui';
import Board from '~/boards/components/board'; import Board from '~/boards/components/board';
import { __, n__, sprintf } from '~/locale'; import { __, sprintf, s__ } from '~/locale';
import boardsStore from '~/boards/stores/boards_store'; import boardsStore from '~/boards/stores/boards_store';
export default Board.extend({ export default Board.extend({
...@@ -11,22 +12,31 @@ export default Board.extend({ ...@@ -11,22 +12,31 @@ export default Board.extend({
}; };
}, },
components: { components: {
GlTooltip,
boardPromotionState, boardPromotionState,
}, },
computed: { computed: {
counterTooltip() { issuesTooltip() {
if (!this.weightFeatureAvailable) { const { issuesSize, maxIssueCount } = this.list;
// call computed property from base component (CE board.js)
return Board.options.computed.counterTooltip.call(this); if (maxIssueCount > 0) {
return sprintf(__('%{issuesSize} issues with a limit of %{maxIssueCount}'), {
issuesSize,
maxIssueCount,
});
}
// TODO: Remove this pattern.
return Board.options.computed.issuesTooltip.call(this);
},
weightCountToolTip() {
const { totalWeight } = this.list;
if (this.weightFeatureAvailable) {
return sprintf(s__('%{totalWeight} total weight'), { totalWeight });
} }
const { issuesSize, totalWeight } = this.list; return null;
return sprintf(
__(`${n__('%d issue', '%d issues', issuesSize)} with %{totalWeight} total weight`),
{
totalWeight,
},
);
}, },
}, },
methods: { methods: {
......
- if (@group || @project)&.feature_available?(:issue_weights) - if (@group || @project)&.feature_available?(:issue_weights)
%span.d-inline-flex.ml-2 %gl-tooltip{ ":target" => "() => $refs.weightTooltip", ":title" => "weightCountToolTip" }
%span.d-inline-flex.ml-2{ "ref" => "weightTooltip" }
%icon.mr-1{ name: "weight" } %icon.mr-1{ name: "weight" }
{{ list.totalWeight }} {{ list.totalWeight }}
...@@ -136,11 +136,12 @@ describe 'issue boards', :js do ...@@ -136,11 +136,12 @@ describe 'issue boards', :js do
end end
it 'hides weight' do it 'hides weight' do
expect(page).not_to have_text('2 issues')
backlog = board.lists.first backlog = board.lists.first
badge(backlog).hover badge(backlog).hover
tooltip = find("##{badge(backlog)['aria-describedby']}") expect(page).to have_text('2 issues')
expect(tooltip.text).to eq('2 issues')
end end
end end
end end
......
...@@ -284,6 +284,12 @@ msgstr "" ...@@ -284,6 +284,12 @@ msgstr ""
msgid "%{issuableType} will be removed! Are you sure?" msgid "%{issuableType} will be removed! Are you sure?"
msgstr "" msgstr ""
msgid "%{issuesSize} issues"
msgstr ""
msgid "%{issuesSize} issues with a limit of %{maxIssueCount}"
msgstr ""
msgid "%{label_for_message} unavailable" msgid "%{label_for_message} unavailable"
msgstr "" msgstr ""
...@@ -440,6 +446,9 @@ msgstr "" ...@@ -440,6 +446,9 @@ msgstr ""
msgid "%{title} changes" msgid "%{title} changes"
msgstr "" msgstr ""
msgid "%{totalWeight} total weight"
msgstr ""
msgid "%{total} open issue weight" msgid "%{total} open issue weight"
msgstr "" msgstr ""
......
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