Skip to content

Commit

Permalink
feat(catalog): add catalog dialog, the title is now a list to select …
Browse files Browse the repository at this point in the history
…values (#931)

* feat(catalog): add catalog dialog, the title is now a list to select values

* wip

* wip

* wip

* wip

* fix(sharemap): URL construction was duplication the ? in the builded url
  • Loading branch information
pelord committed Nov 15, 2021
1 parent 07089b8 commit 33543e5
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 11 deletions.
Expand Up @@ -146,7 +146,7 @@ export class ShareMapService {

let version = '';
if (layerVersion) {
const operator = linkUrl.indexOf('?') === -1 ? '?' : '&';
const operator = (layer.dataSource.options as any).url.indexOf('?') === -1 ? '?' : '&';
version = encodeURIComponent(`${operator}VERSION=${layerVersion}`);
}
linkUrl = `${linkUrl}${version}`;
Expand Down
Expand Up @@ -3,21 +3,24 @@ <h1 mat-dialog-title class="mat-typography">{{'igo.geo.catalog.library.addTitle'
<form class="igo-form" [formGroup]="form">
<div class="igo-input-container">
<mat-form-field>
<input type="text" formControlName="url" placeholder="URL" matInput [matAutocomplete]="auto">
<mat-autocomplete #auto="matAutocomplete" (optionSelected)='changeUrl($event.option.value)'>
<input type="text" formControlName="title" placeholder="{{'igo.geo.printForm.title' | translate}}" matInput [matAutocomplete]="auto2">
<mat-autocomplete #auto2="matAutocomplete" (optionSelected)='changeUrlOrTitle($event.option.value)'>
<mat-option *ngFor="let predefinedCatalog of (predefinedCatalogsList$ | async)" matTooltipShowDelay="500"
[matTooltip]="predefinedCatalog.url" [value]="predefinedCatalog">
{{predefinedCatalog.url}}
[matTooltip]="predefinedCatalog.title" [value]="predefinedCatalog">
{{predefinedCatalog.title}}
</mat-option>
</mat-autocomplete>
</mat-form-field>
</div>
<div class="igo-input-container">
<mat-form-field>
<input
matInput
formControlName="title"
placeholder="{{'igo.geo.printForm.title' | translate}}">
<input type="text" formControlName="url" placeholder="URL" matInput [matAutocomplete]="auto">
<mat-autocomplete #auto="matAutocomplete" (optionSelected)='changeUrlOrTitle($event.option.value)'>
<mat-option *ngFor="let predefinedCatalog of (predefinedCatalogsList$ | async)" matTooltipShowDelay="500"
[matTooltip]="predefinedCatalog.url" [value]="predefinedCatalog">
{{predefinedCatalog.url}}
</mat-option>
</mat-autocomplete>
</mat-form-field>
</div>
<div class="igo-input-container">
Expand Down Expand Up @@ -60,4 +63,4 @@ <h1 mat-dialog-title class="mat-typography">{{'igo.geo.catalog.library.addTitle'
{{'igo.geo.catalog.library.add' | translate}}
</button>
</div>
</div>
</div>
Expand Up @@ -75,7 +75,7 @@ export class AddCatalogDialogComponent implements OnInit, OnDestroy {
this.storeViewAll$$.unsubscribe();
}

changeUrl(catalog: Catalog) {
changeUrlOrTitle(catalog: Catalog) {
this.form.patchValue(catalog);
this.error = false;
this.computePredefinedCatalogList();
Expand Down
Expand Up @@ -87,6 +87,7 @@ export class CatalogLibaryComponent implements OnInit, OnDestroy {
c.id = Md5.hashStr(
(c.type || 'wms') + standardizeUrl(c.url)
) as string;
c.title = c.title === '' || !c.title ? c.url : c.title;
return c;
});
}
Expand Down

0 comments on commit 33543e5

Please sign in to comment.