Skip to content

Conversation

@gusfcarvalho
Copy link
Contributor

No description provided.

Copilot AI review requested due to automatic review settings January 23, 2026 09:27
Copy link
Contributor

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

Fixes issues where component control implementations fail to load or load too early (before a component UUID is available), and aligns capability creation endpoints with the pluralized API path.

Changes:

  • Add UUID validation + user feedback when creating/adding components.
  • Guard and defer control-implementation loading until a component UUID exists (via watcher).
  • Update capability creation endpoints from /capability to /capabilities.

Reviewed changes

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

Show a summary per file
File Description
src/views/component-definitions/ComponentDefinitionComponentsView.vue Adds UUID validation and toast error when a created component is missing uuid.
src/stores/component-definitions.ts Fixes capability creation POST endpoint to plural /capabilities.
src/components/component-definitions/ComponentDefinitionComponent.vue Prevents control-implementation fetch without UUID and adds watcher to load after UUID becomes available.
src/components/component-definitions/ComponentCreateForm.vue Normalizes create response handling and validates UUID before emitting created component.
src/components/component-definitions/CapabilityCreateForm.vue Updates capability creation URL to plural /capabilities.

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

Signed-off-by: Gustavo Carvalho <gustavo.carvalho@container-solutions.com>
Copy link
Contributor

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 3 out of 3 changed files in this pull request and generated 2 comments.


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

Signed-off-by: Gustavo Carvalho <gustavo.carvalho@container-solutions.com>
Copy link
Contributor

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 3 out of 3 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

src/components/component-definitions/ComponentCreateForm.vue:186

  • createComponent now throws custom Errors when the API returns an empty array, but the catch block always treats the error as an AxiosError and falls back to a generic message. This means users won’t see the more actionable messages thrown above (e.g., "No component was created"). Update the catch logic to handle non-Axios errors (e.g., error instanceof Error) and surface error.message when available.
    // Validate response before accessing the first element
    if (!response.data.value?.data || response.data.value.data.length === 0) {
      throw new Error('No component was created. Please try again.');
    }

    const createdComponentData = response.data.value.data[0];

    // Validate that the created component has a UUID
    if (!createdComponentData.uuid) {
      throw new Error('Created component is missing UUID. Please try again.');
    }

    toast.add({
      severity: 'success',
      summary: 'Component created successfully',
      detail: `Component ${component.value.title} has been created.`,
      life: 3000,
    });
    emit('created', createdComponentData);
  } catch (error) {
    const errorResponse = error as AxiosError<ErrorResponse<ErrorBody>>;
    const errorText =
      errorResponse.response?.data.errors.body ||
      'An error occurred while creating the component.';
    toast.add({

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

Signed-off-by: Gustavo Carvalho <gustavo.carvalho@container-solutions.com>
Copy link
Contributor

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 3 out of 3 changed files in this pull request and generated 2 comments.


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

Signed-off-by: Gustavo Carvalho <gustavo.carvalho@container-solutions.com>
@gusfcarvalho gusfcarvalho enabled auto-merge (squash) January 23, 2026 10:40
@gusfcarvalho gusfcarvalho merged commit ae6ff05 into main Jan 23, 2026
3 checks passed
@gusfcarvalho gusfcarvalho deleted the gc-fix-capabilities branch January 23, 2026 10:52
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