feat: ai actions and feedback#1012
Conversation
…ck.json; add new routes for Docker registries and Git providers
…ck.json; refactor PageHeader component to use AskDevtronButton
…ck.json; modify getDockerRegistriesListMin to include isDefault in response type
…n-fe-common-lib into feat/ai-actions
…n-fe-common-lib into feat/ai-actions-and-feedback
There was a problem hiding this comment.
Pull request overview
This PR introduces new AI-related UI extensibility via MainContext (injectable Ask Devtron button), adds lightweight “min” autocomplete APIs for Git providers and Docker registries, and adds app-name validation utilities to support these flows in the shared FE common library.
Changes:
- Added
validateAppNameand introduced anAPP_NAMEpattern in shared constants. - Extended
MainContextto optionally provide anAskDevtronButtonand updatedPageHeaderto render it when applicable. - Added new minimal-list service calls + routes (
git/provider/autocomplete,docker/registry/autocomplete) and exportedgetProjectOptionsfrom the resource-kinds hook package.
Reviewed changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
src/Shared/validations.tsx |
Adds validateAppName validation helper. |
src/Common/Constants.ts |
Adds PATTERNS.APP_NAME and new autocomplete routes. |
src/Shared/Providers/MainContextProvider/types.ts |
Extends MainContext with optional AskDevtronButton. |
src/Shared/Components/Header/PageHeader.tsx |
Uses AskDevtronButton from context instead of inline Ask-AI button logic. |
src/Common/Common.service.ts |
Adds “min list” service calls for registries and git providers. |
src/Shared/Hooks/useGetResourceKindsOptions/index.ts |
Re-exports getProjectOptions from service. |
package.json / package-lock.json |
Bumps package version to 1.22.8-beta-5. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| export const PATTERNS = { | ||
| STRING: /^[a-zA-Z0-9_]+$/, | ||
| APP_NAME: '^[a-z][a-z0-9-]*[a-z0-9]$/*', |
There was a problem hiding this comment.
PATTERNS.APP_NAME is currently a string (while almost all other PATTERNS entries are RegExps) and it also contains a trailing $/*, which looks unintentional. This mixed typing makes PATTERNS easy to misuse elsewhere (e.g., calling .test on APP_NAME would throw) and the extra /* is confusing. Consider making APP_NAME a RegExp like the other patterns (and remove the trailing /*).
| APP_NAME: '^[a-z][a-z0-9-]*[a-z0-9]$/*', | |
| APP_NAME: /^[a-z][a-z0-9-]*[a-z0-9]$/, |
…n-fe-common-lib into feat/ai-actions-and-feedback
Description
This pull request introduces several improvements and new features to the common library, focusing on validation utilities, API enhancements, and UI component flexibility. The most important changes are the addition of app name validation, new minimal API endpoints for Docker registries and Git providers, and updates to the main context for easier integration of custom UI components.
Validation enhancements:
validateAppNamefunction for app name validation, enforcing minimum/maximum length, allowed characters, and format requirements.PATTERNS.APP_NAMEwithinConstants.ts.API improvements:
getDockerRegistriesListMinandgetGitProvidersListMinfunctions toCommon.service.tsfor fetching minimal lists of Docker registries and Git providers.DOCKER_REGISTRY_MINandGIT_PROVIDER_MINinConstants.ts.UI component flexibility:
MainContexttype to include an optionalAskDevtronButtoncomponent, allowing easier injection of custom UI elements. [1] [2]PageHeader.tsxto use the newAskDevtronButtonprop for rendering the Ask Devtron AI button, improving maintainability and customization. [1] [2] [3]Other changes:
1.22.8-beta-5inpackage.json.getProjectOptionsfromuseGetResourceKindsOptionsfor easier consumption.Type of change
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Checklist