fix: apikey filters
This commit is contained in:
@@ -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)',
|
||||
|
||||
@@ -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}
|
||||
|
||||
Reference in New Issue
Block a user