Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Layer download fails when layer attributes are changed in feature grid #10597 #10832

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions web/client/epics/layerdownload.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ import {

import { getLayerWFSCapabilities, getXMLFeature } from '../observables/wfs';
import { describeProcess } from '../observables/wps/describe';
import { download, downloadWithAttributesFilter } from '../observables/wps/download';
import { download } from '../observables/wps/download';
import { referenceOutputExtractor, makeOutputsExtractor, getExecutionStatus } from '../observables/wps/execute';

import { mergeFiltersToOGC } from '../utils/FilterUtils';
Expand Down Expand Up @@ -366,7 +366,7 @@ export const startFeatureExportDownload = (action$, store) =>
outputsExtractor: makeOutputsExtractor(referenceOutputExtractor)
};

const executor = isVectorLayer && propertyNames ? downloadWithAttributesFilter : download;
const executor = download;

return executor(action.url, wpsDownloadOptions, wpsExecuteOptions)
.takeUntil(action$.ofType(REMOVE_EXPORT_DATA_RESULT).filter(({id}) => id === newResult.id).take(1))
Expand Down
71 changes: 0 additions & 71 deletions web/client/observables/wps/download.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,74 +172,3 @@ export const download = (url, downloadOptions, executeOptions) => {

return Observable.empty();
};


/**
* Execute gs:Download process and passes results to gs:Query, running gs:DownloadEstimator first
* @memberof observables.wps.download
* @param {string} url target url
* @param {object} downloadOptions options to use to construct payload xml for DownloadEstimator and Download processes(except notifyDownloadEstimatorSuccess). See {@link api/framework#observables.wps.download.exports.downloadXML|downloadXML}
* @param {boolean} downloadOptions.notifyDownloadEstimatorSuccess if true, the returned observable emits 'DownloadEstimatorSuccess' string after successful gs:DownloadEstimator run
* @param {object} executeOptions options to pass to executeProcess. See {@link api/framework#observables.wps.execute.exports.executeProcess|executeProcess}
*/
export const downloadWithAttributesFilter = (url, downloadOptions, executeOptions) => {
if (url && downloadOptions) {
const downloadEstimator$ = executeProcess(url, downloadEstimatorXML({
layerName: downloadOptions.layerName,
ROI: downloadOptions.ROI,
roiCRS: downloadOptions.roiCRS,
dataFilter: downloadOptions.dataFilter,
targetCRS: downloadOptions.targetCRS
}), {outputsExtractor: makeOutputsExtractor(literalDataOutputExtractor)});

// use the same format of outputFormat for result
// if resultOutput param is undefined
const resultOutput = downloadOptions.resultOutput || downloadOptions.outputFormat || 'application/zip';

const executeProcess$ = executeProcess(url, downloadXML({
...omit(downloadOptions, 'notifyDownloadEstimatorSuccess', 'attribute', 'asynchronous', 'outputFormat'),
asynchronous: true,
outputAsReference: true,
resultOutput: 'application/wfs-collection-1.0',
outputFormat: 'application/wfs-collection-1.0'
}), executeOptions, {headers: {'Content-Type': 'application/xml', 'Accept': `application/xml, application/wfs-collection-1.0`}});

return downloadEstimator$
.catch(() => {
throw new Error('DownloadEstimatorException');
})
.mergeMap((estimatorResult = []) => {
if (estimatorResult.length > 0 && estimatorResult[0].identifier === 'result' && estimatorResult[0].data === 'true') {
if (downloadOptions.notifyDownloadEstimatorSuccess) {
return Observable.of('DownloadEstimatorSuccess').concat(executeProcess$);
}
return executeProcess$;
}

throw new Error('DownloadEstimatorFailed');
})
.mergeMap((result) => {
if (result === 'DownloadEstimatorSuccess') {
return Observable.of('DownloadEstimatorSuccess');
}
if (result && result?.length === 1) {
return executeProcess(url, queryXML({
...omit(downloadOptions, 'notifyDownloadEstimatorSuccess'),
input: result[0],
filter: null,
outputAsReference: downloadOptions.asynchronous ? downloadOptions.outputAsReference : false,
resultOutput
}), executeOptions, {
headers: {
'Content-Type': 'application/xml',
'Accept': `application/xml, ${resultOutput}`
}
});
}

throw new Error('DownloadFailed');
});
}

return Observable.empty();
};