OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
[36277] Boards list not ordered (#9586)
Behrokh Satarnejadb58743503493
diff --git a/frontend/src/app/features/boards/boards-sidebar/boards-menu.component.html b/frontend/src/app/features/boards/boards-sidebar/boards-menu.component.htmlindex 26cd2e31d26..99d7c63bc71 100644--- a/frontend/src/app/features/boards/boards-sidebar/boards-menu.component.html+++ b/frontend/src/app/features/boards/boards-sidebar/boards-menu.component.html@@ -6,7 +6,9 @@[uiOptions]="{ reload: true }"[uiParams]="{ board_id: board.id, query_props: '', projects: 'projects', projectPath: currentProjectIdentifier }"class="main-menu--children-sub-item ellipsis"- [ngClass]=" {'selected': selectedBoardId === board.id }">+ [ngClass]=" {'selected': selectedBoardId === board.id }"+ data-qa-selector="boards-menu--item"+ ></a></li></ul>diff --git a/frontend/src/app/features/boards/boards-sidebar/boards-menu.component.ts b/frontend/src/app/features/boards/boards-sidebar/boards-menu.component.tsindex 67658d5bcf2..60e857547cf 100644--- a/frontend/src/app/features/boards/boards-sidebar/boards-menu.component.ts+++ b/frontend/src/app/features/boards/boards-sidebar/boards-menu.component.ts@@ -28,15 +28,7 @@ export class BoardsMenuComponent extends UntilDestroyedMixin implements OnInit {.boards.observeAll().pipe(- map((boards:Board[]) => boards.sort((a, b) => {- if (a.name < b.name) {- return -1;- }- if (a.name > b.name) {- return 1;- }- return 0;- })),+ map((boards:Board[]) => boards.sort((a, b) => a.name.localeCompare(b.name))),);constructor(private readonly boardService:BoardService,diff --git a/frontend/src/app/features/boards/index-page/boards-index-page.component.html b/frontend/src/app/features/boards/index-page/boards-index-page.component.htmlindex 7c18c26462c..7e4f6cbbc94 100644--- a/frontend/src/app/features/boards/index-page/boards-index-page.component.html+++ b/frontend/src/app/features/boards/index-page/boards-index-page.component.html@@ -77,7 +77,10 @@</td></tr><tr *ngFor="let board of boards">- <td class="name">+ <td+ class="name"+ data-qa-selector="boards-table-column--name"+ ><a [textContent]="board.name"uiSref="boards.partitioned.show"[uiParams]="{ board_id: board.id }">diff --git a/frontend/src/app/features/boards/index-page/boards-index-page.component.ts b/frontend/src/app/features/boards/index-page/boards-index-page.component.tsindex fe2a831c0fd..8aca85625eb 100644--- a/frontend/src/app/features/boards/index-page/boards-index-page.component.ts+++ b/frontend/src/app/features/boards/index-page/boards-index-page.component.ts@@ -17,6 +17,7 @@ import { boardTeaserVideoURL } from 'core-app/features/boards/board-constants.coimport { UntilDestroyedMixin } from 'core-app/shared/helpers/angular/until-destroyed.mixin';import { componentDestroyed } from '@w11k/ngx-componentdestroyed';import { APIV3Service } from 'core-app/core/apiv3/api-v3.service';+import { map } from 'rxjs/operators';@Component({templateUrl: './boards-index-page.component.html',@@ -48,7 +49,10 @@ export class BoardsIndexPageComponent extends UntilDestroyedMixin implements OnIpublic boards$:Observable<Board[]> = this.apiV3Service.boards- .observeAll();+ .observeAll()+ .pipe(+ map((boards:Board[]) => boards.sort((a, b) => a.name.localeCompare(b.name))),+ );teaserVideoURL = this.domSanitizer.bypassSecurityTrustResourceUrl(boardTeaserVideoURL);diff --git a/modules/boards/spec/features/boards_sorting_spec.rb b/modules/boards/spec/features/boards_sorting_spec.rbnew file mode 100644index 00000000000..c2b40e8de2f--- /dev/null+++ b/modules/boards/spec/features/boards_sorting_spec.rb@@ -0,0 +1,74 @@+#-- copyright+# OpenProject is an open source project management software.+# Copyright (C) 2012-2021 the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2013 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See docs/COPYRIGHT.rdoc for more details.+#++++require 'spec_helper'+require_relative './support/board_index_page'+require_relative './support/board_page'++describe 'Work Package boards sorting spec', type: :feature, js: true do+ let(:admin) { FactoryBot.create(:admin) }+ let(:project) { FactoryBot.create(:project, enabled_module_names: %i[work_package_tracking board_view]) }+ let(:board_index) { Pages::BoardIndex.new(project) }+ let!(:status) { FactoryBot.create :default_status }+ let(:version) { @version ||= FactoryBot.create(:version, project: project) }++ before do+ with_enterprise_token :board_view+ project+ login_as(admin)+ board_index.visit!+ end++ # By adding each board the sort of table will change+ # The currently added board should be at the top+ it 'sorts the boards grid and menu based on their names' do+ board_page = board_index.create_board action: nil+ board_page.back_to_index++ expect(page.first('[data-qa-selector="boards-table-column--name"]'))+ .to have_text('Unnamed board')+ expect(page.first('[data-qa-selector="boards-menu--item"]'))+ .to have_text('Unnamed board')++ board_page = board_index.create_board action: :Version, expect_empty: true+ board_page.back_to_index++ expect(page.first('[data-qa-selector="boards-table-column--name"]'))+ .to have_text('Action board (version)')+ expect(page.first('[data-qa-selector="boards-menu--item"]'))+ .to have_text('Action board (version)')++ board_page = board_index.create_board action: :Status+ board_page.back_to_index++ expect(page.first('[data-qa-selector="boards-table-column--name"]'))+ .to have_text('Action board (status)')+ expect(page.first('[data-qa-selector="boards-menu--item"]'))+ .to have_text('Action board (status)')+ end+enddiff --git a/modules/boards/spec/features/support/board_page.rb b/modules/boards/spec/features/support/board_page.rbindex 16234d0a2e1..9935bfc3138 100644--- a/modules/boards/spec/features/support/board_page.rb+++ b/modules/boards/spec/features/support/board_page.rb@@ -276,7 +276,7 @@ module Pagesenddef back_to_index- find('.back-button').click+ find('[data-qa-selector="op-back-button"]').clickenddef expect_editable_board(editable)