Merge pull request #7200 from opf/fix/board-medley

Medley of board fixes

[ci skip]
pull/7202/head
Oliver Günther 6 years ago committed by GitHub
commit 10db6171c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      frontend/src/app/modules/boards/board/board-filter/board-filter.component.ts
  2. 20
      frontend/src/app/modules/boards/board/board.component.ts
  3. 2
      frontend/src/app/modules/boards/board/board.service.ts
  4. 1
      frontend/src/app/modules/boards/boards-sidebar/boards-menu.component.html
  5. 4
      modules/boards/spec/features/board_management_spec.rb
  6. 4
      modules/boards/spec/features/support/board_page.rb

@ -32,6 +32,8 @@ export class BoardFilterComponent implements OnDestroy {
@Output() public onFiltersChanged = new DebouncedEventEmitter<ApiV3Filter[]>(componentDestroyed(this));
initialized = false;
constructor(private readonly currentProjectService:CurrentProjectService,
private readonly querySpace:IsolatedQuerySpace,
private readonly halResourceService:HalResourceService,
@ -50,6 +52,14 @@ export class BoardFilterComponent implements OnDestroy {
* when children are loaded.
*/
public doInitialize():void {
if (this.initialized) {
return;
}
// Since we're being called from the board component
// ensure this happens only once.
this.initialized = true;
// Initially load the form once to be able to render filters
this.loadQueryForm();

@ -24,12 +24,11 @@ import {OpModalService} from "core-components/op-modals/op-modal.service";
import {AddListModalComponent} from "core-app/modules/boards/board/add-list-modal/add-list-modal.component";
import {DynamicCssService} from "core-app/modules/common/dynamic-css/dynamic-css.service";
import {BannersService} from "core-app/modules/common/enterprise/banners.service";
import {QueryFilterInstanceResource} from "core-app/modules/hal/resources/query-filter-instance-resource";
import {ApiV3Filter} from "core-components/api/api-v3/api-v3-filter-builder";
import {RequestSwitchmap} from "core-app/helpers/rxjs/request-switchmap";
import {from} from "rxjs";
import {BoardFilterComponent} from "core-app/modules/boards/board/board-filter/board-filter.component";
import {delay} from "rxjs/operators";
import {WorkPackageNotificationService} from "core-components/wp-edit/wp-notification.service";
@Component({
selector: 'board',
@ -92,7 +91,10 @@ export class BoardComponent implements OnInit, OnDestroy {
this.inFlight = false;
return board;
})
.catch(() => this.inFlight = false);
.catch((error) => {
this.inFlight = false;
throw error;
});
return from(promise);
}
@ -103,6 +105,7 @@ export class BoardComponent implements OnInit, OnDestroy {
constructor(public readonly state:StateService,
private readonly I18n:I18nService,
private readonly notifications:NotificationsService,
private readonly wpNotifications:WorkPackageNotificationService,
private readonly BoardList:BoardListsService,
private readonly opModalService:OpModalService,
private readonly injector:Injector,
@ -122,10 +125,13 @@ export class BoardComponent implements OnInit, OnDestroy {
this.boardSaver
.observe(componentDestroyed(this))
.subscribe((board:Board) => {
this.BoardCache.update(board);
this.notifications.addSuccess(this.text.updateSuccessful);
});
.subscribe(
(board:Board) => {
this.BoardCache.update(board);
this.notifications.addSuccess(this.text.updateSuccessful);
},
(error:unknown) => this.wpNotifications.handleRawError(error)
);
this.BoardCache
.observe(id)

@ -123,7 +123,7 @@ export class BoardService {
* @param board
*/
private reorderWidgets(board:Board) {
board.grid.columnCount = board.grid.widgets.length;
board.grid.columnCount = Math.max(board.grid.widgets.length, 1);
board.grid.widgets.map((el:GridWidgetResource, index:number) => {
el.startColumn = index + 1;
el.endColumn = index + 2;

@ -3,6 +3,7 @@
<li *ngFor="let board of boards;trackBy:trackById">
<a [textContent]="board.name"
uiSref="boards.show"
[uiOptions]="{ reload: true }"
[uiParams]="{ board_id: board.id, query_props: '' }"
class="main-menu--children-sub-item ellipsis">
</a>

@ -155,6 +155,10 @@ describe 'Board management spec', type: :feature, js: true do
expect(queries.first.name).to eq 'First'
expect(queries.first.ordered_work_packages).to be_empty
# Remove first list
board_page.remove_list 'First'
board_page.expect_empty
# Remove entire board
board_page.delete_board
board_index.expect_board 'Board foo', present: false

@ -181,6 +181,10 @@ module Pages
expect(page).to have_field('editable-toolbar-title', with: name)
end
def expect_empty
expect(page).to have_no_selector('.boards-list--item')
end
def remove_list(name)
within_list(name) do
page.find('.board-list--delete-icon a').click

Loading…
Cancel
Save