Skip to content

feat: add YAML editor functionalities#1482

Closed
cnotv wants to merge 11 commits into
rancher:mainfrom
cnotv:feature/1480-yaml-missing-features
Closed

feat: add YAML editor functionalities#1482
cnotv wants to merge 11 commits into
rancher:mainfrom
cnotv:feature/1480-yaml-missing-features

Conversation

@cnotv

@cnotv cnotv commented Apr 17, 2026

Copy link
Copy Markdown
Member

Fixes #1480

NOTE: This logic is a per-case issue. There is no built-in functionality.

  • Moved initialization logic within a single function
  • Created comparison function
  • Imported existing FileDiff component, avoiding duplication in code and configuration
  • Added all the missing crossed unit tests

Views

Policy server

Kapture.2026-04-24.at.10.41.17.mp4

Cluster admission policy

Kapture.2026-04-23.at.17.20.33.mp4

Admission Policies

Kapture.2026-04-24.at.11.20.45.mp4

@cnotv cnotv changed the title feat: add missing validations for Policy create page feat: add YAML editor functionalities Apr 20, 2026
@kravciak kravciak moved this from Pending review to In Progress in Kubewarden Admission Controller Apr 20, 2026
@cnotv
cnotv force-pushed the feature/1480-yaml-missing-features branch 2 times, most recently from 1967135 to 12e119d Compare April 23, 2026 15:05
@cnotv
cnotv marked this pull request as ready for review April 23, 2026 15:21
@cnotv
cnotv force-pushed the feature/1480-yaml-missing-features branch from 12e119d to 9651ee0 Compare April 23, 2026 15:27
@cnotv
cnotv requested a review from rak-phillip April 23, 2026 15:32
@cnotv
cnotv marked this pull request as draft April 24, 2026 08:06
@cnotv

cnotv commented Apr 24, 2026

Copy link
Copy Markdown
Member Author

Set back to draft again, so I can add the functionality to every editor. Done

@cnotv
cnotv marked this pull request as ready for review April 24, 2026 09:22
@cnotv
cnotv force-pushed the feature/1480-yaml-missing-features branch 2 times, most recently from 43b922f to c84ce02 Compare April 27, 2026 07:21
@cnotv
cnotv force-pushed the feature/1480-yaml-missing-features branch from c84ce02 to 3d99959 Compare April 27, 2026 08:01

@rak-phillip rak-phillip left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think that this looks good, and I only want to double check the UX because it doesn't necessarily match Dashboard patterns for editing YAML, especially when taking into account Policy server/Cluster admission policy. The three buttons for editing the form/yaml/compare changes is usually reserved for multi-step wizards in Dashboard and this pattern is applied to a workflow that's more akin to editing resources, where "Edit as YAML" would be down in the footer.

That's not to say that this is explicitly incorrect, I want to confirm that the UX does not subvert expectations, taking the rest of Dashboard into account.

edit: hmmm... after typing all of this, I am now realizing that the "Edit Options/Edit YAML" pattern is already quite established throughout the Kubewarden UI. I think that my initial observation and concern is less relevant. The pattern fits correctly with pre-existing Kubewarden.

Comment thread pkg/kubewarden/components/YamlFullDiff.vue Outdated
Comment thread pkg/kubewarden/components/YamlFullDiff.vue Outdated
@cnotv

cnotv commented Apr 29, 2026

Copy link
Copy Markdown
Member Author

I think that this looks good, and I only want to double check the UX because it doesn't necessarily match Dashboard patterns for editing YAML, especially when taking into account Policy server/Cluster admission policy. The three buttons for editing the form/yaml/compare changes is usually reserved for multi-step wizards in Dashboard and this pattern is applied to a workflow that's more akin to editing resources, where "Edit as YAML" would be down in the footer.

That's not to say that this is explicitly incorrect, I want to confirm that the UX does not subvert expectations, taking the rest of Dashboard into account.

edit: hmmm... after typing all of this, I am now realizing that the "Edit Options/Edit YAML" pattern is already quite established throughout the Kubewarden UI. I think that my initial observation and concern is less relevant. The pattern fits correctly with pre-existing Kubewarden.

This use of the editor has been directed by @oboc-sts
I leave it to you guys to discuss this and confirm to be ok.

@cnotv
cnotv requested a review from rak-phillip April 29, 2026 08:34
@oboc-sts

Copy link
Copy Markdown

The pattern used here is inline with the "form / yaml / compare changes" functionality used in a few places across the dashboard in a variety of places, usually as part of a multi-step process indeed... but this doesn't mean we can't use it as a standalone interface if the situation asks for it - the consistency targets the mental models in terms of functionality and interaction patterns, not necessarily the context in which they are used. cc @rak-phillip

This being said, I thing it looks and behaves as it should @cnotv , it's good to go from my side 🚀

@rak-phillip

Copy link
Copy Markdown
Member

@cnotv @oboc-sts I was hoping that my edit would be enough to express that I was coming to the realization that this was an accepted and intended pattern, and I thank you both for taking my concerns/observations into account 🙂

@cnotv

cnotv commented Apr 29, 2026

Copy link
Copy Markdown
Member Author

@cnotv @oboc-sts I was hoping that my edit would be enough to express that I was coming to the realization that this was an accepted and intended pattern, and I thank you both for taking my concerns/observations into account 🙂

No harm done, I just wanted to double-check, taking the chance. TBH I feel better with a designer approval either case 😅
Sorry for not specifying it earlier.

@rak-phillip rak-phillip left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@kravciak kravciak self-assigned this Apr 30, 2026
@kravciak

Copy link
Copy Markdown
Collaborator

In some policies default values from are reported as changes.
I randomly found Pod Privileged Policy or Rbac Prohibit Watch On Secrets, but they are probably more.

Screencast.From.2026-04-30.08-37-18.mp4

@kravciak kravciak removed their assignment Apr 30, 2026
@cnotv

cnotv commented May 4, 2026

Copy link
Copy Markdown
Member Author

In some policies default values from are reported as changes. I randomly found Pod Privileged Policy or Rbac Prohibit Watch On Secrets, but they are probably more.

Screencast.From.2026-04-30.08-37-18.mp4

I guess we have to review as we initialize every single policy and find the default values to be added like that. It seems like the whole logic is not clearly defined in steps.
I'll try to remake it, thanks.

@cnotv

cnotv commented May 15, 2026

Copy link
Copy Markdown
Member Author

Ok this issue seems to require way too much efforts into restructuring all the code, so I will just close it.

@cnotv cnotv closed this May 15, 2026
@github-project-automation github-project-automation Bot moved this from In Progress to Done in Kubewarden Admission Controller May 15, 2026
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.

Add existing logic for switching YAML/Option form

4 participants