-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: refreshing debug tab can now be done with conditions, to al…
…low not showing the Data loaded toast
- Loading branch information
1 parent
3ff5d50
commit af62a1d
Showing
5 changed files
with
57 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,31 @@ | ||
import { Injectable } from '@angular/core'; | ||
import { Observable, Subject } from 'rxjs'; | ||
import { RefreshCondition } from '../shared/interfaces/refresh-condition'; | ||
|
||
@Injectable({ | ||
providedIn: 'root', | ||
}) | ||
export class DebugTabService { | ||
private refreshAllSubject: Subject<number[]> = new Subject(); | ||
private refreshTableSubject: Subject<void> = new Subject(); | ||
private refreshTreeSubject: Subject<number[]> = new Subject(); | ||
private refreshAllSubject: Subject<RefreshCondition> = new Subject(); | ||
private refreshTableSubject: Subject<RefreshCondition> = new Subject(); | ||
private refreshTreeSubject: Subject<RefreshCondition> = new Subject(); | ||
|
||
refreshAll$: Observable<number[]> = this.refreshAllSubject.asObservable(); | ||
refreshTable$: Observable<void> = this.refreshTableSubject.asObservable(); | ||
refreshTree$: Observable<number[]> = this.refreshTreeSubject.asObservable(); | ||
refreshAll$: Observable<RefreshCondition> = this.refreshAllSubject.asObservable(); | ||
refreshTable$: Observable<RefreshCondition> = this.refreshTableSubject.asObservable(); | ||
refreshTree$: Observable<RefreshCondition> = this.refreshTreeSubject.asObservable(); | ||
|
||
// triggers a refresh that refreshes both the debug table and the debug tree | ||
refreshAll(reportIds: number[]): void { | ||
this.refreshAllSubject.next(reportIds); | ||
refreshAll(condition: RefreshCondition): void { | ||
this.refreshAllSubject.next(condition); | ||
} | ||
|
||
// triggers a refresh that refreshes only the debug table | ||
refreshTable(): void { | ||
this.refreshTableSubject.next(); | ||
refreshTable(condition?: RefreshCondition): void { | ||
this.refreshTableSubject.next(condition ?? ({} as RefreshCondition)); | ||
} | ||
|
||
//triggers a refresh that refreshes only the debug tree and the reports in the debug tree where the reportId is present in the argument | ||
refreshTree(reportIds: number[]): void { | ||
this.refreshTreeSubject.next(reportIds); | ||
refreshTree(condition: RefreshCondition): void { | ||
this.refreshTreeSubject.next(condition); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export interface RefreshCondition { | ||
reportIds?: number[]; | ||
displayToast?: boolean; | ||
} |