Commit 1d28e4dd by t0ng7u

馃帹 feat(models): add row styling for disabled models in ModelsTable

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.
parent 029768e8
......@@ -45,7 +45,7 @@ const SelectionNotification = ({ selectedKeys = [], t, onDelete, onAddPrefill, o
<Space wrap>
<Button
size="small"
type="secondary"
type="tertiary"
theme="solid"
onClick={onClear}
>
......@@ -61,7 +61,7 @@ const SelectionNotification = ({ selectedKeys = [], t, onDelete, onAddPrefill, o
</Button>
<Button
size="small"
type="tertiary"
type="secondary"
theme="solid"
onClick={onCopy}
>
......
......@@ -339,38 +339,29 @@ const EditModelModal = (props) => {
formApiRef.current.setValue('tags', normalized);
}}
style={{ width: '100%' }}
extraText={(
<Space wrap>
{tagGroups.map(group => (
<Button
key={group.id}
size='small'
type='primary'
onClick={() => {
if (formApiRef.current) {
const currentTags = formApiRef.current.getValue('tags') || [];
const newTags = [...currentTags, ...(group.items || [])];
const uniqueTags = [...new Set(newTags)];
formApiRef.current.setValue('tags', uniqueTags);
}
}}
>
{group.name}
</Button>
))}
<Button
size='small'
type='warning'
onClick={() => {
if (formApiRef.current) {
formApiRef.current.setValue('tags', []);
}
}}
>
{t('娓呴櫎鏍囩')}
</Button>
</Space>
)}
{...(tagGroups.length > 0 && {
extraText: (
<Space wrap>
{tagGroups.map(group => (
<Button
key={group.id}
size='small'
type='primary'
onClick={() => {
if (formApiRef.current) {
const currentTags = formApiRef.current.getValue('tags') || [];
const newTags = [...currentTags, ...(group.items || [])];
const uniqueTags = [...new Set(newTags)];
formApiRef.current.setValue('tags', uniqueTags);
}
}}
>
{group.name}
</Button>
))}
</Space>
)
})}
/>
</Col>
<Col span={24}>
......@@ -398,38 +389,29 @@ const EditModelModal = (props) => {
addOnBlur
showClear
style={{ width: '100%' }}
extraText={(
<Space wrap>
{endpointGroups.map(group => (
<Button
key={group.id}
size='small'
type='primary'
onClick={() => {
if (formApiRef.current) {
const currentEndpoints = formApiRef.current.getValue('endpoints') || [];
const newEndpoints = [...currentEndpoints, ...(group.items || [])];
const uniqueEndpoints = [...new Set(newEndpoints)];
formApiRef.current.setValue('endpoints', uniqueEndpoints);
}
}}
>
{group.name}
</Button>
))}
<Button
size='small'
type='warning'
onClick={() => {
if (formApiRef.current) {
formApiRef.current.setValue('endpoints', []);
}
}}
>
{t('娓呴櫎绔偣')}
</Button>
</Space>
)}
{...(endpointGroups.length > 0 && {
extraText: (
<Space wrap>
{endpointGroups.map(group => (
<Button
key={group.id}
size='small'
type='primary'
onClick={() => {
if (formApiRef.current) {
const currentEndpoints = formApiRef.current.getValue('endpoints') || [];
const newEndpoints = [...currentEndpoints, ...(group.items || [])];
const uniqueEndpoints = [...new Set(newEndpoints)];
formApiRef.current.setValue('endpoints', uniqueEndpoints);
}
}}
>
{group.name}
</Button>
))}
</Space>
)
})}
/>
</Col>
<Col span={24}>
......
......@@ -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')) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment