Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(toast): clear query result trigger workspace clear selection #958

Merged
merged 3 commits into from
Jun 5, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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