fix: apikey filters
This commit is contained in:
@@ -182,15 +182,20 @@ const AddModal: React.FC<AddModalProps> = ({
|
|||||||
}
|
}
|
||||||
if (action === PageAction.EDIT && currentData && open) {
|
if (action === PageAction.EDIT && currentData && open) {
|
||||||
parseExpireValue(currentData as ListItem);
|
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({
|
form.setFieldsValue({
|
||||||
name: currentData.name,
|
name: currentData.name,
|
||||||
description: currentData.description,
|
description: currentData.description,
|
||||||
scope: currentData.scope,
|
scope: normalizedScope,
|
||||||
allowed_type: currentData.allowed_model_names?.length
|
allowed_type: normalizedAllowedModelNames.length ? 'custom' : 'all',
|
||||||
? 'custom'
|
|
||||||
: 'all',
|
|
||||||
expires_in: parseExpireValue(currentData as ListItem),
|
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) => (
|
render: (text: string[], record: ListItem) => (
|
||||||
<div className="flex-column gap-4">
|
<div className="flex-column gap-4">
|
||||||
{record.scope?.includes('management') && (
|
{(record.scope?.includes('management') ||
|
||||||
|
record.scope?.includes('*')) && (
|
||||||
<AutoTooltip ghost>
|
<AutoTooltip ghost>
|
||||||
{intl.formatMessage({ id: 'apikeys.accessScope.management' })}
|
{intl.formatMessage({ id: 'apikeys.accessScope.management' })}
|
||||||
</AutoTooltip>
|
</AutoTooltip>
|
||||||
)}
|
)}
|
||||||
{record.scope?.includes('inference') && (
|
{(record.scope?.includes('inference') ||
|
||||||
|
record.scope?.includes('*')) && (
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
border: '1px solid var(--ant-color-split)',
|
border: '1px solid var(--ant-color-split)',
|
||||||
|
|||||||
@@ -163,7 +163,7 @@ const APIKeys: React.FC = () => {
|
|||||||
marginTop={30}
|
marginTop={30}
|
||||||
showSelect={currentUser?.is_admin}
|
showSelect={currentUser?.is_admin}
|
||||||
selectOptions={userList}
|
selectOptions={userList}
|
||||||
select={{ showSearch: true }}
|
select={{ showSearch: { optionFilterProp: 'label' } }}
|
||||||
selectHolder={intl.formatMessage({ id: 'models.table.filterByName' })}
|
selectHolder={intl.formatMessage({ id: 'models.table.filterByName' })}
|
||||||
buttonText={intl.formatMessage({ id: 'apikeys.button.create' })}
|
buttonText={intl.formatMessage({ id: 'apikeys.button.create' })}
|
||||||
handleSearch={handleSearch}
|
handleSearch={handleSearch}
|
||||||
|
|||||||
Reference in New Issue
Block a user