Merge pull request #7191 from opf/fix/29905/do-not-save-board-filters

[29905] Do not save board filters unless explicitly saved
pull/7195/head
Henriette Dinger 6 years ago committed by GitHub
commit 37eb61b3c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 13
      frontend/src/app/modules/boards/board/board-filter/board-filter.component.ts
  2. 3
      frontend/src/app/modules/boards/board/board.component.html
  3. 9
      frontend/src/app/modules/boards/board/board.component.ts

@ -21,9 +21,16 @@ import {ApiV3Filter} from "core-components/api/api-v3/api-v3-filter-builder";
templateUrl: './board-filter.component.html'
})
export class BoardFilterComponent implements OnInit, OnDestroy {
/** Current active */
@Input() public board:Board;
@Output() public filters = new DebouncedEventEmitter<ApiV3Filter[]>(componentDestroyed(this));
/** Transient set of active filters
* Either from saved board (then filters === board.filters)
* or from the unsaved query props
*/
@Input() public filters:ApiV3Filter[];
@Output() public onFiltersChanged = new DebouncedEventEmitter<ApiV3Filter[]>(componentDestroyed(this));
constructor(private readonly currentProjectService:CurrentProjectService,
private readonly querySpace:IsolatedQuerySpace,
@ -62,7 +69,7 @@ export class BoardFilterComponent implements OnInit, OnDestroy {
let filterHash = this.urlParamsHelper.buildV3GetFilters(filters);
let query_props = JSON.stringify(filterHash);
this.filters.emit(filterHash);
this.onFiltersChanged.emit(filterHash);
this.$state.go('.', {query_props: query_props}, {custom: {notify: false}});
});
@ -71,7 +78,7 @@ export class BoardFilterComponent implements OnInit, OnDestroy {
private loadQueryForm() {
this.queryFormDm
.loadWithParams(
{ filters: JSON.stringify(this.board.filters) },
{filters: JSON.stringify(this.filters)},
undefined,
this.currentProjectService.id
)

@ -48,7 +48,8 @@
<div class="boards-filters-container">
<board-filter [board]="board"
(filters)="updateFilters($event)"></board-filter>
[filters]="filters"
(onFiltersChanged)="updateFilters($event)"></board-filter>
</div>
</ng-container>

@ -89,7 +89,7 @@ export class BoardComponent implements OnInit, OnDestroy {
.subscribe(board => {
this.board = board;
let queryProps = this.state.params.query_props;
this.filters = this.board.filters = queryProps ? JSON.parse(queryProps) : this.board.filters;
this.filters = queryProps ? JSON.parse(queryProps) : this.board.filters;
if (!initialized) {
this.dynamicCss.requireHighlighting();
@ -105,14 +105,14 @@ export class BoardComponent implements OnInit, OnDestroy {
saveWithNameAndFilters(board:Board, newName:string) {
board.name = newName;
board.filters = this.filters;
return this.saveBoard(board);
return this.saveBoard(board, true);
}
showError(text = this.text.loadingError) {
this.notifications.addError(text);
}
saveBoard(board:Board) {
saveBoard(board:Board, resetFilters = false) {
this.inFlight = true;
this.Boards
.save(board)
@ -120,7 +120,8 @@ export class BoardComponent implements OnInit, OnDestroy {
this.BoardCache.update(board);
this.notifications.addSuccess(this.text.updateSuccessful);
this.inFlight = false;
this.state.go('.', { query_props: null, isNew: false }, {custom: {notify: false}});
let params = { isNew: false, query_props: (resetFilters ? null : this.state.params.query_props) };
this.state.go('.', params, {custom: {notify: false}});
});
}

Loading…
Cancel
Save