@provoly/dashboard 0.18.7 → 0.18.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/esm2022/lib/core/store/search/search.effects.mjs +2 -3
  2. package/esm2022/lib/dashboard/components/widgets/widget-instanciator/widget-factory.service.mjs +8 -1
  3. package/esm2022/lib/dashboard/components/widgets/widget-instanciator/widgets-definition.model.mjs +1 -1
  4. package/esm2022/lib/dashboard/filter/components/filter-instanciator/filter-instanciator.component.mjs +5 -1
  5. package/esm2022/lib/dashboard/store/dashboard.actions.mjs +3 -2
  6. package/esm2022/lib/dashboard/store/dashboard.effects.mjs +17 -17
  7. package/esm2022/widgets/widget-aggregated-chart/component/widget-aggregated-chart.component.mjs +2 -2
  8. package/esm2022/widgets/widget-map/component/widget-map.component.mjs +3 -3
  9. package/fesm2022/provoly-dashboard-widgets-widget-aggregated-chart.mjs +1 -1
  10. package/fesm2022/provoly-dashboard-widgets-widget-aggregated-chart.mjs.map +1 -1
  11. package/fesm2022/provoly-dashboard-widgets-widget-map.mjs +2 -2
  12. package/fesm2022/provoly-dashboard-widgets-widget-map.mjs.map +1 -1
  13. package/fesm2022/provoly-dashboard.mjs +28 -17
  14. package/fesm2022/provoly-dashboard.mjs.map +1 -1
  15. package/lib/core/store/search/search.effects.d.ts +0 -3
  16. package/lib/dashboard/components/widgets/widget-instanciator/widget-factory.service.d.ts +1 -0
  17. package/lib/dashboard/components/widgets/widget-instanciator/widgets-definition.model.d.ts +2 -2
  18. package/lib/dashboard/filter/components/filter-instanciator/filter-instanciator.component.d.ts +3 -2
  19. package/lib/dashboard/store/dashboard.actions.d.ts +5 -0
  20. package/lib/dashboard/store/dashboard.effects.d.ts +7 -5
  21. package/package.json +25 -25
  22. package/schematics/migration.json +5 -0
  23. package/schematics/ng-add/index.js +1 -1
  24. package/schematics/ng-add/index.js.map +1 -1
  25. package/schematics/ng-add/index.spec.js +1 -1
  26. package/schematics/ng-add/index.spec.js.map +1 -1
  27. package/schematics/ng-update/version-0-18/index.d.ts +2 -0
  28. package/schematics/ng-update/version-0-18/index.js +15 -0
  29. package/schematics/ng-update/version-0-18/index.js.map +1 -0
  30. package/styles/components/_m-filter.scss +7 -3
@@ -1378,7 +1378,8 @@ const DashboardActions = {
1378
1378
  getCapability: createAction('[Widget map] Get Wms capability', props()),
1379
1379
  updateCapability: createAction('[Widget map] Store Wms capability', props()),
1380
1380
  addManifestMetadata: createAction('[Dashboard] Add manifest metadata', props()),
1381
- deleteManifestMetadata: createAction('[Dashboard] Delete manifest metadata', props())
1381
+ deleteManifestMetadata: createAction('[Dashboard] Delete manifest metadata', props()),
1382
+ triggerAggregate: createAction('[Dashboard] (bus) Triggering aggregates for datasource', props())
1382
1383
  };
1383
1384
 
1384
1385
  const ConfigActions = {
@@ -4679,7 +4680,6 @@ class SearchEffects {
4679
4680
  id: props.id,
4680
4681
  params: this.searchService.getItemsSerializedParams(props.id, quickOrder)
4681
4682
  })), catchError$1((error) => [SearchActions.searchFailure({ error, id: props.id })])))));
4682
- this.updateAggregatesInWidget$ = createEffect(() => this.actions$.pipe(ofType(SearchActions.getDatasourceItems), filter((props) => props.id !== DEFAULT_NAMED_QUERY_ID && props.id !== EXPLORE_NAMED_QUERY_ID), tap$1((props) => window.dispatchEvent(new CustomEvent('datasourceRefresh', { detail: props.id })))), { dispatch: false });
4683
4683
  this.search$ = createEffect(() => this.actions$.pipe(ofType(SearchActions.search), mergeMap((props) => this.searchService.search(props.payload).pipe(map((resultSet) => SearchActions.searchSuccess({ resultSet, id: props.id })), catchError$1((error) => [SearchActions.searchFailure({ error })])))));
4684
4684
  this.searchSuccess$ = createEffect(() => this.actions$.pipe(ofType(SearchActions.searchSuccess), map((action) => DashboardActions.updateResultSet({
4685
4685
  id: action.id ?? DEFAULT_NAMED_QUERY_ID,
@@ -7392,6 +7392,13 @@ class WidgetFactoryService {
7392
7392
  (widgetDefinition.autoLoadDatasource === 'not-geo' && !DatasourceUtils.isGeo(matching)));
7393
7393
  });
7394
7394
  }
7395
+ aggregatesToAutoLoad(manifest) {
7396
+ const widgetDefinition = this.reference$.getValue()[manifest.type];
7397
+ const datasourcesArray = Array.isArray(manifest.datasource ?? [])
7398
+ ? (manifest.datasource ?? [])
7399
+ : [manifest.datasource];
7400
+ return datasourcesArray.filter(() => widgetDefinition.autoLoadDatasource === undefined || widgetDefinition.autoLoadDatasource === 'aggregate');
7401
+ }
7395
7402
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: WidgetFactoryService, deps: [{ token: i0.Injector }, { token: WIDGET_DEFINITION }, { token: i1.Store }], target: i0.ɵɵFactoryTarget.Injectable }); }
7396
7403
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: WidgetFactoryService, providedIn: 'root' }); }
7397
7404
  }
@@ -10088,6 +10095,10 @@ class FilterInstanciatorComponent extends SubscriptionnerDirective {
10088
10095
  }
10089
10096
  }));
10090
10097
  }
10098
+ ngOnDestroy() {
10099
+ super.ngOnDestroy();
10100
+ this.applySub?.unsubscribe();
10101
+ }
10091
10102
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: FilterInstanciatorComponent, deps: [{ token: i1.Store }, { token: i0.Injector }, { token: FilterFactoryService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
10092
10103
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.6", type: FilterInstanciatorComponent, selector: "pry-filter-instanciator", inputs: { filter: "filter", applyFilter$: "applyFilter$" }, viewQueries: [{ propertyName: "filterContainerRef", first: true, predicate: ["filters"], descendants: true, read: ViewContainerRef }], usesInheritance: true, ngImport: i0, template: "<ng-template #filters></ng-template>\n" }); }
10093
10104
  }
@@ -10446,9 +10457,18 @@ class DashboardEffects {
10446
10457
  }
10447
10458
  })), { dispatch: false });
10448
10459
  this.requestManifestRoute$ = createEffect(() => this.actions$.pipe(ofType(DashboardActions.requestAllRoutes), map$1(() => DashboardActions.updateRouteManifest({ route: this.router.url }))));
10449
- this.assertResultSets$ = createEffect(() => this.actions$.pipe(ofType(DashboardActions.assertResultSets), withLatestFrom(this.store.select(DashboardSelectors.globalManifest), this.store.select(DashboardSelectors.resultSets), this.store.select(DashboardSelectors.resultSetsParams), this.store.select(DashboardSelectors.quickOrder)), mergeMap$1(([action, manifest, resultSets, resultSetsParams, quickOrder]) => {
10460
+ this.assertResultSets$ = createEffect(() => this.actions$.pipe(ofType(DashboardActions.assertResultSets, DashboardActions.dispatchFilters, DashboardActions.clearAllFilterValues), withLatestFrom(this.store.select(DashboardSelectors.globalManifest), this.store.select(DashboardSelectors.resultSets), this.store.select(DashboardSelectors.resultSetsParams), this.store.select(DashboardSelectors.quickOrder)), mergeMap$1(([action, manifest, resultSets, resultSetsParams, quickOrder]) => {
10461
+ // @ts-ignore
10450
10462
  if (!action.id) {
10451
- return [
10463
+ // First send aggregate updates
10464
+ const toAggregateActions = [
10465
+ ...new Set(manifest.windows
10466
+ .map((winManifest) => (winManifest ?? {}).widgets ?? [])
10467
+ .reduce((p, c) => [...p, ...c], [])
10468
+ .map((widManifest) => this.widgetFactoryService.aggregatesToAutoLoad(widManifest))
10469
+ .reduce((p, c) => [...p, ...c], []))
10470
+ ].map((ds) => DashboardActions.triggerAggregate({ id: ds }));
10471
+ const toItemsActions = [
10452
10472
  ...new Set(manifest.windows
10453
10473
  .map((winManifest) => (winManifest ?? {}).widgets ?? [])
10454
10474
  .reduce((p, c) => [...p, ...c], [])
@@ -10460,14 +10480,18 @@ class DashboardEffects {
10460
10480
  (!resultSets[resultSet] ||
10461
10481
  resultSetsParams[resultSet] !== this.searchService.getItemsSerializedParams(resultSet, quickOrder)))
10462
10482
  .map((resultSet) => SearchActions.getDatasourceItems({ id: resultSet }));
10483
+ return [...toItemsActions, ...toAggregateActions];
10463
10484
  }
10464
10485
  else {
10486
+ // @ts-ignore
10465
10487
  if (!resultSets[action.id]) {
10488
+ // @ts-ignore
10466
10489
  return [SearchActions.getDatasourceItems({ id: action.id })];
10467
10490
  }
10468
10491
  return [];
10469
10492
  }
10470
10493
  })));
10494
+ this.sendAggregatesEvent$ = createEffect(() => this.actions$.pipe(ofType(DashboardActions.triggerAggregate), filter$1((action) => action.id !== DEFAULT_NAMED_QUERY_ID && action.id !== EXPLORE_NAMED_QUERY_ID), tap((action) => window.dispatchEvent(new CustomEvent('datasourceRefresh', { detail: action.id })))), { dispatch: false });
10471
10495
  this.resize$ = createEffect(() => this.actions$.pipe(
10472
10496
  // forward new manifest after any of these types of actions
10473
10497
  ofType(DashboardActions.updateDashboardManifest, DashboardActions.moveWidget, DashboardActions.updateWidgetManifest),
@@ -10667,19 +10691,6 @@ class DashboardEffects {
10667
10691
  this.relaunchAfterOrder$ = createEffect(() => this.actions$.pipe(ofType(DashboardActions.quickOrder), map$1((action) => SearchActions.getDatasourceItems({ id: action.datasourceId }))));
10668
10692
  this.propagateGridLayout$ = createEffect(() => this.actions$.pipe(ofType(DashboardActions.setGridLayout), withLatestFrom(this.store.select(DashboardSelectors.rank), this.store.select(DashboardSelectors.windowManifest)), map$1(([action, rank, windowManifest]) => DashboardActions.propagateGridLayout({ manifest: windowManifest, rank }))));
10669
10693
  this.toggleEditionModeIfNotManual$ = createEffect(() => this.actions$.pipe(ofType(DashboardActions.setGridLayout), filter$1((action) => action.layout !== DashboardGridLayout.MANUAL), map$1(() => DashboardActions.toggleEditionMode({ force: false }))));
10670
- this.dispatchFilters$ = createEffect(() => this.actions$.pipe(ofType(DashboardActions.dispatchFilters, DashboardActions.clearAllFilterValues), withLatestFrom(this.store.select(DashboardSelectors.filters), this.store.select(DashboardSelectors.resultSets), this.store.select(DashboardSelectors.resultSetsParams), this.store.select(DashboardSelectors.quickOrder)), mergeMap$1(([action, filters, resultSets, resultSetsParams, quickOrder]) => {
10671
- return [
10672
- ...new Set(filters
10673
- .map((f) => f.attributes)
10674
- .flat()
10675
- .map((attribute) => attribute.datasource))
10676
- ]
10677
- .filter((resultSet) => !!resultSet &&
10678
- resultSet !== '' &&
10679
- (!resultSets[resultSet] ||
10680
- resultSetsParams[resultSet] !== this.searchService.getItemsSerializedParams(resultSet, quickOrder)))
10681
- .map((ds) => SearchActions.getDatasourceItems({ id: ds }));
10682
- })));
10683
10694
  this.getCapability$ = createEffect(() => this.actions$.pipe(ofType(DashboardActions.getCapability), debounceTime$1(100), withLatestFrom(this.store.select(DashboardSelectors.capabilities)), filter$1(([action, capabilities]) => (!!capabilities && !!action.url && !capabilities[action.url]) || !!action.force), mergeMap$1(([action, _]) => this.wmsService.getCapabilities(action.url).pipe(map$1((capability) => DashboardActions.updateCapability({ url: action.url, capability })), startWith(DashboardActions.updateCapability({ url: action.url, capability: null }))))));
10684
10695
  this.getWmsFeatures = createEffect(() => this.actions$.pipe(ofType(DashboardActions.getWmsFeatures), mergeMap$1((action) => combineLatest([of(action), this.wmsService.getWmsFeatures(action.url)])), map$1(([action, json]) => {
10685
10696
  return DashboardActions.addWmsFeatures({