@provoly/dashboard 0.18.8 → 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 (24) 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/store/dashboard.actions.mjs +3 -2
  5. package/esm2022/lib/dashboard/store/dashboard.effects.mjs +17 -17
  6. package/esm2022/widgets/widget-aggregated-chart/component/widget-aggregated-chart.component.mjs +2 -2
  7. package/fesm2022/provoly-dashboard-widgets-widget-aggregated-chart.mjs +1 -1
  8. package/fesm2022/provoly-dashboard-widgets-widget-aggregated-chart.mjs.map +1 -1
  9. package/fesm2022/provoly-dashboard.mjs +24 -17
  10. package/fesm2022/provoly-dashboard.mjs.map +1 -1
  11. package/lib/core/store/search/search.effects.d.ts +0 -3
  12. package/lib/dashboard/components/widgets/widget-instanciator/widget-factory.service.d.ts +1 -0
  13. package/lib/dashboard/components/widgets/widget-instanciator/widgets-definition.model.d.ts +2 -2
  14. package/lib/dashboard/store/dashboard.actions.d.ts +5 -0
  15. package/lib/dashboard/store/dashboard.effects.d.ts +7 -5
  16. package/package.json +7 -7
  17. package/schematics/migration.json +5 -0
  18. package/schematics/ng-add/index.js +1 -1
  19. package/schematics/ng-add/index.js.map +1 -1
  20. package/schematics/ng-add/index.spec.js +1 -1
  21. package/schematics/ng-add/index.spec.js.map +1 -1
  22. package/schematics/ng-update/version-0-18/index.d.ts +2 -0
  23. package/schematics/ng-update/version-0-18/index.js +15 -0
  24. package/schematics/ng-update/version-0-18/index.js.map +1 -0
@@ -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
  }
@@ -10450,9 +10457,18 @@ class DashboardEffects {
10450
10457
  }
10451
10458
  })), { dispatch: false });
10452
10459
  this.requestManifestRoute$ = createEffect(() => this.actions$.pipe(ofType(DashboardActions.requestAllRoutes), map$1(() => DashboardActions.updateRouteManifest({ route: this.router.url }))));
10453
- 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
10454
10462
  if (!action.id) {
10455
- 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 = [
10456
10472
  ...new Set(manifest.windows
10457
10473
  .map((winManifest) => (winManifest ?? {}).widgets ?? [])
10458
10474
  .reduce((p, c) => [...p, ...c], [])
@@ -10464,14 +10480,18 @@ class DashboardEffects {
10464
10480
  (!resultSets[resultSet] ||
10465
10481
  resultSetsParams[resultSet] !== this.searchService.getItemsSerializedParams(resultSet, quickOrder)))
10466
10482
  .map((resultSet) => SearchActions.getDatasourceItems({ id: resultSet }));
10483
+ return [...toItemsActions, ...toAggregateActions];
10467
10484
  }
10468
10485
  else {
10486
+ // @ts-ignore
10469
10487
  if (!resultSets[action.id]) {
10488
+ // @ts-ignore
10470
10489
  return [SearchActions.getDatasourceItems({ id: action.id })];
10471
10490
  }
10472
10491
  return [];
10473
10492
  }
10474
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 });
10475
10495
  this.resize$ = createEffect(() => this.actions$.pipe(
10476
10496
  // forward new manifest after any of these types of actions
10477
10497
  ofType(DashboardActions.updateDashboardManifest, DashboardActions.moveWidget, DashboardActions.updateWidgetManifest),
@@ -10671,19 +10691,6 @@ class DashboardEffects {
10671
10691
  this.relaunchAfterOrder$ = createEffect(() => this.actions$.pipe(ofType(DashboardActions.quickOrder), map$1((action) => SearchActions.getDatasourceItems({ id: action.datasourceId }))));
10672
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 }))));
10673
10693
  this.toggleEditionModeIfNotManual$ = createEffect(() => this.actions$.pipe(ofType(DashboardActions.setGridLayout), filter$1((action) => action.layout !== DashboardGridLayout.MANUAL), map$1(() => DashboardActions.toggleEditionMode({ force: false }))));
10674
- 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]) => {
10675
- return [
10676
- ...new Set(filters
10677
- .map((f) => f.attributes)
10678
- .flat()
10679
- .map((attribute) => attribute.datasource))
10680
- ]
10681
- .filter((resultSet) => !!resultSet &&
10682
- resultSet !== '' &&
10683
- (!resultSets[resultSet] ||
10684
- resultSetsParams[resultSet] !== this.searchService.getItemsSerializedParams(resultSet, quickOrder)))
10685
- .map((ds) => SearchActions.getDatasourceItems({ id: ds }));
10686
- })));
10687
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 }))))));
10688
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]) => {
10689
10696
  return DashboardActions.addWmsFeatures({