Skip to content

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

Remove Angular `NewBoardModalComponent`

Aaron Contrerasf38e5e58458f
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.html
index 9206dbae494..a5d6cc46fcb 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
@@ -12,7 +12,7 @@
<button
*ngIf="canCreateBoards$ | async"
class="button -alt-highlight -expand"
- (click)="showNewBoardModal()"
+ (click)="redirectToNewBoardForm()"
[title]="text.create_new_board"
data-qa-selector="sidebar--create-board-button"
>
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.ts
index b52de0fca4d..47471f47043 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
@@ -86,7 +86,7 @@ export class BoardsMenuComponent extends UntilDestroyedMixin implements OnInit {
});
}
- showNewBoardModal():void {
+ redirectToNewBoardForm():void {
const newBoardFormPath = (this.currentProject && this.currentProject.identifier)
? `${window.appBasePath}/projects/${this.currentProject.identifier}/boards/new`
: `${window.appBasePath}/boards/new`;
diff --git a/frontend/src/app/features/boards/new-board-modal/new-board-modal.component.ts b/frontend/src/app/features/boards/new-board-modal/new-board-modal.component.ts
deleted file mode 100644
index d4beae34ed7..00000000000
--- a/frontend/src/app/features/boards/new-board-modal/new-board-modal.component.ts
+++ /dev/null
@@ -1,198 +0,0 @@
-// -- copyright
-// OpenProject is an open source project management software.
-// Copyright (C) 2012-2023 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 COPYRIGHT and LICENSE files for more details.
-//++
-
-import {
- ChangeDetectorRef,
- Component,
- ElementRef,
- Inject,
- OnInit,
- ViewChild,
-} from '@angular/core';
-import { OpModalComponent } from 'core-app/shared/components/modal/modal.component';
-import { OpModalLocalsToken } from 'core-app/shared/components/modal/modal.service';
-import { OpModalLocalsMap } from 'core-app/shared/components/modal/modal.types';
-import { I18nService } from 'core-app/core/i18n/i18n.service';
-import { BoardType } from 'core-app/features/boards/board/board';
-import { StateService } from '@uirouter/core';
-import { BoardService } from 'core-app/features/boards/board/board.service';
-import { BoardActionsRegistryService } from 'core-app/features/boards/board/board-actions/board-actions-registry.service';
-import { LoadingIndicatorService } from 'core-app/core/loading-indicator/loading-indicator.service';
-import { HalResourceNotificationService } from 'core-app/features/hal/services/hal-resource-notification.service';
-import { imagePath } from 'core-app/shared/helpers/images/path-helper';
-import { ITileViewEntry } from '../tile-view/tile-view.component';
-import { BannersService } from 'core-app/core/enterprise/banners.service';
-import { ToastService } from 'core-app/shared/components/toaster/toast.service';
-import { enterpriseDocsUrl } from 'core-app/core/setup/globals/constants.const';
-
-@Component({
- templateUrl: './new-board-modal.html',
-})
-export class NewBoardModalComponent extends OpModalComponent implements OnInit {
- @ViewChild('actionAttributeSelect', { static: true }) actionAttributeSelect:ElementRef;
-
- public showClose = true;
-
- public confirmed = false;
-
- public available = this.boardActions.available();
-
- public inFlight = false;
-
- public eeShowBanners = false;
-
- public text = {
- close_popup: this.I18n.t('js.close_popup_title'),
-
- free_board: this.I18n.t('js.boards.board_type.free'),
- free_board_text: this.I18n.t('js.boards.board_type.free_text'),
- free_board_title: this.I18n.t('js.boards.board_type.board_type_title.basic'),
- board_type: this.I18n.t('js.boards.board_type.text'),
-
- action_board: this.I18n.t('js.boards.board_type.action'),
- action_board_text: this.I18n.t('js.boards.board_type.action_text'),
- select_attribute: this.I18n.t('js.boards.board_type.select_attribute'),
- select_board_type: this.I18n.t('js.boards.board_type.select_board_type'),
- placeholder: this.I18n.t('js.placeholders.selection'),
-
- teaser_text: this.I18n.t('js.boards.upsale.teaser_text'),
- upgrade_to_ee_text: this.I18n.t('js.boards.upsale.upgrade'),
- more_info_ee_link: enterpriseDocsUrl.boards,
- cancel_button: this.I18n.t('js.button_cancel'),
- };
-
- constructor(
- @Inject(OpModalLocalsToken) public locals:OpModalLocalsMap,
- readonly elementRef:ElementRef,
- readonly cdRef:ChangeDetectorRef,
- readonly state:StateService,
- readonly boardService:BoardService,
- readonly boardActions:BoardActionsRegistryService,
- readonly halNotification:HalResourceNotificationService,
- readonly loadingIndicatorService:LoadingIndicatorService,
- readonly I18n:I18nService,
- readonly boardActionRegistry:BoardActionsRegistryService,
- readonly bannersService:BannersService,
- readonly toastService:ToastService,
- ) {
- super(locals, cdRef, elementRef);
- this.initiateTiles();
- }
-
- ngOnInit():void {
- super.ngOnInit();
- this.eeShowBanners = this.bannersService.eeShowBanners;
- }
-
- public createBoard(attribute:string):void {
- if (attribute === 'basic') {
- this.createFree();
- } else {
- this.createAction(attribute);
- }
- }
-
- private initiateTiles() {
- this.available.unshift({
- attribute: 'basic',
- text: this.text.free_board_title,
- icon: 'icon-boards',
- description: this.text.free_board_text,
- image: imagePath('board_creation_modal/lists.svg'),
- });
- this.addIcon(this.available);
- this.addDescription(this.available);
- this.addText(this.available);
- this.addImage(this.available);
- }
-
- private createFree() {
- this.create({ type: 'free' });
- }
-
- private createAction(attribute:string):void {
- if (this.eeShowBanners) {
- this.toastService.addError(this.I18n.t('js.upsale.ee_only'));
- return;
- }
-
- this.create({ type: 'action', attribute });
- }
-
- private create(params:{ type:BoardType, attribute?:string }) {
- this.inFlight = true;
-
- this.loadingIndicatorService.modal.promise = this.boardService
- .create(params)
- .then((board) => {
- this.inFlight = false;
- this.closeMe();
- this.state.go('boards.partitioned.show', { board_id: board.id, isNew: true });
- })
- .catch((error:unknown) => {
- this.inFlight = false;
- this.halNotification.handleRawError(error);
- });
- }
-
- private addDescription(tiles:ITileViewEntry[]) {
- tiles.forEach((element) => {
- if (element.attribute !== 'basic') {
- const service = this.boardActionRegistry.get(element.attribute);
- element.description = service.description;
- }
- });
- }
-
- private addIcon(tiles:ITileViewEntry[]) {
- tiles.forEach((element) => {
- if (element.attribute !== 'basic') {
- const service = this.boardActionRegistry.get(element.attribute);
- element.icon = service.icon;
- }
- });
- }
-
- private addText(tiles:ITileViewEntry[]) {
- tiles.forEach((element) => {
- if (element.attribute !== 'basic') {
- const service = this.boardActionRegistry.get(element.attribute);
- element.text = service.text;
- }
- });
- }
-
- private addImage(tiles:ITileViewEntry[]) {
- tiles.forEach((element) => {
- if (element.attribute !== 'basic') {
- const service = this.boardActionRegistry.get(element.attribute);
- element.image = service.image;
- }
- });
- }
-}
diff --git a/frontend/src/app/features/boards/new-board-modal/new-board-modal.html b/frontend/src/app/features/boards/new-board-modal/new-board-modal.html
deleted file mode 100644
index 5716116870e..00000000000
--- a/frontend/src/app/features/boards/new-board-modal/new-board-modal.html
+++ /dev/null
@@ -1,44 +0,0 @@
-<div
- class="spot-modal spot-modal_wide confirm-form-submit--modal loading-indicator--location"
- data-indicator-name="modal"
->
- <div class="spot-modal--header">{{text.board_type}}</div>
-
- <div class="spot-divider"></div>
-
- <div class="spot-modal--body spot-container">
- <p
- *ngIf="eeShowBanners"
- >
- <op-enterprise-banner
- [linkMessage]="text.upgrade_to_ee_text"
- [textMessage]="text.teaser_text"
- [moreInfoLink]="text.more_info_ee_link"
- opReferrer="boards"
- ></op-enterprise-banner>
- </p>
- <p
- *ngIf="!eeShowBanners"
- class="spot-body-small"
- [textContent]="text.select_board_type"></p>
- <section class="new-board--section">
- <tile-view
- [tiles]="available"
- [disable]="inFlight"
- (create)="createBoard($event)">
- </tile-view>
- </section>
- </div>
-
- <div class="spot-action-bar hidden-for-mobile">
- <div class="spot-action-bar--right">
- <button
- type="button"
- class="button button_no-margin spot-action-bar--action spot-modal--cancel-button"
- (click)="closeMe()"
- >
- {{ text.cancel_button }}
- </button>
- </div>
- </div>
-</div>
diff --git a/frontend/src/app/features/boards/openproject-boards.module.ts b/frontend/src/app/features/boards/openproject-boards.module.ts
index 12c3788ea59..49f758e860e 100644
--- a/frontend/src/app/features/boards/openproject-boards.module.ts
+++ b/frontend/src/app/features/boards/openproject-boards.module.ts
@@ -37,7 +37,6 @@ import { BoardInlineAddAutocompleterComponent } from 'core-app/features/boards/b
import { BoardsToolbarMenuDirective } from 'core-app/features/boards/board/toolbar-menu/boards-toolbar-menu.directive';
import { BoardConfigurationModalComponent } from 'core-app/features/boards/board/configuration-modal/board-configuration.modal';
import { BoardsMenuComponent } from 'core-app/features/boards/boards-sidebar/boards-menu.component';
-import { NewBoardModalComponent } from 'core-app/features/boards/new-board-modal/new-board-modal.component';
import { AddListModalComponent } from 'core-app/features/boards/board/add-list-modal/add-list-modal.component';
import { BoardHighlightingTabComponent } from 'core-app/features/boards/board/configuration-modal/tabs/highlighting-tab.component';
import { AddCardDropdownMenuDirective } from 'core-app/features/boards/board/add-card-dropdown/add-card-dropdown-menu.directive';
@@ -83,7 +82,6 @@ import { TileViewComponent } from './tile-view/tile-view.component';
BoardConfigurationModalComponent,
BoardsToolbarMenuDirective,
BoardsMenuButtonComponent,
- NewBoardModalComponent,
AddListModalComponent,
AddCardDropdownMenuDirective,
BoardListMenuComponent,