Skip to content

Commit

Permalink
fix: Ignore wfs status, when looking for layer descriptor adding vect…
Browse files Browse the repository at this point in the history
…or layers
  • Loading branch information
DailisLangovskis authored and raitisbe committed Jun 11, 2022
1 parent bfd3bc6 commit 4463b38
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,8 @@ export class HsAddDataVectorService {
descriptor = await this.hsLaymanService.describeLayer(
commonFileRef.endpoint,
name,
commonFileRef.endpoint.user
commonFileRef.endpoint.user,
true
);
} catch (error) {
console.error(error);
Expand Down
40 changes: 22 additions & 18 deletions projects/hslayers/src/components/save-map/layman.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,8 @@ export class HsLaymanService implements HsSaverService {
async describeLayer(
endpoint: HsEndpoint,
layerName: string,
workspace: string
workspace: string,
ignoreStatus?: boolean
): Promise<HsLaymanLayerDescriptor> {
try {
layerName = getLaymanFriendlyLayerName(layerName); //Better safe than sorry
Expand All @@ -705,23 +706,26 @@ export class HsLaymanService implements HsSaverService {
}
)
);
if (response?.code == 15 || response?.code == 15 || wfsFailed(response)) {
return null;
}
if (
response.wfs &&
(wfsPendingOrStarting(response) || response.wfs?.url == undefined)
) {
if (!this.pendingLayers.includes(layerName)) {
this.pendingLayers.push(layerName);
this.laymanLayerPending.next(this.pendingLayers);
}
await new Promise((resolve) => setTimeout(resolve, 3500));
return this.describeLayer(endpoint, layerName, workspace);
}
if (response.name) {
this.managePendingLayers(layerName);
return response;
switch (true) {
case response?.code == 15 ||
response?.code == 15 ||
wfsFailed(response):
return null;
case response.name && ignoreStatus:
return response;
case response.wfs &&
(wfsPendingOrStarting(response) || response.wfs?.url == undefined):
if (!this.pendingLayers.includes(layerName)) {
this.pendingLayers.push(layerName);
this.laymanLayerPending.next(this.pendingLayers);
}
await new Promise((resolve) => setTimeout(resolve, 3500));
return this.describeLayer(endpoint, layerName, workspace);
default:
if (response.name) {
this.managePendingLayers(layerName);
return response;
}
}
} catch (ex) {
this.managePendingLayers(layerName);
Expand Down

0 comments on commit 4463b38

Please sign in to comment.