Skip to content

Conversation

@tcrundall-tng
Copy link
Contributor

Extend SimpleButtonWidget to be disable-able via a StateProvider

This is important to prevent long running actions from being triggered multiple times.

@PaulBrnrther contributed the functional code
@tcrundall-tng contributed the example implementation

Copilot AI review requested due to automatic review settings January 27, 2026 19:19
@tcrundall-tng tcrundall-tng requested a review from a team as a code owner January 27, 2026 19:19
@tcrundall-tng tcrundall-tng requested review from knime-ghub-bot and removed request for a team January 27, 2026 19:19
@tcrundall-tng tcrundall-tng changed the title Enh/UI ext 3206 webui migration sdf reader UIEXT-3206: SimpleButtonWidget to be disable-able via a StateProvider Jan 27, 2026
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR extends the SimpleButtonWidget to support being disabled via a StateProvider, preventing long-running actions from being triggered multiple times. The implementation adds a runFinishedProvider parameter that re-enables buttons once their actions complete.

Changes:

  • Added runFinishedProvider parameter to SimpleButtonWidget annotation for controlling button enable/disable state
  • Integrated the new provider into the UI schema generation and state provider registration
  • Provided a comprehensive example implementation (ExampleCancelableButton) demonstrating cancelable long-running actions

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
SimpleButtonWidget.java Added runFinishedProvider parameter to the annotation
WidgetTreesToRefsAndStateProviders.java Registered the new runFinishedProvider as a UI state provider
UiSchemaOptionsGenerator.java Added logic to include the provider in UI schema options when specified
JsonFormsConsts.java Added TAG_RUN_FINISHED constant for the frontend integration
ExampleCancelableButton.java Complete example implementation of a cancelable button with UUID-based state management

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 261 to 266
synchronized (threadPerNode) {
Optional.ofNullable(threadPerNode.get(nodeID)).ifPresent(thread -> {
thread.interrupt();
threadPerNode.remove(nodeID);
});
}
Copy link

Copilot AI Jan 27, 2026

Choose a reason for hiding this comment

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

Nested synchronization on the same object threadPerNode creates redundant locking. The outer synchronized block at line 258 already locks this object, making the inner synchronized block at line 261 unnecessary and potentially confusing.

Suggested change
synchronized (threadPerNode) {
Optional.ofNullable(threadPerNode.get(nodeID)).ifPresent(thread -> {
thread.interrupt();
threadPerNode.remove(nodeID);
});
}
Optional.ofNullable(threadPerNode.get(nodeID)).ifPresent(thread -> {
thread.interrupt();
threadPerNode.remove(nodeID);
});

Copilot uses AI. Check for mistakes.
Comment on lines +84 to +87
* re-enabled once the provider provides a new uuid.
*
* @return provide a unique uuid once the button action has finished which lets frontend know the button can be
* re-enabled
Copy link

Copilot AI Jan 27, 2026

Choose a reason for hiding this comment

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

The documentation states the provider should return a 'unique uuid', but any value change would trigger re-enablement. Consider clarifying that the provider returns a String value that changes when the action completes, rather than specifically requiring a UUID format.

Suggested change
* re-enabled once the provider provides a new uuid.
*
* @return provide a unique uuid once the button action has finished which lets frontend know the button can be
* re-enabled
* re-enabled once the provider returns a new value.
*
* @return a {@link String} token whose value changes once the button action has finished, informing the frontend
* that the button can be re-enabled

Copilot uses AI. Check for mistakes.
@tcrundall-tng tcrundall-tng force-pushed the enh/UIEXT-3206-webui-migration-sdf-reader branch from 692ab0b to c6dc6bb Compare January 27, 2026 19:25
@sonarqubecloud
Copy link

sonarqubecloud bot commented Jan 27, 2026

Quality Gate Failed Quality Gate failed

Failed conditions
77.8% Coverage on New Code (required ≥ 85%)
C Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@tcrundall-tng tcrundall-tng force-pushed the enh/UIEXT-3206-webui-migration-sdf-reader branch from c6dc6bb to 78b30b5 Compare January 27, 2026 19:51
Copilot AI review requested due to automatic review settings January 27, 2026 19:51
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

This is a precursor to allowing frontend button to be disabled on click
until the action has finished.

UIEXT-3206 (WebUI-Migration SDF Reader)
@tcrundall-tng tcrundall-tng force-pushed the enh/UIEXT-3206-webui-migration-sdf-reader branch from 78b30b5 to 853f416 Compare January 28, 2026 08:40
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.

2 participants