Skip to content

Conversation

@makdeniss
Copy link
Contributor

@makdeniss makdeniss commented Sep 12, 2025

Summary by CodeRabbit

  • New Features

    • Edit resources from the list via a new Edit action; edit modal pre-fills fields and emits updates handled by the list.
  • UI/Style

    • Modal header toggles “Create” / “Edit”; create-only fields are disabled in Edit mode; actions show Edit and Delete with adjusted spacing.
  • Reliability

    • Update requests now sanitize payloads to remove internal metadata before sending; failures log errors and show user alerts.
  • Tests

    • Added tests for update flows, modal edit behavior, payload sanitization, and error handling.

@makdeniss makdeniss requested a review from gkrajniak September 12, 2025 07:23
@makdeniss makdeniss self-assigned this Sep 12, 2025
@makdeniss makdeniss added the enhancement New feature or request label Sep 12, 2025
makdeniss and others added 4 commits September 12, 2025 10:43
# Conflicts:
#	projects/wc/src/app/components/generic-ui/list-view/list-view.component.spec.ts
#	projects/wc/src/app/components/generic-ui/list-view/list-view.component.ts
@gkrajniak gkrajniak changed the title Feat/edit entity btn feat: edit entity btn Sep 15, 2025
@makdeniss makdeniss marked this pull request as ready for review September 16, 2025 07:39
@mirzakopic
Copy link

@makdeniss Your ticket is in the wrong project board, please assign it to the correct one,.

@makdeniss
Copy link
Contributor Author

@makdeniss Your ticket is in the wrong project board, please assign it to the correct one,.

did so. Hopefully it is now correct. Sorry about that.

@gkrajniak gkrajniak requested a review from Sobyt483 September 18, 2025 11:30
@coderabbitai
Copy link

coderabbitai bot commented Sep 18, 2025

Walkthrough

Adds ResourceService.update (inserted twice) that strips __typename and performs no-cache GraphQL mutations; introduces stripTypename util and tests; extends CreateResourceModal and ListView to support edit flow (prefill, disable create-only fields, emit update) and updates related tests/styles.

Changes

Cohort / File(s) Summary
Resource service + tests (duplicate insertions)
projects/lib/services/resource/resource.service.ts, projects/lib/services/resource/resource.service.spec.ts
Adds update(resource, resourceDefinition, nodeContext) which normalizes the definition, strips __typename via stripTypename, constructs an update{Kind} mutation (optional namespace), executes a no-cache GraphQL mutate, and logs/alerts on errors. The method and its test suite were inserted twice, producing duplicate public method definitions and duplicated tests covering recursive __typename stripping, namespaced/cluster updates, and error handling.
Resource sanitizer util + tests + re-export
projects/lib/utils/utils/resource-sanitizer.ts, projects/lib/utils/utils/resource-sanitizer.spec.ts, projects/lib/utils/utils/index.ts
Adds stripTypename<T>(value: T): T to recursively remove __typename from objects/arrays; adds unit tests for primitives, nested objects, and arrays; re-exports the sanitizer from the utils index.
Create-resource modal: component, template, enums, tests
projects/wc/src/app/components/generic-ui/list-view/create-resource-modal/create-resource-modal.component.ts, projects/wc/src/app/components/generic-ui/list-view/create-resource-modal/create-resource-modal.component.html, projects/wc/src/app/components/generic-ui/list-view/create-resource-modal/create-resource-modal.component.spec.ts, projects/wc/src/app/components/generic-ui/list-view/create-resource-modal/create-resource-modal.enums.ts
Adds updateResource output and changes open(resource?: Resource) to support edit mode (stores originalResource signal, adds isEditMode()), introduces isCreateFieldOnly(field) and createControls(resource?) to prefill and disable create-only fields in edit mode, emits updateResource on save in edit mode; replaces dialog header with a ui5-bar; adds enum CreateOnlyResourceFieldNames; tests updated/added for prefill, edit-mode disabling, and open behavior.
List view: template, logic, styles, tests
projects/wc/src/app/components/generic-ui/list-view/list-view.component.ts, projects/wc/src/app/components/generic-ui/list-view/list-view.component.html, projects/wc/src/app/components/generic-ui/list-view/list-view.component.scss, projects/wc/src/app/components/generic-ui/list-view/list-view.component.spec.ts
Adds per-row Edit icon and retains Delete; wires (updateResource)="update($event)" on the create/edit modal; adds openEditResourceModal(event, resource) to stop propagation, read the resource and open the modal with fetched data; adds update(resource) to call ResourceService.update; adjusts SCSS spacing; updates tests to cover edit/open/read/update flows.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes


📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Free

📥 Commits

Reviewing files that changed from the base of the PR and between 50643ee and 9f2e8be.

📒 Files selected for processing (1)
  • projects/wc/src/app/components/generic-ui/list-view/list-view.component.html (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • projects/wc/src/app/components/generic-ui/list-view/list-view.component.html

Tip

👮 Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

Please see the documentation for more information.

Example:

reviews:
  pre_merge_checks:
    custom_checks:
      - name: "Undocumented Breaking Changes"
        mode: "warning"
        instructions: |
          Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).

Please share your feedback with us on this Discord post.


Note

🎁 Summarized by CodeRabbit Free

Your organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login.

Comment @coderabbitai help to get the list of available commands and usage tips.

makdeniss added 2 commits September 18, 2025 17:21
# Conflicts:
#	projects/lib/services/resource/resource.service.ts
@makdeniss makdeniss requested a review from Sobyt483 September 18, 2025 17:21
@makdeniss
Copy link
Contributor Author

@gkrajniak I have resolved all the comments / issues. The only problem is that I cannot find a solution to only initialise the form once either with or without values (using signals perhaps?).

Maybe you have some hints for that?

# Conflicts:
#	projects/wc/src/app/components/generic-ui/list-view/list-view.component.ts
@gkrajniak
Copy link
Collaborator

gkrajniak commented Sep 24, 2025

@gkrajniak I have resolved all the comments / issues. The only problem is that I cannot find a solution to only initialise the form once either with or without values (using signals perhaps?).

Maybe you have some hints for that?

you use the new FormControl(fieldValue, validator); if there is a resource provided while opening the dialog fieldValue should contain the value of a given field in a resource, if it's create the value would be '', initial value empty

@makdeniss
Copy link
Contributor Author

@gkrajniak I have resolved all the comments / issues. The only problem is that I cannot find a solution to only initialise the form once either with or without values (using signals perhaps?).
Maybe you have some hints for that?

you use the new FormControl(fieldValue, validator); if there is a resource provided while opening the dialog fieldValue should contain the value of a given field in a resource, if it's create the value would be '', initial value empty

I am not sure I understood you or maybe you misunderstood me. The problem is that I am doing this in ngOnInit()

this.form = this.fb.group(this.createControls());

and also this in open()

this.form = this.fb.group(this.createControls(resource));

I would like to do it only once. I didn't find a way to do it yet.

@gkrajniak
Copy link
Collaborator

gkrajniak commented Sep 24, 2025

@gkrajniak I have resolved all the comments / issues. The only problem is that I cannot find a solution to only initialise the form once either with or without values (using signals perhaps?).
Maybe you have some hints for that?

you use the new FormControl(fieldValue, validator); if there is a resource provided while opening the dialog fieldValue should contain the value of a given field in a resource, if it's create the value would be '', initial value empty

I am not sure I understood you or maybe you misunderstood me. The problem is that I am doing this in ngOnInit()

this.form = this.fb.group(this.createControls());

and also this in open()

this.form = this.fb.group(this.createControls(resource));

I would like to do it only once. I didn't find a way to do it yet.

ok if it needs to stay it needs tio stay or we recreate the form or have an additional logic to set values on the form form.setValue... and in our case setting values is not trivial

@makdeniss makdeniss requested a review from gkrajniak September 24, 2025 13:20
@makdeniss makdeniss merged commit e0b4cc2 into main Sep 26, 2025
7 checks passed
@makdeniss makdeniss deleted the feat/edit-entity-btn branch September 26, 2025 08:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants