Skip to content

UI/DataTable: Actions may open Prompt directly - #7809

Closed
nhaagen wants to merge 1 commit into
ILIAS-eLearning:trunkfrom
nhaagen:10/UI/DataTable/Dialog
Closed

nhaagen wants to merge 1 commit into
ILIAS-eLearning:trunkfrom
nhaagen:10/UI/DataTable/Dialog

Conversation

@nhaagen

@nhaagen nhaagen commented Jul 16, 2024 •

Copy link
Copy Markdown
Contributor

following #7045, this adds Prompts to DataTable's Actions.

@nhaagen

nhaagen commented Oct 23, 2024 •

Copy link
Copy Markdown
Contributor Author

this PR includes #7045

@nhaagen nhaagen changed the title UI/DataTable: Actions may open Dialog UI/DataTable: Actions may open Prompt directly Oct 23, 2024
@Amstutz Amstutz self-assigned this Oct 24, 2024
@nhaagen
nhaagen force-pushed the 10/UI/DataTable/Dialog branch 3 times, most recently from 8cf0945 to acec51b Compare October 24, 2024 09:55
@Amstutz Amstutz removed their assignment Nov 14, 2024
@nhaagen
nhaagen force-pushed the 10/UI/DataTable/Dialog branch from acec51b to e08e7c3 Compare January 13, 2025 08:47
@nhaagen
nhaagen force-pushed the 10/UI/DataTable/Dialog branch 2 times, most recently from 6b1d234 to f323458 Compare January 21, 2025 12:33
@nhaagen

nhaagen commented Jan 21, 2025

Copy link
Copy Markdown
Contributor Author

There is a change in the interface of Prompt - it now is constructed with an URLBuilder instead of an URI.
This allows us to add parameters to an otherwise fixed URL.
A Prompt should always point to its endpoint; with its use in the table, it is not economical to add a new Prompt for every
action per row. So, with this change, we can still use distinct prompts to perform actions and add a parameter, in this case the row-id.

@nhaagen
nhaagen force-pushed the 10/UI/DataTable/Dialog branch from f323458 to afcc997 Compare January 21, 2025 13:19
@klees klees assigned thibsy and unassigned klees Jan 24, 2025
@klees

klees commented Jan 24, 2025

Copy link
Copy Markdown
Contributor

Hi @thibsy and @Amstutz,

please review this!

Thanks!

@thibsy thibsy left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hi @nhaagen,

Thanks a lot for your contribution to the UI components!

About the concrete changes, please answer the following questions:

  • Async Table\Action\Action: what is the advantage of accepting a Prompt in the constructor vs. simply rendering the Prompt internally, when an action is considered async? Could we not leverage the URI parameter of Prompt::getShowSignal() to achieve the same result?

Kind regards,

@Amstutz and @thibsy

@nhaagen

nhaagen commented Jan 28, 2025

Copy link
Copy Markdown
Contributor Author

Hi @Amstutz & @thibsy ,

we actually do render a single default prompt as template and alter its target in the JS.

The reason for using a template is obvious: rendering a prompt for every action and row is way too much.

The construction of an action with prompt actually strengthens the prompt's semantic:

A Prompt points to an endpoint, usually a component, and thus "lives" in the component's domain.
It requires one or many states as a counterpart, and probably some action in between.
Constructing the prompt with a populated URLBuilder from that domain pins the prompt to its component with all needed params in the url - as we feel is the correct way of using a prompt.

There still is need for a "moving" parameter in order to point to the record(s), and that's provided via a token for that exact prompt/URLBuilder.

E.g., we might then write code like this at the component:

function getUserRemovalPrompt(): array
{
	//[....]
	return [$prompt, $token];
}

and use it in the table like this:

$f->table()->action()->multi('remove user', ...$component->getUserRemovalPrompt());

Best regards,
Nils

@thibsy thibsy left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hi @nhaagen,

Thx for the explanation and sorry for the delay here.

When reviewing this PR I had a hard time to understand why we need a C\Prompt\Prompt in order to create a C\Table\Action\Action. If I understand correctly, the prompt will only be used to communicate to the action that it should be called asynchronously (by using the prompt template for C\Table\Data). The rest of the prompt is simply discarded. IMO we should either fully embrace the prompt and make the action a composite UI component, which actually renders every prompt, or we should leave the action as it is because we already have a way to determine if its asynchronous - and the prompt would then be misleading.

Rendering the internal prompt inside the I\Table\Renderer is also problematic at the moment, because you rely on the request being provided, which is not always the case. Embracing the prompt in actions would solve this problem while consumers would also benefit, because they could respond to the prompts signals this way.

Let me know how you want to proceed.

Kind regards,
@thibsy

@thibsy

thibsy commented Apr 1, 2025

Copy link
Copy Markdown
Contributor

@nhaagen I assign this back to you. Feel free to reassign once we can proceed.

@thibsy thibsy assigned nhaagen and unassigned thibsy Apr 1, 2025
@oliversamoila

Copy link
Copy Markdown
Contributor

Hello @nhaagen,
can you give me a status and outlook on this PR?
UI changes of all old tables in LOM Editor are waiting for it.
Many thanks to you

@nhaagen
nhaagen force-pushed the 10/UI/DataTable/Dialog branch 3 times, most recently from 66268de to d9582df Compare October 2, 2025 08:43
@thibsy

thibsy commented Oct 6, 2025

Copy link
Copy Markdown
Contributor

@nhaagen is this ready for review?

@thibsy thibsy self-assigned this Oct 6, 2025
@klees

klees commented Oct 9, 2025

Copy link
Copy Markdown
Contributor

Hello everyone,

I have discussed this with @thibsy today, and I think I now understood. The core of the question is: We already have a Prompt in the Action, and Actions using Prompts (instead of URLBuilders) would be the desired state of the art there. Instead of fully embracing this, we instead deconstruct the Prompt into a URLBuilder (which might discard information at some point) only to reconstruct a Prompt later on. We should turn this the other way round: Make Prompt the real content of the Action (instead of URLBuilder) and bend the deprecated URLBuilder variant to that form.

The symptom of this is

protected URLBuilder | Prompt $url_builder,

in the constructor of Action. This should rather be:

protected Prompt |  URLBuilder  $prompt,

as this is what we actually want to have.

This makes a lot of sense to me and I kindly ask @nhaagen to adjust the code accordingly. I also expect that the code might become smaller and simpler then...

Kind regards!

@nhaagen
nhaagen force-pushed the 10/UI/DataTable/Dialog branch 2 times, most recently from d5f4743 to e04fa35 Compare October 14, 2025 12:45
@nhaagen

nhaagen commented Oct 14, 2025

Copy link
Copy Markdown
Contributor Author

Actions may now be constructed with Prompt and URLBuilder; withAsync (and the according Modals) have fallen.
All Prompts added via Actions are rendered (not per row, but per action) and triggered with their respective signals.

@thibsy thibsy left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thx a lot @nhaagen for fully embracing the prompt. This looks a lot more straightforward IMO =).

However, you remove the withAsync() option completely now, which leaves a lot of usages not attended to in the latest trunk. I approve of the changes but cannot merge this until usages are either amended or the option is added as a transitional measure again (with deprecation). Therefore, please

  • Action::withAsync(): either amend all current usages of this method or introduce it again as a transitional measure.
  • Conflicts: rebase this onto the latest trunk

Kind regards,
@thibsy

@nhaagen

nhaagen commented Oct 28, 2025 •

Copy link
Copy Markdown
Contributor Author

I was so sure I saw a deprecation-note for 11 on withAsync - but that was probably from myself in a former version of this 🫣
a342df8#diff-2722f6d106071a286e67cbaa30002f18c4b83c5675194c206d2fe98ea703ce33R71-R73

@nhaagen
nhaagen force-pushed the 10/UI/DataTable/Dialog branch 2 times, most recently from d7037c6 to ce6baea Compare October 29, 2025 13:59
@nhaagen

nhaagen commented Oct 29, 2025

Copy link
Copy Markdown
Contributor Author
  • Action::withAsync(): either amend all current usages of this method or introduce it again as a transitional measure.
  • Conflicts: rebase this onto the latest trunk

 - Prompt is constructed with URLBuilder
 - Actions may be constructed with Prompts
 - deprecate async (modal) Actions, make Prompt standard
@nhaagen
nhaagen force-pushed the 10/UI/DataTable/Dialog branch from ce6baea to 7458c5b Compare November 25, 2025 08:25
@dsstrassner dsstrassner assigned oliversamoila and unassigned nhaagen Dec 29, 2025
@dsstrassner

Copy link
Copy Markdown
Contributor

Hi @oliversamoila, I think you should discuss with @thibsy how to proceed in the future with this PR 🙈

@BettyFromHH BettyFromHH added the css/html Pull requests that propose changes to CSS/SCSS or HTML files. label Jan 21, 2026
@thibsy

thibsy commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

Superseded by #12389

@thibsy thibsy closed this Nov 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

css/html Pull requests that propose changes to CSS/SCSS or HTML files. improvement kitchen sink

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants