-
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 #1002 from geonetwork/ME/record-field-distributions
ME: edit record distributions
- Loading branch information
Showing
28 changed files
with
742 additions
and
31 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
Empty file.
31 changes: 31 additions & 0 deletions
31
...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,31 @@ | ||
<div class="flex flex-row justify-between"> | ||
<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]"> | ||
<mat-radio-group | ||
aria-labelledby="example-radio-group-label" | ||
class="flex flex-row gap-[8px]" | ||
[(ngModel)]="service.accessServiceProtocol" | ||
> | ||
<mat-radio-button | ||
*ngFor="let protocolOption of protocolOptions" | ||
[value]="protocolOption.value" | ||
> | ||
{{ protocolOption.label | translate }} | ||
</mat-radio-button> | ||
</mat-radio-group> | ||
</div> | ||
<gn-ui-text-input | ||
[(value)]="service.identifierInService" | ||
data-cy="identifier-in-service" | ||
></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() | ||
}) | ||
}) |
82 changes: 82 additions & 0 deletions
82
...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,82 @@ | ||
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 | ||
|
||
selectedProtocol: ServiceProtocol | ||
|
||
protocolOptions: { | ||
label: string | ||
value: ServiceProtocol | ||
}[] = [ | ||
{ | ||
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' | ||
} | ||
} |
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.
71 changes: 71 additions & 0 deletions
71
...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,71 @@ | ||
<gn-ui-switch-toggle | ||
[options]="typeOptions" | ||
(selectedValue)="onSelectedTypeChange($event.value)" | ||
extraClasses="grow" | ||
data-cy="online-resources-type" | ||
></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" | ||
[urlCanParse]="true" | ||
(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> | ||
<div class="flex flex-col gap-[16px]"> | ||
<div> | ||
<h3 class="text-[16px] font-bold text-main mb-[12px]" translate> | ||
editor.record.form.field.onlineResource.edit.title | ||
</h3> | ||
<gn-ui-text-input [(value)]="onlineResource.name"></gn-ui-text-input> | ||
</div> | ||
<div> | ||
<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> | ||
</div> | ||
<ng-container *ngIf="onlineResource.type === 'service'"> | ||
<span class="w-full border-b border-gray-300"></span> | ||
<gn-ui-online-service-resource-input | ||
[service]="onlineResource" | ||
></gn-ui-online-service-resource-input> | ||
</ng-container> | ||
<span class="w-full border-b border-gray-300"></span> | ||
<gn-ui-url-input | ||
class="w-full" | ||
[disabled]="true" | ||
[value]="onlineResource.url" | ||
></gn-ui-url-input> | ||
</div> | ||
</ng-template> |
Oops, something went wrong.