-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #909 from geonetwork/me-add-graphical-overview-rec…
…ord-field EDITOR - Record field: graphic overview
- Loading branch information
Showing
22 changed files
with
319 additions
and
119 deletions.
There are no files selected for viewing
4 changes: 3 additions & 1 deletion
4
libs/feature/editor/src/lib/components/overview-upload/overview-upload.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
<gn-ui-image-input | ||
[maxSizeMB]="5" | ||
[previewUrl]="resourceUrl" | ||
[altText]="resourceFileName" | ||
[altText]="resourceAltText" | ||
[formControl]="formControl" | ||
(fileChange)="handleFileChange($event)" | ||
(urlChange)="handleUrlChange($event)" | ||
(altTextChange)="handleAltTextChange($event)" | ||
(delete)="handleDelete()" | ||
></gn-ui-image-input> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
5 changes: 5 additions & 0 deletions
5
...omponents/record-form/form-field/form-field-overviews/form-field-overviews.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<gn-ui-overview-upload | ||
[metadataUuid]="metadataUuid" | ||
[formControl]="control" | ||
(overviewChange)="handleOverviewChange($event)" | ||
></gn-ui-overview-upload> |
40 changes: 40 additions & 0 deletions
40
...onents/record-form/form-field/form-field-overviews/form-field-overviews.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing' | ||
|
||
import { FormFieldOverviewsComponent } from './form-field-overviews.component' | ||
import { HttpClientTestingModule } from '@angular/common/http/testing' | ||
import { TranslateModule } from '@ngx-translate/core' | ||
import { FormControl } from '@angular/forms' | ||
|
||
describe('FormFieldOverviewsComponent', () => { | ||
let component: FormFieldOverviewsComponent | ||
let fixture: ComponentFixture<FormFieldOverviewsComponent> | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
imports: [ | ||
FormFieldOverviewsComponent, | ||
HttpClientTestingModule, | ||
TranslateModule.forRoot(), | ||
], | ||
}).compileComponents() | ||
|
||
fixture = TestBed.createComponent(FormFieldOverviewsComponent) | ||
component = fixture.componentInstance | ||
component.metadataUuid = '8505d991-e38f-4704-a47a-e7d335dfbef5' | ||
const control = new FormControl() | ||
control.setValue([ | ||
{ | ||
description: 'doge.jpg', | ||
url: new URL( | ||
'http://localhost:8080/geonetwork/srv/api/0.1/records/8505d991-e38f-4704-a47a-e7d335dfbef5/attachments/doge.jpg' | ||
), | ||
}, | ||
]) | ||
component.control = control | ||
fixture.detectChanges() | ||
}) | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy() | ||
}) | ||
}) |
22 changes: 22 additions & 0 deletions
22
.../components/record-form/form-field/form-field-overviews/form-field-overviews.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { CommonModule } from '@angular/common' | ||
import { ChangeDetectionStrategy, Component, Input } from '@angular/core' | ||
import { OverviewUploadComponent } from '../../../overview-upload/overview-upload.component' | ||
import { FormControl } from '@angular/forms' | ||
import { GraphicOverview } from '@geonetwork-ui/common/domain/model/record' | ||
|
||
@Component({ | ||
selector: 'gn-ui-form-field-overviews', | ||
templateUrl: './form-field-overviews.component.html', | ||
styleUrls: ['./form-field-overviews.component.css'], | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
standalone: true, | ||
imports: [CommonModule, OverviewUploadComponent], | ||
}) | ||
export class FormFieldOverviewsComponent { | ||
@Input() metadataUuid: string | ||
@Input() control!: FormControl | ||
|
||
handleOverviewChange(overView: GraphicOverview | null) { | ||
this.control.setValue(overView ? [overView] : []) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.