-
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.
feature(metadata-editor): added FormFieldOverviews component to the F…
…ormFieldComponent.
- Loading branch information
Romuald Caplier
committed
Jul 2, 2024
1 parent
6e19d67
commit 47b30b3
Showing
22 changed files
with
286 additions
and
73 deletions.
There are no files selected for viewing
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
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
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
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
Oops, something went wrong.