@provoly/dashboard 1.1.7 → 1.1.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 (101) hide show
  1. package/admin/admin.module.d.ts +1 -1
  2. package/admin/components/admin-dataset/admin-edit-dataset/admin-edit-dataset.component.d.ts +3 -2
  3. package/admin/components/admin-dataset/store/admin-dataset.actions.d.ts +76 -0
  4. package/admin/components/admin-dataset/store/admin-dataset.effects.d.ts +71 -0
  5. package/admin/components/admin-dataset/store/admin-dataset.reducer.d.ts +10 -0
  6. package/admin/components/admin-dataset/store/admin-dataset.selectors.d.ts +10 -0
  7. package/admin/components/admin-dataset/store/admin-dataset.service.d.ts +20 -0
  8. package/admin/store/admin.effects.d.ts +1 -14
  9. package/components/metadata-editor/store/metadata.effects.d.ts +1 -23
  10. package/components/stepper/stepper.component.d.ts +2 -1
  11. package/esm2022/admin/admin.module.mjs +8 -2
  12. package/esm2022/admin/components/admin-dataset/admin-dataset.component.mjs +8 -6
  13. package/esm2022/admin/components/admin-dataset/admin-edit-dataset/admin-edit-dataset.component.mjs +5 -4
  14. package/esm2022/admin/components/admin-dataset/admin-select-dataset/admin-select-dataset.component.mjs +11 -9
  15. package/esm2022/admin/components/admin-dataset/shared/admin-form-dataset/admin-form-dataset.component.mjs +4 -3
  16. package/esm2022/admin/components/admin-dataset/store/admin-dataset.actions.mjs +17 -0
  17. package/esm2022/admin/components/admin-dataset/store/admin-dataset.effects.mjs +104 -0
  18. package/esm2022/admin/components/admin-dataset/store/admin-dataset.reducer.mjs +29 -0
  19. package/esm2022/admin/components/admin-dataset/store/admin-dataset.selectors.mjs +19 -0
  20. package/esm2022/admin/components/admin-dataset/store/admin-dataset.service.mjs +56 -0
  21. package/esm2022/admin/store/admin.effects.mjs +9 -36
  22. package/esm2022/components/metadata-editor/store/metadata.effects.mjs +4 -23
  23. package/esm2022/components/stepper/stepper.component.mjs +11 -8
  24. package/esm2022/dataset/components/dataset-card/dataset-card.component.mjs +1 -1
  25. package/esm2022/import/components/import.component.mjs +101 -61
  26. package/esm2022/import/i18n/en.translations.mjs +3 -2
  27. package/esm2022/import/i18n/fr.translations.mjs +3 -2
  28. package/esm2022/import/style/css.component.mjs +2 -2
  29. package/esm2022/lib/core/access/access.service.mjs +4 -1
  30. package/esm2022/lib/core/components/share/access-rights-share/access-rights-share.component.mjs +23 -10
  31. package/esm2022/lib/core/components/share/access-rights-share-modal/access-rights-share-modal.component.mjs +92 -0
  32. package/esm2022/lib/core/components/share/share.module.mjs +39 -6
  33. package/esm2022/lib/core/i18n/fr.translations.mjs +2 -2
  34. package/esm2022/lib/core/model/filter.interface.mjs +1 -1
  35. package/esm2022/lib/core/public-api.mjs +2 -1
  36. package/esm2022/lib/core/store/aggregation/frontend-aggregation/aggregation-utils.class.mjs +52 -47
  37. package/esm2022/lib/core/store/data-source/data-source.actions.mjs +1 -15
  38. package/esm2022/lib/core/store/data-source/data-source.effects.mjs +1 -39
  39. package/esm2022/lib/core/store/data-source/data-source.reducer.mjs +8 -29
  40. package/esm2022/lib/core/store/data-source/data-source.selectors.mjs +1 -9
  41. package/esm2022/lib/core/store/data-source/data-source.service.mjs +1 -36
  42. package/esm2022/presentation/components/presentation.component.mjs +14 -92
  43. package/esm2022/restitution/components/restitution/restitution.component.mjs +4 -3
  44. package/esm2022/restitution/components/restitution-list/restitution-list.component.mjs +10 -23
  45. package/esm2022/restitution/components/restitution-list-item/restitution-list-item.component.mjs +4 -16
  46. package/esm2022/restitution/i18n/en.translations.mjs +2 -1
  47. package/esm2022/restitution/i18n/fr.translations.mjs +2 -1
  48. package/esm2022/restitution/style/css.component.mjs +2 -2
  49. package/esm2022/toolbox/components/edit-mode-action/edit-mode-action.component.mjs +1 -1
  50. package/esm2022/toolbox/components/save-view/save-view.component.mjs +1 -1
  51. package/esm2022/toolbox/components/share/share.component.mjs +18 -75
  52. package/esm2022/toolbox/components/toolbox-action/toolbox-action.component.mjs +7 -4
  53. package/esm2022/toolbox/toolbox.model.mjs +2 -2
  54. package/esm2022/widgets/widget-map/utils/cql-utils.class.mjs +2 -2
  55. package/fesm2022/provoly-dashboard-admin.mjs +216 -37
  56. package/fesm2022/provoly-dashboard-admin.mjs.map +1 -1
  57. package/fesm2022/provoly-dashboard-components-metadata-editor.mjs +4 -21
  58. package/fesm2022/provoly-dashboard-components-metadata-editor.mjs.map +1 -1
  59. package/fesm2022/provoly-dashboard-components-stepper.mjs +10 -7
  60. package/fesm2022/provoly-dashboard-components-stepper.mjs.map +1 -1
  61. package/fesm2022/provoly-dashboard-dataset.mjs.map +1 -1
  62. package/fesm2022/provoly-dashboard-import.mjs +106 -65
  63. package/fesm2022/provoly-dashboard-import.mjs.map +1 -1
  64. package/fesm2022/provoly-dashboard-presentation.mjs +13 -91
  65. package/fesm2022/provoly-dashboard-presentation.mjs.map +1 -1
  66. package/fesm2022/provoly-dashboard-restitution.mjs +13 -34
  67. package/fesm2022/provoly-dashboard-restitution.mjs.map +1 -1
  68. package/fesm2022/provoly-dashboard-toolbox.mjs +33 -82
  69. package/fesm2022/provoly-dashboard-toolbox.mjs.map +1 -1
  70. package/fesm2022/provoly-dashboard-widgets-widget-map.mjs +1 -1
  71. package/fesm2022/provoly-dashboard-widgets-widget-map.mjs.map +1 -1
  72. package/fesm2022/provoly-dashboard.mjs +206 -194
  73. package/fesm2022/provoly-dashboard.mjs.map +1 -1
  74. package/import/components/import.component.d.ts +31 -18
  75. package/import/i18n/en.translations.d.ts +2 -1
  76. package/import/i18n/fr.translations.d.ts +2 -1
  77. package/import/style/_o-import.scss +16 -29
  78. package/lib/core/access/access.service.d.ts +2 -0
  79. package/lib/core/components/share/access-rights-share/access-rights-share.component.d.ts +5 -2
  80. package/lib/core/components/share/access-rights-share-modal/access-rights-share-modal.component.d.ts +34 -0
  81. package/lib/core/components/share/share.module.d.ts +9 -8
  82. package/lib/core/model/filter.interface.d.ts +1 -1
  83. package/lib/core/public-api.d.ts +1 -0
  84. package/lib/core/store/aggregation/frontend-aggregation/aggregation-utils.class.d.ts +1 -1
  85. package/lib/core/store/data-source/data-source.actions.d.ts +1 -91
  86. package/lib/core/store/data-source/data-source.effects.d.ts +2 -30
  87. package/lib/core/store/data-source/data-source.reducer.d.ts +0 -3
  88. package/lib/core/store/data-source/data-source.selectors.d.ts +0 -4
  89. package/lib/core/store/data-source/data-source.service.d.ts +0 -9
  90. package/package.json +19 -19
  91. package/presentation/components/presentation.component.d.ts +4 -18
  92. package/restitution/components/restitution/restitution.component.d.ts +1 -0
  93. package/restitution/components/restitution-list/restitution-list.component.d.ts +3 -9
  94. package/restitution/components/restitution-list-item/restitution-list-item.component.d.ts +1 -4
  95. package/restitution/i18n/en.translations.d.ts +1 -0
  96. package/restitution/i18n/fr.translations.d.ts +1 -0
  97. package/restitution/style/_o-restitution-list.scss +0 -11
  98. package/styles/components/_o-modal.scss +1 -1
  99. package/styles-theme/components-theme/_o-restitution-list.theme.scss +0 -9
  100. package/toolbox/components/share/share.component.d.ts +4 -22
  101. package/toolbox/components/toolbox-action/toolbox-action.component.d.ts +3 -1
@@ -1871,6 +1871,66 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.3", ngImpor
1871
1871
  args: [{ selector: 'pry-admin-classes', template: "<div class=\"o-base-container\">\n <h1 class=\"a-h1\">{{ '@pry.admin.classes.list' | i18n }}</h1>\n <table\n class=\"a-table\"\n prySortTable\n prySortActive=\"name\"\n prySortDirection=\"asc\"\n (prySortChange)=\"sortActive = $event.active; sortDirection = $event.direction\"\n >\n <caption>\n {{\n '@pry.admin.classes.list' | i18n\n }},\n {{\n '@pry.action.sortableColumnHeader' | i18n\n }}\n </caption>\n <thead>\n <tr>\n <th></th>\n <th prySortHeader=\"image\">{{ '@pry.admin.classes.image' | i18n }}</th>\n <th prySortHeader=\"name\">{{ '@pry.admin.classes.name' | i18n }}</th>\n <th prySortHeader=\"lines\">{{ '@pry.admin.menus.dataset' | i18n }}</th>\n </tr>\n </thead>\n <tbody>\n <tr\n *ngFor=\"let clazz of classesInputFlows$ | async | prySortData: sortActive : sortDirection\"\n (click)=\"selectClass(clazz)\"\n [class.is-selected]=\"(selectedClassId$ | async) === clazz.id\"\n >\n <td class=\"view-details\">\n <button\n id=\"button-class-{{ clazz.id }}\"\n type=\"button\"\n class=\"a-btn a-btn--icon-only\"\n title=\"{{ '@pry.action.viewDetails' | i18n }}\"\n [attr.aria-expanded]=\"(selectedClassId$ | async) === clazz.id\"\n aria-haspopup\n [attr.aria-controls]=\"'panel-class-' + clazz.id\"\n >\n <span class=\"u-visually-hidden\">{{ clazz.name }}, {{ '@pry.action.viewDetails' | i18n }}</span>\n <pry-icon iconSvg=\"eye\" [width]=\"15\" [height]=\"15\"></pry-icon>\n </button>\n </td>\n <td>\n <img\n alt=\"\"\n [height]=\"25\"\n [width]=\"25\"\n [src]=\"clazz.id | translateId: { type: 'class', output: 'icon' } | async\"\n />\n </td>\n <td>{{ clazz.name }}</td>\n <td>{{ clazz.count }}</td>\n </tr>\n </tbody>\n </table>\n</div>\n" }]
1872
1872
  }], ctorParameters: () => [{ type: i1.Store }, { type: i2.Router }, { type: i2.ActivatedRoute }] });
1873
1873
 
1874
+ const AdminDatasetActions = {
1875
+ failure: createAction('[Dataset] failure effect Dataset', props()),
1876
+ create: createAction('[Dataset] create Dataset', props()),
1877
+ update: createAction('[Dataset] update Dataset', props()),
1878
+ confirmDatasetDeletion: createAction('[Dataset] confirm deletion', props()),
1879
+ delete: createAction('[Dataset] delete Dataset', props()),
1880
+ deleted: createAction('[Dataset] Dataset is deleted call to admin', props()),
1881
+ selectDataset: createAction('[Dataset] open Dataset details', props()),
1882
+ unselectDataset: createAction('[Dataset] unselect Dataset'),
1883
+ getDatasetById: createAction('[Dataset] Get Dataset by ID', props()),
1884
+ getDatasetByIdSuccess: createAction('[Dataset] Get Dataset by Id Success', props()),
1885
+ getDatasetByIdFailure: createAction('[Dataset] Get Dataset by Id Failure', props()),
1886
+ openNewDataset: createAction('[Dataset] open new Dataset', props()),
1887
+ setMissingGroups: createAction('[Dataset] set missing groups', props())
1888
+ };
1889
+
1890
+ const datasetFeatureKey = '@pry/admin/datasets';
1891
+ const initialDatasetState = {
1892
+ isLoading: false,
1893
+ selectedDataset: null
1894
+ };
1895
+ const datasetReducer = createReducer(initialDatasetState, on(AdminDatasetActions.getDatasetById, (state, action) => ({
1896
+ ...state,
1897
+ loading: true
1898
+ })), on(AdminDatasetActions.getDatasetByIdSuccess, (state, action) => ({
1899
+ ...state,
1900
+ selectedDataset: action.data,
1901
+ loading: false
1902
+ })), on(AdminDatasetActions.getDatasetByIdFailure, (state, action) => ({
1903
+ ...state,
1904
+ error: action.error,
1905
+ loading: false
1906
+ })), on(AdminDatasetActions.setMissingGroups, (state, { missingGroups }) => ({
1907
+ ...state,
1908
+ missingGroups
1909
+ })), on(AdminDatasetActions.unselectDataset, (state) => ({
1910
+ ...state,
1911
+ selectedDataset: null
1912
+ })), on(AdminDatasetActions.selectDataset, (state, action) => ({
1913
+ ...state,
1914
+ selectedDataset: action.dataset
1915
+ })));
1916
+
1917
+ const selectFeature = createFeatureSelector(datasetFeatureKey);
1918
+ const errors = createSelector(selectFeature, (state) => state.error);
1919
+ const isLoading = createSelector(selectFeature, (state) => state.isLoading);
1920
+ const selectedDatasetId = createSelector(selectFeature, (state) => state?.selectedDataset?.id);
1921
+ const selectedDataset = createSelector(selectFeature, (state) => state?.selectedDataset);
1922
+ const selectedDatasetMetadata = createSelector(selectFeature, (state) => state?.selectedDataset?.metadata ?? []);
1923
+ const selectedDatasetMissingGroups = createSelector(selectFeature, (state) => state?.missingGroups);
1924
+ const AdminDatasetSelectors = {
1925
+ selectFeature,
1926
+ errors,
1927
+ isLoading,
1928
+ selectedDataset,
1929
+ selectedDatasetMetadata,
1930
+ selectedDatasetMissingGroups,
1931
+ selectedDatasetId
1932
+ };
1933
+
1874
1934
  class AdminDatasetComponent {
1875
1935
  constructor(store, translateService, router, route) {
1876
1936
  this.store = store;
@@ -1892,13 +1952,13 @@ class AdminDatasetComponent {
1892
1952
  { headerType: 'label', label: this.translateService.instant('@pry.admin.dataset.type') }
1893
1953
  ];
1894
1954
  this.datasetList$ = this.store.select(DataSourceSelectors.datasets);
1895
- this.selectedDataset$ = this.store.select(DataSourceSelectors.selectedDatasetId);
1896
- this.store.dispatch(DataSourceActions.dataset.unselectDataset());
1955
+ this.selectedDataset$ = this.store.select(AdminDatasetSelectors.selectedDatasetId);
1956
+ this.store.dispatch(AdminDatasetActions.unselectDataset());
1897
1957
  const path = this.router.createUrlTree(['.', 'new'], { relativeTo: this.route });
1898
1958
  this.store.dispatch(AdminActions.mainActions({
1899
1959
  actions: [
1900
1960
  {
1901
- action: DataSourceActions.dataset.openNewDataset({ route: path.toString() }),
1961
+ action: AdminDatasetActions.openNewDataset({ route: path.toString() }),
1902
1962
  label: 'add',
1903
1963
  icon: 'add_column',
1904
1964
  moduleAccess: 'admin',
@@ -1910,7 +1970,7 @@ class AdminDatasetComponent {
1910
1970
  }
1911
1971
  cancelEdition() {
1912
1972
  this.toggleEditionDataset();
1913
- this.store.dispatch(DataSourceActions.dataset.unselectDataset());
1973
+ this.store.dispatch(AdminDatasetActions.unselectDataset());
1914
1974
  }
1915
1975
  toggleEditionDataset() {
1916
1976
  this.editOpened = !this.editOpened;
@@ -1928,7 +1988,7 @@ class AdminDatasetComponent {
1928
1988
  }
1929
1989
  selectDataset(dataset) {
1930
1990
  this.store.dispatch(AdminActions.fetchDatasetAssociations({ id: dataset.id }));
1931
- this.store.dispatch(DataSourceActions.dataset.selectDataset({ dataset }));
1991
+ this.store.dispatch(AdminDatasetActions.selectDataset({ dataset }));
1932
1992
  this.store.dispatch(AdminActions.selectComponentType({ componentType: 'AdminSelectDatasetComponent' }));
1933
1993
  }
1934
1994
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: AdminDatasetComponent, deps: [{ token: i1.Store }, { token: i4.PryI18nService }, { token: i2.Router }, { token: i2.ActivatedRoute }], target: i0.ɵɵFactoryTarget.Component }); }
@@ -2008,13 +2068,13 @@ class AdminFormDatasetComponent {
2008
2068
  this.isSubmitted = false;
2009
2069
  if (this.dataset$) {
2010
2070
  const path = this.router.createUrlTree(['../..'], { relativeTo: this.route });
2011
- this.store.dispatch(DataSourceActions.dataset.update({ dataset: this.form.value, route: path.toString() }));
2071
+ this.store.dispatch(AdminDatasetActions.update({ dataset: this.form.value, route: path.toString() }));
2012
2072
  return;
2013
2073
  }
2014
2074
  const path = this.router.createUrlTree(['..'], { relativeTo: this.route });
2015
2075
  this.isSameName = !!this.datasetList.find((dataset) => this.form.get('name')?.value.toLowerCase() === dataset.name.toLowerCase());
2016
2076
  if (!this.isSameName) {
2017
- this.store.dispatch(DataSourceActions.dataset.create({ dataset: this.form.value, route: path.toString() }));
2077
+ this.store.dispatch(AdminDatasetActions.create({ dataset: this.form.value, route: path.toString() }));
2018
2078
  }
2019
2079
  }
2020
2080
  }
@@ -2032,11 +2092,11 @@ class AdminEditDatasetComponent {
2032
2092
  constructor(store, route) {
2033
2093
  this.store = store;
2034
2094
  this.route = route;
2035
- this.datasetSelected$ = this.store.select(DataSourceSelectors.selectedDataset);
2095
+ this.datasetSelected$ = this.store.select(AdminDatasetSelectors.selectedDataset);
2036
2096
  }
2037
2097
  ngOnInit() {
2038
2098
  this.route.params.subscribe((params) => {
2039
- this.store.dispatch(DataSourceActions.dataset.getDatasetById({ id: params['uuid'] }));
2099
+ this.store.dispatch(AdminDatasetActions.getDatasetById({ id: params['uuid'] }));
2040
2100
  });
2041
2101
  }
2042
2102
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: AdminEditDatasetComponent, deps: [{ token: i1.Store }, { token: i2.ActivatedRoute }], target: i0.ɵɵFactoryTarget.Component }); }
@@ -2778,11 +2838,11 @@ class AdminSelectDatasetComponent extends SubscriptionnerDirective {
2778
2838
  this.shareRadioValue$ = new BehaviorSubject(undefined);
2779
2839
  this.disableShareButton$ = new BehaviorSubject(false);
2780
2840
  this.store.dispatch(MetadataActions.loadMetadata());
2781
- this.selectedDataset$ = this.store.select(DataSourceSelectors.selectedDataset);
2782
- this.datasetMetadata$ = this.store.select(DataSourceSelectors.selectedDatasetMetadata);
2841
+ this.selectedDataset$ = this.store.select(AdminDatasetSelectors.selectedDataset);
2842
+ this.datasetMetadata$ = this.store.select(AdminDatasetSelectors.selectedDatasetMetadata);
2783
2843
  this.associations$ = this.store.select(AdminSelectors.selectedAssociation);
2784
2844
  this.editable$ = this.store.select(MetadataSelectors.editable);
2785
- this.selectedDatasetMissingGroups$ = this.store.select(DataSourceSelectors.selectedDatasetMissingGroups);
2845
+ this.selectedDatasetMissingGroups$ = this.store.select(AdminDatasetSelectors.selectedDatasetMissingGroups);
2786
2846
  this.missingGroups$ = this.selectedDatasetMissingGroups$.pipe(withLatestFrom(this.store.select(DashboardSelectors.manifestsList)), map(([conflict, manifests]) => {
2787
2847
  const result = {};
2788
2848
  Object.keys(conflict ?? {}).forEach((entityId) => {
@@ -2813,7 +2873,7 @@ class AdminSelectDatasetComponent extends SubscriptionnerDirective {
2813
2873
  actionAccess: 'write'
2814
2874
  },
2815
2875
  {
2816
- action: DataSourceActions.dataset.confirmDataSourceDeletion({
2876
+ action: AdminDatasetActions.confirmDatasetDeletion({
2817
2877
  name: dataset.id,
2818
2878
  route: this.router.createUrlTree(['.', 'dataset'], { relativeTo: this.route }).toString(),
2819
2879
  addRoute: this.router
@@ -2840,7 +2900,7 @@ class AdminSelectDatasetComponent extends SubscriptionnerDirective {
2840
2900
  }
2841
2901
  closePanel() {
2842
2902
  const path = this.router.createUrlTree(['.', 'dataset', 'new'], { relativeTo: this.route });
2843
- this.store.dispatch(DataSourceActions.dataset.unselectDataset());
2903
+ this.store.dispatch(AdminDatasetActions.unselectDataset());
2844
2904
  this.store.dispatch(AdminActions.togglePanel({ panelOpen: false }));
2845
2905
  this.store.dispatch(AdminActions.mainActions({
2846
2906
  actions: [
@@ -2866,7 +2926,7 @@ class AdminSelectDatasetComponent extends SubscriptionnerDirective {
2866
2926
  }));
2867
2927
  }
2868
2928
  share(dataset) {
2869
- this.store.dispatch(DataSourceActions.dataset.update({ dataset: { ...dataset, groups: this.accessGroups }, route: '' }));
2929
+ this.store.dispatch(AdminDatasetActions.update({ dataset: { ...dataset, groups: this.accessGroups }, route: '' }));
2870
2930
  }
2871
2931
  getGroupLabel(groupName) {
2872
2932
  const i18nBase = '@pry.components.chipsSelector.share.groups.';
@@ -2876,7 +2936,7 @@ class AdminSelectDatasetComponent extends SubscriptionnerDirective {
2876
2936
  changeGroup($event) {
2877
2937
  this.accessGroups = $event;
2878
2938
  this.updateDisableButtonValue();
2879
- this.store.dispatch(DataSourceActions.dataset.setMissingGroups({ missingGroups: undefined }));
2939
+ this.store.dispatch(AdminDatasetActions.setMissingGroups({ missingGroups: undefined }));
2880
2940
  }
2881
2941
  updateVisibility($event) {
2882
2942
  this.shareRadioValue$.next($event);
@@ -6600,12 +6660,11 @@ const frTranslations = {
6600
6660
  };
6601
6661
 
6602
6662
  class AdminEffects {
6603
- constructor(actions$, service, router, dsService) {
6663
+ constructor(actions$, service, router) {
6604
6664
  this.actions$ = actions$;
6605
6665
  this.service = service;
6606
6666
  this.router = router;
6607
- this.dsService = dsService;
6608
- this.routeTo$ = createEffect(() => this.actions$.pipe(ofType(AdminActions.routeTo, DataSourceActions.dataset.created, DataSourceActions.dataset.updated), mergeMap((action) => {
6667
+ this.routeTo$ = createEffect(() => this.actions$.pipe(ofType(AdminActions.routeTo), mergeMap((action) => {
6609
6668
  this.router.navigate([action.path], { queryParams: action.params });
6610
6669
  return action.path === this.router.url ? [] : [AdminActions.resetActions()];
6611
6670
  })));
@@ -6633,7 +6692,115 @@ class AdminEffects {
6633
6692
  this.closePanel$ = createEffect(() => this.actions$.pipe(ofType(AdminActions.highlightMenu), mergeMap((action) => {
6634
6693
  return [AdminActions.togglePanel({ panelOpen: false })];
6635
6694
  })));
6636
- this.deleted$ = createEffect(() => this.actions$.pipe(ofType(DataSourceActions.dataset.deleted), mergeMap((action) => [
6695
+ this.openNewDataset$ = createEffect(() => this.actions$.pipe(ofType(AdminDatasetActions.openNewDataset), map((action) => {
6696
+ return AdminActions.routeTo({ path: action.route });
6697
+ })));
6698
+ this.fetchClassAssociations$ = createEffect(() => this.actions$.pipe(ofType(AdminActions.fetchClassAssociations), mergeMap((action) => this.service.getClassAssociations(action.id).pipe(map((association) => AdminActions.fetchAssociationsSuccess({ association })), catchError((error) => [AdminActions.fetchAssociationsFailure({ error: error })])))));
6699
+ this.fetchFieldAssociations$ = createEffect(() => this.actions$.pipe(ofType(AdminActions.fetchFieldAssociations), mergeMap((action) => this.service.getFieldAssociations(action.id).pipe(map((association) => AdminActions.fetchAssociationsSuccess({ association })), catchError((error) => [AdminActions.fetchAssociationsFailure({ error: error })])))));
6700
+ this.fetchDatasetAssociations$ = createEffect(() => this.actions$.pipe(ofType(AdminActions.fetchDatasetAssociations), mergeMap((action) => this.service.getDatasetAssociations(action.id).pipe(map((association) => AdminActions.fetchAssociationsSuccess({ association })), catchError((error) => [AdminActions.fetchAssociationsFailure({ error: error })])))));
6701
+ this.fetchAttributeAssociations$ = createEffect(() => this.actions$.pipe(ofType(AdminActions.fetchAttributeAssociations), mergeMap((action) => this.service.getAttributeAssociations(action.id).pipe(map((association) => AdminActions.fetchAssociationsSuccess({ association })), catchError((error) => [AdminActions.fetchAssociationsFailure({ error: error })])))));
6702
+ }
6703
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: AdminEffects, deps: [{ token: i1$2.Actions }, { token: AdminService }, { token: i2.Router }], target: i0.ɵɵFactoryTarget.Injectable }); }
6704
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: AdminEffects }); }
6705
+ }
6706
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: AdminEffects, decorators: [{
6707
+ type: Injectable
6708
+ }], ctorParameters: () => [{ type: i1$2.Actions }, { type: AdminService }, { type: i2.Router }] });
6709
+
6710
+ class AdminDatasetService {
6711
+ constructor(store, httpClient) {
6712
+ this.store = store;
6713
+ this.httpClient = httpClient;
6714
+ }
6715
+ addDataset(dataset) {
6716
+ return this.store
6717
+ .select(ConfigSelectors.refUrl)
6718
+ .pipe(mergeMap((url) => this.httpClient.post(encodeURI(`${url}/datasets`), dataset)));
6719
+ }
6720
+ updateDataset(dataset) {
6721
+ return this.store
6722
+ .select(ConfigSelectors.refUrl)
6723
+ .pipe(mergeMap((url) => this.httpClient.put(encodeURI(`${url}/datasets`), dataset)));
6724
+ }
6725
+ deleteDataset(id) {
6726
+ return this.store
6727
+ .select(ConfigSelectors.refUrl)
6728
+ .pipe(mergeMap((url) => this.httpClient.delete(`${url}/datasets/id/${id}`)));
6729
+ }
6730
+ getDatasetById(id) {
6731
+ return this.store
6732
+ .select(ConfigSelectors.refUrl)
6733
+ .pipe(mergeMap((url) => this.httpClient.get(`${url}/datasets/id/${id}`)));
6734
+ }
6735
+ getDatasetMetadata(id) {
6736
+ return this.store
6737
+ .select(ConfigSelectors.refUrl)
6738
+ .pipe(mergeMap((url) => this.httpClient.get(`${url}/datasets/id/${id}/metadata`)));
6739
+ }
6740
+ addDatasetMetadata(datasetId, metadataId, value) {
6741
+ return this.store.select(ConfigSelectors.refUrl).pipe(mergeMap((url) => this.httpClient.put(encodeURI(`${url}/datasets/id/${datasetId}/metadata/id/${metadataId}`), {
6742
+ value: value
6743
+ })));
6744
+ }
6745
+ deleteDatasetMetadata(datasetId, metadataId) {
6746
+ return this.store
6747
+ .select(ConfigSelectors.refUrl)
6748
+ .pipe(mergeMap((url) => this.httpClient.delete(encodeURI(`${url}/datasets/id/${datasetId}/metadata/id/${metadataId}`))));
6749
+ }
6750
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: AdminDatasetService, deps: [{ token: i1.Store }, { token: i1$1.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable }); }
6751
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: AdminDatasetService, providedIn: 'root' }); }
6752
+ }
6753
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: AdminDatasetService, decorators: [{
6754
+ type: Injectable,
6755
+ args: [{
6756
+ providedIn: 'root'
6757
+ }]
6758
+ }], ctorParameters: () => [{ type: i1.Store }, { type: i1$1.HttpClient }] });
6759
+
6760
+ class AdminDatasetEffects {
6761
+ constructor(actions$, datasetService, pryDialog) {
6762
+ this.actions$ = actions$;
6763
+ this.datasetService = datasetService;
6764
+ this.pryDialog = pryDialog;
6765
+ this.createDataset$ = createEffect(() => this.actions$.pipe(ofType(AdminDatasetActions.create), switchMap((props) => this.datasetService
6766
+ .addDataset(props.dataset)
6767
+ .pipe(mergeMap(() => [
6768
+ DataSourceActions.dataset.loadDataset(),
6769
+ AdminDatasetActions.unselectDataset(),
6770
+ AdminActions.routeTo({ path: props.route })
6771
+ ]))), catchError$1((error) => [AdminDatasetActions.failure({ error })])));
6772
+ this.confirmDatasetDeletion$ = createEffect(() => this.actions$.pipe(ofType(AdminDatasetActions.confirmDatasetDeletion), tap((action) => {
6773
+ const data = {
6774
+ title: '@pry.admin.infoModalTitle',
6775
+ message: '@pry.admin.dataset.delete',
6776
+ actions: [
6777
+ {
6778
+ id: 0,
6779
+ label: '@pry.admin.delete',
6780
+ actions: [
6781
+ AdminDatasetActions.delete({
6782
+ name: action.name,
6783
+ route: action.route,
6784
+ addRoute: action.addRoute
6785
+ })
6786
+ ]
6787
+ },
6788
+ { id: 0, label: '@pry.admin.cancel' }
6789
+ ]
6790
+ };
6791
+ this.pryDialog.open(PryDialogConfirmComponent, { data });
6792
+ })), { dispatch: false });
6793
+ this.deleteDataset$ = createEffect(() => this.actions$.pipe(ofType(AdminDatasetActions.delete), switchMap((action) => this.datasetService.deleteDataset(action.name).pipe(mergeMap(() => [
6794
+ DataSourceActions.dataset.loadDataset(),
6795
+ AdminDatasetActions.unselectDataset(),
6796
+ AdminDatasetActions.deleted({ addRoute: action.addRoute })
6797
+ ]), catchError$1((error) => [AdminDatasetActions.failure({ error })])))));
6798
+ this.getDatasetById$ = createEffect(() => this.actions$.pipe(ofType(AdminDatasetActions.getDatasetById), mergeMap((action) => this.datasetService.getDatasetById(action.id).pipe(map((data) => AdminDatasetActions.getDatasetByIdSuccess({ data })), catchError$1((error) => [AdminDatasetActions.getDatasetByIdFailure({ error })])))));
6799
+ this.unsetMissingGroupsOnDatasetSelection$ = createEffect(() => this.actions$.pipe(ofType(AdminDatasetActions.selectDataset), mergeMap((action) => [
6800
+ AdminDatasetActions.setMissingGroups({ missingGroups: undefined }),
6801
+ DataSourceActions.dataset.listVersionsByDatasetId({ id: action.dataset.id })
6802
+ ])));
6803
+ this.deleted$ = createEffect(() => this.actions$.pipe(ofType(AdminDatasetActions.deleted), mergeMap((action) => [
6637
6804
  AdminActions.togglePanel({ panelOpen: false }),
6638
6805
  AdminActions.selectComponentType({ componentType: null }),
6639
6806
  AdminActions.mainActions({
@@ -6649,30 +6816,38 @@ class AdminEffects {
6649
6816
  ]
6650
6817
  })
6651
6818
  ])));
6652
- this.openNewDataset$ = createEffect(() => this.actions$.pipe(ofType(DataSourceActions.dataset.openNewDataset), map((action) => {
6653
- return AdminActions.routeTo({ path: action.route });
6654
- })));
6655
- this.fetchClassAssociations$ = createEffect(() => this.actions$.pipe(ofType(AdminActions.fetchClassAssociations), mergeMap((action) => this.service.getClassAssociations(action.id).pipe(map((association) => AdminActions.fetchAssociationsSuccess({ association })), catchError((error) => [AdminActions.fetchAssociationsFailure({ error: error })])))));
6656
- this.fetchFieldAssociations$ = createEffect(() => this.actions$.pipe(ofType(AdminActions.fetchFieldAssociations), mergeMap((action) => this.service.getFieldAssociations(action.id).pipe(map((association) => AdminActions.fetchAssociationsSuccess({ association })), catchError((error) => [AdminActions.fetchAssociationsFailure({ error: error })])))));
6657
- this.fetchDatasetAssociations$ = createEffect(() => this.actions$.pipe(ofType(AdminActions.fetchDatasetAssociations), mergeMap((action) => this.service.getDatasetAssociations(action.id).pipe(map((association) => AdminActions.fetchAssociationsSuccess({ association })), catchError((error) => [AdminActions.fetchAssociationsFailure({ error: error })])))));
6658
- this.fetchAttributeAssociations$ = createEffect(() => this.actions$.pipe(ofType(AdminActions.fetchAttributeAssociations), mergeMap((action) => this.service.getAttributeAssociations(action.id).pipe(map((association) => AdminActions.fetchAssociationsSuccess({ association })), catchError((error) => [AdminActions.fetchAssociationsFailure({ error: error })])))));
6659
- // TODO move this effect into an admin-datasource store (provoly-dashboard#586)
6660
- this.updateDataset$ = createEffect(() => this.actions$.pipe(ofType(DataSourceActions.dataset.update), switchMap((action) => this.dsService.updateDataset(action.dataset).pipe(mergeMap((conflict) => {
6819
+ this.updateDataset$ = createEffect(() => this.actions$.pipe(ofType(AdminDatasetActions.update), switchMap((action) => this.datasetService.updateDataset(action.dataset).pipe(mergeMap((conflict) => {
6661
6820
  let actions = [
6662
- DataSourceActions.dataset.setMissingGroups({ missingGroups: conflict?.missingGroupsByEntity }),
6821
+ AdminDatasetActions.setMissingGroups({ missingGroups: conflict?.missingGroupsByEntity }),
6663
6822
  DataSourceActions.dataset.loadDataset()
6664
6823
  ];
6665
6824
  if (action.route)
6666
- actions.push(DataSourceActions.dataset.unselectDataset(), AdminActions.routeTo({ path: action.route }));
6825
+ actions.push(AdminDatasetActions.unselectDataset(), AdminActions.routeTo({ path: action.route }));
6667
6826
  return actions;
6668
- }))), catchError((error) => [DataSourceActions.dataset.failure({ error })])));
6827
+ }))), catchError$1((error) => [DataSourceActions.dataset.failure({ error })])));
6828
+ this.addDatasetMetadata$ = createEffect(() => this.actions$.pipe(ofType(MetadataActions.addDatasetMetadata), mergeMap((action) => this.datasetService.addDatasetMetadata(action.datasetId, action.metadataId, action.value).pipe(map(() => MetadataActions.addDatasetMetadataSuccess({ datasetId: action.datasetId })), catchError$1((error) => [MetadataActions.addDatasetMetadataFailure({ error })])))));
6829
+ this.addDatasetMetadataSuccess$ = createEffect(() => this.actions$.pipe(ofType(MetadataActions.addDatasetMetadataSuccess), mergeMap((action) => {
6830
+ return [
6831
+ AdminDatasetActions.getDatasetById({ id: action.datasetId }),
6832
+ MetadataActions.isEditable({ editable: false }),
6833
+ DataSourceActions.dataset.loadDataset()
6834
+ ];
6835
+ })));
6836
+ this.deleteDatasetMetadata$ = createEffect(() => this.actions$.pipe(ofType(MetadataActions.deleteDatasetMetadata), mergeMap((action) => this.datasetService.deleteDatasetMetadata(action.datasetId, action.metadataId).pipe(map(() => MetadataActions.deleteDatasetMetadataSuccess({ datasetId: action.datasetId })), catchError$1((error) => [MetadataActions.deleteDatasetMetadataFailure({ error })])))));
6837
+ this.deleteDatasetMetadataSuccess$ = createEffect(() => this.actions$.pipe(ofType(MetadataActions.deleteDatasetMetadataSuccess), mergeMap((action) => {
6838
+ return [
6839
+ AdminDatasetActions.getDatasetById({ id: action.datasetId }),
6840
+ MetadataActions.isEditable({ editable: false }),
6841
+ DataSourceActions.dataset.loadDataset()
6842
+ ];
6843
+ })));
6669
6844
  }
6670
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: AdminEffects, deps: [{ token: i1$2.Actions }, { token: AdminService }, { token: i2.Router }, { token: i4.DataSourceService }], target: i0.ɵɵFactoryTarget.Injectable }); }
6671
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: AdminEffects }); }
6845
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: AdminDatasetEffects, deps: [{ token: i1$2.Actions }, { token: AdminDatasetService }, { token: i4.PryDialogService }], target: i0.ɵɵFactoryTarget.Injectable }); }
6846
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: AdminDatasetEffects }); }
6672
6847
  }
6673
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: AdminEffects, decorators: [{
6848
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: AdminDatasetEffects, decorators: [{
6674
6849
  type: Injectable
6675
- }], ctorParameters: () => [{ type: i1$2.Actions }, { type: AdminService }, { type: i2.Router }, { type: i4.DataSourceService }] });
6850
+ }], ctorParameters: () => [{ type: i1$2.Actions }, { type: AdminDatasetService }, { type: i4.PryDialogService }] });
6676
6851
 
6677
6852
  class PryAdminModule {
6678
6853
  constructor(pryTranslateService) {
@@ -6755,7 +6930,7 @@ class PryAdminModule {
6755
6930
  AdminClassesCustomizeSymbolComponent,
6756
6931
  PryAssociationComponent], imports: [CommonModule,
6757
6932
  PryCoreModule,
6758
- AdminRoutingModule, i1.StoreFeatureModule, i1.StoreFeatureModule, i1.StoreFeatureModule, i1.StoreFeatureModule, i1.StoreFeatureModule, i1.StoreFeatureModule, i1.StoreFeatureModule, i1.StoreFeatureModule, i1.StoreFeatureModule, i1.StoreFeatureModule, i1$2.EffectsFeatureModule, i1$2.EffectsFeatureModule, i1$2.EffectsFeatureModule, i1$2.EffectsFeatureModule, i1$2.EffectsFeatureModule, i1$2.EffectsFeatureModule, i1$2.EffectsFeatureModule, i1$2.EffectsFeatureModule, i1$2.EffectsFeatureModule, i1$2.EffectsFeatureModule, PryIconModule,
6933
+ AdminRoutingModule, i1.StoreFeatureModule, i1.StoreFeatureModule, i1.StoreFeatureModule, i1.StoreFeatureModule, i1.StoreFeatureModule, i1.StoreFeatureModule, i1.StoreFeatureModule, i1.StoreFeatureModule, i1.StoreFeatureModule, i1.StoreFeatureModule, i1.StoreFeatureModule, i1$2.EffectsFeatureModule, i1$2.EffectsFeatureModule, i1$2.EffectsFeatureModule, i1$2.EffectsFeatureModule, i1$2.EffectsFeatureModule, i1$2.EffectsFeatureModule, i1$2.EffectsFeatureModule, i1$2.EffectsFeatureModule, i1$2.EffectsFeatureModule, i1$2.EffectsFeatureModule, i1$2.EffectsFeatureModule, PryIconModule,
6759
6934
  FormsModule,
6760
6935
  ReactiveFormsModule,
6761
6936
  PrySortModule,
@@ -6785,6 +6960,7 @@ class PryAdminModule {
6785
6960
  StoreModule.forFeature(fieldsFeatureKey, fieldReducer),
6786
6961
  StoreModule.forFeature(adminUserFeatureKey, adminUserReducer),
6787
6962
  StoreModule.forFeature(linksFeatureKey, linkReducer),
6963
+ StoreModule.forFeature(datasetFeatureKey, datasetReducer),
6788
6964
  EffectsModule.forFeature([AdminEffects]),
6789
6965
  EffectsModule.forFeature([PredicatesEffects]),
6790
6966
  EffectsModule.forFeature([EnvironmentEffects]),
@@ -6795,6 +6971,7 @@ class PryAdminModule {
6795
6971
  EffectsModule.forFeature([AdminUserEffects]),
6796
6972
  EffectsModule.forFeature([LinksEffects]),
6797
6973
  EffectsModule.forFeature([AdminMetadataRulesEffects]),
6974
+ EffectsModule.forFeature([AdminDatasetEffects]),
6798
6975
  PryIconModule,
6799
6976
  FormsModule,
6800
6977
  ReactiveFormsModule,
@@ -6906,6 +7083,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.3", ngImpor
6906
7083
  StoreModule.forFeature(fieldsFeatureKey, fieldReducer),
6907
7084
  StoreModule.forFeature(adminUserFeatureKey, adminUserReducer),
6908
7085
  StoreModule.forFeature(linksFeatureKey, linkReducer),
7086
+ StoreModule.forFeature(datasetFeatureKey, datasetReducer),
6909
7087
  EffectsModule.forFeature([AdminEffects]),
6910
7088
  EffectsModule.forFeature([PredicatesEffects]),
6911
7089
  EffectsModule.forFeature([EnvironmentEffects]),
@@ -6916,6 +7094,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.3", ngImpor
6916
7094
  EffectsModule.forFeature([AdminUserEffects]),
6917
7095
  EffectsModule.forFeature([LinksEffects]),
6918
7096
  EffectsModule.forFeature([AdminMetadataRulesEffects]),
7097
+ EffectsModule.forFeature([AdminDatasetEffects]),
6919
7098
  PryIconModule,
6920
7099
  FormsModule,
6921
7100
  ReactiveFormsModule,