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

Avoid board double submit

Oliver Günthere757aaf34e8a
diff --git a/frontend/src/app/modules/boards/board/add-list-modal/add-list-modal.component.ts b/frontend/src/app/modules/boards/board/add-list-modal/add-list-modal.component.ts
index 2d47535321f..b64807d4011 100644
--- a/frontend/src/app/modules/boards/board/add-list-modal/add-list-modal.component.ts
+++ b/frontend/src/app/modules/boards/board/add-list-modal/add-list-modal.component.ts
@@ -65,6 +65,9 @@ export class AddListModalComponent extends OpModalComponent implements OnInit {
/** The selected attribute */
public selectedAttribute:HalResource|undefined;
+ /** avoid double click */
+ public inFlight = false;
+
public trackByHref = AngularTrackingHelpers.trackByHref;
/* Do not close on outside click (because the select option are appended to the body */
@@ -122,14 +125,17 @@ export class AddListModalComponent extends OpModalComponent implements OnInit {
}
create() {
+ this.inFlight = true;
this.actionService
.addActionQuery(this.board, this.selectedAttribute!)
.then(board => this.boardService.save(board))
.then((board) => {
+ this.inFlight = false;
this.closeMe();
this.boardCache.update(board);
this.state.go('boards.show', { board_id: board.id, isNew: true });
- });
+ })
+ .catch(() => this.inFlight = false);
}
onNewActionCreated(newValue:HalResource) {
diff --git a/frontend/src/app/modules/boards/board/add-list-modal/add-list-modal.html b/frontend/src/app/modules/boards/board/add-list-modal/add-list-modal.html
index 46eb8217427..9cdad8c9f90 100644
--- a/frontend/src/app/modules/boards/board/add-list-modal/add-list-modal.html
+++ b/frontend/src/app/modules/boards/board/add-list-modal/add-list-modal.html
@@ -33,7 +33,7 @@
<div class="op-modal--modal-footer">
<button class="button -highlight"
(click)="create()"
- [disabled]="!this.selectedAttribute"
+ [disabled]="!this.selectedAttribute || inFlight"
[textContent]="text.button_continue"
[attr.title]="text.button_continue">
</button>