@provoly/dashboard 0.11.0 → 0.11.2

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 (25) hide show
  1. package/admin/components/admin-abac-rules/store/abac-rules.effects.d.ts +2 -2
  2. package/admin/components/admin-dataset/store/admin-dataset.effects.d.ts +6 -6
  3. package/admin/components/admin-metadata/store/metadata.effects.d.ts +6 -6
  4. package/admin/components/admin-metadata-rules/store/metadata-rules.effects.d.ts +3 -3
  5. package/admin/components/admin-metadata-user/store/admin-metadata-user.effects.d.ts +6 -6
  6. package/esm2022/lib/core/components/modalStatus/modalStatus.component.mjs +3 -3
  7. package/esm2022/lib/core/errors/http-error-interceptor.service.mjs +13 -9
  8. package/esm2022/lib/core/model/filter.interface.mjs +1 -1
  9. package/esm2022/lib/core/store/search/search.service.mjs +15 -15
  10. package/esm2022/lib/dashboard/components/widgets/data-widget.component.mjs +2 -3
  11. package/esm2022/lib/dashboard/store/dashboard.reducers.mjs +21 -15
  12. package/esm2022/lib/dashboard/store/dashboard.selectors.mjs +4 -4
  13. package/esm2022/lib/dashboard/store/manifest.service.mjs +5 -3
  14. package/esm2022/widgets/widget-aggregated-chart/service/backend-aggregation.service.mjs +8 -15
  15. package/fesm2022/provoly-dashboard-widgets-widget-aggregated-chart.mjs +6 -13
  16. package/fesm2022/provoly-dashboard-widgets-widget-aggregated-chart.mjs.map +1 -1
  17. package/fesm2022/provoly-dashboard.mjs +60 -49
  18. package/fesm2022/provoly-dashboard.mjs.map +1 -1
  19. package/lib/core/model/filter.interface.d.ts +1 -1
  20. package/lib/core/store/search/search.service.d.ts +3 -5
  21. package/package.json +13 -13
  22. package/search/search-fulltext/store/search-fulltext.effects.d.ts +2 -2
  23. package/search/search-mono-class/store/search-mono-class.effects.d.ts +6 -6
  24. package/search/search-multi-class/store/search-multi-class.effects.d.ts +2 -2
  25. package/widgets/widget-aggregated-chart/service/backend-aggregation.service.d.ts +3 -3
@@ -3,7 +3,7 @@ import { OverlayConfig, OverlayModule } from '@angular/cdk/overlay';
3
3
  import * as i1$1 from '@angular/common';
4
4
  import { CommonModule, AsyncPipe } from '@angular/common';
5
5
  import * as i1$2 from '@angular/common/http';
6
- import { HttpHeaders, HttpClientModule } from '@angular/common/http';
6
+ import { HttpHeaders, HttpParams, HttpClientModule } from '@angular/common/http';
7
7
  import * as i0 from '@angular/core';
8
8
  import { InjectionToken, Injectable, Directive, Optional, Inject, Input, Component, Pipe, ChangeDetectionStrategy, HostBinding, SecurityContext, NgModule, EventEmitter, Output, TemplateRef, ViewChild, Injector, HostListener, forwardRef, ContentChildren, ViewContainerRef, createNgModule } from '@angular/core';
9
9
  import * as i2 from '@angular/router';
@@ -2350,11 +2350,11 @@ class PryModalStatusComponent {
2350
2350
  this.gotoConsult.emit(this.version);
2351
2351
  }
2352
2352
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: PryModalStatusComponent, deps: [{ token: i1.Store }], target: i0.ɵɵFactoryTarget.Component }); }
2353
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.6", type: PryModalStatusComponent, selector: "pry-modalStatus", inputs: { version: "version" }, outputs: { gotoConsult: "gotoConsult" }, ngImport: i0, template: "<div class=\"o-modal-wrapper\">\n <div>\n <h2>{{ '@pry.dataset.error.title' | i18n }}</h2>\n </div>\n <div></div>\n <table class=\"a-table\">\n <thead>\n <tr>\n <th>{{ '@pry.dataset.error.code' | i18n }}</th>\n <th>{{ '@pry.dataset.error.elements' | i18n }} << TOFIX</th>\n <th>{{ '@pry.dataset.error.message' | i18n }}</th>\n </tr>\n </thead>\n <tbody>\n <tr *ngFor=\"let error of datasetErrors$ | async\">\n <td>\n {{ error.code }}\n </td>\n <td>\n {{ error.line }}\n </td>\n <td>\n {{ error.message }}\n </td>\n </tr>\n </tbody>\n </table>\n <div class=\"m-btn-group\">\n <button>\n <pry-icon [height]=\"15\" [width]=\"15\" iconSvg=\"download\" class=\"download\"></pry-icon>\n <span>{{ '@pry.dataset.export' | i18n }}</span>\n </button>\n <button class=\"a-btn a-btn--primary\" (click)=\"goBack()\">\n <span>{{ '@pry.dataset.error.close' | i18n }}</span>\n </button>\n </div>\n</div>\n", dependencies: [{ kind: "directive", type: i1$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: PryIconComponent, selector: "pry-icon", inputs: ["color", "iconSvg", "animation", "iconImage", "alt", "width", "height", "classes"] }, { kind: "pipe", type: i1$1.AsyncPipe, name: "async" }, { kind: "pipe", type: I18nPipe, name: "i18n" }] }); }
2353
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.6", type: PryModalStatusComponent, selector: "pry-modalStatus", inputs: { version: "version" }, outputs: { gotoConsult: "gotoConsult" }, ngImport: i0, template: "<div class=\"o-modal-wrapper\">\n <div class=\"o-modal__top\">\n <div class=\"o-modal__top__title\">\n <h2 class=\"a-h2\">{{ '@pry.dataset.error.title' | i18n }}</h2>\n </div>\n <div class=\"o-modal__top__close\">\n <button class=\"a-btn a-btn--icon-only\" (click)=\"goBack()\">\n <pry-icon iconSvg=\"close\" [height]=\"35\" [width]=\"35\"></pry-icon>\n <span class=\"u-visually-hidden\">{{ '@pry.toolbox.close' | i18n }}</span>\n </button>\n </div>\n </div>\n <table class=\"a-table\">\n <thead>\n <tr>\n <th>{{ '@pry.dataset.error.code' | i18n }}</th>\n <th>{{ '@pry.dataset.error.elements' | i18n }}</th>\n <th>{{ '@pry.dataset.error.message' | i18n }}</th>\n </tr>\n </thead>\n <tbody>\n <tr *ngFor=\"let error of datasetErrors$ | async | slice : 0 : 5\">\n <td>\n {{ error.code }}\n </td>\n <td>\n {{ error.line }}\n </td>\n <td>\n {{ error.message }}\n </td>\n </tr>\n </tbody>\n </table>\n</div>\n", dependencies: [{ kind: "directive", type: i1$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: PryIconComponent, selector: "pry-icon", inputs: ["color", "iconSvg", "animation", "iconImage", "alt", "width", "height", "classes"] }, { kind: "pipe", type: i1$1.AsyncPipe, name: "async" }, { kind: "pipe", type: i1$1.SlicePipe, name: "slice" }, { kind: "pipe", type: I18nPipe, name: "i18n" }] }); }
2354
2354
  }
2355
2355
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: PryModalStatusComponent, decorators: [{
2356
2356
  type: Component,
2357
- args: [{ selector: 'pry-modalStatus', template: "<div class=\"o-modal-wrapper\">\n <div>\n <h2>{{ '@pry.dataset.error.title' | i18n }}</h2>\n </div>\n <div></div>\n <table class=\"a-table\">\n <thead>\n <tr>\n <th>{{ '@pry.dataset.error.code' | i18n }}</th>\n <th>{{ '@pry.dataset.error.elements' | i18n }} << TOFIX</th>\n <th>{{ '@pry.dataset.error.message' | i18n }}</th>\n </tr>\n </thead>\n <tbody>\n <tr *ngFor=\"let error of datasetErrors$ | async\">\n <td>\n {{ error.code }}\n </td>\n <td>\n {{ error.line }}\n </td>\n <td>\n {{ error.message }}\n </td>\n </tr>\n </tbody>\n </table>\n <div class=\"m-btn-group\">\n <button>\n <pry-icon [height]=\"15\" [width]=\"15\" iconSvg=\"download\" class=\"download\"></pry-icon>\n <span>{{ '@pry.dataset.export' | i18n }}</span>\n </button>\n <button class=\"a-btn a-btn--primary\" (click)=\"goBack()\">\n <span>{{ '@pry.dataset.error.close' | i18n }}</span>\n </button>\n </div>\n</div>\n" }]
2357
+ args: [{ selector: 'pry-modalStatus', template: "<div class=\"o-modal-wrapper\">\n <div class=\"o-modal__top\">\n <div class=\"o-modal__top__title\">\n <h2 class=\"a-h2\">{{ '@pry.dataset.error.title' | i18n }}</h2>\n </div>\n <div class=\"o-modal__top__close\">\n <button class=\"a-btn a-btn--icon-only\" (click)=\"goBack()\">\n <pry-icon iconSvg=\"close\" [height]=\"35\" [width]=\"35\"></pry-icon>\n <span class=\"u-visually-hidden\">{{ '@pry.toolbox.close' | i18n }}</span>\n </button>\n </div>\n </div>\n <table class=\"a-table\">\n <thead>\n <tr>\n <th>{{ '@pry.dataset.error.code' | i18n }}</th>\n <th>{{ '@pry.dataset.error.elements' | i18n }}</th>\n <th>{{ '@pry.dataset.error.message' | i18n }}</th>\n </tr>\n </thead>\n <tbody>\n <tr *ngFor=\"let error of datasetErrors$ | async | slice : 0 : 5\">\n <td>\n {{ error.code }}\n </td>\n <td>\n {{ error.line }}\n </td>\n <td>\n {{ error.message }}\n </td>\n </tr>\n </tbody>\n </table>\n</div>\n" }]
2358
2358
  }], ctorParameters: function () { return [{ type: i1.Store }]; }, propDecorators: { gotoConsult: [{
2359
2359
  type: Output
2360
2360
  }], version: [{
@@ -3085,10 +3085,10 @@ const rank = createSelector(manifests, (manifests) => manifests?.tenants.indexOf
3085
3085
  const currentManifestId = createSelector(manifests, (manifests) => manifests.currentId);
3086
3086
  const globalManifest = createSelector(manifests,
3087
3087
  // @ts-ignore
3088
- (manifests) => ({ windows: [], ...manifests?.manifest }) ?? { windows: [] });
3088
+ (manifests) => ({ windows: [], ...manifests?.manifest } ?? { windows: [] }));
3089
3089
  const staticManifest = createSelector(manifests,
3090
3090
  // @ts-ignore
3091
- (manifests) => ({ windows: [], ...manifests?.staticManifest }) ?? { windows: [] });
3091
+ (manifests) => ({ windows: [], ...manifests?.staticManifest } ?? { windows: [] }));
3092
3092
  const refreshRates = createSelector(globalManifest, (manifests) => manifests.refreshRates ?? {});
3093
3093
  const windowManifest = createSelector(globalManifest, rank, (manifest, rank) => manifest.windows[rank] ?? { widgets: [] });
3094
3094
  const gridLayout = createSelector(windowManifest, (manifest) => (manifest.grid ?? {}).layout ?? DashboardGridLayout.MANUAL);
@@ -3151,7 +3151,7 @@ const datasourceFilters = createSelector(feature$5, (state) => state?.manifests.
3151
3151
  ? state?.manifests.manifest.filters.reduce((obj, filter) => (filter.attributes.forEach((attribute) => (obj[attribute.datasource] || (obj[attribute.datasource] = [])).push({
3152
3152
  attribute: attribute.id,
3153
3153
  operator: filter.operator ?? '',
3154
- value: filter.value ?? ''
3154
+ value: filter.value
3155
3155
  })),
3156
3156
  obj), {})
3157
3157
  : {});
@@ -3759,32 +3759,31 @@ class SearchService {
3759
3759
  * @param quickOrder if it has to be applied
3760
3760
  */
3761
3761
  getItems(id, quickOrder) {
3762
- const params = this.getItemsParams(quickOrder);
3763
- let filterFormed = this.getItemsFilter(id);
3762
+ const params = this.getItemsFilter(id, this.getOrder(quickOrder));
3764
3763
  if (!id) {
3765
3764
  console.warn('Not sending items request with no datasource attached.');
3766
3765
  return of({ items: {}, relations: [] });
3767
3766
  }
3768
- return this.store.select(ConfigSelectors.dataUrl).pipe(mergeMap((url) => this.httpClient.get(encodeURI(`${url}/data-sources/id/${id}/items${filterFormed}`), { params })), map((rs) => this.applyTransformations('current', rs)));
3767
+ return this.store.select(ConfigSelectors.dataUrl).pipe(mergeMap((url) => this.httpClient.get(encodeURI(`${url}/data-sources/id/${id}/items`), { params })), map((rs) => this.applyTransformations('current', rs)));
3769
3768
  }
3770
3769
  getItemsSerializedParams(id, quickOrder) {
3771
- return JSON.stringify(this.getItemsParams(quickOrder[id])) + this.getItemsFilter(id);
3770
+ return JSON.stringify(this.getItemsFilter(id, this.getOrder(quickOrder[id])));
3772
3771
  }
3773
- getItemsFilter(id) {
3774
- let filterFormed = '';
3772
+ getItemsFilter(id, cumulative) {
3773
+ let params = cumulative ?? new HttpParams();
3775
3774
  if (this.filters[id]) {
3776
- filterFormed = [];
3777
- this.filters[id].forEach((filter) => {
3778
- filterFormed.push('filter=' + filter.attribute + ',' + filter.operator + ',' + filter.value);
3775
+ this.filters[id]
3776
+ .filter((filter) => filter.value !== null && filter.value !== undefined)
3777
+ .forEach((filter) => {
3778
+ params = params.append('filter', `${filter.attribute},${filter.operator},${filter.value}`);
3779
3779
  });
3780
- filterFormed = '?' + filterFormed.join('&');
3781
3780
  }
3782
- return filterFormed;
3781
+ return params;
3783
3782
  }
3784
- getItemsParams(quickOrder) {
3785
- const params = {};
3783
+ getOrder(quickOrder, cumulative) {
3784
+ let params = cumulative ?? new HttpParams();
3786
3785
  if (quickOrder) {
3787
- params['order'] = `${quickOrder.attribute},${quickOrder.asc ?? ''}`;
3786
+ params = params.append('order', `${quickOrder.attribute},${quickOrder.asc ?? ''}`);
3788
3787
  }
3789
3788
  return params;
3790
3789
  }
@@ -8172,17 +8171,21 @@ class PryHttpErrorInterceptorService {
8172
8171
  if (!message) {
8173
8172
  message = error.message;
8174
8173
  }
8175
- this.snackbar.open({
8176
- message: 'Statut: ' + error.status + '. Erreur: ' + message,
8177
- type: 'error'
8178
- });
8174
+ if (error.status >= 400) {
8175
+ this.snackbar.open({
8176
+ message: 'Statut: ' + error.status + '. Erreur: ' + message,
8177
+ type: 'error'
8178
+ });
8179
+ }
8179
8180
  console.error(error);
8180
8181
  }
8181
8182
  else {
8182
- this.snackbar.open({
8183
- message: this.translateService.instant('@pry.errors.codes.' + error.status),
8184
- type: 'error'
8185
- });
8183
+ if (error.status >= 400) {
8184
+ this.snackbar.open({
8185
+ message: this.translateService.instant('@pry.errors.codes.' + error.status),
8186
+ type: 'error'
8187
+ });
8188
+ }
8186
8189
  }
8187
8190
  return throwError(() => error);
8188
8191
  }));
@@ -8448,15 +8451,15 @@ class DataWidgetComponent extends BaseWidgetComponent {
8448
8451
  constructor(store, el) {
8449
8452
  super(store, el);
8450
8453
  this.staticResultSet$ = new BehaviorSubject(null);
8451
- this.datasourceIds$ = this.manifest$.pipe(map$1((manifest) => (Array.isArray(manifest.datasource) ? manifest.datasource : [manifest.datasource]).filter((id) => !!id)));
8454
+ this.datasourceIds$ = this.manifest$.pipe(map((manifest) => (Array.isArray(manifest.datasource) ? manifest.datasource : [manifest.datasource]).filter((id) => !!id)));
8452
8455
  this.usedDatasources$ = combineLatest([
8453
8456
  this.datasourceIds$,
8454
8457
  this.store.select(DataSourceSelectors.getDataSources)
8455
- ]).pipe(map$1(([ids, datasources]) => ids
8458
+ ]).pipe(map(([ids, datasources]) => ids
8456
8459
  .map((id) => datasources.find((ds) => ds.id === id) ?? id)
8457
8460
  .map((nq) => (typeof nq !== 'string' ? nq : UNKNOWN_DATASOURCE(nq)))));
8458
8461
  this.resultSet$ = this.initResultSet$();
8459
- this.allItems$ = this.resultSet$.pipe(filter$1((resultSet) => !!resultSet), map$1((resultSet) => Object.keys(resultSet?.items)
8462
+ this.allItems$ = this.resultSet$.pipe(filter((resultSet) => !!resultSet), map((resultSet) => Object.keys(resultSet?.items)
8460
8463
  .map((classId) => resultSet.items[classId])
8461
8464
  .reduce((prev, curr) => [...prev, ...curr], [])));
8462
8465
  }
@@ -8465,7 +8468,7 @@ class DataWidgetComponent extends BaseWidgetComponent {
8465
8468
  this.store.select(DashboardSelectors.resultSets),
8466
8469
  this.datasourceIds$,
8467
8470
  this.staticResultSet$
8468
- ]).pipe(map$1(([resultSets, resultSetNamesArray, staticResultSet]) => {
8471
+ ]).pipe(map(([resultSets, resultSetNamesArray, staticResultSet]) => {
8469
8472
  if (!!staticResultSet) {
8470
8473
  return staticResultSet;
8471
8474
  }
@@ -8477,7 +8480,7 @@ class DataWidgetComponent extends BaseWidgetComponent {
8477
8480
  relations: [],
8478
8481
  merged: resultSetArray.length
8479
8482
  });
8480
- }), distinctUntilChanged((p, v) => equal(p, v)));
8483
+ }), distinctUntilChanged$1((p, v) => equal(p, v)));
8481
8484
  }
8482
8485
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.6", ngImport: i0, type: DataWidgetComponent, deps: [{ token: i1.Store }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); }
8483
8486
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.6", type: DataWidgetComponent, selector: "pry-data-widget", inputs: { staticResultSet: "staticResultSet" }, usesInheritance: true, ngImport: i0, template: '', isInline: true }); }
@@ -9202,8 +9205,10 @@ class ManifestService {
9202
9205
  }
9203
9206
  else {
9204
9207
  // The backend returned an unsuccessful response code.
9205
- console.error(`Backend returned code ${error.status}, body was: ${JSON.stringify(error.error)}`);
9206
- if (error.code !== 204) {
9208
+ if (error.code !== 200) {
9209
+ console.error(`Backend returned code ${error.status}, body was: ${JSON.stringify(error.error)}`);
9210
+ }
9211
+ if (error.code >= 400) {
9207
9212
  this.snackBar.open({
9208
9213
  type: 'error',
9209
9214
  message: this.translateService.instant('@pry.manifest.get.errorBack', {
@@ -10293,22 +10298,28 @@ const internalReducer = createReducer(dashboardInitialState, on(DashboardActions
10293
10298
  filters: state.manifests.manifest.filters?.filter((filter) => filter.id !== action.id)
10294
10299
  }
10295
10300
  }
10296
- })), on(DashboardActions.updateFilterValue, (state, action) => ({
10297
- ...state,
10298
- manifests: {
10299
- ...state.manifests,
10300
- manifest: {
10301
- ...state.manifests.manifest,
10302
- filters: state.manifests.manifest.filters
10303
- ? [
10304
- ...state.manifests.manifest.filters.map((filter, i) => i === state.manifests.manifest.filters?.findIndex((filter) => filter.id === action.id)
10305
- ? { ...filter, value: action.value }
10306
- : filter)
10307
- ]
10308
- : []
10301
+ })), on(DashboardActions.updateFilterValue, (state, action) => {
10302
+ const filters = JSON.parse(JSON.stringify(state.manifests.manifest.filters ?? []));
10303
+ const filterToUpdate = filters.find((filter) => filter.id === action.id);
10304
+ if (filterToUpdate) {
10305
+ if (!action.value) {
10306
+ delete filterToUpdate.value;
10307
+ }
10308
+ else {
10309
+ filterToUpdate.value = action.value;
10309
10310
  }
10310
10311
  }
10311
- })), on(DashboardActions.getWmsFeatures, (state, action) => ({
10312
+ return {
10313
+ ...state,
10314
+ manifests: {
10315
+ ...state.manifests,
10316
+ manifest: {
10317
+ ...state.manifests.manifest,
10318
+ filters
10319
+ }
10320
+ }
10321
+ };
10322
+ }), on(DashboardActions.getWmsFeatures, (state, action) => ({
10312
10323
  ...state,
10313
10324
  wmsFeatures: []
10314
10325
  })), on(DashboardActions.addWmsFeatures, (state, action) => ({