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

Slb/ab/map layer object selection #17

Closed
wants to merge 35 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
3e05d12
404 reponse, if embedding target do not match the embeded target type
AndreasWBartels Jan 29, 2024
0c7ccb2
Added set selection method, to select objects of a map layer by objec…
AndreasWBartels Jan 30, 2024
7649456
Added add and remove methods, to change set of selected objects of a …
AndreasWBartels Feb 9, 2024
7acda28
housekeeping; combine selectObjects examples into one
jkissel Feb 9, 2024
e428556
improve docs for fetchData and downloadData
jkissel Feb 9, 2024
1eaaafd
format string values in the API docs consistently
jkissel Feb 9, 2024
14bfeb2
added docs for how to define the ExternalLinkKey
jkissel Feb 9, 2024
a4cd933
remove supposedly unused types
jkissel Feb 13, 2024
ebff610
improve documentation of the EmbeddingTargetId type
jkissel Feb 13, 2024
ab99f44
removed unused variables
jkissel Feb 13, 2024
0648a89
Extend selectObjects with 'selectObjects:info' event
klinakerdisy Feb 15, 2024
6959725
maintain alphabetic order
jkissel Feb 15, 2024
9d141c0
CADENZA-35393 [Cadenza API] Show and Hide Layers in Embedded Map
Feb 9, 2024
7843ad7
group actions in sandbox for better overview
jkissel Feb 15, 2024
adc09a6
improve input of layer path in sandbox
jkissel Feb 15, 2024
88421b4
simplify setLayerVisibility docs
jkissel Feb 15, 2024
8bde324
accept simple print names to identify layers
jkissel Feb 16, 2024
e9b956a
fix data type assertions
jkissel Feb 16, 2024
6c8cd27
ensure that parallel requests do not interfere
jkissel Feb 16, 2024
5d067e2
assert iframe visibility
jkissel Feb 16, 2024
38a6868
CADENZA-35430 numeric filter variables description
tsmoljo Feb 19, 2024
1559445
add comment to CadenzaClient#postRequest
jkissel Feb 19, 2024
2a6d384
add test for iframe visibility assertion
jkissel Feb 19, 2024
27230ce
fix casing of the type name
jkissel Feb 19, 2024
8fd0bd4
add tests for #postRequest
jkissel Feb 19, 2024
df48fb7
add OpaqueString type and use it with EmbeddingTargetId and GlobalId
jkissel Feb 20, 2024
bb0aecd
revert accidentally commented-out code
jkissel Feb 20, 2024
4962ccc
add visible hint to webApplication option
jkissel Feb 20, 2024
f8cb30a
update changelog
jkissel Feb 20, 2024
20a5518
add getData method to get map image (#19)
jpalys Feb 21, 2024
54aef91
improve order of sandbox actions and examples in the docs
jkissel Feb 21, 2024
7fdc276
handle targetType in createParams
jkissel Feb 21, 2024
8f38b7f
improve docs of #setSelection, #addSelection, #removeSelection
jkissel Feb 21, 2024
36e53dd
sandbox: add common-layer and common-layer-selection templates
jkissel Feb 21, 2024
efa51f9
update CHANGELOG
jkissel Feb 21, 2024
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
39 changes: 39 additions & 0 deletions sandbox.html
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,9 @@
createGeometry: data => cadenzaClient.createGeometry(data.embeddingTargetId, data.geometryType, getOptions(data)),
editGeometry: ({ geometry, ...data }) => cadenzaClient.editGeometry(data.embeddingTargetId, JSON.parse(geometry), getOptions(data)),
selectObjects: data => cadenzaClient.selectObjects(data.embeddingTargetId, getOptions(data)),
setSelection: data => cadenzaClient.setSelection(JSON.parse(data.layerPath), JSON.parse(data.values)),
addSelection: data => cadenzaClient.addSelection(JSON.parse(data.layerPath), JSON.parse(data.values)),
removeSelection: data => cadenzaClient.removeSelection(JSON.parse(data.layerPath), JSON.parse(data.values)),
fetchData: data => {
console.log('Inspect the fetchData() request in the devtools.');
cadenzaClient.fetchData(data.embeddingTargetId, data.dataType, getOptions(data));
Expand Down Expand Up @@ -240,6 +243,9 @@
<option value="createGeometry">Create Geometry</option>
<option value="editGeometry">Edit Geometry</option>
<option value="selectObjects">Select Objects</option>
<option value="setSelection">Set Selection</option>
<option value="addSelection">Add Selection</option>
<option value="removeSelection">Remove Selection</option>
<option value="downloadData">Download data</option>
<option value="fetchData">Fetch data</option>
</select>
Expand Down Expand Up @@ -457,6 +463,39 @@
</div>
</template>

<template data-action="setSelection">
jkissel marked this conversation as resolved.
Show resolved Hide resolved
<div>
<label for="layerPath">Path to the dataview layer * (JSON Array)</label>
<textarea name="layerPath" id="layerPath" rows="5" required></textarea>
</div>
<div>
<label for="values">List of Object identifiers * (JSON Array)</label>
<textarea name="values" id="values" rows="5" required></textarea>
</div>
</template>

<template data-action="addSelection">
<div>
<label for="layerPath">Path to the dataview layer * (JSON Array)</label>
<textarea name="layerPath" id="layerPath" rows="5" required></textarea>
</div>
<div>
<label for="values">List of Object identifiers * (JSON Array)</label>
<textarea name="values" id="values" rows="5" required></textarea>
</div>
</template>

<template data-action="removeSelection">
<div>
<label for="layerPath">Path to the dataview layer * (JSON Array)</label>
<textarea name="layerPath" id="layerPath" rows="5" required></textarea>
</div>
<div>
<label for="values">List of Object identifiers * (JSON Array)</label>
<textarea name="values" id="values" rows="5" required></textarea>
</div>
</template>

<template data-action="downloadData" data-common="data">
<div>
<label for="embeddingTargetId">Embedding target ID *</label>
Expand Down
46 changes: 46 additions & 0 deletions src/cadenza.js
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@ export class CadenzaClient {
operationMode,
useMapSrs,
});
params.append('targetType', 'MAP');
jkissel marked this conversation as resolved.
Show resolved Hide resolved
await this.#show(resolvePath(mapView), params, signal);
if (geometry) {
this.#postEvent('setGeometry', { geometry });
Expand Down Expand Up @@ -327,6 +328,51 @@ export class CadenzaClient {
return this.#postRequest('setFilter', { filter });
}

/**
* Set Selection in the currently shown map view.
*
* @param {WorkbookLayerPath} layer - The data view layer to set the selection in
* @param {string[]} values - The variable values
Copy link
Member

@jkissel jkissel Feb 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

string[] works for the layer selection. But to set the selection of a table view, we'd need unknown[][], right? How do would you handle that later? Automatically transform string[] to unknown[][]?

* @return {Promise<void>} A 'Promise' for when the selection was set.
*/
setSelection(
/** @type WorkbookLayerPath */ layer,
/** @type string[] */ values,
jkissel marked this conversation as resolved.
Show resolved Hide resolved
) {
this.#log('CadenzaClient#setSelection', layer, values);
return this.#postRequest('setSelection', { layer, values });
}

/**
* Add Selection in the currently shown map view.
*
* @param {WorkbookLayerPath} layer - The data view layer to add the selection in
* @param {string[]} values - The variable values
* @return {Promise<void>} A 'Promise' for when the selection was added.
*/
addSelection(
/** @type WorkbookLayerPath */ layer,
/** @type string[] */ values,
) {
this.#log('CadenzaClient#addSelection', layer, values);
return this.#postRequest('addSelection', { layer, values });
}

/**
* Remove Selection in the currently shown map view.
jkissel marked this conversation as resolved.
Show resolved Hide resolved
*
* @param {WorkbookLayerPath} layer - The data view layer to remove the selection from
* @param {string[]} values - The variable values
* @return {Promise<void>} A 'Promise' for when the selection was removed.
*/
removeSelection(
/** @type WorkbookLayerPath */ layer,
/** @type string[] */ values,
) {
this.#log('CadenzaClient#removeSelection', layer, values);
return this.#postRequest('removeSelection', { layer, values });
Copy link
Member

@jkissel jkissel Feb 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it maybe make our life in Cadenza easier if we used only one event with a mode?: 'add' | 'remove'? (The API here is fine 👍)

}

/**
* Create a geometry.
*
Expand Down
1 change: 1 addition & 0 deletions src/docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ cadenzaClient.show('{embeddingTargetId}', {
});
```

- The embedded target id can be defined for an open "workbook" in the menu under "more -> Manage workbook -> Embeddeding"
jkissel marked this conversation as resolved.
Show resolved Hide resolved
- If the embedding target cannot be resolved, a 404 page is shown to the user.
- Cadenza JS does not handle user authentication: If the user is not already logged in, the normal authentication flow of Cadenza will run. By default, the login page would be shown to the user.

Expand Down
Loading