Skip to content

Commit

Permalink
Merge pull request #77 from conterra/resolve-types
Browse files Browse the repository at this point in the history
Show Name of typeIdField instea of code
  • Loading branch information
matthiasstein authored Sep 30, 2024
2 parents 2c5c614 + 63fe5ae commit 17c692d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
9 changes: 3 additions & 6 deletions src/main/js/bundles/dn_querybuilder-config/FieldWidget.js
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -592,12 +590,11 @@ export default declare([_WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin, _
},

queryMetadata(url) {
return apprt_request(url,
return apprtFetchJson(url,
{
query: {
f: 'json'
},
handleAs: 'json'
}
});
}
});
21 changes: 12 additions & 9 deletions src/main/js/bundles/dn_querybuilder/MetadataAnalyzer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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) => {
Expand Down Expand Up @@ -231,12 +235,11 @@ export default class MetadataAnalyzer {
}

queryMetadata(url) {
return apprt_request(url,
return apprtFetchJson(url,
{
query: {
f: 'json'
},
handleAs: 'json'
}
});
}
}

0 comments on commit 17c692d

Please sign in to comment.