diff --git a/src/main/js/bundles/dn_querybuilder-config/FieldWidget.js b/src/main/js/bundles/dn_querybuilder-config/FieldWidget.js index 592a7a7..7e7e9f5 100644 --- a/src/main/js/bundles/dn_querybuilder-config/FieldWidget.js +++ b/src/main/js/bundles/dn_querybuilder-config/FieldWidget.js @@ -23,9 +23,7 @@ import Memory from "dojo/store/Memory"; import _Connect from "ct/_Connect"; import apprt_when from "apprt-core/when"; -import apprt_request from "apprt-request"; -// TODO: Replace apprt-request with apprt-fetch -// https://demos.conterra.de/mapapps/resources/jsregistry/root/apprt-fetch/latest/README.md +import {apprtFetchJson} from "apprt-fetch"; import ct_css from "ct/util/css"; import {executeQueryJSON} from "esri/rest/query"; @@ -592,12 +590,11 @@ export default declare([_WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin, _ }, queryMetadata(url) { - return apprt_request(url, + return apprtFetchJson(url, { query: { f: 'json' - }, - handleAs: 'json' + } }); } }); diff --git a/src/main/js/bundles/dn_querybuilder/MetadataAnalyzer.js b/src/main/js/bundles/dn_querybuilder/MetadataAnalyzer.js index 74aaefc..233ade2 100644 --- a/src/main/js/bundles/dn_querybuilder/MetadataAnalyzer.js +++ b/src/main/js/bundles/dn_querybuilder/MetadataAnalyzer.js @@ -16,9 +16,7 @@ import apprt_when from "apprt-core/when"; import Promise from "apprt-core/Promise"; import ServiceResolver from "apprt/ServiceResolver"; -import apprt_request from "apprt-request"; -// TODO: Replace apprt-request with apprt-fetch -// https://demos.conterra.de/mapapps/resources/jsregistry/root/apprt-fetch/latest/README.md +import { apprtFetchJson } from "apprt-fetch"; export default class MetadataAnalyzer { @@ -52,6 +50,13 @@ export default class MetadataAnalyzer { } } } + if(metadata.typeIdField){ + if (domainsFromTypes[metadata.typeIdField]) { + domainsFromTypes[metadata.typeIdField].push({code: type.id, name: type.name}); + } else { + domainsFromTypes[metadata.typeIdField] = [{code: type.id, name: type.name}]; + } + } }); const fields = metadata.fields; @@ -174,9 +179,8 @@ export default class MetadataAnalyzer { } else if (fieldData.type === "number") { query.where = "1=1"; } - this.#distinctValueQuery = apprt_request(store.target + "/query", { - query: query, - handleAs: 'json' + this.#distinctValueQuery = apprtFetchJson(store.target + "/query", { + query: query }).then((result) => { const distinctValues = []; result.features?.forEach((feature) => { @@ -231,12 +235,11 @@ export default class MetadataAnalyzer { } queryMetadata(url) { - return apprt_request(url, + return apprtFetchJson(url, { query: { f: 'json' - }, - handleAs: 'json' + } }); } }