geonetwork-ui 2.4.1-dev.9ee0df3df → 2.4.1-dev.a1ec7cf5a

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 (111) hide show
  1. package/esm2022/libs/api/metadata-converter/src/lib/gn4/gn4.converter.mjs +4 -3
  2. package/esm2022/libs/api/metadata-converter/src/lib/gn4/gn4.field.mapper.mjs +5 -2
  3. package/esm2022/libs/api/metadata-converter/src/lib/gn4/types/metadata.model.mjs +1 -1
  4. package/esm2022/libs/api/repository/src/lib/gn4/gn4-repository.mjs +27 -16
  5. package/esm2022/libs/common/domain/src/lib/repository/records-repository.interface.mjs +1 -1
  6. package/esm2022/libs/data-access/gn4/src/openapi/api/records.api.service.mjs +7 -1
  7. package/esm2022/libs/feature/editor/src/lib/+state/editor.actions.mjs +3 -1
  8. package/esm2022/libs/feature/editor/src/lib/+state/editor.effects.mjs +18 -14
  9. package/esm2022/libs/feature/editor/src/lib/+state/editor.facade.mjs +15 -5
  10. package/esm2022/libs/feature/editor/src/lib/+state/editor.reducer.mjs +10 -4
  11. package/esm2022/libs/feature/editor/src/lib/+state/editor.selectors.mjs +6 -5
  12. package/esm2022/libs/feature/editor/src/lib/components/record-form/form-field/form-field-license/form-field-license.component.mjs +36 -23
  13. package/esm2022/libs/feature/editor/src/lib/components/record-form/form-field/form-field-online-link-resources/form-field-online-link-resources.component.mjs +7 -12
  14. package/esm2022/libs/feature/editor/src/lib/components/record-form/form-field/form-field-online-resources/form-field-online-resources.component.mjs +7 -12
  15. package/esm2022/libs/feature/editor/src/lib/components/record-form/form-field/form-field-overviews/form-field-overviews.component.mjs +6 -12
  16. package/esm2022/libs/feature/editor/src/lib/components/record-form/form-field/form-field.component.mjs +3 -3
  17. package/esm2022/libs/feature/editor/src/lib/services/editor.service.mjs +9 -5
  18. package/esm2022/libs/feature/search/src/lib/results-table/results-table-container.component.mjs +3 -4
  19. package/esm2022/libs/ui/dataviz/src/lib/figure/figure.component.mjs +3 -3
  20. package/esm2022/libs/ui/inputs/src/lib/file-input/file-input.component.mjs +4 -4
  21. package/esm2022/libs/ui/layout/src/lib/interactive-table/interactive-table.component.mjs +9 -4
  22. package/esm2022/libs/ui/search/src/lib/results-table/results-table.component.mjs +10 -10
  23. package/esm2022/translations/de.json +27 -6
  24. package/esm2022/translations/en.json +11 -9
  25. package/esm2022/translations/es.json +25 -4
  26. package/esm2022/translations/fr.json +11 -9
  27. package/esm2022/translations/it.json +241 -218
  28. package/esm2022/translations/nl.json +25 -4
  29. package/esm2022/translations/pt.json +25 -4
  30. package/fesm2022/geonetwork-ui.mjs +777 -609
  31. package/fesm2022/geonetwork-ui.mjs.map +1 -1
  32. package/libs/api/metadata-converter/src/lib/gn4/gn4.converter.d.ts.map +1 -1
  33. package/libs/api/metadata-converter/src/lib/gn4/gn4.field.mapper.d.ts.map +1 -1
  34. package/libs/api/metadata-converter/src/lib/gn4/types/metadata.model.d.ts +1 -0
  35. package/libs/api/metadata-converter/src/lib/gn4/types/metadata.model.d.ts.map +1 -1
  36. package/libs/api/repository/src/lib/gn4/gn4-repository.d.ts +4 -3
  37. package/libs/api/repository/src/lib/gn4/gn4-repository.d.ts.map +1 -1
  38. package/libs/common/domain/src/lib/repository/records-repository.interface.d.ts +4 -3
  39. package/libs/common/domain/src/lib/repository/records-repository.interface.d.ts.map +1 -1
  40. package/libs/data-access/gn4/src/openapi/api/records.api.service.d.ts +3 -0
  41. package/libs/data-access/gn4/src/openapi/api/records.api.service.d.ts.map +1 -1
  42. package/libs/feature/editor/src/lib/+state/editor.actions.d.ts +10 -2
  43. package/libs/feature/editor/src/lib/+state/editor.actions.d.ts.map +1 -1
  44. package/libs/feature/editor/src/lib/+state/editor.effects.d.ts +6 -2
  45. package/libs/feature/editor/src/lib/+state/editor.effects.d.ts.map +1 -1
  46. package/libs/feature/editor/src/lib/+state/editor.facade.d.ts +5 -2
  47. package/libs/feature/editor/src/lib/+state/editor.facade.d.ts.map +1 -1
  48. package/libs/feature/editor/src/lib/+state/editor.reducer.d.ts +2 -1
  49. package/libs/feature/editor/src/lib/+state/editor.reducer.d.ts.map +1 -1
  50. package/libs/feature/editor/src/lib/+state/editor.selectors.d.ts +2 -1
  51. package/libs/feature/editor/src/lib/+state/editor.selectors.d.ts.map +1 -1
  52. package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-license/form-field-license.component.d.ts +4 -4
  53. package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-license/form-field-license.component.d.ts.map +1 -1
  54. package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-online-link-resources/form-field-online-link-resources.component.d.ts +1 -4
  55. package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-online-link-resources/form-field-online-link-resources.component.d.ts.map +1 -1
  56. package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-online-resources/form-field-online-resources.component.d.ts +1 -4
  57. package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-online-resources/form-field-online-resources.component.d.ts.map +1 -1
  58. package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-overviews/form-field-overviews.component.d.ts +1 -4
  59. package/libs/feature/editor/src/lib/components/record-form/form-field/form-field-overviews/form-field-overviews.component.d.ts.map +1 -1
  60. package/libs/feature/editor/src/lib/services/editor.service.d.ts +1 -1
  61. package/libs/feature/editor/src/lib/services/editor.service.d.ts.map +1 -1
  62. package/libs/feature/search/src/lib/results-table/results-table-container.component.d.ts +0 -1
  63. package/libs/feature/search/src/lib/results-table/results-table-container.component.d.ts.map +1 -1
  64. package/libs/ui/inputs/src/lib/file-input/file-input.component.d.ts +1 -1
  65. package/libs/ui/inputs/src/lib/file-input/file-input.component.d.ts.map +1 -1
  66. package/libs/ui/layout/src/lib/interactive-table/interactive-table.component.d.ts +2 -1
  67. package/libs/ui/layout/src/lib/interactive-table/interactive-table.component.d.ts.map +1 -1
  68. package/libs/ui/search/src/lib/results-table/results-table.component.d.ts +3 -3
  69. package/libs/ui/search/src/lib/results-table/results-table.component.d.ts.map +1 -1
  70. package/package.json +1 -1
  71. package/src/libs/api/metadata-converter/src/lib/gn4/gn4.converter.ts +4 -3
  72. package/src/libs/api/metadata-converter/src/lib/gn4/gn4.field.mapper.ts +8 -1
  73. package/src/libs/api/metadata-converter/src/lib/gn4/types/metadata.model.ts +1 -0
  74. package/src/libs/api/repository/src/lib/gn4/gn4-repository.ts +53 -27
  75. package/src/libs/common/domain/src/lib/repository/records-repository.interface.ts +5 -4
  76. package/src/libs/common/fixtures/src/lib/elasticsearch/full-response.fixtures.ts +2 -2
  77. package/src/libs/common/fixtures/src/lib/elasticsearch/search-responses.fixtures.ts +16 -16
  78. package/src/libs/common/fixtures/src/lib/records.fixtures.ts +163 -0
  79. package/src/libs/data-access/gn4/src/openapi/api/records.api.service.ts +24 -4
  80. package/src/libs/feature/editor/src/lib/+state/editor.actions.ts +10 -1
  81. package/src/libs/feature/editor/src/lib/+state/editor.effects.ts +57 -31
  82. package/src/libs/feature/editor/src/lib/+state/editor.facade.ts +15 -9
  83. package/src/libs/feature/editor/src/lib/+state/editor.reducer.ts +18 -12
  84. package/src/libs/feature/editor/src/lib/+state/editor.selectors.ts +13 -8
  85. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-license/form-field-license.component.html +1 -1
  86. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-license/form-field-license.component.ts +31 -19
  87. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-online-link-resources/form-field-online-link-resources.component.html +1 -10
  88. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-online-link-resources/form-field-online-link-resources.component.ts +1 -7
  89. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-online-resources/form-field-online-resources.component.html +0 -11
  90. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-online-resources/form-field-online-resources.component.ts +2 -8
  91. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-overviews/form-field-overviews.component.html +0 -9
  92. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field-overviews/form-field-overviews.component.ts +2 -8
  93. package/src/libs/feature/editor/src/lib/components/record-form/form-field/form-field.component.html +2 -2
  94. package/src/libs/feature/editor/src/lib/services/editor.service.ts +18 -16
  95. package/src/libs/feature/search/src/lib/results-table/results-table-container.component.html +0 -1
  96. package/src/libs/feature/search/src/lib/results-table/results-table-container.component.ts +0 -3
  97. package/src/libs/ui/dataviz/src/lib/figure/figure.component.html +1 -0
  98. package/src/libs/ui/inputs/src/lib/file-input/file-input.component.ts +1 -1
  99. package/src/libs/ui/layout/src/lib/interactive-table/interactive-table.component.html +12 -1
  100. package/src/libs/ui/layout/src/lib/interactive-table/interactive-table.component.ts +4 -6
  101. package/src/libs/ui/search/src/lib/results-table/results-table.component.html +23 -6
  102. package/src/libs/ui/search/src/lib/results-table/results-table.component.ts +6 -6
  103. package/tailwind.base.config.js +2 -0
  104. package/translations/de.json +27 -6
  105. package/translations/en.json +11 -9
  106. package/translations/es.json +25 -4
  107. package/translations/fr.json +11 -9
  108. package/translations/it.json +241 -218
  109. package/translations/nl.json +25 -4
  110. package/translations/pt.json +25 -4
  111. package/translations/sk.json +25 -4
@@ -30,11 +30,6 @@ export const selectRecordChangedSinceSave = createSelector(
30
30
  (state: EditorState) => state.changedSinceSave
31
31
  )
32
32
 
33
- export const selectRecordAlreadySavedOnce = createSelector(
34
- selectEditorState,
35
- (state: EditorState) => state.alreadySavedOnce
36
- )
37
-
38
33
  export const selectEditorConfig = createSelector(
39
34
  selectEditorState,
40
35
  (state: EditorState) => state.editorConfig
@@ -48,11 +43,11 @@ export const selectCurrentPage = createSelector(
48
43
  export const selectRecordSections = createSelector(
49
44
  selectEditorState,
50
45
  (state: EditorState) => {
51
- const currentPage = state.editorConfig.pages[state.currentPage]
52
- if (!currentPage) {
46
+ const currentPageConfig = state.editorConfig.pages[state.currentPage]
47
+ if (!currentPageConfig) {
53
48
  return [] as EditorSectionWithValues[]
54
49
  }
55
- return currentPage.sections.map((section) => ({
50
+ return currentPageConfig.sections.map((section) => ({
56
51
  ...section,
57
52
  fieldsWithValues: section.fields.map((fieldConfig) => ({
58
53
  config: fieldConfig,
@@ -66,3 +61,13 @@ export const selectHasRecordChanged = createSelector(
66
61
  selectEditorState,
67
62
  (state: EditorState) => state.hasRecordChanged
68
63
  )
64
+
65
+ export const selectIsPublished = createSelector(
66
+ selectEditorState,
67
+ (state: EditorState) => state.isPublished
68
+ )
69
+
70
+ export const selectCanEditRecord = createSelector(
71
+ selectEditorState,
72
+ (state: EditorState) => state.canEditRecord
73
+ )
@@ -2,7 +2,7 @@
2
2
  <gn-ui-dropdown-selector
3
3
  [title]="label"
4
4
  [showTitle]="false"
5
- [choices]="licenceOptions"
5
+ [choices]="choices"
6
6
  [selected]="selectedLicence"
7
7
  (selectValue)="handleLicenceSelection($event)"
8
8
  [extraBtnClass]="'input-as-button gn-ui-text-input'"
@@ -26,35 +26,47 @@ type Licence = {
26
26
  })
27
27
  export class FormFieldLicenseComponent implements OnInit {
28
28
  @Input() label: string
29
- @Input() recordConstraints: Constraint[] = []
30
- @Output() recordConstraintsChange: EventEmitter<Constraint[]> =
29
+ @Input() recordLicences: Constraint[] = []
30
+ @Output() recordLicencesChange: EventEmitter<Constraint[]> =
31
31
  new EventEmitter()
32
32
 
33
+ choices: Licence[] = AVAILABLE_LICENSES.map((license) => ({
34
+ label: marker(`editor.record.form.license.${license}`),
35
+ value: license,
36
+ }))
37
+
33
38
  selectedLicence: string
34
39
 
35
40
  ngOnInit(): void {
36
- // get the licence from the record constraints if it is one of the open data licence list
37
- this.selectedLicence = this.recordConstraints.find((constraint) => {
38
- return this.licenceOptions.find((licence) => {
39
- return licence.value === constraint.text
40
- })
41
- })?.text
42
- // otherwise pre-select the first licence option
43
- if (this.selectedLicence === undefined) {
44
- this.selectedLicence = this.licenceOptions[0].value // cannot select 'etalab' as default as this would toggle the OpenData Toggle
45
- this.recordConstraintsChange.emit([{ text: this.selectedLicence }])
41
+ if (this.recordLicences.length === 0) {
42
+ this.selectedLicence = 'unknown'
43
+ } else {
44
+ this.selectedLicence = this.recordLicences.find((constraint) => {
45
+ return this.choices.find((licence) => {
46
+ return licence.value === constraint.text
47
+ })
48
+ })?.text
46
49
  }
47
- }
48
50
 
49
- get licenceOptions(): Licence[] {
50
- return AVAILABLE_LICENSES.map((license) => ({
51
- label: marker(`editor.record.form.license.${license}`),
52
- value: license,
53
- }))
51
+ if (this.selectedLicence === undefined) {
52
+ this.choices = [
53
+ {
54
+ value: this.recordLicences[0].text,
55
+ label: this.recordLicences[0].text,
56
+ },
57
+ ...this.choices,
58
+ ]
59
+ this.selectedLicence = this.recordLicences[0].text
60
+ }
54
61
  }
55
62
 
56
63
  handleLicenceSelection(licenceValue: string) {
57
64
  this.selectedLicence = licenceValue
58
- this.recordConstraintsChange.emit([{ text: licenceValue }])
65
+ if (licenceValue === 'unknown') {
66
+ this.recordLicencesChange.emit([])
67
+ return
68
+ } else {
69
+ this.recordLicencesChange.emit([{ text: licenceValue }])
70
+ }
59
71
  }
60
72
  }
@@ -5,7 +5,6 @@
5
5
  (uploadCancel)="handleUploadCancel()"
6
6
  [uploadProgress]="uploadProgress"
7
7
  (urlChange)="handleUrlChange($event)"
8
- [disabled]="disabled$ | async"
9
8
  ></gn-ui-file-input>
10
9
  <div class="h-[8px]"></div>
11
10
  <gn-ui-sortable-list
@@ -42,17 +41,9 @@
42
41
  class="w-full"
43
42
  [disabled]="true"
44
43
  [value]="onlineResource.url"
45
- [showValidateButton]="false"
46
44
  [disabled]="disabled$ | async"
45
+ [showValidateButton]="false"
47
46
  ></gn-ui-url-input>
48
47
  </div>
49
48
  </ng-template>
50
- <div
51
- *ngIf="disabled$ | async"
52
- class="p-4 text-sm border border-primary bg-primary-lightest rounded-lg"
53
- translate
54
- data-test="disabled-message"
55
- >
56
- editor.record.form.field.draft.only.disabled
57
- </div>
58
49
  </div>
@@ -30,7 +30,6 @@ import { PlatformServiceInterface } from '../../../../../../../../../libs/common
30
30
  import { map, Subscription } from 'rxjs'
31
31
  import { MatDialog } from '@angular/material/dialog'
32
32
  import { MAX_UPLOAD_SIZE_MB } from '../../../../fields.config'
33
- import { EditorFacade } from '../../../../+state/editor.facade'
34
33
 
35
34
  @Component({
36
35
  selector: 'gn-ui-form-field-online-link-resources',
@@ -69,17 +68,12 @@ export class FormFieldOnlineLinkResourcesComponent {
69
68
 
70
69
  protected MAX_UPLOAD_SIZE_MB = MAX_UPLOAD_SIZE_MB
71
70
 
72
- disabled$ = this.editorFacade.alreadySavedOnce$.pipe(
73
- map((alreadySavedOnce) => !alreadySavedOnce)
74
- )
75
-
76
71
  constructor(
77
72
  private notificationsService: NotificationsService,
78
73
  private translateService: TranslateService,
79
74
  private platformService: PlatformServiceInterface,
80
75
  private cd: ChangeDetectorRef,
81
- private dialog: MatDialog,
82
- private editorFacade: EditorFacade
76
+ private dialog: MatDialog
83
77
  ) {}
84
78
 
85
79
  handleFileChange(file: File) {
@@ -4,7 +4,6 @@
4
4
  (selectedValue)="onSelectedTypeChange($event.value)"
5
5
  extraClasses="grow text-sm"
6
6
  data-cy="online-resources-type"
7
- [disabled]="disabled$ | async"
8
7
  ></gn-ui-switch-toggle>
9
8
  <div class="h-[8px]"></div>
10
9
  <gn-ui-file-input
@@ -14,7 +13,6 @@
14
13
  (uploadCancel)="handleUploadCancel()"
15
14
  [uploadProgress]="uploadProgress"
16
15
  (urlChange)="handleDownloadUrlChange($event)"
17
- [disabled]="disabled$ | async"
18
16
  ></gn-ui-file-input>
19
17
  <div
20
18
  *ngIf="selectedType === 'service'"
@@ -61,7 +59,6 @@
61
59
  <span class="w-full border-b border-gray-300"></span>
62
60
  <gn-ui-online-service-resource-input
63
61
  [service]="onlineResource"
64
- [disabled]="disabled$ | async"
65
62
  ></gn-ui-online-service-resource-input>
66
63
  </ng-container>
67
64
  <span class="w-full border-b border-gray-300"></span>
@@ -73,12 +70,4 @@
73
70
  ></gn-ui-url-input>
74
71
  </div>
75
72
  </ng-template>
76
- <div
77
- *ngIf="disabled$ | async"
78
- class="p-4 text-sm border border-primary bg-primary-lightest rounded-lg"
79
- translate
80
- data-test="disabled-message"
81
- >
82
- editor.record.form.field.draft.only.disabled
83
- </div>
84
73
  </div>
@@ -32,11 +32,10 @@ import {
32
32
  SortableListComponent,
33
33
  } from '../../../../../../../../../libs/ui/layout/src'
34
34
  import { TranslateModule, TranslateService } from '@ngx-translate/core'
35
- import { map, Subscription } from 'rxjs'
35
+ import { Subscription } from 'rxjs'
36
36
  import { MAX_UPLOAD_SIZE_MB } from '../../../../fields.config'
37
37
  import { OnlineResourceCardComponent } from '../../../online-resource-card/online-resource-card.component'
38
38
  import { OnlineServiceResourceInputComponent } from '../../../online-service-resource-input/online-service-resource-input.component'
39
- import { EditorFacade } from '../../../../+state/editor.facade'
40
39
 
41
40
  type OnlineNotLinkResource =
42
41
  | DatasetDownloadDistribution
@@ -101,17 +100,12 @@ export class FormFieldOnlineResourcesComponent {
101
100
 
102
101
  protected MAX_UPLOAD_SIZE_MB = MAX_UPLOAD_SIZE_MB
103
102
 
104
- disabled$ = this.editorFacade.alreadySavedOnce$.pipe(
105
- map((alreadySavedOnce) => !alreadySavedOnce)
106
- )
107
-
108
103
  constructor(
109
104
  private notificationsService: NotificationsService,
110
105
  private translateService: TranslateService,
111
106
  private platformService: PlatformServiceInterface,
112
107
  private cd: ChangeDetectorRef,
113
- private dialog: MatDialog,
114
- private editorFacade: EditorFacade
108
+ private dialog: MatDialog
115
109
  ) {}
116
110
 
117
111
  onSelectedTypeChange(selectedType: unknown) {
@@ -9,14 +9,5 @@
9
9
  (delete)="handleDelete()"
10
10
  [uploadProgress]="uploadProgress"
11
11
  (uploadCancel)="handleUploadCancel()"
12
- [disabled]="disabled$ | async"
13
12
  ></gn-ui-image-input>
14
- <div
15
- *ngIf="disabled$ | async"
16
- class="p-4 text-sm border border-primary bg-primary-lightest rounded-lg"
17
- translate
18
- data-test="disabled-message"
19
- >
20
- editor.record.form.field.draft.only.disabled
21
- </div>
22
13
  </div>
@@ -12,9 +12,8 @@ import { ImageInputComponent } from '../../../../../../../../../libs/ui/elements
12
12
  import { PlatformServiceInterface } from '../../../../../../../../../libs/common/domain/src/lib/platform.service.interface'
13
13
  import { NotificationsService } from '../../../../../../../../../libs/feature/notifications/src'
14
14
  import { TranslateModule, TranslateService } from '@ngx-translate/core'
15
- import { map, Subscription } from 'rxjs'
15
+ import { Subscription } from 'rxjs'
16
16
  import { MAX_UPLOAD_SIZE_MB } from '../../../../fields.config'
17
- import { EditorFacade } from '../../../../+state/editor.facade'
18
17
 
19
18
  @Component({
20
19
  selector: 'gn-ui-form-field-overviews',
@@ -30,10 +29,6 @@ export class FormFieldOverviewsComponent {
30
29
  @Output() valueChange: EventEmitter<Array<GraphicOverview>> =
31
30
  new EventEmitter()
32
31
 
33
- disabled$ = this.editorFacade.alreadySavedOnce$.pipe(
34
- map((alreadySavedOnce) => !alreadySavedOnce)
35
- )
36
-
37
32
  uploadProgress = undefined
38
33
  uploadSubscription: Subscription = null
39
34
 
@@ -52,8 +47,7 @@ export class FormFieldOverviewsComponent {
52
47
  private platformService: PlatformServiceInterface,
53
48
  private notificationsService: NotificationsService,
54
49
  private translateService: TranslateService,
55
- private cd: ChangeDetectorRef,
56
- private editorFacade: EditorFacade
50
+ private cd: ChangeDetectorRef
57
51
  ) {}
58
52
 
59
53
  handleFileChange(file: File) {
@@ -112,8 +112,8 @@
112
112
  <ng-container *ngSwitchCase="'licenses'">
113
113
  <gn-ui-form-field-license
114
114
  [label]="config.labelKey! | translate"
115
- [recordConstraints]="valueAsConstraints"
116
- (recordConstraintsChange)="valueChange.emit($event)"
115
+ [recordLicences]="valueAsConstraints"
116
+ (recordLicencesChange)="valueChange.emit($event)"
117
117
  ></gn-ui-form-field-license>
118
118
  </ng-container>
119
119
 
@@ -1,5 +1,5 @@
1
1
  import { Injectable } from '@angular/core'
2
- import { Observable, switchMap } from 'rxjs'
2
+ import { forkJoin, Observable, of, switchMap } from 'rxjs'
3
3
  import { map, tap } from 'rxjs/operators'
4
4
  import { CatalogRecord } from '../../../../../../libs/common/domain/src/lib/model/record'
5
5
  import { EditorConfig } from '../models/'
@@ -16,8 +16,7 @@ export class EditorService {
16
16
  saveRecord(
17
17
  record: CatalogRecord,
18
18
  recordSource: string,
19
- fieldsConfig: EditorConfig,
20
- generateNewUniqueIdentifier = false
19
+ fieldsConfig: EditorConfig
21
20
  ): Observable<[CatalogRecord, string]> {
22
21
  const savedRecord = { ...record }
23
22
 
@@ -35,22 +34,25 @@ export class EditorService {
35
34
  })
36
35
  }
37
36
  }
38
-
39
- // if we want a new unique identifier, clear the existing one
40
- if (generateNewUniqueIdentifier) {
37
+ let publishToAll = true
38
+ // if the record is new, generate a new unique identifier and pass publishToAll as false
39
+ if (!record.uniqueIdentifier) {
41
40
  savedRecord.uniqueIdentifier = null
41
+ publishToAll = false
42
42
  }
43
43
 
44
- return this.recordsRepository.saveRecord(savedRecord, recordSource).pipe(
45
- switchMap((uniqueIdentifier) =>
46
- this.recordsRepository.openRecordForEdition(uniqueIdentifier)
47
- ),
48
- tap(() => {
49
- // if saving was successful, the original draft can be discarded
50
- this.recordsRepository.clearRecordDraft(record.uniqueIdentifier)
51
- }),
52
- map(([record, recordSource]) => [record, recordSource])
53
- )
44
+ return this.recordsRepository
45
+ .saveRecord(savedRecord, recordSource, publishToAll)
46
+ .pipe(
47
+ switchMap((uniqueIdentifier) =>
48
+ this.recordsRepository.openRecordForEdition(uniqueIdentifier)
49
+ ),
50
+ tap(() => {
51
+ // if saving was successful, the original draft can be discarded
52
+ this.recordsRepository.clearRecordDraft(record.uniqueIdentifier)
53
+ }),
54
+ map(([record, recordSource]) => [record, recordSource])
55
+ )
54
56
  }
55
57
 
56
58
  // emits and completes once saving is done
@@ -4,7 +4,6 @@
4
4
  [hasDraft]="hasDraft"
5
5
  [selectedRecordsIdentifiers]="selectedRecords$ | async"
6
6
  [sortOrder]="sortBy$ | async"
7
- [isUnsavedDraft]="isUnsavedDraft"
8
7
  [canDelete]="canDelete"
9
8
  [canDuplicate]="canDuplicate"
10
9
  (recordClick)="handleRecordClick($event)"
@@ -38,9 +38,6 @@ export class ResultsTableContainerComponent implements OnDestroy {
38
38
  hasDraft = (record: CatalogRecord): boolean =>
39
39
  this.recordsRepository.recordHasDraft(record.uniqueIdentifier)
40
40
 
41
- isUnsavedDraft = (record: CatalogRecord): boolean =>
42
- this.recordsRepository.isRecordNotYetSaved(record.uniqueIdentifier)
43
-
44
41
  constructor(
45
42
  protected searchFacade: SearchFacade,
46
43
  private searchService: SearchService,
@@ -10,6 +10,7 @@
10
10
  "
11
11
  >
12
12
  <div
13
+ data-test="icon-container"
13
14
  class="{{ bgClass }} {{
14
15
  textClass
15
16
  }} text-[1.875em] rounded-full mr-[0.55em] flex justify-center items-center w-[2.2em] h-[2.2em] shrink-0"
@@ -48,10 +48,10 @@ import { iconoirCloudUpload, iconoirFramePlusIn } from '@ng-icons/iconoir'
48
48
  export class FileInputComponent {
49
49
  @Input() maxSizeMB: number
50
50
  @Input() uploadProgress?: number
51
- @Input() disabled? = false
52
51
  @Output() fileChange: EventEmitter<File> = new EventEmitter()
53
52
  @Output() urlChange: EventEmitter<string> = new EventEmitter()
54
53
  @Output() uploadCancel: EventEmitter<void> = new EventEmitter()
54
+ @Input() disabled? = false
55
55
 
56
56
  dragFilesOver = false
57
57
 
@@ -31,6 +31,11 @@
31
31
  *ngFor="let item of items"
32
32
  (click)="handleRowClick(item)"
33
33
  data-cy="table-row"
34
+ [title]="
35
+ !item.extras?.edit && !isDraftPage
36
+ ? ('editor.record.lock.reason' | translate)
37
+ : ''
38
+ "
34
39
  >
35
40
  <div
36
41
  class="relative h-0"
@@ -44,7 +49,13 @@
44
49
  </div>
45
50
  <ng-container *ngFor="let column of columns">
46
51
  <div
47
- class="table-row-cell px-3 py-1.5 flex items-center bg-white transition-colors duration-75 truncate group-hover:text-main group-hover:bg-gray-50 border-b border-gray-200"
52
+ class="table-row-cell px-3 py-1.5 flex items-center bg-white transition-colors duration-75 truncate border-b border-gray-200"
53
+ [ngClass]="{
54
+ 'text-purple-light cursor-default':
55
+ !item.extras?.edit && !isDraftPage,
56
+ 'group-hover:text-main group-hover:bg-gray-50':
57
+ item.extras?.edit || isDraftPage,
58
+ }"
48
59
  >
49
60
  <ng-container
50
61
  *ngTemplateOutlet="column.cell; context: { $implicit: item }"
@@ -9,12 +9,9 @@ import {
9
9
  } from '@angular/core'
10
10
  import { InteractiveTableColumnComponent } from './interactive-table-column/interactive-table-column.component'
11
11
  import { CommonModule } from '@angular/common'
12
- import {
13
- NgIconComponent,
14
- provideIcons,
15
- provideNgIconsConfig,
16
- } from '@ng-icons/core'
12
+ import { NgIconComponent, provideIcons } from '@ng-icons/core'
17
13
  import { iconoirNavArrowDown, iconoirNavArrowUp } from '@ng-icons/iconoir'
14
+ import { TranslateModule } from '@ngx-translate/core'
18
15
 
19
16
  @Component({
20
17
  selector: 'gn-ui-interactive-table',
@@ -22,7 +19,7 @@ import { iconoirNavArrowDown, iconoirNavArrowUp } from '@ng-icons/iconoir'
22
19
  styleUrls: ['./interactive-table.component.css'],
23
20
  changeDetection: ChangeDetectionStrategy.OnPush,
24
21
  standalone: true,
25
- imports: [CommonModule, InteractiveTableColumnComponent, NgIconComponent],
22
+ imports: [CommonModule, NgIconComponent, TranslateModule],
26
23
  providers: [provideIcons({ iconoirNavArrowDown, iconoirNavArrowUp })],
27
24
  })
28
25
  export class InteractiveTableComponent {
@@ -30,6 +27,7 @@ export class InteractiveTableComponent {
30
27
  columns: QueryList<InteractiveTableColumnComponent>
31
28
 
32
29
  @Input() items: unknown[] = []
30
+ @Input() isDraftPage = false
33
31
  @Output() itemClick = new EventEmitter<unknown>()
34
32
 
35
33
  get gridStyle() {
@@ -1,11 +1,18 @@
1
1
  <gn-ui-interactive-table
2
2
  [items]="records"
3
+ [isDraftPage]="isDraftPage"
3
4
  (itemClick)="handleRecordClick($event)"
4
5
  >
5
6
  <!-- SELECTED COLUMN -->
6
7
  <gn-ui-interactive-table-column [width]="'3rem'">
7
- <ng-template #cell let-item>
8
+ <ng-template #cell let-item let-i="index">
9
+ <ng-icon
10
+ name="iconoirLock"
11
+ class="text-purple"
12
+ *ngIf="!item.extras?.edit && !isDraftPage"
13
+ ></ng-icon>
8
14
  <gn-ui-checkbox
15
+ *ngIf="item.extras?.edit || isDraftPage"
9
16
  [checked]="isChecked(item)"
10
17
  (changed)="handleRecordSelectedChange($event, item)"
11
18
  class="-m-2"
@@ -102,9 +109,9 @@
102
109
  <ng-template #cell let-item>
103
110
  <span class="text-xs">
104
111
  {{
105
- (isUnsavedDraft(item)
106
- ? 'record.metadata.status.notPublished'
107
- : 'record.metadata.status.published'
112
+ (item.extras?.['isPublishedToAll']
113
+ ? 'record.metadata.status.published'
114
+ : 'record.metadata.status.notPublished'
108
115
  ) | translate
109
116
  }}</span
110
117
  >
@@ -123,7 +130,11 @@
123
130
  </ng-template>
124
131
  <ng-template #cell let-item>
125
132
  <div class="flex text-left w-full text-xs">
126
- {{ isUnsavedDraft(item) ? '-' : dateToString(item.recordUpdated) }}
133
+ {{
134
+ item.extras?.['isPublishedToAll']
135
+ ? dateToString(item.recordUpdated)
136
+ : '-'
137
+ }}
127
138
  </div>
128
139
  </ng-template>
129
140
  </gn-ui-interactive-table-column>
@@ -138,8 +149,14 @@
138
149
  (buttonClick)="openActionMenu(item, template)"
139
150
  type="light"
140
151
  data-test="record-menu-button"
152
+ [disabled]="!item.extras?.edit && !isDraftPage"
141
153
  >
142
- <ng-icon name="matMoreVert"></ng-icon>
154
+ <ng-icon
155
+ [ngClass]="{
156
+ 'text-purple-light': !item.extras?.edit && !isDraftPage,
157
+ }"
158
+ name="matMoreVert"
159
+ ></ng-icon>
143
160
  </gn-ui-button>
144
161
  <ng-template #template>
145
162
  <gn-ui-action-menu
@@ -30,7 +30,7 @@ import {
30
30
  import { TranslateModule } from '@ngx-translate/core'
31
31
  import { ActionMenuComponent } from './action-menu/action-menu.component'
32
32
  import { NgIconComponent, provideIcons } from '@ng-icons/core'
33
- import { iconoirUser } from '@ng-icons/iconoir'
33
+ import { iconoirUser, iconoirLock } from '@ng-icons/iconoir'
34
34
  import {
35
35
  CdkConnectedOverlay,
36
36
  CdkOverlayOrigin,
@@ -55,9 +55,8 @@ import { matMoreVert } from '@ng-icons/material-icons/baseline'
55
55
  ActionMenuComponent,
56
56
  NgIconComponent,
57
57
  CdkOverlayOrigin,
58
- CdkConnectedOverlay,
59
58
  ],
60
- providers: [provideIcons({ iconoirUser, matMoreVert })],
59
+ providers: [provideIcons({ iconoirUser, iconoirLock, matMoreVert })],
61
60
  })
62
61
  export class ResultsTableComponent {
63
62
  @Input() records: CatalogRecord[] = []
@@ -65,8 +64,8 @@ export class ResultsTableComponent {
65
64
  @Input() sortOrder: SortByField = null
66
65
  @Input() hasDraft: (record: CatalogRecord) => boolean = () => false
67
66
  @Input() canDuplicate: (record: CatalogRecord) => boolean = () => true
68
- @Input() isUnsavedDraft: (record: CatalogRecord) => boolean = () => true
69
67
  @Input() canDelete: (record: CatalogRecord) => boolean = () => true
68
+ @Input() isDraftPage = false
70
69
 
71
70
  // emits the column (field) as well as the order
72
71
  @Output() sortByChange = new EventEmitter<[string, 'asc' | 'desc']>()
@@ -170,8 +169,9 @@ export class ResultsTableComponent {
170
169
  return getBadgeColor(format)
171
170
  }
172
171
 
173
- handleRecordClick(item: unknown) {
174
- this.recordClick.emit(item as CatalogRecord)
172
+ handleRecordClick(item: CatalogRecord) {
173
+ if (item?.extras?.edit || this.isDraftPage)
174
+ this.recordClick.emit(item as CatalogRecord)
175
175
  }
176
176
 
177
177
  handleDuplicate(item: unknown) {
@@ -44,6 +44,8 @@ module.exports = {
44
44
  800: '#8a2c0d',
45
45
  900: '#73230d',
46
46
  },
47
+ purple: '#9747FF',
48
+ 'purple-light': '#DDC3FF',
47
49
  },
48
50
  fontFamily: {
49
51
  sans: 'var(--font-family-main, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji")',