-
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.
- Loading branch information
1 parent
66a3379
commit c29ab22
Showing
24 changed files
with
559 additions
and
13 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
Empty file.
34 changes: 34 additions & 0 deletions
34
...lib/components/online-service-resource-input/online-service-resource-input.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,34 @@ | ||
<div class="flex flex-row justify-between mb-[16px]"> | ||
<h3 class="text-[16px] font-bold text-main mb-[12px]" translate> | ||
editor.record.form.field.onlineResource.edit.protocol | ||
</h3> | ||
<span | ||
*ngIf="protocolHint" | ||
class="material-symbols-outlined m-2 gn-ui-icon-small" | ||
[matTooltip]="protocolHint" | ||
matTooltipPosition="above" | ||
> | ||
help | ||
</span> | ||
</div> | ||
<div class="flex flex-row items-center gap-[16px] h-[48px] mb-[16px]"> | ||
<mat-radio-group | ||
aria-labelledby="example-radio-group-label" | ||
class="flex flex-row gap-[8px]" | ||
[(ngModel)]="selectedProtocol" | ||
(ngModelChange)="handleProtocolChange($event)" | ||
> | ||
<mat-radio-button | ||
*ngFor="let protocolOption of protocolOptions" | ||
[value]="protocolOption.value" | ||
> | ||
{{ protocolOption.label | translate }} | ||
</mat-radio-button> | ||
</mat-radio-group> | ||
<gn-ui-text-input | ||
*ngIf="selectedProtocol === 'other'" | ||
class="grow" | ||
[(value)]="service.accessServiceProtocol" | ||
></gn-ui-text-input> | ||
</div> | ||
<gn-ui-text-input [(value)]="service.identifierInService"></gn-ui-text-input> |
21 changes: 21 additions & 0 deletions
21
.../components/online-service-resource-input/online-service-resource-input.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,21 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing' | ||
import { TranslateModule } from '@ngx-translate/core' | ||
import { OnlineServiceResourceInputComponent } from './online-service-resource-input.component' | ||
|
||
describe('OnlineServiceResourceInputComponent', () => { | ||
let component: OnlineServiceResourceInputComponent | ||
let fixture: ComponentFixture<OnlineServiceResourceInputComponent> | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
imports: [OnlineServiceResourceInputComponent, TranslateModule.forRoot()], | ||
}).compileComponents() | ||
|
||
fixture = TestBed.createComponent(OnlineServiceResourceInputComponent) | ||
component = fixture.componentInstance | ||
}) | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy() | ||
}) | ||
}) |
90 changes: 90 additions & 0 deletions
90
...c/lib/components/online-service-resource-input/online-service-resource-input.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,90 @@ | ||
import { CommonModule } from '@angular/common' | ||
import { | ||
ChangeDetectionStrategy, | ||
Component, | ||
Input, | ||
OnChanges, | ||
} from '@angular/core' | ||
import { FormsModule } from '@angular/forms' | ||
import { MatIconModule } from '@angular/material/icon' | ||
import { MatRadioModule } from '@angular/material/radio' | ||
import { MatTooltipModule } from '@angular/material/tooltip' | ||
import { marker } from '@biesbjerg/ngx-translate-extract-marker' | ||
import { | ||
DatasetServiceDistribution, | ||
ServiceProtocol, | ||
} from '@geonetwork-ui/common/domain/model/record' | ||
import { TextInputComponent } from '@geonetwork-ui/ui/inputs' | ||
import { TranslateModule } from '@ngx-translate/core' | ||
|
||
@Component({ | ||
selector: 'gn-ui-online-service-resource-input', | ||
templateUrl: './online-service-resource-input.component.html', | ||
styleUrls: ['./online-service-resource-input.component.css'], | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
standalone: true, | ||
imports: [ | ||
CommonModule, | ||
MatIconModule, | ||
MatTooltipModule, | ||
MatRadioModule, | ||
FormsModule, | ||
TextInputComponent, | ||
TranslateModule, | ||
], | ||
}) | ||
export class OnlineServiceResourceInputComponent implements OnChanges { | ||
@Input() service: Omit<DatasetServiceDistribution, 'url'> | ||
@Input() protocolHint?: string = 'toto' | ||
|
||
selectedProtocol: ServiceProtocol | 'other' | ||
|
||
protocolOptions: { | ||
label: string | ||
value: ServiceProtocol | 'other' | ||
}[] = [ | ||
{ | ||
label: 'OGC API', | ||
value: 'ogcFeatures', | ||
}, | ||
{ | ||
label: 'WFS', | ||
value: 'wfs', | ||
}, | ||
{ | ||
label: 'WMS', | ||
value: 'wms', | ||
}, | ||
{ | ||
label: 'WMTS', | ||
value: 'wmts', | ||
}, | ||
{ | ||
label: 'WPS', | ||
value: 'wps', | ||
}, | ||
{ | ||
label: 'ESRI REST', | ||
value: 'esriRest', | ||
}, | ||
{ | ||
label: marker('editor.record.onlineResource.protocol.other'), | ||
value: 'other', | ||
}, | ||
] | ||
|
||
ngOnChanges() { | ||
this.selectedProtocol = | ||
this.protocolOptions.find( | ||
(option) => option.value === this.service.accessServiceProtocol | ||
)?.value ?? 'other' | ||
} | ||
|
||
handleProtocolChange(protocol: ServiceProtocol | 'other') { | ||
if (protocol === 'other') { | ||
this.service.accessServiceProtocol = '' | ||
} else { | ||
this.service.accessServiceProtocol = protocol | ||
} | ||
} | ||
} |
Empty file.
62 changes: 62 additions & 0 deletions
62
...rd-form/form-field/form-field-online-resources/form-field-online-resources.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,62 @@ | ||
<gn-ui-switch-toggle | ||
[options]="typeOptions" | ||
(selectedValue)="onSelectedTypeChange($event.value)" | ||
extraClasses="grow" | ||
></gn-ui-switch-toggle> | ||
<div class="h-[8px]"></div> | ||
<gn-ui-file-input | ||
*ngIf="selectedType === 'download'" | ||
[maxSizeMB]="MAX_UPLOAD_SIZE_MB" | ||
(fileChange)="handleFileChange($event)" | ||
(uploadCancel)="handleUploadCancel()" | ||
[uploadProgress]="uploadProgress" | ||
(urlChange)="handleDownloadUrlChange($event)" | ||
></gn-ui-file-input> | ||
<div | ||
*ngIf="selectedType === 'service'" | ||
class="w-full border-2 border-dashed rounded-lg p-6 flex flex-col gap-[16px]" | ||
> | ||
<gn-ui-online-service-resource-input | ||
[service]="newService" | ||
></gn-ui-online-service-resource-input> | ||
<span class="w-full border-b border-gray-300"></span> | ||
<gn-ui-url-input | ||
class="w-full" | ||
(valueChange)="handleServiceUrlChange($event)" | ||
></gn-ui-url-input> | ||
</div> | ||
<div class="h-[8px]"></div> | ||
<gn-ui-sortable-list | ||
[items]="notLinkResources" | ||
(itemsOrderChange)="handleResourcesChange($event)" | ||
[elementTemplate]="template" | ||
> | ||
</gn-ui-sortable-list> | ||
<ng-template #template let-onlineResource let-index="index"> | ||
<gn-ui-online-resource-card | ||
[onlineResource]="onlineResource" | ||
(modifyClick)="handleResourceModify(onlineResource, index)" | ||
></gn-ui-online-resource-card> | ||
</ng-template> | ||
|
||
<ng-template #dialogTemplate let-onlineResource> | ||
<h3 class="text-[16px] font-bold text-main mb-[12px]" translate> | ||
editor.record.form.field.onlineResource.edit.title | ||
</h3> | ||
<gn-ui-text-input | ||
extraClass="mb-[16px]" | ||
[(value)]="onlineResource.name" | ||
></gn-ui-text-input> | ||
<h3 class="text-[16px] font-bold text-main mb-[12px]" translate> | ||
editor.record.form.field.onlineResource.edit.description | ||
</h3> | ||
<gn-ui-text-area [(value)]="onlineResource.description"></gn-ui-text-area> | ||
<ng-container *ngIf="onlineResource.type === 'service'"> | ||
<div class="h-[8px]"></div> | ||
<span class="w-full border-b border-gray-300"></span> | ||
<div class="h-[8px]"></div> | ||
<gn-ui-online-service-resource-input | ||
[service]="onlineResource" | ||
></gn-ui-online-service-resource-input> | ||
</ng-container> | ||
</ng-template> |
21 changes: 21 additions & 0 deletions
21
...form/form-field/form-field-online-resources/form-field-online-resources.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,21 @@ | ||
import { ComponentFixture, TestBed } from '@angular/core/testing' | ||
import { TranslateModule } from '@ngx-translate/core' | ||
import { FormFieldOnlineResourcesComponent } from './form-field-online-resources.component' | ||
|
||
describe('FormFieldOnlineResourcesComponent', () => { | ||
let component: FormFieldOnlineResourcesComponent | ||
let fixture: ComponentFixture<FormFieldOnlineResourcesComponent> | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
imports: [FormFieldOnlineResourcesComponent, TranslateModule.forRoot()], | ||
}).compileComponents() | ||
|
||
fixture = TestBed.createComponent(FormFieldOnlineResourcesComponent) | ||
component = fixture.componentInstance | ||
}) | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy() | ||
}) | ||
}) |
Oops, something went wrong.