From 522c94f2bbdc639b3fa7a5d7f479d483431cd1ed Mon Sep 17 00:00:00 2001 From: Nick Jakuschona Date: Wed, 11 Sep 2024 16:25:05 +0200 Subject: [PATCH 1/2] if types available also resolve typeIdField --- src/main/js/bundles/dn_querybuilder/MetadataAnalyzer.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/js/bundles/dn_querybuilder/MetadataAnalyzer.js b/src/main/js/bundles/dn_querybuilder/MetadataAnalyzer.js index 74aaefc..166eca9 100644 --- a/src/main/js/bundles/dn_querybuilder/MetadataAnalyzer.js +++ b/src/main/js/bundles/dn_querybuilder/MetadataAnalyzer.js @@ -52,6 +52,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; From 63fe5aee0fa0421a6e893b9ce1f5988fb8b853c4 Mon Sep 17 00:00:00 2001 From: Nick Jakuschona Date: Wed, 11 Sep 2024 16:26:35 +0200 Subject: [PATCH 2/2] Replace apprt-request with apprt-fetch --- .../bundles/dn_querybuilder-config/FieldWidget.js | 9 +++------ .../js/bundles/dn_querybuilder/MetadataAnalyzer.js | 14 +++++--------- 2 files changed, 8 insertions(+), 15 deletions(-) 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 166eca9..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 { @@ -181,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) => { @@ -238,12 +235,11 @@ export default class MetadataAnalyzer { } queryMetadata(url) { - return apprt_request(url, + return apprtFetchJson(url, { query: { f: 'json' - }, - handleAs: 'json' + } }); } }