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

Show Name of typeIdField instea of code #77

Merged
merged 2 commits into from
Sep 30, 2024
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
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'
}
});
}
}
Loading