Skip to content

Commit 0ff7fe3

Browse files
authored
Merge pull request #92 from conterra/dev_tempstore_useins
Add useins to tempstore config and add documentation
2 parents fad121c + 52d764f commit 0ff7fe3

File tree

5 files changed

+31
-19
lines changed

5 files changed

+31
-19
lines changed

src/main/js/apps/sample/app.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
"defaultLinkOperator": "$or",
4444
"defaultSpatialRelation": "everywhere",
4545
"useCurrentMapExtent": false,
46+
"enableTempStore": false,
4647
"visibleElements": {
4748
"defaultMode": {
4849
"spatialRelation": true,

src/main/js/bundles/dn_querybuilder/QueryBuilderWidgetModel.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ export default declare({
8080
"shape"
8181
],
8282
enableTempStore: false,
83+
tempStoreUseIn: ["querybuilder"],
8384
replaceOpenedTables: false,
8485
metadataQuery: null,
8586
metadataDelay: 500,

src/main/js/bundles/dn_querybuilder/QueryController.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ export default class QueryController {
9090
if (res && totalInQuery || res.total) {
9191

9292
// close widget on query
93-
if(queryBuilderWidgetModel.closeOnQuery){
93+
if (queryBuilderWidgetModel.closeOnQuery) {
9494
this._queryBuilderToggleTool.set("active", false);
9595
}
9696

@@ -107,7 +107,9 @@ export default class QueryController {
107107
return;
108108
} else {
109109
if (queryBuilderWidgetModel.enableTempStore) {
110-
this._registerTempStore(store, complexQuery, queryBuilderWidgetModel);
110+
this._registerTempStore(
111+
store, complexQuery, queryBuilderWidgetModel, queryBuilderWidgetModel?.tempStoreUseIn
112+
);
111113
}
112114

113115
// result-ui
@@ -230,7 +232,7 @@ export default class QueryController {
230232
});
231233
}
232234

233-
async _registerTempStore(store, complexQuery, queryBuilderWidgetModel) {
235+
async _registerTempStore(store, complexQuery, queryBuilderWidgetModel, useIn) {
234236
let tempStore;
235237
if (store.url) {
236238
tempStore = await this._agsStoreFactory.createStore({
@@ -244,6 +246,9 @@ export default class QueryController {
244246
layerId: store.layerId
245247
});
246248
}
249+
if(useIn?.includes("selection")) {
250+
tempStore?.load();
251+
}
247252
const filter = new Filter(tempStore, complexQuery);
248253
const storeTitle = queryBuilderWidgetModel.getSelectedStoreTitle(store.id);
249254
if (this.#serviceRegistration) {
@@ -259,7 +264,7 @@ export default class QueryController {
259264
const serviceProperties = {
260265
id: "querybuilder_temp",
261266
title: title,
262-
useIn: ["querybuilder"]
267+
useIn: useIn || ["querybuilder"]
263268
};
264269
const interfaces = ["ct.api.Store"];
265270
this.#serviceRegistration = this.#bundleContext.registerService(interfaces, filter, serviceProperties);

src/main/js/bundles/dn_querybuilder/README.md

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ The Query Builder uses the Complex Query Language: [https://docs.conterra.de/en/
1717
To make the functions of this bundle available to the user, the following tool can be added to a toolset:
1818

1919
| Tool ID | Component | Description |
20-
| ---------------------- | ---------------------- | ------------------------ |
20+
|------------------------|------------------------|--------------------------|
2121
| queryBuilderToggleTool | QueryBuilderToggleTool | Show or hide the widget. |
2222

2323
Use a toolset:
@@ -149,6 +149,8 @@ To use a store with the Query Builder bundle, add the value _querybuilder_ to th
149149
"*"
150150
],
151151
"allowMultipleSpatialInputs": true,
152+
"enableTempStore": true,
153+
"tempStoreUseIn": ["querybuilder"],
152154
"visibleElements": {
153155
"defaultMode": {
154156
"spatialRelation": true,
@@ -271,19 +273,21 @@ To use a store with the Query Builder bundle, add the value _querybuilder_ to th
271273
}
272274
```
273275

274-
| Property | Type | Possible Values | Default | Description |
275-
|----------------------------------|---------|---------------------------------------------------------|------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------|
276-
| enableDistinctValues | Boolean | ```true``` | ```false``` | ```true``` | Distinct values are queried by the service. |
277-
| enableInitialDistinctValues | Boolean | ```true``` | ```false``` | ```true``` | Distinct values are queried after a new field was selected. |
278-
| defaultLinkOperator | String | ```or``` | ```and``` | ```or``` | Defines the default link operator. |
279-
| defaultSpatialRelation | String | ```everywhere``` | ```current_extent``` | ```everywhere``` | Defines the default spatial relation. |
280-
| useCurrentMapExtent | Boolean | ```true``` | ```false``` | ```false``` | Use the current user extent to filter predefined queries. |
281-
| availableSpatialInputActions | Array | ```point``` | ```rectangle``` | ```polygon``` | ```["*"]``` | IDs of allowed spatial input actions. More actions are available in the selection-actions bundle: https://github.com/conterra/mapapps-selection-actions |
282-
| allowMultipleSpatialInputs | Boolean | ```true``` | ```false``` | ```true``` | Allow multiple selection of geometries via the selection actions. |
283-
| visibleElements | Object | | | Select visible elements in default mode, predefined mode and filter mode. |
284-
| hiddenFields | Array | | ```[]``` | Names of fields that should be hidden in the field select |
285-
| hiddenSortFields | Array | | ```[]``` | Names of fields that should be hidden in the sort field select |
286-
| symbols | Object | | | Symbols that will be used for the presentation of geometries that are selected via the spatial input actions. |
276+
| Property | Type | Possible Values | Default | Description |
277+
|------------------------------|---------|---------------------------------------------------------|------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------|
278+
| enableDistinctValues | Boolean | ```true``` | ```false``` | ```true``` | Distinct values are queried by the service. |
279+
| enableInitialDistinctValues | Boolean | ```true``` | ```false``` | ```true``` | Distinct values are queried after a new field was selected. |
280+
| defaultLinkOperator | String | ```or``` | ```and``` | ```or``` | Defines the default link operator. |
281+
| defaultSpatialRelation | String | ```everywhere``` | ```current_extent``` | ```everywhere``` | Defines the default spatial relation. |
282+
| useCurrentMapExtent | Boolean | ```true``` | ```false``` | ```false``` | Use the current user extent to filter predefined queries. |
283+
| availableSpatialInputActions | Array | ```point``` | ```rectangle``` | ```polygon``` | ```["*"]``` | IDs of allowed spatial input actions. More actions are available in the selection-actions bundle: https://github.com/conterra/mapapps-selection-actions |
284+
| allowMultipleSpatialInputs | Boolean | ```true``` | ```false``` | ```true``` | Allow multiple selection of geometries via the selection actions. |
285+
| enableTempStore | Boolean | ```true``` | ```false``` | ```true``` | Allow registration of an additional store containing the query results. |
286+
| tempStoreUseIn | Array | | ["querybuilder"] | OPTIONAL Set useins of tempstore, e.g. "selection". |
287+
| visibleElements | Object | | | Select visible elements in default mode, predefined mode and filter mode. |
288+
| hiddenFields | Array | | ```[]``` | Names of fields that should be hidden in the field select |
289+
| hiddenSortFields | Array | | ```[]``` | Names of fields that should be hidden in the sort field select |
290+
| symbols | Object | | | Symbols that will be used for the presentation of geometries that are selected via the spatial input actions. |
287291
| operators | Object | | | Specify the allowed operators when formulating a custom query. All provided information is optional; if no information is given the default will be chosen. You could also provide additional field types. Further, you can add a specific `operatorClass` to the fields and specify the operators here like: `{"operators": {default {...}, operatorClass: {...}}}`
288292

289293
### QueryTools:

src/main/js/bundles/dn_querybuilder/manifest.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,8 @@
224224
"availableSpatialInputActions": [
225225
"*"
226226
],
227+
"enableTempStore": false,
228+
"tempStoreUseIn": ["querybuilder"],
227229
"allowMultipleSpatialInputs": true,
228230
"visibleElements": {
229231
"defaultMode": {
@@ -266,7 +268,6 @@
266268
"OBJECTID",
267269
"shape"
268270
],
269-
"enableTempStore": false,
270271
"symbols": {
271272
"point": {
272273
"type": "simple-marker",

0 commit comments

Comments
 (0)