geonetwork-ui 2.3.0-dev.c22cb78a → 2.3.0-dev.e07c5606

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 (130) hide show
  1. package/esm2022/libs/api/metadata-converter/src/lib/gn4/gn4.field.mapper.mjs +3 -3
  2. package/esm2022/libs/api/repository/src/lib/gn4/auth/avatar.service.interface.mjs +1 -1
  3. package/esm2022/libs/api/repository/src/lib/gn4/auth/gravatar.service.mjs +12 -1
  4. package/esm2022/libs/api/repository/src/lib/gn4/platform/gn4-platform.mapper.mjs +36 -3
  5. package/esm2022/libs/api/repository/src/lib/gn4/platform/gn4-platform.service.mjs +19 -7
  6. package/esm2022/libs/common/domain/src/lib/model/record/index.mjs +2 -1
  7. package/esm2022/libs/common/domain/src/lib/model/record/user-feedbacks.model.mjs +2 -0
  8. package/esm2022/libs/common/domain/src/lib/model/user/index.mjs +2 -0
  9. package/esm2022/libs/common/domain/src/lib/platform.service.interface.mjs +1 -1
  10. package/esm2022/libs/feature/editor/src/lib/components/record-form/form-field/form-field-license/form-field-license.component.mjs +64 -0
  11. package/esm2022/libs/feature/editor/src/lib/components/record-form/form-field/form-field.component.mjs +15 -6
  12. package/esm2022/libs/feature/editor/src/lib/components/wizard-field/wizard-field.component.mjs +1 -1
  13. package/esm2022/libs/feature/editor/src/lib/fields.config.mjs +9 -1
  14. package/esm2022/libs/feature/map/src/lib/add-layer-from-ogc-api/add-layer-from-ogc-api.component.mjs +1 -1
  15. package/esm2022/libs/feature/map/src/lib/add-layer-from-wfs/add-layer-from-wfs.component.mjs +1 -1
  16. package/esm2022/libs/feature/map/src/lib/add-layer-from-wms/add-layer-from-wms.component.mjs +1 -1
  17. package/esm2022/libs/feature/record/src/lib/feature-record.module.mjs +4 -4
  18. package/esm2022/libs/feature/record/src/lib/state/mdview.actions.mjs +22 -4
  19. package/esm2022/libs/feature/record/src/lib/state/mdview.effects.mjs +37 -10
  20. package/esm2022/libs/feature/record/src/lib/state/mdview.facade.mjs +22 -7
  21. package/esm2022/libs/feature/record/src/lib/state/mdview.reducer.mjs +52 -17
  22. package/esm2022/libs/feature/record/src/lib/state/mdview.selectors.mjs +18 -3
  23. package/esm2022/libs/feature/router/src/lib/default/state/router.effects.mjs +2 -2
  24. package/esm2022/libs/ui/elements/src/lib/markdown-editor/markdown-editor.component.mjs +2 -2
  25. package/esm2022/libs/ui/elements/src/lib/record-api-form/record-api-form.component.mjs +1 -1
  26. package/esm2022/libs/ui/elements/src/lib/ui-elements.module.mjs +10 -2
  27. package/esm2022/libs/ui/elements/src/lib/user-feedback-item/time-since.pipe.mjs +59 -0
  28. package/esm2022/libs/ui/elements/src/lib/user-feedback-item/user-feedback-item.component.mjs +62 -0
  29. package/esm2022/libs/ui/inputs/src/lib/dropdown-selector/dropdown-selector.component.mjs +17 -8
  30. package/esm2022/libs/ui/inputs/src/lib/text-area/text-area.component.mjs +27 -4
  31. package/esm2022/libs/ui/inputs/src/lib/text-input/text-input.component.mjs +19 -3
  32. package/esm2022/libs/ui/inputs/src/lib/ui-inputs.module.mjs +7 -6
  33. package/esm2022/translations/de.json +25 -0
  34. package/esm2022/translations/en.json +25 -0
  35. package/esm2022/translations/es.json +25 -0
  36. package/esm2022/translations/fr.json +25 -0
  37. package/esm2022/translations/it.json +25 -0
  38. package/esm2022/translations/nl.json +25 -0
  39. package/esm2022/translations/pt.json +25 -0
  40. package/fesm2022/geonetwork-ui.mjs +644 -68
  41. package/fesm2022/geonetwork-ui.mjs.map +1 -1
  42. package/libs/api/repository/src/lib/gn4/auth/avatar.service.interface.d.ts +1 -0
  43. package/libs/api/repository/src/lib/gn4/auth/avatar.service.interface.d.ts.map +1 -1
  44. package/libs/api/repository/src/lib/gn4/auth/gravatar.service.d.ts +1 -0
  45. package/libs/api/repository/src/lib/gn4/auth/gravatar.service.d.ts.map +1 -1
  46. package/libs/api/repository/src/lib/gn4/platform/gn4-platform.mapper.d.ts +6 -2
  47. package/libs/api/repository/src/lib/gn4/platform/gn4-platform.mapper.d.ts.map +1 -1
  48. package/libs/api/repository/src/lib/gn4/platform/gn4-platform.service.d.ts +9 -6
  49. package/libs/api/repository/src/lib/gn4/platform/gn4-platform.service.d.ts.map +1 -1
  50. package/libs/common/domain/src/lib/model/record/index.d.ts +1 -0
  51. package/libs/common/domain/src/lib/model/record/index.d.ts.map +1 -1
  52. package/libs/common/domain/src/lib/model/record/user-feedbacks.model.d.ts +15 -0
  53. package/libs/common/domain/src/lib/model/record/user-feedbacks.model.d.ts.map +1 -0
  54. package/libs/common/domain/src/lib/model/user/index.d.ts +2 -0
  55. package/libs/common/domain/src/lib/model/user/index.d.ts.map +1 -0
  56. package/libs/common/domain/src/lib/platform.service.interface.d.ts +3 -0
  57. package/libs/common/domain/src/lib/platform.service.interface.d.ts.map +1 -1
  58. package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-license/form-field-license.component.d.ts +39 -0
  59. package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-license/form-field-license.component.d.ts.map +1 -0
  60. package/libs/feature/editor/src/lib/components/record-form/form-field/form-field.component.d.ts +3 -1
  61. package/libs/feature/editor/src/lib/components/record-form/form-field/form-field.component.d.ts.map +1 -1
  62. package/libs/feature/editor/src/lib/fields.config.d.ts.map +1 -1
  63. package/libs/feature/record/src/lib/feature-record.module.d.ts.map +1 -1
  64. package/libs/feature/record/src/lib/state/mdview.actions.d.ts +40 -6
  65. package/libs/feature/record/src/lib/state/mdview.actions.d.ts.map +1 -1
  66. package/libs/feature/record/src/lib/state/mdview.effects.d.ts +24 -4
  67. package/libs/feature/record/src/lib/state/mdview.effects.d.ts.map +1 -1
  68. package/libs/feature/record/src/lib/state/mdview.facade.d.ts +14 -4
  69. package/libs/feature/record/src/lib/state/mdview.facade.d.ts.map +1 -1
  70. package/libs/feature/record/src/lib/state/mdview.reducer.d.ts +8 -5
  71. package/libs/feature/record/src/lib/state/mdview.reducer.d.ts.map +1 -1
  72. package/libs/feature/record/src/lib/state/mdview.selectors.d.ts +12 -9
  73. package/libs/feature/record/src/lib/state/mdview.selectors.d.ts.map +1 -1
  74. package/libs/ui/elements/src/lib/ui-elements.module.d.ts +16 -14
  75. package/libs/ui/elements/src/lib/ui-elements.module.d.ts.map +1 -1
  76. package/libs/ui/elements/src/lib/user-feedback-item/time-since.pipe.d.ts +11 -0
  77. package/libs/ui/elements/src/lib/user-feedback-item/time-since.pipe.d.ts.map +1 -0
  78. package/libs/ui/elements/src/lib/user-feedback-item/user-feedback-item.component.d.ts +22 -0
  79. package/libs/ui/elements/src/lib/user-feedback-item/user-feedback-item.component.d.ts.map +1 -0
  80. package/libs/ui/inputs/src/lib/dropdown-selector/dropdown-selector.component.d.ts +1 -1
  81. package/libs/ui/inputs/src/lib/dropdown-selector/dropdown-selector.component.d.ts.map +1 -1
  82. package/libs/ui/inputs/src/lib/text-area/text-area.component.d.ts +7 -1
  83. package/libs/ui/inputs/src/lib/text-area/text-area.component.d.ts.map +1 -1
  84. package/libs/ui/inputs/src/lib/text-input/text-input.component.d.ts +4 -1
  85. package/libs/ui/inputs/src/lib/text-input/text-input.component.d.ts.map +1 -1
  86. package/libs/ui/inputs/src/lib/ui-inputs.module.d.ts +35 -35
  87. package/package.json +1 -1
  88. package/src/libs/api/metadata-converter/src/lib/gn4/gn4.field.mapper.ts +2 -2
  89. package/src/libs/api/repository/src/lib/gn4/auth/avatar.service.interface.ts +1 -0
  90. package/src/libs/api/repository/src/lib/gn4/auth/gravatar.service.ts +12 -1
  91. package/src/libs/api/repository/src/lib/gn4/platform/gn4-platform.mapper.ts +51 -1
  92. package/src/libs/api/repository/src/lib/gn4/platform/gn4-platform.service.ts +34 -7
  93. package/src/libs/common/domain/src/lib/model/record/index.ts +1 -0
  94. package/src/libs/common/domain/src/lib/model/record/user-feedbacks.model.ts +15 -0
  95. package/src/libs/common/domain/src/lib/platform.service.interface.ts +3 -0
  96. package/src/libs/common/fixtures/src/index.ts +8 -6
  97. package/src/libs/common/fixtures/src/lib/records.fixtures.ts +1 -1
  98. package/src/libs/common/fixtures/src/lib/user-feedbacks.fixtures.ts +83 -0
  99. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-license/form-field-license.component.css +0 -0
  100. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-license/form-field-license.component.html +8 -0
  101. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-license/form-field-license.component.ts +64 -0
  102. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field.component.html +28 -33
  103. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field.component.ts +11 -0
  104. package/src/libs/feature/editor/src/lib/fields.config.ts +8 -0
  105. package/src/libs/feature/record/src/lib/feature-record.module.ts +5 -2
  106. package/src/libs/feature/record/src/lib/state/mdview.actions.ts +51 -6
  107. package/src/libs/feature/record/src/lib/state/mdview.effects.ts +82 -7
  108. package/src/libs/feature/record/src/lib/state/mdview.facade.ts +49 -8
  109. package/src/libs/feature/record/src/lib/state/mdview.reducer.ts +81 -24
  110. package/src/libs/feature/record/src/lib/state/mdview.selectors.ts +40 -10
  111. package/src/libs/feature/router/src/lib/default/state/router.effects.ts +2 -2
  112. package/src/libs/ui/elements/src/lib/ui-elements.module.ts +5 -0
  113. package/src/libs/ui/elements/src/lib/user-feedback-item/time-since.pipe.ts +54 -0
  114. package/src/libs/ui/elements/src/lib/user-feedback-item/user-feedback-item.component.css +0 -0
  115. package/src/libs/ui/elements/src/lib/user-feedback-item/user-feedback-item.component.html +75 -0
  116. package/src/libs/ui/elements/src/lib/user-feedback-item/user-feedback-item.component.ts +63 -0
  117. package/src/libs/ui/inputs/src/lib/dropdown-selector/dropdown-selector.component.ts +13 -0
  118. package/src/libs/ui/inputs/src/lib/text-area/text-area.component.html +2 -1
  119. package/src/libs/ui/inputs/src/lib/text-area/text-area.component.ts +29 -0
  120. package/src/libs/ui/inputs/src/lib/text-input/text-input.component.html +1 -1
  121. package/src/libs/ui/inputs/src/lib/text-input/text-input.component.ts +16 -1
  122. package/src/libs/ui/inputs/src/lib/ui-inputs.module.ts +1 -1
  123. package/translations/de.json +25 -0
  124. package/translations/en.json +25 -0
  125. package/translations/es.json +25 -0
  126. package/translations/fr.json +25 -0
  127. package/translations/it.json +25 -0
  128. package/translations/nl.json +25 -0
  129. package/translations/pt.json +25 -0
  130. package/translations/sk.json +25 -0
@@ -0,0 +1,64 @@
1
+ import { ChangeDetectionStrategy, Component, Input } from '@angular/core'
2
+ import { FormControl } from '@angular/forms'
3
+ import { marker } from '@biesbjerg/ngx-translate-extract-marker'
4
+ import { DropdownSelectorComponent } from '../../../../../../../../../libs/ui/inputs/src'
5
+
6
+ @Component({
7
+ selector: 'gn-ui-form-field-license',
8
+ templateUrl: './form-field-license.component.html',
9
+ styleUrls: ['./form-field-license.component.css'],
10
+ changeDetection: ChangeDetectionStrategy.OnPush,
11
+ standalone: true,
12
+ imports: [DropdownSelectorComponent],
13
+ })
14
+ export class FormFieldLicenseComponent {
15
+ @Input() control!: FormControl
16
+ @Input() label: string
17
+
18
+ get selected() {
19
+ return this.control.value[0]?.text
20
+ }
21
+
22
+ onSelectValue(value: unknown) {
23
+ this.control.setValue([{ text: value }])
24
+ }
25
+
26
+ choices = [
27
+ {
28
+ value: 'cc-by',
29
+ label: marker('editor.record.form.license.cc-by'),
30
+ },
31
+ {
32
+ value: 'cc-by-sa',
33
+ label: marker('editor.record.form.license.cc-by-sa'),
34
+ },
35
+ {
36
+ value: 'cc-zero',
37
+ label: marker('editor.record.form.license.cc-zero'),
38
+ },
39
+ {
40
+ value: 'etalab',
41
+ label: marker('editor.record.form.license.etalab'),
42
+ },
43
+ {
44
+ value: 'etalab-v2',
45
+ label: marker('editor.record.form.license.etalab-v2'),
46
+ },
47
+ {
48
+ value: 'odbl',
49
+ label: marker('editor.record.form.license.odbl'),
50
+ },
51
+ {
52
+ value: 'odc-by',
53
+ label: marker('editor.record.form.license.odc-by'),
54
+ },
55
+ {
56
+ value: 'pddl',
57
+ label: marker('editor.record.form.license.pddl'),
58
+ },
59
+ {
60
+ value: 'unknown',
61
+ label: marker('editor.record.form.license.unknown'),
62
+ },
63
+ ]
64
+ }
@@ -1,29 +1,18 @@
1
1
  <div class="flex flex-col h-full">
2
- <div class="mb-2 flex flex-row">
3
- <label class="grow">
4
- <span class="font-medium field-label">{{
5
- config.labelKey | translate
6
- }}</span>
7
- <span *ngIf="config.hintKey" class="text-gray-900 text-sm">
8
- - {{ config.hintKey | translate }}
9
- </span>
10
- </label>
11
- <mat-icon
12
- *ngIf="isFieldOk"
13
- class="material-symbols-outlined text-[#c6d950] icon-ok"
14
- >check_circle</mat-icon
15
- >
16
- <mat-icon
17
- *ngIf="isFieldLocked"
18
- class="material-symbols-outlined text-blue-400 icon-locked"
19
- >lock</mat-icon
20
- >
21
- <mat-icon
22
- *ngIf="isFieldInvalid"
23
- class="material-symbols-outlined text-pink-500 icon-invalid"
24
- >cancel</mat-icon
2
+ <ng-container *ngIf="withoutWrapper; else withGenericWrapper">
3
+ <ng-container *ngTemplateOutlet="fieldContent"></ng-container>
4
+ </ng-container>
5
+ <ng-template #withGenericWrapper>
6
+ <gn-ui-form-field-wrapper
7
+ [label]="config.labelKey | translate"
8
+ [hint]="config.hintKey | translate"
25
9
  >
26
- </div>
10
+ <ng-container *ngTemplateOutlet="fieldContent"></ng-container>
11
+ </gn-ui-form-field-wrapper>
12
+ </ng-template>
13
+ </div>
14
+
15
+ <ng-template #fieldContent>
27
16
  <ng-container *ngIf="isTitle">
28
17
  <div class="flex justify-between items-center gap-3">
29
18
  <h2
@@ -48,6 +37,20 @@
48
37
  </span>
49
38
  </div>
50
39
  </ng-container>
40
+ <ng-container *ngIf="isAbstract">
41
+ <gn-ui-form-field-rich
42
+ class="h-[8rem]"
43
+ [control]="formControl"
44
+ [label]="config.labelKey | translate"
45
+ [hint]="config.hintKey | translate"
46
+ ></gn-ui-form-field-rich>
47
+ </ng-container>
48
+ <ng-container *ngIf="isLicenses">
49
+ <gn-ui-form-field-license
50
+ [control]="formControl"
51
+ [label]="config.labelKey | translate"
52
+ ></gn-ui-form-field-license>
53
+ </ng-container>
51
54
  <ng-container *ngIf="isSimpleField">
52
55
  <gn-ui-form-field-simple
53
56
  [type]="simpleType"
@@ -63,14 +66,6 @@
63
66
  [invalid]="isFieldInvalid"
64
67
  ></gn-ui-form-field-file>
65
68
  </ng-container>
66
- <ng-container *ngIf="isAbstract">
67
- <gn-ui-form-field-rich
68
- class="h-[8rem]"
69
- [control]="formControl"
70
- [label]="config.labelKey | translate"
71
- [hint]="config.hintKey | translate"
72
- ></gn-ui-form-field-rich>
73
- </ng-container>
74
69
  <ng-container *ngIf="isArrayField">
75
70
  <gn-ui-form-field-array></gn-ui-form-field-array>
76
71
  </ng-container>
@@ -89,4 +84,4 @@
89
84
  >
90
85
  {{ config.invalidHintKey | translate }}
91
86
  </div>
92
- </div>
87
+ </ng-template>
@@ -11,10 +11,12 @@ import { FormControl, ReactiveFormsModule } from '@angular/forms'
11
11
  import { MatIconModule } from '@angular/material/icon'
12
12
  import { MatTooltipModule } from '@angular/material/tooltip'
13
13
  import { EditableLabelDirective } from '../../../../../../../../libs/ui/inputs/src'
14
+ import { FormFieldWrapperComponent } from '../../../../../../../../libs/ui/layout/src'
14
15
  import { TranslateModule } from '@ngx-translate/core'
15
16
  import { Observable } from 'rxjs'
16
17
  import { FormFieldArrayComponent } from './form-field-array/form-field-array.component'
17
18
  import { FormFieldFileComponent } from './form-field-file/form-field-file.component'
19
+ import { FormFieldLicenseComponent } from './form-field-license/form-field-license.component'
18
20
  import { FormFieldObjectComponent } from './form-field-object/form-field-object.component'
19
21
  import { FormFieldRichComponent } from './form-field-rich/form-field-rich.component'
20
22
  import { FormFieldSimpleComponent } from './form-field-simple/form-field-simple.component'
@@ -34,6 +36,7 @@ import { FormFieldConfig } from './form-field.model'
34
36
  EditableLabelDirective,
35
37
  MatIconModule,
36
38
  MatTooltipModule,
39
+ FormFieldWrapperComponent,
37
40
  FormFieldSimpleComponent,
38
41
  FormFieldRichComponent,
39
42
  FormFieldObjectComponent,
@@ -41,6 +44,7 @@ import { FormFieldConfig } from './form-field.model'
41
44
  FormFieldTemporalExtentComponent,
42
45
  FormFieldFileComponent,
43
46
  FormFieldArrayComponent,
47
+ FormFieldLicenseComponent,
44
48
  TranslateModule,
45
49
  ],
46
50
  })
@@ -118,4 +122,11 @@ export class FormFieldComponent {
118
122
  get isAbstract() {
119
123
  return this.model === 'abstract'
120
124
  }
125
+ get isLicenses() {
126
+ return this.model === 'licenses'
127
+ }
128
+
129
+ get withoutWrapper() {
130
+ return this.model === 'title' || this.model === 'abstract'
131
+ }
121
132
  }
@@ -1,3 +1,4 @@
1
+ import { marker } from '@biesbjerg/ngx-translate-extract-marker'
1
2
  import { EditorFieldsConfig } from './models/fields.model'
2
3
 
3
4
  export const DEFAULT_FIELDS: EditorFieldsConfig = [
@@ -32,4 +33,11 @@ export const DEFAULT_FIELDS: EditorFieldsConfig = [
32
33
  },
33
34
  onSaveProcess: '${dateNow()}',
34
35
  },
36
+ {
37
+ model: 'licenses',
38
+ formFieldConfig: {
39
+ labelKey: marker('editor.record.form.license'),
40
+ type: 'list',
41
+ },
42
+ },
35
43
  ]
@@ -11,7 +11,10 @@ import { MdViewFacade } from './state'
11
11
  import { MdViewEffects } from './state/mdview.effects'
12
12
  import { MapViewComponent } from './map-view/map-view.component'
13
13
  import { DataViewComponent } from './data-view/data-view.component'
14
- import { MD_VIEW_FEATURE_STATE_KEY, reducer } from './state/mdview.reducer'
14
+ import {
15
+ METADATA_VIEW_FEATURE_STATE_KEY,
16
+ reducer,
17
+ } from './state/mdview.reducer'
15
18
  import { MatTabsModule } from '@angular/material/tabs'
16
19
  import { MatIconModule } from '@angular/material/icon'
17
20
  import { UiWidgetsModule } from '../../../../../libs/ui/widgets/src'
@@ -35,7 +38,7 @@ import { DataViewShareComponent } from './data-view-share/data-view-share.compon
35
38
  ],
36
39
  imports: [
37
40
  CommonModule,
38
- StoreModule.forFeature(MD_VIEW_FEATURE_STATE_KEY, reducer),
41
+ StoreModule.forFeature(METADATA_VIEW_FEATURE_STATE_KEY, reducer),
39
42
  EffectsModule.forFeature([MdViewEffects]),
40
43
  UiLayoutModule,
41
44
  FeatureMapModule,
@@ -1,7 +1,13 @@
1
1
  import { DatavizConfigurationModel } from '../../../../../../libs/common/domain/src/lib/model/dataviz/dataviz-configuration.model'
2
2
  import { createAction, props } from '@ngrx/store'
3
- import { CatalogRecord } from '../../../../../../libs/common/domain/src/lib/model/record'
3
+ import {
4
+ CatalogRecord,
5
+ UserFeedback,
6
+ } from '../../../../../../libs/common/domain/src/lib/model/record'
4
7
 
8
+ /*
9
+ Metadata actions
10
+ */
5
11
  export const loadFullMetadata = createAction(
6
12
  '[Metadata view] Load full metadata',
7
13
  props<{ uuid: string }>()
@@ -12,24 +18,63 @@ export const setIncompleteMetadata = createAction(
12
18
  props<{ incomplete: Partial<CatalogRecord> }>()
13
19
  )
14
20
 
15
- export const loadFullSuccess = createAction(
16
- '[Metadata view] Load full success',
21
+ export const loadFullMetadataSuccess = createAction(
22
+ '[Metadata view] Load full metadata success',
17
23
  props<{ full: CatalogRecord }>()
18
24
  )
19
25
 
20
- export const loadFullFailure = createAction(
21
- '[Metadata view] Load full failure',
26
+ export const loadFullMetadataFailure = createAction(
27
+ '[Metadata view] Load full metadata failure',
22
28
  props<{ otherError?: string; notFound?: boolean }>()
23
29
  )
24
30
 
31
+ export const closeMetadata = createAction('[Metadata view] close')
32
+
33
+ /*
34
+ Related actions
35
+ */
25
36
  export const setRelated = createAction(
26
37
  '[Metadata view] Set related records',
27
38
  props<{ related: CatalogRecord[] }>()
28
39
  )
29
40
 
41
+ /*
42
+ ChartConfig actions
43
+ */
30
44
  export const setChartConfig = createAction(
31
45
  '[Metadata view] Set chart config',
32
46
  props<{ chartConfig: DatavizConfigurationModel }>()
33
47
  )
34
48
 
35
- export const close = createAction('[Metadata view] close')
49
+ /*
50
+ User Feedbacks actions
51
+ */
52
+ export const addUserFeedback = createAction(
53
+ '[Metadata view] Add UserFeedback',
54
+ props<{ userFeedback: UserFeedback }>()
55
+ )
56
+
57
+ export const addUserFeedbackSuccess = createAction(
58
+ '[Metadata view] Add UserFeedback Success',
59
+ props<{ datasetUuid: string }>()
60
+ )
61
+
62
+ export const addUserFeedbackFailure = createAction(
63
+ '[Metadata view] Add UserFeedback Failure',
64
+ props<{ otherError?: string; notFound?: boolean }>()
65
+ )
66
+
67
+ export const loadUserFeedbacks = createAction(
68
+ '[Metadata view] Load UserFeedbacks',
69
+ props<{ datasetUuid: string }>()
70
+ )
71
+
72
+ export const loadUserFeedbacksSuccess = createAction(
73
+ '[Metadata view] Load UserFeedbacks Success',
74
+ props<{ userFeedbacks: UserFeedback[] }>()
75
+ )
76
+
77
+ export const loadUserFeedbacksFailure = createAction(
78
+ '[Metadata view] Load UserFeedbacks Failure',
79
+ props<{ otherError?: string; notFound?: boolean }>()
80
+ )
@@ -1,18 +1,23 @@
1
1
  import { Injectable } from '@angular/core'
2
2
  import { Actions, createEffect, ofType } from '@ngrx/effects'
3
- import { of } from 'rxjs'
3
+ import { exhaustMap, mergeMap, of } from 'rxjs'
4
4
  import { catchError, map, switchMap } from 'rxjs/operators'
5
5
  import * as MdViewActions from './mdview.actions'
6
6
  import { RecordsRepositoryInterface } from '../../../../../../libs/common/domain/src/lib/repository/records-repository.interface'
7
+ import { PlatformServiceInterface } from '../../../../../../libs/common/domain/src/lib/platform.service.interface'
7
8
 
8
9
  @Injectable()
9
10
  export class MdViewEffects {
10
11
  constructor(
11
12
  private actions$: Actions,
12
- private recordsRepository: RecordsRepositoryInterface
13
+ private recordsRepository: RecordsRepositoryInterface,
14
+ private platformServiceInterface: PlatformServiceInterface
13
15
  ) {}
14
16
 
15
- loadFull$ = createEffect(() =>
17
+ /*
18
+ Metadata effects
19
+ */
20
+ loadFullMetadata$ = createEffect(() =>
16
21
  this.actions$.pipe(
17
22
  ofType(MdViewActions.loadFullMetadata),
18
23
  switchMap(({ uuid }) =>
@@ -20,19 +25,22 @@ export class MdViewEffects {
20
25
  ),
21
26
  map((record) => {
22
27
  if (record === null) {
23
- return MdViewActions.loadFullFailure({ notFound: true })
28
+ return MdViewActions.loadFullMetadataFailure({ notFound: true })
24
29
  }
25
- return MdViewActions.loadFullSuccess({ full: record })
30
+ return MdViewActions.loadFullMetadataSuccess({ full: record })
26
31
  }),
27
32
  catchError((error) =>
28
- of(MdViewActions.loadFullFailure({ otherError: error.message }))
33
+ of(MdViewActions.loadFullMetadataFailure({ otherError: error.message }))
29
34
  )
30
35
  )
31
36
  )
32
37
 
38
+ /*
39
+ Related effects
40
+ */
33
41
  loadRelatedRecords$ = createEffect(() =>
34
42
  this.actions$.pipe(
35
- ofType(MdViewActions.loadFullSuccess),
43
+ ofType(MdViewActions.loadFullMetadataSuccess),
36
44
  switchMap(({ full }) => this.recordsRepository.getSimilarRecords(full)),
37
45
  map((related) => {
38
46
  return MdViewActions.setRelated({ related })
@@ -40,4 +48,71 @@ export class MdViewEffects {
40
48
  catchError((error) => of(MdViewActions.setRelated({ related: null })))
41
49
  )
42
50
  )
51
+
52
+ /*
53
+ UserFeedback effects
54
+ */
55
+ loadUserFeedbacks$ = createEffect(() =>
56
+ this.actions$.pipe(
57
+ ofType(MdViewActions.loadUserFeedbacks),
58
+ exhaustMap(({ datasetUuid }) =>
59
+ this.platformServiceInterface.getUserFeedbacks(datasetUuid).pipe(
60
+ map((userFeedbacks) =>
61
+ MdViewActions.loadUserFeedbacksSuccess({ userFeedbacks })
62
+ ),
63
+ catchError((error) =>
64
+ of(
65
+ MdViewActions.loadUserFeedbacksFailure({
66
+ otherError: error.message,
67
+ })
68
+ )
69
+ )
70
+ )
71
+ )
72
+ )
73
+ )
74
+
75
+ reloadUserFeedbacks$ = createEffect(() =>
76
+ this.actions$.pipe(
77
+ ofType(MdViewActions.addUserFeedbackSuccess),
78
+ exhaustMap(({ datasetUuid }) =>
79
+ this.platformServiceInterface.getUserFeedbacks(datasetUuid).pipe(
80
+ map((userFeedbacks) =>
81
+ MdViewActions.loadUserFeedbacksSuccess({ userFeedbacks })
82
+ ),
83
+ catchError((error) =>
84
+ of(
85
+ MdViewActions.loadUserFeedbacksFailure({
86
+ otherError: error.message,
87
+ })
88
+ )
89
+ )
90
+ )
91
+ )
92
+ )
93
+ )
94
+
95
+ addUserFeedback$ = createEffect(() =>
96
+ this.actions$.pipe(
97
+ ofType(MdViewActions.addUserFeedback),
98
+ mergeMap((action) =>
99
+ this.platformServiceInterface
100
+ .postUserFeedbacks(action.userFeedback)
101
+ .pipe(
102
+ map(() =>
103
+ MdViewActions.addUserFeedbackSuccess({
104
+ datasetUuid: action.userFeedback.metadataUUID,
105
+ })
106
+ ),
107
+ catchError((error) => {
108
+ return of(
109
+ MdViewActions.addUserFeedbackFailure({
110
+ otherError: error.message,
111
+ })
112
+ )
113
+ })
114
+ )
115
+ )
116
+ )
117
+ )
43
118
  }
@@ -5,7 +5,12 @@ import * as MdViewActions from './mdview.actions'
5
5
  import * as MdViewSelectors from './mdview.selectors'
6
6
  import { LinkClassifierService, LinkUsage } from '../../../../../../libs/util/shared/src'
7
7
  import { DatavizConfigurationModel } from '../../../../../../libs/common/domain/src/lib/model/dataviz/dataviz-configuration.model'
8
- import { CatalogRecord } from '../../../../../../libs/common/domain/src/lib/model/record'
8
+ import {
9
+ CatalogRecord,
10
+ UserFeedback,
11
+ UserFeedbackViewModel,
12
+ } from '../../../../../../libs/common/domain/src/lib/model/record'
13
+ import { AvatarServiceInterface } from '../../../../../../libs/api/repository/src'
9
14
 
10
15
  @Injectable()
11
16
  /**
@@ -15,19 +20,31 @@ import { CatalogRecord } from '../../../../../../libs/common/domain/src/lib/mode
15
20
  * To clear the current record use the `close()` method.
16
21
  */
17
22
  export class MdViewFacade {
23
+ constructor(
24
+ private store: Store,
25
+ private linkClassifier: LinkClassifierService,
26
+ private avatarService: AvatarServiceInterface
27
+ ) {}
28
+
18
29
  isPresent$ = this.store.pipe(
19
30
  select(MdViewSelectors.getMetadataUuid),
20
31
  map((uuid) => !!uuid)
21
32
  )
22
- isLoading$ = this.store.pipe(select(MdViewSelectors.getMetadataIsLoading))
33
+
34
+ isMetadataLoading$ = this.store.pipe(
35
+ select(MdViewSelectors.getMetadataIsLoading)
36
+ )
37
+
23
38
  metadata$ = this.store.pipe(
24
39
  select(MdViewSelectors.getMetadata),
25
40
  filter((md) => !!md)
26
41
  )
42
+
27
43
  isIncomplete$ = this.store.pipe(
28
44
  select(MdViewSelectors.getMetadataIsIncomplete),
29
45
  filter((incomplete) => incomplete !== null)
30
46
  )
47
+
31
48
  error$ = this.store.pipe(select(MdViewSelectors.getMetadataError))
32
49
 
33
50
  related$ = this.store.pipe(select(MdViewSelectors.getRelated))
@@ -37,11 +54,13 @@ export class MdViewFacade {
37
54
  allLinks$ = this.metadata$.pipe(
38
55
  map((record) => ('distributions' in record ? record.distributions : []))
39
56
  )
57
+
40
58
  apiLinks$ = this.allLinks$.pipe(
41
59
  map((links) =>
42
60
  links.filter((link) => this.linkClassifier.hasUsage(link, LinkUsage.API))
43
61
  )
44
62
  )
63
+
45
64
  mapApiLinks$ = this.allLinks$.pipe(
46
65
  map((links) =>
47
66
  links.filter((link) =>
@@ -49,6 +68,7 @@ export class MdViewFacade {
49
68
  )
50
69
  )
51
70
  )
71
+
52
72
  downloadLinks$ = this.allLinks$.pipe(
53
73
  map((links) =>
54
74
  links.filter((link) =>
@@ -56,11 +76,13 @@ export class MdViewFacade {
56
76
  )
57
77
  )
58
78
  )
79
+
59
80
  dataLinks$ = this.allLinks$.pipe(
60
81
  map((links) =>
61
82
  links.filter((link) => this.linkClassifier.hasUsage(link, LinkUsage.DATA))
62
83
  )
63
84
  )
85
+
64
86
  geoDataLinks$ = this.allLinks$.pipe(
65
87
  map((links) =>
66
88
  links.filter((link) =>
@@ -68,9 +90,11 @@ export class MdViewFacade {
68
90
  )
69
91
  )
70
92
  )
93
+
71
94
  landingPageLinks$ = this.metadata$.pipe(
72
95
  map((record) => ('landingPage' in record ? [record.landingPage] : []))
73
96
  )
97
+
74
98
  otherLinks$ = this.allLinks$.pipe(
75
99
  map((links) =>
76
100
  links.filter((link) =>
@@ -79,10 +103,13 @@ export class MdViewFacade {
79
103
  )
80
104
  )
81
105
 
82
- constructor(
83
- private store: Store,
84
- private linkClassifier: LinkClassifierService
85
- ) {}
106
+ userFeedbacks$ = this.store.pipe(select(MdViewSelectors.getUserFeedbacks))
107
+ isAllUserFeedbackLoading$ = this.store.pipe(
108
+ select(MdViewSelectors.getAllUserFeedbacksLoading)
109
+ )
110
+ isAddUserFeedbackLoading$ = this.store.pipe(
111
+ select(MdViewSelectors.getAddUserFeedbacksLoading)
112
+ )
86
113
 
87
114
  /**
88
115
  * This will show an incomplete record (e.g. from a search result) as a preview
@@ -91,16 +118,30 @@ export class MdViewFacade {
91
118
  setIncompleteMetadata(incomplete: CatalogRecord) {
92
119
  this.store.dispatch(MdViewActions.setIncompleteMetadata({ incomplete }))
93
120
  }
121
+
94
122
  /**
95
123
  * This will trigger the load of a full metadata record
96
124
  */
97
125
  loadFull(uuid: string) {
98
126
  this.store.dispatch(MdViewActions.loadFullMetadata({ uuid }))
99
127
  }
100
- close() {
101
- this.store.dispatch(MdViewActions.close())
128
+
129
+ closeMetadata() {
130
+ this.store.dispatch(MdViewActions.closeMetadata())
102
131
  }
132
+
103
133
  setChartConfig(chartConfig: DatavizConfigurationModel) {
104
134
  this.store.dispatch(MdViewActions.setChartConfig({ chartConfig }))
105
135
  }
136
+
137
+ /**
138
+ * UserFeedbacks
139
+ */
140
+ addUserFeedback(userFeedback: UserFeedback) {
141
+ this.store.dispatch(MdViewActions.addUserFeedback({ userFeedback }))
142
+ }
143
+
144
+ loadUserFeedbacks(datasetUuid: string) {
145
+ this.store.dispatch(MdViewActions.loadUserFeedbacks({ datasetUuid }))
146
+ }
106
147
  }