-
Notifications
You must be signed in to change notification settings - Fork 1
fix(BCH-1108): fix control implementations loading after capability is created #171
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
Conversation
There was a problem hiding this 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
/capabilityto/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.
src/components/component-definitions/ComponentDefinitionComponent.vue
Outdated
Show resolved
Hide resolved
Signed-off-by: Gustavo Carvalho <gustavo.carvalho@container-solutions.com>
ff26b10 to
e17657a
Compare
There was a problem hiding this 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>
There was a problem hiding this 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
createComponentnow throws customErrors when the API returns an empty array, but thecatchblock always treats the error as anAxiosErrorand 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 thecatchlogic to handle non-Axios errors (e.g.,error instanceof Error) and surfaceerror.messagewhen 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>
There was a problem hiding this 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>
No description provided.