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

[Nu-5490] Expand Custom Action with display policy #5491

Closed

Conversation

DeamonDev
Copy link
Contributor

Describe your changes

Checklist before merge

  • Related issue ID is placed at the beginning of PR title in [brackets] (can be GH issue or Nu Jira issue)
  • Code is cleaned from temporary changes and commented out lines
  • Parts of the code that are not easy to understand are documented in the code
  • Changes are covered by automated tests
  • Showcase in dev-application.conf added to demonstrate the feature
  • Documentation added or updated
  • Added entry in Changelog.md describing the change from the perspective of a public distribution user
  • Added MigrationGuide.md entry in the appropriate subcategory if introducing a breaking change
  • Verify that PR will be squashed during merge

@github-actions github-actions bot added client client main fe ui labels Feb 1, 2024
@DeamonDev DeamonDev self-assigned this Feb 1, 2024
@DeamonDev DeamonDev marked this pull request as draft February 1, 2024 13:10
@DeamonDev DeamonDev linked an issue Feb 1, 2024 that may be closed by this pull request
@DeamonDev DeamonDev marked this pull request as ready for review February 1, 2024 14:56
sealed trait CustomActionDisplayPolicy

// TODO: Add more
case object CurrentlyViewedProcessVersionIsDeployed extends CustomActionDisplayPolicy
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure if it is good approach. Those policies seem to be instance-specific, but each NU instance can be configured with different custom actions, different policies.

What happens when I want to add my own custom policy? E.g I want a button that is enabled when scenario diagram contains specified node. Do I need to hardcode it here and in designer/client/src/helpers/customActionDisplayabilityResolver.ts ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Answering to your very last question, the answer is yes. If such hardcoded solution cannot be taken into account, the natural improvement is to create some configuration language (implemented using yaml, json, whatever), send it thru' the backend and teach frontend to read it. And of course we should not then use selaed traits.

} ~ path("processes" / ProcessNameSegment / "lastDeployedVersionId") { processName =>
processId(processName) { processId =>
complete {
processService.getLastDeployedVersionId(processId.id)
Copy link
Member

Choose a reason for hiding this comment

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

Can we use results of processService.getLatestProcessWithDetails or processService.getProcessWithDetails instead of adding new endpoint? See ScenarioWithDetails.lastDeployedAction, there is some info on current and last deployed version.

@DeamonDev DeamonDev closed this Feb 20, 2024
@mk-software-pl mk-software-pl deleted the improvements/extend-custom-action-with-display-policy branch April 29, 2024 10:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client client main fe ui
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Expand display mechanism of Custom Actions
3 participants