Skip to content

feat(yasr): add in-session query result history navigation - #177

Merged
MathiasVDA merged 8 commits into
mainfrom
copilot/matdata-eu-98-history-query-results
Sep 12, 2026
Merged

MathiasVDA merged 8 commits into
mainfrom
copilot/matdata-eu-98-history-query-results

Conversation

Copilot AI commented Sep 12, 2026

Copy link
Copy Markdown

Yasr had no way to revisit previous query results within a session — each new response overwrote the last.

Changes

packages/yasr/src/index.ts

  • Maintains an in-memory history stack (resultHistory, capped at 20 entries) of raw response data per Yasr instance
  • setResponse truncates forward history on new queries, pushes the new entry, and updates navigation state
  • drawHistoryButtons() renders back/forward chevron buttons (fa-chevron-left / fa-chevron-right) in the header between the plugin controls and the download icon — created once, guarded against re-creation on subsequent draw() calls
  • navigateHistory(direction) replays a history entry by reinstantiating Parser and calling draw()
  • Buttons use the native disabled attribute (not a CSS class) for correct focus/keyboard/AT behaviour

packages/yasr/src/main.scss

  • Adds .yasr_btn_history styles with [disabled]-aware hover suppression

Behaviour

setResponse(r1) → history: [r1],  index: 0  — ◀ disabled, ▶ disabled
setResponse(r2) → history: [r1, r2], index: 1  — ◀ enabled,  ▶ disabled
click ◀         → history: [r1, r2], index: 0  — ◀ disabled, ▶ enabled
setResponse(r3) → history: [r1, r3], index: 1  — forward history truncated

History is in-memory only and does not persist across page reloads.

Copilot AI linked an issue Sep 12, 2026 that may be closed by this pull request
- Add back/forward chevron buttons to the Yasr header (between plugin
  controls and the download icon) so users can navigate through previous
  results within the same session
- Each setResponse call pushes the result onto an in-memory history stack
  (capped at 20 entries to prevent unbounded memory growth)
- Sending a new response truncates any forward history
- Buttons use the native disabled attribute for accessibility
- SCSS styles for the new history buttons; restore fullscreen button styles
Copilot AI changed the title [WIP] Add history functionality for query results in session feat(yasr): add in-session query result history navigation Sep 12, 2026
Copilot AI requested a review from MathiasVDA September 12, 2026 14:56
MathiasVDA and others added 4 commits September 12, 2026 17:59
…shes (#175)

* Initial plan

* fix: persist horizontal/vertical orientation across page refreshes

* fix: add JSDoc comments to getOrientation/setOrientation

* Improve getOrientation method implementation

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Mathias Vanden Auweele <mathias@matdata.eu>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…end the result (fixes #176)

* Initial plan

* feat: Ctrl+Click URI in response plugin runs DESCRIBE and appends result

* refactor: surface DESCRIBE failures in response view and tighten typing

* refactor: reuse showMore for revealing appended DESCRIBE content

* feat: don't describe but retrieve all triples where uri is subject of

* docs: also the docker image has been renamed

* chore: update prefixes

* fix: persist horizontal/vertical layout orientation across page refreshes (#175)

* Initial plan

* fix: persist horizontal/vertical orientation across page refreshes

* fix: add JSDoc comments to getOrientation/setOrientation

* Improve getOrientation method implementation

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Mathias Vanden Auweele <mathias@matdata.eu>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* Fix offset condition in extractUriAtOffset function

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* Modify loading behavior in describeUri method

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Mathias Vanden Auweele <mathias@matdata.eu>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@MathiasVDA
MathiasVDA marked this pull request as ready for review September 12, 2026 16:01
@MathiasVDA
MathiasVDA requested a lite review from Copilot September 12, 2026 16:01

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

There is a confirmed functional mismatch that will fail unit tests (DESCRIBE builder returns a CONSTRUCT query) plus additional correctness/maintainability concerns in the changed code.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

This PR extends the Matgui SPARQL result viewing experience by adding in-session navigation of previous Yasr results, and introduces a “Ctrl/Cmd+Click URI to run DESCRIBE” workflow in the Response plugin. It also includes some additional UI persistence and documentation/link updates.

Changes:

  • Add an in-memory back/forward result history stack to Yasr, with header navigation buttons.
  • Add Response plugin URI utilities + Ctrl/Cmd+Click behavior to execute a DESCRIBE and append returned triples; includes new unit tests.
  • Persist Yasgui layout orientation and update Docker Hub/documentation links.
File summaries
File Description
website/docusaurus.config.ts Updates Docker Hub link to the matgui image.
test/unit/response-uri-utils-test.ts Adds unit tests for URI extraction and DESCRIBE query building.
README.md Updates Docker Hub URLs and docker run examples to mathiasvda/matgui.
packages/yasr/src/plugins/response/uriUtils.ts Adds testable helpers for extracting URIs and building a DESCRIBE query.
packages/yasr/src/plugins/response/index.ts Adds Ctrl/Cmd+Click handling to run a DESCRIBE query and append results to the response view.
packages/yasr/src/main.scss Styles new Yasr history navigation buttons with disabled-aware hover behavior.
packages/yasr/src/index.ts Implements Yasr result history stack + back/forward navigation buttons.
packages/yasqe/src/prefixes.json Reorders/adds prefixes (data update).
packages/yasgui/src/Tab.ts Persists orientation changes when toggling layout.
packages/yasgui/src/PersistentConfig.ts Adds getters/setters for persisted orientation (and stores it).
packages/yasgui/src/index.ts Loads persisted orientation at startup.
docs/user-guide.md Updates Docker commands and documents the new Ctrl/Cmd+Click DESCRIBE behavior in the Response plugin.
Review details
  • Files reviewed: 12/12 changed files
  • Comments generated: 4
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread packages/yasr/src/plugins/response/uriUtils.ts
Comment on lines +159 to +163
const query = buildDescribeQuery(uri);
try {
this.yasr.showLoading();
const response = await this.yasr.executeQuery(query, { acceptHeader: this.getDescribeAcceptHeader() });
if (this.cm !== cmAtStart) return;
Comment thread packages/yasgui/src/PersistentConfig.ts Outdated
Comment thread packages/yasgui/src/Tab.ts
MathiasVDA and others added 2 commits September 12, 2026 18:13
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@MathiasVDA
MathiasVDA merged commit 4963687 into main Sep 12, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

History of query results

3 participants