Commit ac01a943 authored by Kushal Pandya's avatar Kushal Pandya

Merge branch 'psi-remove-board-html' into 'master'

Remove sfc_issue_boards feature flag and friends

Closes #212300

See merge request gitlab-org/gitlab!32661
parents 333c6d55 d9f5af79
......@@ -280,7 +280,6 @@ linters:
- "app/views/shared/_no_password.html.haml"
- "app/views/shared/_ping_consent.html.haml"
- "app/views/shared/_project_limit.html.haml"
- "app/views/shared/boards/components/_board.html.haml"
- "app/views/shared/boards/components/_sidebar.html.haml"
- "app/views/shared/boards/components/sidebar/_due_date.html.haml"
- "app/views/shared/boards/components/sidebar/_labels.html.haml"
......@@ -372,7 +371,6 @@ linters:
- "ee/app/views/projects/services/gitlab_slack_application/_slack_integration_form.html.haml"
- "ee/app/views/projects/settings/slacks/edit.html.haml"
- "ee/app/views/shared/_mirror_update_button.html.haml"
- "ee/app/views/shared/boards/components/_list_weight.html.haml"
- "ee/app/views/shared/epic/_search_bar.html.haml"
- "ee/app/views/shared/issuable/_approvals.html.haml"
- "ee/app/views/shared/issuable/_board_create_list_dropdown.html.haml"
......
import $ from 'jquery';
import Sortable from 'sortablejs';
import Vue from 'vue';
import { GlButtonGroup, GlDeprecatedButton, GlLabel, GlTooltip } from '@gitlab/ui';
import isWipLimitsOn from 'ee_else_ce/boards/mixins/is_wip_limits';
import { s__, __, sprintf } from '~/locale';
import Icon from '~/vue_shared/components/icon.vue';
import Tooltip from '~/vue_shared/directives/tooltip';
import AccessorUtilities from '../../lib/utils/accessor';
import BoardBlankState from './board_blank_state.vue';
import BoardDelete from './board_delete';
import BoardList from './board_list.vue';
import IssueCount from './issue_count.vue';
import boardsStore from '../stores/boards_store';
import { getBoardSortableDefaultOptions, sortableEnd } from '../mixins/sortable_default_options';
import { ListType } from '../constants';
import { isScopedLabel } from '~/lib/utils/common_utils';
/**
* Please don't edit this file, have a look at:
* ./board_column.vue
* https://gitlab.com/gitlab-org/gitlab/-/issues/212300
*
* This file here will be deleted soon
* @deprecated
*/
export default Vue.extend({
components: {
BoardBlankState,
BoardDelete,
BoardList,
Icon,
GlButtonGroup,
IssueCount,
GlDeprecatedButton,
GlLabel,
GlTooltip,
},
directives: {
Tooltip,
},
mixins: [isWipLimitsOn],
props: {
list: {
type: Object,
default: () => ({}),
required: false,
},
disabled: {
type: Boolean,
required: true,
},
issueLinkBase: {
type: String,
required: true,
},
rootPath: {
type: String,
required: true,
},
boardId: {
type: String,
required: true,
},
// Does not do anything but is used
// to support the API of the new board_column.vue
canAdminList: {
type: Boolean,
required: false,
default: false,
},
},
data() {
return {
detailIssue: boardsStore.detail,
filter: boardsStore.filter,
};
},
computed: {
isLoggedIn() {
return Boolean(gon.current_user_id);
},
showListHeaderButton() {
return (
!this.disabled && this.list.type !== ListType.closed && this.list.type !== ListType.blank
);
},
issuesTooltip() {
const { issuesSize } = this.list;
return sprintf(__('%{issuesSize} issues'), { issuesSize });
},
// Only needed to make karma pass.
weightCountToolTip() {}, // eslint-disable-line vue/return-in-computed-property
caretTooltip() {
return this.list.isExpanded ? s__('Boards|Collapse') : s__('Boards|Expand');
},
isNewIssueShown() {
return this.list.type === ListType.backlog || this.showListHeaderButton;
},
isSettingsShown() {
return (
this.list.type !== ListType.backlog &&
this.showListHeaderButton &&
this.list.isExpanded &&
this.isWipLimitsOn
);
},
showBoardListAndBoardInfo() {
return this.list.type !== ListType.blank && this.list.type !== ListType.promotion;
},
uniqueKey() {
// eslint-disable-next-line @gitlab/require-i18n-strings
return `boards.${this.boardId}.${this.list.type}.${this.list.id}`;
},
},
watch: {
filter: {
handler() {
this.list.page = 1;
this.list.getIssues(true).catch(() => {
// TODO: handle request error
});
},
deep: true,
},
},
mounted() {
const instance = this;
const sortableOptions = getBoardSortableDefaultOptions({
disabled: this.disabled,
group: 'boards',
draggable: '.is-draggable',
handle: '.js-board-handle',
onEnd(e) {
sortableEnd();
const sortable = this;
if (e.newIndex !== undefined && e.oldIndex !== e.newIndex) {
const order = sortable.toArray();
const list = boardsStore.findList('id', parseInt(e.item.dataset.id, 10));
instance.$nextTick(() => {
boardsStore.moveList(list, order);
});
}
},
});
Sortable.create(this.$el.parentNode, sortableOptions);
},
created() {
if (
this.list.isExpandable &&
AccessorUtilities.isLocalStorageAccessSafe() &&
!this.isLoggedIn
) {
const isCollapsed = localStorage.getItem(`${this.uniqueKey}.expanded`) === 'false';
this.list.isExpanded = !isCollapsed;
}
},
methods: {
showScopedLabels(label) {
return boardsStore.scopedLabels.enabled && isScopedLabel(label);
},
showNewIssueForm() {
this.$refs['board-list'].showIssueForm = !this.$refs['board-list'].showIssueForm;
},
toggleExpanded() {
if (this.list.isExpandable) {
this.list.isExpanded = !this.list.isExpanded;
if (AccessorUtilities.isLocalStorageAccessSafe() && !this.isLoggedIn) {
localStorage.setItem(`${this.uniqueKey}.expanded`, this.list.isExpanded);
}
if (this.isLoggedIn) {
this.list.update();
}
// When expanding/collapsing, the tooltip on the caret button sometimes stays open.
// Close all tooltips manually to prevent dangling tooltips.
$('.tooltip').tooltip('hide');
}
},
},
template: '#js-board-template',
});
......@@ -80,15 +80,7 @@ export default () => {
el: $boardApp,
components: {
BoardContent,
Board: () =>
window?.gon?.features?.sfcIssueBoards
? import('ee_else_ce/boards/components/board_column.vue')
: /**
* Please have a look at, we are moving to the SFC soon:
* https://gitlab.com/gitlab-org/gitlab/-/issues/212300
* @deprecated
*/
import('ee_else_ce/boards/components/board'),
Board: () => import('ee_else_ce/boards/components/board_column.vue'),
BoardSidebar,
BoardAddIssuesModal,
BoardSettingsSidebar: () =>
......
......@@ -8,7 +8,6 @@ class Groups::BoardsController < Groups::ApplicationController
before_action :assign_endpoint_vars
before_action do
push_frontend_feature_flag(:multi_select_board, default_enabled: true)
push_frontend_feature_flag(:sfc_issue_boards, default_enabled: true)
push_frontend_feature_flag(:boards_with_swimlanes, group, default_enabled: false)
end
......
......@@ -9,7 +9,6 @@ class Projects::BoardsController < Projects::ApplicationController
before_action :assign_endpoint_vars
before_action do
push_frontend_feature_flag(:multi_select_board, default_enabled: true)
push_frontend_feature_flag(:sfc_issue_boards, default_enabled: true)
end
private
......
......@@ -13,7 +13,6 @@
- content_for :page_specific_javascripts do
-# haml-lint:disable InlineJavaScript
%script#js-board-template{ type: "text/x-template" }= render "shared/boards/components/board"
%script#js-board-modal-filter{ type: "text/x-template" }= render "shared/issuable/search_bar", type: :boards_modal, show_sorting_dropdown: false
%script#js-board-promotion{ type: "text/x-template" }= render_if_exists "shared/promotions/promote_issue_board"
......
-# Please have a look at app/assets/javascripts/boards/components/board_column.vue
This haml file is deprecated and will be deleted soon, please change the Vue app
https://gitlab.com/gitlab-org/gitlab/-/issues/212300
.board.h-100.px-2.align-top.ws-normal{ ":class" => '{ "is-draggable": !list.preset, "is-expandable": list.isExpandable, "is-collapsed": !list.isExpanded, "board-type-assignee": list.type === "assignee" }',
":data-id" => "list.id", data: { qa_selector: "board_list" } }
.board-inner.d-flex.flex-column.position-relative.h-100.rounded
%header.board-header{ ":class" => '{ "has-border": list.label && list.label.color, "position-relative": list.isExpanded, "position-absolute position-top-0 position-left-0 w-100 h-100": !list.isExpanded }', ":style" => "{ borderTopColor: (list.label && list.label.color ? list.label.color : null) }", data: { qa_selector: "board_list_header" } }
%h3.board-title.m-0.d-flex.js-board-handle{ ":class" => '{ "user-can-drag": (!disabled && !list.preset), "border-bottom-0": !list.isExpanded }' }
.board-title-caret.no-drag{ "v-if": "list.isExpandable",
"aria-hidden": "true",
":aria-label": "caretTooltip",
":title": "caretTooltip",
"v-tooltip": "",
data: { placement: "bottom" },
"@click": "toggleExpanded" }
%i.fa.fa-fw{ ":class": '{ "fa-caret-right": list.isExpanded, "fa-caret-down": !list.isExpanded }' }
= render_if_exists "shared/boards/components/list_milestone"
%a.user-avatar-link.js-no-trigger{ "v-if": "list.type === \"assignee\"", ":href": "list.assignee.path" }
-# haml-lint:disable AltText
%img.avatar.s20.has-tooltip{ height: "20", width: "20", ":src": "list.assignee.avatar", ":alt": "list.assignee.name" }
.board-title-text
%span.board-title-main-text.block-truncated{ "v-if": "list.type !== \"label\"",
":title" => '((list.label && list.label.description) || list.title || "")',
data: { container: "body" },
":class": "{ 'has-tooltip': !['backlog', 'closed'].includes(list.type), 'd-block': list.type === 'milestone' }" }
{{ list.title }}
%span.board-title-sub-text.prepend-left-5.has-tooltip{ "v-if": "list.type === \"assignee\"",
":title" => '(list.assignee && list.assignee.username || "")' }
@{{ list.assignee.username }}
%gl-label{ "v-if" => " list.type === \"label\"",
":background-color" => "list.label.color",
":title" => "list.label.title",
":description" => "list.label.description",
"tooltipPlacement" => "bottom",
":size" => '(!list.isExpanded ? "sm" : "")',
":scoped" => "showScopedLabels(list.label)" }
- if can?(current_user, :admin_list, current_board_parent)
%board-delete{ "inline-template" => true,
":list" => "list",
"v-if" => "!list.preset && list.id" }
%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")
.issue-count-badge.pr-0.no-drag.text-secondary{ "v-if" => "showBoardListAndBoardInfo" }
%span.d-inline-flex
%gl-tooltip{ ":target" => "() => $refs.issueCount", ":title" => "issuesTooltip" }
%span.issue-count-badge-count{ "ref" => "issueCount" }
%icon.mr-1{ name: "issues" }
%issue-count{ ":maxIssueCount" => "list.maxIssueCount",
":issuesSize" => "list.issuesSize" }
= render_if_exists "shared/boards/components/list_weight"
%gl-button-group.board-list-button-group.pl-2{ "v-if" => "isNewIssueShown || isSettingsShown" }
%gl-deprecated-button.issue-count-badge-add-button.no-drag{ type: "button",
"@click" => "showNewIssueForm",
"v-if" => "isNewIssueShown",
":class": "{ 'd-none': !list.isExpanded, 'rounded-right': isNewIssueShown && !isSettingsShown }",
"aria-label" => _("New issue"),
"ref" => "newIssueBtn" }
= icon("plus")
%gl-tooltip{ ":target" => "() => $refs.newIssueBtn" }
= _("New Issue")
= render_if_exists 'shared/boards/components/list_settings'
%board-list{ "v-if" => "showBoardListAndBoardInfo",
":list" => "list",
":issues" => "list.issues",
":loading" => "list.loading",
":disabled" => "disabled",
":issue-link-base" => "issueLinkBase",
":root-path" => "rootPath",
":groupId" => ((current_board_parent.id if @group) || 'null'),
"ref" => "board-list" }
- if can?(current_user, :admin_list, current_board_parent)
%board-blank-state{ "v-if" => 'list.id == "blank"' }
= render_if_exists 'shared/boards/board_promotion_state'
import { mapActions, mapState } from 'vuex';
import boardPromotionState from 'ee/boards/components/board_promotion_state';
import { GlTooltip } from '@gitlab/ui';
import Board from '~/boards/components/board';
import { __, sprintf, s__ } from '~/locale';
import boardsStore from '~/boards/stores/boards_store';
import eventHub from '~/sidebar/event_hub';
/**
* Please have a look at:
* ./board_column.vue
* https://gitlab.com/gitlab-org/gitlab/-/issues/212300
* @deprecated
*/
export default Board.extend({
data() {
return {
weightFeatureAvailable: boardsStore.weightFeatureAvailable,
};
},
components: {
GlTooltip,
boardPromotionState,
},
computed: {
...mapState(['activeListId']),
issuesTooltip() {
const { issuesSize, maxIssueCount } = this.list;
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 });
}
return null;
},
},
methods: {
...mapActions(['setActiveListId']),
openSidebarSettings() {
// If no list is opened, close all sidebars first
if (!this.activeListId) {
eventHub.$emit('sidebar.closeAll');
}
this.setActiveListId(this.list.id);
},
},
});
%board-promotion-state{ "v-if" => 'list.id == "promotion"' }
= content_tag(:span, sprite_icon('timer', size: 16), { "v-if": "list.milestone", "aria-hidden": "true", "class": "append-right-5 milestone-icon" })
- if current_board_parent.feature_available?(:wip_limits)
%gl-deprecated-button.no-drag.rounded-right{ type: "button",
"@click" => "openSidebarSettings",
"v-if" => "isSettingsShown",
"aria-label" => _("List settings"),
"ref" => "settingsBtn",
"title" => _("List settings") }
= sprite_icon("settings")
%gl-tooltip{ ":target" => "() => $refs.settingsBtn" }
= _("List settings")
- if (@group || @project)&.feature_available?(:issue_weights)
%gl-tooltip{ ":target" => "() => $refs.weightTooltip", ":title" => "weightCountToolTip" }
%span.d-inline-flex.ml-2{ "ref" => "weightTooltip" }
%icon.mr-1{ name: "weight" }
{{ list.totalWeight }}
......@@ -39,11 +39,6 @@ module QA
element :boards_list
end
view 'app/views/shared/boards/components/_board.html.haml' do
element :board_list
element :board_list_header
end
view 'app/assets/javascripts/boards/toggle_focus.js' do
element :focus_mode_button
end
......
......@@ -6,7 +6,7 @@ import '~/boards/models/assignee';
import '~/boards/models/issue';
import '~/boards/models/list';
import IssueCardInner from '~/boards/components/issue_card_inner.vue';
import { listObj } from '../../javascripts/boards/mock_data';
import { listObj } from './mock_data';
import store from '~/boards/stores';
import { GlLabel } from '@gitlab/ui';
......
import { shallowMount } from '@vue/test-utils';
import UserAvatarLink from '~/vue_shared/components/user_avatar/user_avatar_link.vue';
import IssueAssignees from '~/vue_shared/components/issue/issue_assignees.vue';
import { mockAssigneesList } from '../../../../javascripts/boards/mock_data';
import { mockAssigneesList } from 'jest/boards/mock_data';
const TEST_CSS_CLASSES = 'test-classes';
const TEST_MAX_VISIBLE = 4;
......
......@@ -4,7 +4,7 @@ import { shallowMount } from '@vue/test-utils';
import IssueMilestone from '~/vue_shared/components/issue/issue_milestone.vue';
import Icon from '~/vue_shared/components/icon.vue';
import { mockMilestone } from '../../../../javascripts/boards/mock_data';
import { mockMilestone } from 'jest/boards/mock_data';
const createComponent = (milestone = mockMilestone) => {
const Component = Vue.extend(IssueMilestone);
......
import Vue from 'vue';
import Board from '~/boards/components/board';
import List from '~/boards/models/list';
describe('Board component', () => {
let vm;
const createComponent = ({ gon = {}, collapsed = false, listType = 'backlog' } = {}) => {
if (Object.prototype.hasOwnProperty.call(gon, 'current_user_id')) {
window.gon = gon;
} else {
window.gon = {};
}
const el = document.createElement('div');
document.body.appendChild(el);
vm = new Board({
propsData: {
boardId: '1',
disabled: false,
issueLinkBase: '/',
rootPath: '/',
list: new List({
id: 1,
position: 0,
title: 'test',
list_type: listType,
collapsed,
}),
},
}).$mount(el);
};
const setUpTests = (done, opts = {}) => {
loadFixtures('boards/show.html');
createComponent(opts);
Vue.nextTick(done);
};
const cleanUpTests = spy => {
if (spy) {
spy.calls.reset();
}
vm.$destroy();
// remove the component from the DOM
document.querySelector('.board').remove();
localStorage.removeItem(`${vm.uniqueKey}.expanded`);
};
describe('List', () => {
it('board is expandable when list type is closed', () => {
expect(new List({ id: 1, list_type: 'closed' }).isExpandable).toBe(true);
});
it('board is expandable when list type is label', () => {
expect(new List({ id: 1, list_type: 'closed' }).isExpandable).toBe(true);
});
it('board is not expandable when list type is blank', () => {
expect(new List({ id: 1, list_type: 'blank' }).isExpandable).toBe(false);
});
});
describe('when clicking the header', () => {
beforeEach(done => {
setUpTests(done);
});
afterEach(() => {
cleanUpTests();
});
it('does not collapse', done => {
vm.list.isExpanded = true;
vm.$el.querySelector('.board-header').click();
Vue.nextTick()
.then(() => {
expect(vm.$el.classList.contains('is-collapsed')).toBe(false);
})
.then(done)
.catch(done.fail);
});
});
describe('when clicking the collapse icon', () => {
beforeEach(done => {
setUpTests(done);
});
afterEach(() => {
cleanUpTests();
});
it('collapses', done => {
Vue.nextTick()
.then(() => {
vm.$el.querySelector('.board-title-caret').click();
})
.then(() => {
expect(vm.$el.classList.contains('is-collapsed')).toBe(true);
})
.then(done)
.catch(done.fail);
});
});
describe('when clicking the expand icon', () => {
beforeEach(done => {
setUpTests(done);
});
afterEach(() => {
cleanUpTests();
});
it('expands', done => {
vm.list.isExpanded = false;
Vue.nextTick()
.then(() => {
vm.$el.querySelector('.board-title-caret').click();
})
.then(() => {
expect(vm.$el.classList.contains('is-collapsed')).toBe(false);
})
.then(done)
.catch(done.fail);
});
});
describe('when collapsed is false', () => {
beforeEach(done => {
setUpTests(done);
});
afterEach(() => {
cleanUpTests();
});
it('is expanded when collapsed is false', () => {
expect(vm.list.isExpanded).toBe(true);
expect(vm.$el.classList.contains('is-collapsed')).toBe(false);
});
});
describe('when list type is blank', () => {
beforeEach(done => {
setUpTests(done, { listType: 'blank' });
});
afterEach(() => {
cleanUpTests();
});
it('does not render add issue button when list type is blank', done => {
Vue.nextTick(() => {
expect(vm.$el.querySelector('.issue-count-badge-add-button')).toBeNull();
done();
});
});
});
describe('when list type is backlog', () => {
beforeEach(done => {
setUpTests(done);
});
afterEach(() => {
cleanUpTests();
});
it('board is expandable', () => {
expect(vm.$el.classList.contains('is-expandable')).toBe(true);
});
});
describe('when logged in', () => {
let spy;
beforeEach(done => {
spy = spyOn(List.prototype, 'update');
setUpTests(done, { gon: { current_user_id: 1 } });
});
afterEach(() => {
cleanUpTests(spy);
});
it('calls list update', done => {
Vue.nextTick()
.then(() => {
vm.$el.querySelector('.board-title-caret').click();
})
.then(() => {
expect(vm.list.update).toHaveBeenCalledTimes(1);
})
.then(done)
.catch(done.fail);
});
});
describe('when logged out', () => {
let spy;
beforeEach(done => {
spy = spyOn(List.prototype, 'update');
setUpTests(done, { collapsed: false });
});
afterEach(() => {
cleanUpTests(spy);
});
// can only be one or the other cant toggle window.gon.current_user_id states.
it('clicking on the caret does not call list update', done => {
Vue.nextTick()
.then(() => {
vm.$el.querySelector('.board-title-caret').click();
})
.then(() => {
expect(vm.list.update).toHaveBeenCalledTimes(0);
})
.then(done)
.catch(done.fail);
});
it('sets expanded to be the opposite of its value when toggleExpanded is called', done => {
const expanded = true;
vm.list.isExpanded = expanded;
vm.toggleExpanded();
Vue.nextTick()
.then(() => {
expect(vm.list.isExpanded).toBe(!expanded);
expect(localStorage.getItem(`${vm.uniqueKey}.expanded`)).toBe(String(!expanded));
})
.then(done)
.catch(done.fail);
});
it('does render add issue button', () => {
expect(vm.$el.querySelector('.issue-count-badge-add-button')).not.toBeNull();
});
});
});
export * from '../../frontend/boards/mock_data';
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