@provoly/dashboard 1.4.13 → 1.4.14

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 (37) hide show
  1. package/esm2022/lib/core/model/result-set.interface.mjs +1 -1
  2. package/esm2022/lib/core/model/search-mono-class.model.mjs +1 -1
  3. package/esm2022/lib/core/store/relation-types/relation-types.actions.mjs +2 -1
  4. package/esm2022/lib/core/store/relation-types/relation-types.effects.mjs +2 -1
  5. package/esm2022/lib/core/store/relation-types/relation-types.service.mjs +5 -1
  6. package/esm2022/lib/core/store/search/search.actions.mjs +1 -1
  7. package/esm2022/lib/core/store/search/search.effects.mjs +3 -3
  8. package/esm2022/lib/core/store/search/search.service.mjs +17 -7
  9. package/esm2022/lib/dashboard/store/dashboard.actions.mjs +2 -1
  10. package/esm2022/lib/dashboard/store/dashboard.reducers.mjs +20 -1
  11. package/esm2022/search/search-mono-class/store/search-mono-class.service.mjs +4 -4
  12. package/esm2022/toolbox/shared/presentation-form/presentation-form.component.mjs +7 -3
  13. package/esm2022/widgets/widget-map/component/widget-map.component.mjs +3 -3
  14. package/fesm2022/provoly-dashboard-search.mjs +3 -3
  15. package/fesm2022/provoly-dashboard-search.mjs.map +1 -1
  16. package/fesm2022/provoly-dashboard-toolbox.mjs +6 -2
  17. package/fesm2022/provoly-dashboard-toolbox.mjs.map +1 -1
  18. package/fesm2022/provoly-dashboard-widgets-widget-map.mjs +2 -2
  19. package/fesm2022/provoly-dashboard-widgets-widget-map.mjs.map +1 -1
  20. package/fesm2022/provoly-dashboard.mjs +44 -8
  21. package/fesm2022/provoly-dashboard.mjs.map +1 -1
  22. package/lib/core/model/result-set.interface.d.ts +6 -0
  23. package/lib/core/model/search-mono-class.model.d.ts +9 -2
  24. package/lib/core/store/relation-types/relation-types.actions.d.ts +9 -0
  25. package/lib/core/store/relation-types/relation-types.effects.d.ts +5 -0
  26. package/lib/core/store/relation-types/relation-types.service.d.ts +1 -0
  27. package/lib/core/store/search/search.actions.d.ts +4 -0
  28. package/lib/core/store/search/search.effects.d.ts +1 -0
  29. package/lib/core/store/search/search.service.d.ts +2 -2
  30. package/lib/dashboard/store/dashboard.actions.d.ts +5 -0
  31. package/lib/dashboard/store/dashboard.effects.d.ts +2 -0
  32. package/package.json +31 -31
  33. package/search/search-fulltext/store/search-fulltext.effects.d.ts +1 -0
  34. package/search/search-mono-class/store/search-mono-class.effects.d.ts +1 -0
  35. package/search/search-mono-class/store/search-mono-class.service.d.ts +1 -1
  36. package/search/search-multi-class/store/search-multi-class.effects.d.ts +1 -0
  37. package/toolbox/shared/presentation-form/presentation-form.component.d.ts +1 -0
@@ -3851,6 +3851,7 @@ const DashboardActions = {
3851
3851
  assertResultSets: createAction('[Dashboard] assert resultSet', props()),
3852
3852
  updateResultSet: createAction('[Dashboard] (bus) received named resultSet (not-active-action)', props()),
3853
3853
  addRelationsToResultSets: createAction('[Dashboard] (bus) add relations to resultSet', props()),
3854
+ removeRelationsFromResultSets: createAction('[Dashboard] (bus) remove relations from resultSet', props()),
3854
3855
  addItemToResultSets: createAction('[Dashboard] (bus) add item to resultSet', props()),
3855
3856
  startingMissingViews: createAction('[Dashboard] opening missing views for manifest'),
3856
3857
  setAvailableNamedQueries: createAction('[Dashboard] (bus) set available rs names', props()),
@@ -4212,7 +4213,7 @@ class SearchService {
4212
4213
  this.datasources = datasources;
4213
4214
  });
4214
4215
  }
4215
- getItems(id, quickOrder, excludeGeo, searchAfter) {
4216
+ getItems(id, quickOrder, excludeGeo, searchAfter, linkedItems = []) {
4216
4217
  const params = this.getItemsFilter(id, this.getOrder(quickOrder));
4217
4218
  if (!id) {
4218
4219
  console.warn('Not sending items request with no datasource attached.');
@@ -4223,9 +4224,10 @@ class SearchService {
4223
4224
  return this.httpClient.post(encodeURI(`${url}/data-sources/id/${id}/items`), {
4224
4225
  type: ds?.sourceType === 'namedQuery' ? ds.request.type : NamedQueryTypes.MONO_CLASS,
4225
4226
  excludeGeo: excludeGeo ?? false,
4226
- searchAfter: searchAfter ?? undefined
4227
+ searchAfter: searchAfter ?? undefined,
4228
+ linkedItems
4227
4229
  }, { params });
4228
- }), map((rs) => this.applyTransformations('current', rs)));
4230
+ }), map((rs) => this.applyTransformations(id, rs)));
4229
4231
  }
4230
4232
  getItemsSerializedParams(id, quickOrder = {}) {
4231
4233
  return '|' + this.getItemsFilter(id, this.getOrder(quickOrder[id])).toString() + '|';
@@ -4277,7 +4279,7 @@ class SearchService {
4277
4279
  * Launch a search request (and saves it as current search)
4278
4280
  * @param condition
4279
4281
  */
4280
- search(condition) {
4282
+ search(condition, id, withLinkedItems = []) {
4281
4283
  return combineLatest([
4282
4284
  this.store.select(ConfigSelectors.dataUrl),
4283
4285
  this.store.select(DashboardSelectors.quickOrder),
@@ -4287,9 +4289,18 @@ class SearchService {
4287
4289
  if (quickOrder[DEFAULT_NAMED_QUERY_ID]) {
4288
4290
  params['order'] = `${quickOrder[DEFAULT_NAMED_QUERY_ID]?.attribute},${quickOrder[DEFAULT_NAMED_QUERY_ID]?.asc ?? ''}`;
4289
4291
  }
4290
- const _condition = { ...condition, limit: limits[DEFAULT_NAMED_QUERY_ID] ?? limits['default'] };
4292
+ const otherParams = {};
4293
+ if (withLinkedItems.length > 0) {
4294
+ if (withLinkedItems.includes('destination')) {
4295
+ otherParams['withDestinationItems'] = 'true';
4296
+ }
4297
+ if (withLinkedItems.includes('source')) {
4298
+ otherParams['withSourceItems'] = 'true';
4299
+ }
4300
+ }
4301
+ const _condition = { ...condition, limit: limits[DEFAULT_NAMED_QUERY_ID] ?? limits['default'], ...otherParams };
4291
4302
  return this.httpClient.post(encodeURI(`${url}/items/search`), _condition, { params });
4292
- }), map((rs) => this.applyTransformations(DEFAULT_NAMED_QUERY_ID, rs)));
4303
+ }), map((rs) => this.applyTransformations(id ?? DEFAULT_NAMED_QUERY_ID, rs)));
4293
4304
  }
4294
4305
  /**
4295
4306
  * Allows to add a transformation function when getting results from backend
@@ -4908,6 +4919,7 @@ const RelationTypesActions = {
4908
4919
  deleteRelationTypeSuccess: createAction('[Relation Types Api] Delete Relation Types Success'),
4909
4920
  deleteRelationTypeFailure: createAction('[Relation Types Api] Delete Relation Types Failure', props()),
4910
4921
  createRelation: createAction('[Relation Types Api] Create Relation', props()),
4922
+ deleteRelation: createAction('[Relation Types Api] Delete Relation', props()),
4911
4923
  createRelationSuccess: createAction('[Relation Types Api] Create Relation success'),
4912
4924
  createRelationFailure: createAction('[Relation Types Api] Create Relation failure', props()),
4913
4925
  openModal: createAction('[Relation Types] Open modal'),
@@ -4946,6 +4958,10 @@ class RelationTypesService {
4946
4958
  }
4947
4959
  return this.store.select(ConfigSelectors.dataUrl).pipe(mergeMap((url) => this.httpClient.post(`${url}/relations`, relations)), map(() => relations));
4948
4960
  }
4961
+ deleteRelation(source, destination, relationType) {
4962
+ const relation = { source, destination, relationType };
4963
+ return this.store.select(ConfigSelectors.dataUrl).pipe(mergeMap((url) => this.httpClient.delete(`${url}/relations`, { body: relation })), map(() => relation));
4964
+ }
4949
4965
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: RelationTypesService, deps: [{ token: i1.Store }, { token: i1$2.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
4950
4966
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: RelationTypesService, providedIn: 'root' }); }
4951
4967
  }
@@ -4985,6 +5001,7 @@ class RelationTypesEffects {
4985
5001
  RelationTypesActions.createRelationSuccess(),
4986
5002
  DashboardActions.addRelationsToResultSets({ relations })
4987
5003
  ]), catchError((error) => [RelationTypesActions.createRelationFailure({ error })])))));
5004
+ this.deleteRelation$ = createEffect(() => this.actions$.pipe(ofType(RelationTypesActions.deleteRelation), mergeMap$1((action) => this.service.deleteRelation(action.from, action.to, action.typeId).pipe(map$1((relation) => DashboardActions.removeRelationsFromResultSets({ relation })), catchError((error) => [RelationTypesActions.createRelationFailure({ error })])))));
4988
5005
  }
4989
5006
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: RelationTypesEffects, deps: [{ token: i1$3.Actions }, { token: RelationTypesService }, { token: i3.Router }, { token: PryDialogService }], target: i0.ɵɵFactoryTarget.Injectable }); }
4990
5007
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.7", ngImport: i0, type: RelationTypesEffects }); }
@@ -5264,7 +5281,7 @@ class SearchEffects {
5264
5281
  this.store = store;
5265
5282
  this.widgetFactoryService = widgetFactoryService;
5266
5283
  this.searchNamed$ = createEffect(() => this.actions$.pipe(ofType(SearchActions.getDatasourceItems), withLatestFrom$1(this.store.select(DashboardSelectors.rank), this.store.select(DashboardSelectors.quickOrder), this.store.select(DashboardSelectors.resultSets)), filter(([_, rank]) => rank === 0), filter(([props, rank]) => props.id !== DEFAULT_NAMED_QUERY_ID && props.id !== EXPLORE_NAMED_QUERY_ID), groupBy(([props, rank, quickOrder, rs]) => props.id), mergeMap((group$) => group$.pipe(debounceTime(100), switchMap(([props, rank, quickOrder, rs]) => this.searchService
5267
- .getItems(props.id, quickOrder[props.id], props.excludeGeo, props.next ? rs[props.id].searchAfter : undefined)
5284
+ .getItems(props.id, quickOrder[props.id], props.excludeGeo, props.next ? rs[props.id].searchAfter : undefined, props.linkedItems)
5268
5285
  .pipe(map((resultSet) => SearchActions.searchSuccess({
5269
5286
  resultSet,
5270
5287
  id: props.id,
@@ -5288,7 +5305,7 @@ class SearchEffects {
5288
5305
  return EMPTY;
5289
5306
  }
5290
5307
  })));
5291
- 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, id: props.id })])))));
5308
+ this.search$ = createEffect(() => this.actions$.pipe(ofType(SearchActions.search), mergeMap((props) => this.searchService.search(props.payload, props.id, props.linkedItems).pipe(map((resultSet) => SearchActions.searchSuccess({ resultSet, id: props.id })), catchError$1((error) => [SearchActions.searchFailure({ error, id: props.id })])))));
5292
5309
  this.searchSuccess$ = createEffect(() => this.actions$.pipe(ofType(SearchActions.searchSuccess), map((action) => DashboardActions.updateResultSet({
5293
5310
  id: action.id ?? DEFAULT_NAMED_QUERY_ID,
5294
5311
  resultSet: action.resultSet,
@@ -12926,6 +12943,25 @@ const internalReducer = createReducer(dashboardInitialState, on(DashboardActions
12926
12943
  resultSets: updatedResultSets
12927
12944
  }
12928
12945
  };
12946
+ }), on(DashboardActions.removeRelationsFromResultSets, (state, action) => {
12947
+ const updatedResultSets = JSON.parse(JSON.stringify(state.results.resultSets));
12948
+ Object.keys(updatedResultSets).forEach((rsId) => {
12949
+ const isConcerned = Object.keys(updatedResultSets[rsId].items).map((classId) => {
12950
+ return updatedResultSets[rsId].items[classId].map((item) => item.id === action.relation.source || item.id === action.relation.destination);
12951
+ });
12952
+ if (isConcerned) {
12953
+ updatedResultSets[rsId].relations.filter((rel) => rel.relationType !== action.relation.relationType ||
12954
+ rel.source !== action.relation.source ||
12955
+ rel.destination !== action.relation.destination);
12956
+ }
12957
+ });
12958
+ return {
12959
+ ...state,
12960
+ results: {
12961
+ ...state.results,
12962
+ resultSets: updatedResultSets
12963
+ }
12964
+ };
12929
12965
  }), on(DashboardActions.addItemToResultSets, (state, action) => {
12930
12966
  const updatedResultSets = JSON.parse(JSON.stringify(state.results.resultSets));
12931
12967
  if (!!action.resultSet) {