feat(backend): add visibility toggle for backend versions in deployment dropdown - #1302
Draft
yxf0314 wants to merge 1 commit into
Draft
feat(backend): add visibility toggle for backend versions in deployment dropdown#1302yxf0314 wants to merge 1 commit into
yxf0314 wants to merge 1 commit into
Conversation
Contributor
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
There was a problem hiding this comment.
Pull request overview
Adds UI controls to hide/show inference backends and specific backend versions so they can be removed from the deployment “backend version” dropdown without deleting the backend/version (issue #5149).
Changes:
- Add enable/disable actions on backend rows to toggle backend visibility in the deploy dropdown.
- Add per-version visibility Switch in the versions modal, persisted via
disabled_versionson the backend. - Add i18n strings for the new visibility labels/tooltips.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/pages/backends/index.tsx | Adds enable/disable action handling and refresh wiring for the version modal. |
| src/pages/backends/forms/version-info.tsx | Adds per-version visibility Switch UI and passes visibility state into version rows. |
| src/pages/backends/config/types.ts | Extends backend form/type shape with disabled_versions. |
| src/pages/backends/config/index.ts | Re-enables and scopes backend enable/disable actions in the actions list. |
| src/pages/backends/components/version-info-modal.tsx | Persists version visibility via disabled_versions updates and notifies parent to refresh. |
| src/locales/zh-CN/backends.ts | Adds new locale keys for version visibility labels/tooltips. |
| src/locales/tr-TR/backends.ts | Adds new locale keys for version visibility labels/tooltips. |
| src/locales/ru-RU/backends.ts | Adds new locale keys for version visibility labels/tooltips. |
| src/locales/ja-JP/backends.ts | Adds new locale keys for version visibility labels/tooltips. |
| src/locales/en-US/backends.ts | Adds new locale keys for version visibility labels/tooltips. |
Comments suppressed due to low confidence (1)
src/pages/backends/forms/version-info.tsx:273
- Using the array index as the React key can cause items to be reused incorrectly when the list is filtered/reordered (especially now that each row contains a controlled Switch). Prefer a stable key like
version_no.
dataList.map((version: VersionListItem, index: number) => {
return (
<VersionItem
key={index}
data={version}
hidden={disabledVersions.includes(version.version_no as string)}
onToggleVisibility={onToggleVisibility}
/>
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+184
to
+188
| // ================ Enable / Disable ================ | ||
| if (item.action === 'enable' || item.action === 'disable') { | ||
| handleToggleEnabled(item); | ||
| return; | ||
| } |
Comment on lines
+164
to
+175
| await handleEnableBackend({ | ||
| id: item.data.id, | ||
| data: { | ||
| ...item.data, | ||
| enabled: item.action === 'enable' | ||
| }, | ||
| showMessage: true | ||
| }); | ||
| await new Promise((resolve) => { | ||
| setTimeout(resolve, 300); | ||
| }); | ||
| handleSearch(); |
Comment on lines
+33
to
+47
| const handleToggleVisibility = async (versionNo: string, hidden: boolean) => { | ||
| const next = hidden | ||
| ? [...disabledVersions, versionNo] | ||
| : disabledVersions.filter((v) => v !== versionNo); | ||
| try { | ||
| await updateBackend(currentData.id, { | ||
| data: { ...currentData, disabled_versions: next } | ||
| }); | ||
| setDisabledVersions(next); | ||
| message.success(intl.formatMessage({ id: 'common.message.success' })); | ||
| onChanged?.(); | ||
| } catch (error) { | ||
| // request layer surfaces the error message | ||
| } | ||
| }; |
Comment on lines
+217
to
224
| const VersionList: React.FC<{ | ||
| versionConfigs: VersionListItem[]; | ||
| disabledVersions?: string[]; | ||
| onToggleVisibility?: (versionNo: string, hidden: boolean) => void; | ||
| }> = ({ versionConfigs, disabledVersions = [], onToggleVisibility }) => { | ||
| const intl = useIntl(); | ||
| const [dataList, setDataList] = useState<VersionListItem[]>(versionConfigs); | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
gpustack/gpustack#5149