diff --git a/src/pages/api-keys/components/add-apikey-modal/index.tsx b/src/pages/api-keys/components/add-apikey-modal/index.tsx index e91b8fe4..14ab4b8e 100644 --- a/src/pages/api-keys/components/add-apikey-modal/index.tsx +++ b/src/pages/api-keys/components/add-apikey-modal/index.tsx @@ -182,15 +182,20 @@ const AddModal: React.FC = ({ } 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 }); } diff --git a/src/pages/api-keys/hooks/use-keys-columns.tsx b/src/pages/api-keys/hooks/use-keys-columns.tsx index f73b6f72..0a441465 100644 --- a/src/pages/api-keys/hooks/use-keys-columns.tsx +++ b/src/pages/api-keys/hooks/use-keys-columns.tsx @@ -108,12 +108,14 @@ const useModelsColumns = ({ }, render: (text: string[], record: ListItem) => (
- {record.scope?.includes('management') && ( + {(record.scope?.includes('management') || + record.scope?.includes('*')) && ( {intl.formatMessage({ id: 'apikeys.accessScope.management' })} )} - {record.scope?.includes('inference') && ( + {(record.scope?.includes('inference') || + record.scope?.includes('*')) && (
{ 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}