fix: apikey filters

This commit is contained in:
jialin
2026-04-29 18:09:55 +08:00
committed by jialin
parent 217285223c
commit c68f546be9
3 changed files with 15 additions and 8 deletions
@@ -182,15 +182,20 @@ const AddModal: React.FC<AddModalProps> = ({
}
if (action === PageAction.EDIT && currentData && open) {
parseExpireValue(currentData as ListItem);
const isLegacyAllScope = currentData.scope?.includes('*');
const normalizedScope = isLegacyAllScope
? ['management', 'inference']
: currentData.scope;
const normalizedAllowedModelNames = isLegacyAllScope
? []
: currentData.allowed_model_names || [];
form.setFieldsValue({
name: currentData.name,
description: currentData.description,
scope: currentData.scope,
allowed_type: currentData.allowed_model_names?.length
? 'custom'
: 'all',
scope: normalizedScope,
allowed_type: normalizedAllowedModelNames.length ? 'custom' : 'all',
expires_in: parseExpireValue(currentData as ListItem),
allowed_model_names: currentData.allowed_model_names || []
allowed_model_names: normalizedAllowedModelNames
});
}
@@ -108,12 +108,14 @@ const useModelsColumns = ({
},
render: (text: string[], record: ListItem) => (
<div className="flex-column gap-4">
{record.scope?.includes('management') && (
{(record.scope?.includes('management') ||
record.scope?.includes('*')) && (
<AutoTooltip ghost>
{intl.formatMessage({ id: 'apikeys.accessScope.management' })}
</AutoTooltip>
)}
{record.scope?.includes('inference') && (
{(record.scope?.includes('inference') ||
record.scope?.includes('*')) && (
<div
style={{
border: '1px solid var(--ant-color-split)',
+1 -1
View File
@@ -163,7 +163,7 @@ const APIKeys: React.FC = () => {
marginTop={30}
showSelect={currentUser?.is_admin}
selectOptions={userList}
select={{ showSearch: true }}
select={{ showSearch: { optionFilterProp: 'label' } }}
selectHolder={intl.formatMessage({ id: 'models.table.filterByName' })}
buttonText={intl.formatMessage({ id: 'apikeys.button.create' })}
handleSearch={handleSearch}