{
let component: FormFieldComponent
@@ -17,7 +27,18 @@ describe('FormFieldComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
- imports: [FormFieldComponent, TranslateModule.forRoot()],
+ imports: [
+ FormFieldComponent,
+ TranslateModule.forRoot(),
+ HttpClientTestingModule,
+ ],
+ schemas: [NO_ERRORS_SCHEMA],
+ providers: [
+ {
+ provide: EditorFacade,
+ useClass: EditorFacadeMock,
+ },
+ ],
}).compileComponents()
fixture = TestBed.createComponent(FormFieldComponent)
@@ -149,4 +170,17 @@ describe('FormFieldComponent', () => {
expect(formField).toBeTruthy()
})
})
+ describe('overviews field', () => {
+ let formField
+ beforeEach(() => {
+ component.model = 'overviews'
+ fixture.detectChanges()
+ formField = fixture.debugElement.query(
+ By.directive(FormFieldOverviewsComponent)
+ ).componentInstance
+ })
+ it('creates an overview upload form field', () => {
+ expect(formField).toBeTruthy()
+ })
+ })
})
diff --git a/libs/feature/editor/src/lib/components/record-form/form-field/form-field.component.ts b/libs/feature/editor/src/lib/components/record-form/form-field/form-field.component.ts
index 44621437a5..db576ccb2d 100644
--- a/libs/feature/editor/src/lib/components/record-form/form-field/form-field.component.ts
+++ b/libs/feature/editor/src/lib/components/record-form/form-field/form-field.component.ts
@@ -28,6 +28,9 @@ import { FormFieldSpatialExtentComponent } from './form-field-spatial-extent/for
import { FormFieldUpdateFrequencyComponent } from './form-field-update-frequency/form-field-update-frequency.component'
import { CatalogRecordKeys } from '@geonetwork-ui/common/domain/model/record'
import { FormFieldKeywordsComponent } from './form-field-keywords/form-field-keywords.component'
+import { FormFieldOverviewsComponent } from './form-field-overviews/form-field-overviews.component'
+import { map, take } from 'rxjs/operators'
+import { EditorFacade } from '../../../+state/editor.facade'
import { FormFieldConfig } from '../../../models'
@Component({
@@ -55,6 +58,7 @@ import { FormFieldConfig } from '../../../models'
FormFieldArrayComponent,
FormFieldKeywordsComponent,
TranslateModule,
+ FormFieldOverviewsComponent,
],
})
export class FormFieldComponent {
@@ -70,9 +74,14 @@ export class FormFieldComponent {
@ViewChild('titleInput') titleInput: ElementRef
+ metadataUuid$ = this.facade.record$.pipe(
+ take(1),
+ map((record) => record.uniqueIdentifier)
+ )
+
formControl = new FormControl()
- constructor() {
+ constructor(private facade: EditorFacade) {
this.valueChange = this.formControl.valueChanges
}
@@ -101,6 +110,9 @@ export class FormFieldComponent {
get isSpatialExtentField() {
return this.model === 'spatialExtents'
}
+ get isGraphicOverview() {
+ return this.model === 'overviews'
+ }
get isSimpleField() {
return this.model === 'uniqueIdentifier' || this.model === 'recordUpdated'
}
diff --git a/libs/feature/editor/src/lib/components/record-form/record-form.component.ts b/libs/feature/editor/src/lib/components/record-form/record-form.component.ts
index 54d4e59b87..24048c7656 100644
--- a/libs/feature/editor/src/lib/components/record-form/record-form.component.ts
+++ b/libs/feature/editor/src/lib/components/record-form/record-form.component.ts
@@ -24,6 +24,7 @@ export class RecordFormComponent {
if (!model) {
return
}
+ console.log(newValue)
this.facade.updateRecordField(model, newValue)
}
diff --git a/libs/feature/editor/src/lib/fields.config.ts b/libs/feature/editor/src/lib/fields.config.ts
index 8c22644b48..1614eb1e05 100644
--- a/libs/feature/editor/src/lib/fields.config.ts
+++ b/libs/feature/editor/src/lib/fields.config.ts
@@ -83,6 +83,13 @@ export const RECORD_ABSTRACT_FIELD: EditorField = {
},
}
+export const RECORD_GRAPHICAL_OVERVIEW_FIELD: EditorField = {
+ model: 'overviews',
+ formFieldConfig: {
+ labelKey: marker('editor.record.form.field.overviews'),
+ },
+}
+
/************************************************************
*************** SECTIONS *****************
************************************************************
@@ -90,7 +97,11 @@ export const RECORD_ABSTRACT_FIELD: EditorField = {
export const TITLE_SECTION: EditorSection = {
hidden: false,
- fields: [RECORD_TITLE_FIELD, RECORD_ABSTRACT_FIELD],
+ fields: [
+ RECORD_TITLE_FIELD,
+ RECORD_ABSTRACT_FIELD,
+ RECORD_GRAPHICAL_OVERVIEW_FIELD,
+ ],
}
export const ABOUT_SECTION: EditorSection = {
diff --git a/libs/ui/inputs/src/lib/image-input/image-input.component.html b/libs/ui/inputs/src/lib/image-input/image-input.component.html
index ceeb82456a..ec41523dd2 100644
--- a/libs/ui/inputs/src/lib/image-input/image-input.component.html
+++ b/libs/ui/inputs/src/lib/image-input/image-input.component.html
@@ -51,7 +51,7 @@