@provoly/dashboard 0.11.1 → 0.11.3

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.
@@ -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: [{
@@ -3759,34 +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
- getItemsSerializedParams(id, quickOrder) {
3771
- return JSON.stringify(this.getItemsParams(quickOrder[id])) + this.getItemsFilter(id);
3769
+ getItemsSerializedParams(id, quickOrder = {}) {
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
3775
  this.filters[id]
3778
3776
  .filter((filter) => filter.value !== null && filter.value !== undefined)
3779
3777
  .forEach((filter) => {
3780
- filterFormed.push('filter=' + filter.attribute + ',' + filter.operator + ',' + filter.value);
3778
+ params = params.append('filter', `${filter.attribute},${filter.operator},${filter.value}`);
3781
3779
  });
3782
- filterFormed = '?' + filterFormed.join('&');
3783
3780
  }
3784
- return filterFormed;
3781
+ return params;
3785
3782
  }
3786
- getItemsParams(quickOrder) {
3787
- const params = {};
3783
+ getOrder(quickOrder, cumulative) {
3784
+ let params = cumulative ?? new HttpParams();
3788
3785
  if (quickOrder) {
3789
- params['order'] = `${quickOrder.attribute},${quickOrder.asc ?? ''}`;
3786
+ params = params.append('order', `${quickOrder.attribute},${quickOrder.asc ?? ''}`);
3790
3787
  }
3791
3788
  return params;
3792
3789
  }
@@ -8174,17 +8171,21 @@ class PryHttpErrorInterceptorService {
8174
8171
  if (!message) {
8175
8172
  message = error.message;
8176
8173
  }
8177
- this.snackbar.open({
8178
- message: 'Statut: ' + error.status + '. Erreur: ' + message,
8179
- type: 'error'
8180
- });
8174
+ if (error.status >= 400) {
8175
+ this.snackbar.open({
8176
+ message: 'Statut: ' + error.status + '. Erreur: ' + message,
8177
+ type: 'error'
8178
+ });
8179
+ }
8181
8180
  console.error(error);
8182
8181
  }
8183
8182
  else {
8184
- this.snackbar.open({
8185
- message: this.translateService.instant('@pry.errors.codes.' + error.status),
8186
- type: 'error'
8187
- });
8183
+ if (error.status >= 400) {
8184
+ this.snackbar.open({
8185
+ message: this.translateService.instant('@pry.errors.codes.' + error.status),
8186
+ type: 'error'
8187
+ });
8188
+ }
8188
8189
  }
8189
8190
  return throwError(() => error);
8190
8191
  }));
@@ -9204,8 +9205,10 @@ class ManifestService {
9204
9205
  }
9205
9206
  else {
9206
9207
  // The backend returned an unsuccessful response code.
9207
- console.error(`Backend returned code ${error.status}, body was: ${JSON.stringify(error.error)}`);
9208
- 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) {
9209
9212
  this.snackBar.open({
9210
9213
  type: 'error',
9211
9214
  message: this.translateService.instant('@pry.manifest.get.errorBack', {