gabotorresruiz opened a new pull request, #43688:
URL: https://github.com/apache/superset/pull/43688
### SUMMARY
`get_dashboard_info` could only surface a dashboard's applied filters
through `permalink_key`.
Embedded guests cannot mint permalinks (least privilege), so the filtered
view was unreachable for them, and any caller had to persist a permalink just
to describe a dashboard as it is currently filtered.
This adds an optional `filter_state` input that feeds the same
`_apply_permalink_state` path a permalink resolves into, so a caller holding
the live filter context can describe the dashboard as the user currently sees
it, filtered, without a permalink.
`permalink_key` takes precedence when both are supplied.
The change is additive and backward compatible: existing callers are
unaffected.
#### Note on `is_permalink_state`
The response reuses the existing `filter_state` field.
Previously that field was only populated from a permalink, and
`is_permalink_state` doubled as the flag that included `filter_state` in the
default response columns.
This PR decouples the two: the direct path sets `is_permalink_state=False`
(accurate, since the state did not come from a permalink), and `filter_state`
is now included in the response whenever it is present, regardless of source.
#### Known follow ups (non blocking)
* The permalink path redacts data model metadata for callers without
metadata access; the direct path does not, since the state is the caller's own
context echoed back rather than resolved server side. Unifying redaction across
both paths is a reasonable future improvement.
* A short `filter_state` example could be added to the tool docstring (the
schema field description already carries the contract).
### TESTING INSTRUCTIONS
Unit tests:
```
pytest tests/unit_tests/mcp_service/dashboard/tool/test_dashboard_tools.py \
tests/unit_tests/mcp_service/dashboard/test_dashboard_schemas.py -q
```
* Schema: `filter_state` is accepted and defaults to `None`.
* Tool: supplying `filter_state` attaches it to the result
(`is_permalink_state=False`, `filter_state` populated); `permalink_key` takes
precedence when both are supplied.
Manual: call `get_dashboard_info` with
```json
{"identifier": 123, "filter_state": {"applied_filters": [{"col": "gender",
"op": "IN", "val": ["Female"]}]}}
```
and confirm the response includes `filter_state`, with `is_permalink_state`
false and `permalink_key` null.
### ADDITIONAL INFORMATION
- [x] Introduces new feature or API
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]