Skip to content

Commit

Permalink
feat(toast): clear query result trigger workspace clear selection (#958)
Browse files Browse the repository at this point in the history
* feat(toast): clear query result trigger workspace clear selection

* lint
  • Loading branch information
pelord authored Jun 5, 2023
1 parent d485042 commit a069b03
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/app/pages/portal/toast-panel/toast-panel.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ import {
StorageServiceEvent,
ConfigService
} from '@igo2/core';
import { QueryState, StorageState } from '@igo2/integration';
import { QueryState, StorageState, WorkspaceState } from '@igo2/integration';
import { ObjectUtils } from '@igo2/utils';

interface ExtendedGeoServiceDefinition extends GeoServiceDefinition {
Expand Down Expand Up @@ -292,6 +292,7 @@ export class ToastPanelComponent implements OnInit, OnDestroy {
public languageService: LanguageService,
private storageState: StorageState,
private queryState: QueryState,
private workspaceState: WorkspaceState,
private configService: ConfigService,
private propertyTypeDetectorService: PropertyTypeDetectorService,
private layerService: LayerService
Expand Down Expand Up @@ -628,7 +629,20 @@ export class ToastPanelComponent implements OnInit, OnDestroy {
this.map.queryResultsOverlay.setFeatures(features, FeatureMotion.None, 'map');
}

handleWksSelection() {
const entities = this.store.entities$.getValue();
const layersTitle = [...new Set(entities.map(e => e.source.title))];
const workspaces = this.workspaceState.store.entities$.getValue();
if (workspaces.length) {
const wksToHandle = workspaces.filter(wks => layersTitle.includes(wks.title));
wksToHandle.map(ws => {
ws.entityStore.state.updateMany(ws.entityStore.view.all(), { selected: false });
});
}
}

clear() {
this.handleWksSelection();
this.clearFeatureEmphasis();
this.map.queryResultsOverlay.clear();
this.store.clear();
Expand Down

0 comments on commit a069b03

Please sign in to comment.