From 0a231a8acca18a88a0d1a12253ca24b441986501 Mon Sep 17 00:00:00 2001 From: t0ng7u Date: Thu, 7 Aug 2025 10:54:05 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20feat(models):=20add=20row=20styl?= =?UTF-8?q?ing=20for=20disabled=20models=20in=20ModelsTable?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add visual distinction for enabled/disabled models by applying different background colors to table rows based on model status. This implementation follows the same pattern used in ChannelsTable for consistent user experience. Changes: - Modified handleRow function in useModelsData.js to include row styling - Disabled models (status !== 1) now display with gray background using --semi-color-disabled-border CSS variable - Enabled models (status === 1) maintain normal background color - Preserved existing row click selection functionality This enhancement improves the visual feedback for users to quickly identify which models are active vs inactive in the models management interface. --- .../components/SelectionNotification.jsx | 4 +- .../table/models/modals/EditModelModal.jsx | 110 ++++++++---------- web/src/hooks/models/useModelsData.js | 9 +- 3 files changed, 56 insertions(+), 67 deletions(-) diff --git a/web/src/components/table/models/components/SelectionNotification.jsx b/web/src/components/table/models/components/SelectionNotification.jsx index d886a7c0..571c8948 100644 --- a/web/src/components/table/models/components/SelectionNotification.jsx +++ b/web/src/components/table/models/components/SelectionNotification.jsx @@ -45,7 +45,7 @@ const SelectionNotification = ({ selectedKeys = [], t, onDelete, onAddPrefill, o - ))} - - - )} + {...(tagGroups.length > 0 && { + extraText: ( + + {tagGroups.map(group => ( + + ))} + + ) + })} /> @@ -398,38 +389,29 @@ const EditModelModal = (props) => { addOnBlur showClear style={{ width: '100%' }} - extraText={( - - {endpointGroups.map(group => ( - - ))} - - - )} + {...(endpointGroups.length > 0 && { + extraText: ( + + {endpointGroups.map(group => ( + + ))} + + ) + })} /> diff --git a/web/src/hooks/models/useModelsData.js b/web/src/hooks/models/useModelsData.js index b41bdfc2..febc934e 100644 --- a/web/src/hooks/models/useModelsData.js +++ b/web/src/hooks/models/useModelsData.js @@ -247,9 +247,16 @@ export const useModelsData = () => { await loadModels(1, size, activeVendorKey); }; - // Handle row click + // Handle row click and styling const handleRow = (record, index) => { + const rowStyle = record.status !== 1 ? { + style: { + background: 'var(--semi-color-disabled-border)', + }, + } : {}; + return { + ...rowStyle, onClick: (event) => { // Don't trigger row selection when clicking on buttons if (event.target.closest('button, .semi-button')) {