Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eedc5b295a |
+1
-1
@@ -17,7 +17,7 @@
|
|||||||
"@ant-design/pro-components": "3.1.0-0",
|
"@ant-design/pro-components": "3.1.0-0",
|
||||||
"@antv/g6": "^5.0.51",
|
"@antv/g6": "^5.0.51",
|
||||||
"@braintree/sanitize-url": "^7.1.1",
|
"@braintree/sanitize-url": "^7.1.1",
|
||||||
"@gpustack/core-ui": "^1.0.42",
|
"@gpustack/core-ui": "^1.0.41",
|
||||||
"@huggingface/gguf": "^0.1.7",
|
"@huggingface/gguf": "^0.1.7",
|
||||||
"@huggingface/hub": "^0.15.1",
|
"@huggingface/hub": "^0.15.1",
|
||||||
"@huggingface/tasks": "^0.11.6",
|
"@huggingface/tasks": "^0.11.6",
|
||||||
|
|||||||
Generated
+5
-5
@@ -24,8 +24,8 @@ importers:
|
|||||||
specifier: ^7.1.1
|
specifier: ^7.1.1
|
||||||
version: 7.1.2
|
version: 7.1.2
|
||||||
'@gpustack/core-ui':
|
'@gpustack/core-ui':
|
||||||
specifier: ^1.0.42
|
specifier: ^1.0.41
|
||||||
version: 1.0.42(czdvzceysqw7iv6pct2ucnb23e)
|
version: 1.0.41(czdvzceysqw7iv6pct2ucnb23e)
|
||||||
'@huggingface/gguf':
|
'@huggingface/gguf':
|
||||||
specifier: ^0.1.7
|
specifier: ^0.1.7
|
||||||
version: 0.1.18
|
version: 0.1.18
|
||||||
@@ -1481,8 +1481,8 @@ packages:
|
|||||||
resolution: {integrity: sha512-KWk80UPIzPmUg+P0rKh6TqspRw0G6eux1PuJr+zz47ftMaZ9QDwbGzHZbtzWkl5hgayM/qrKRutllRC7D/vVXQ==, tarball: https://registry.npmjs.org/@formatjs/intl-utils/-/intl-utils-2.3.0.tgz}
|
resolution: {integrity: sha512-KWk80UPIzPmUg+P0rKh6TqspRw0G6eux1PuJr+zz47ftMaZ9QDwbGzHZbtzWkl5hgayM/qrKRutllRC7D/vVXQ==, tarball: https://registry.npmjs.org/@formatjs/intl-utils/-/intl-utils-2.3.0.tgz}
|
||||||
deprecated: the package is rather renamed to @formatjs/ecma-abstract with some changes in functionality (primarily selectUnit is removed and we don't plan to make any further changes to this package
|
deprecated: the package is rather renamed to @formatjs/ecma-abstract with some changes in functionality (primarily selectUnit is removed and we don't plan to make any further changes to this package
|
||||||
|
|
||||||
'@gpustack/core-ui@1.0.42':
|
'@gpustack/core-ui@1.0.41':
|
||||||
resolution: {integrity: sha512-upMClTHU+xAqd8dlx0w1S9XWHlog5g1hcOCulTk2rmMXqgl66QHfqhEFhJnWIGe1xc8tEj6rW3r5Sirif+qswA==, tarball: https://registry.npmjs.org/@gpustack/core-ui/-/core-ui-1.0.42.tgz}
|
resolution: {integrity: sha512-Q4mgdjZpvuE5XDioV7MHoVVHK6k7LNzVkq0zGVln1IzAYW7ldpzQPoj/zARXqGWQLAvHLiO03PfEjiP8cE9fdQ==, tarball: https://registry.npmjs.org/@gpustack/core-ui/-/core-ui-1.0.41.tgz}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
'@ant-design/icons': ^6.1.0
|
'@ant-design/icons': ^6.1.0
|
||||||
'@ant-design/pro-components': 3.1.0-0
|
'@ant-design/pro-components': 3.1.0-0
|
||||||
@@ -10802,7 +10802,7 @@ snapshots:
|
|||||||
|
|
||||||
'@formatjs/intl-utils@2.3.0': {}
|
'@formatjs/intl-utils@2.3.0': {}
|
||||||
|
|
||||||
'@gpustack/core-ui@1.0.42(czdvzceysqw7iv6pct2ucnb23e)':
|
'@gpustack/core-ui@1.0.41(czdvzceysqw7iv6pct2ucnb23e)':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@ant-design/icons': 6.2.2(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
|
'@ant-design/icons': 6.2.2(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
|
||||||
'@ant-design/pro-components': 3.1.0-0(antd@6.3.7(date-fns@2.30.0)(moment@2.30.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
|
'@ant-design/pro-components': 3.1.0-0(antd@6.3.7(date-fns@2.30.0)(moment@2.30.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
|
||||||
|
|||||||
@@ -51,9 +51,6 @@ export default {
|
|||||||
withDescriptionPadding: '12px 16px',
|
withDescriptionPadding: '12px 16px',
|
||||||
withDescriptionIconSize: 18
|
withDescriptionIconSize: 18
|
||||||
},
|
},
|
||||||
Card: {
|
|
||||||
headerHeight: 50
|
|
||||||
},
|
|
||||||
Menu: {
|
Menu: {
|
||||||
iconSize: 16,
|
iconSize: 16,
|
||||||
iconMarginInlineEnd: 12,
|
iconMarginInlineEnd: 12,
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import { getGPUStackPlugin } from '@/plugins';
|
|||||||
import { DownOutlined, QuestionCircleOutlined } from '@ant-design/icons';
|
import { DownOutlined, QuestionCircleOutlined } from '@ant-design/icons';
|
||||||
import {
|
import {
|
||||||
AlertBlockInfo,
|
AlertBlockInfo,
|
||||||
CardRadioGroup,
|
TooltipList,
|
||||||
Transfer as TransferInner
|
Transfer as TransferInner
|
||||||
} from '@gpustack/core-ui';
|
} from '@gpustack/core-ui';
|
||||||
import { useIntl } from '@umijs/max';
|
import { useIntl } from '@umijs/max';
|
||||||
@@ -17,6 +17,8 @@ import {
|
|||||||
Empty,
|
Empty,
|
||||||
Flex,
|
Flex,
|
||||||
Form,
|
Form,
|
||||||
|
Radio,
|
||||||
|
RadioChangeEvent,
|
||||||
Tooltip
|
Tooltip
|
||||||
} from 'antd';
|
} from 'antd';
|
||||||
import {
|
import {
|
||||||
@@ -80,8 +82,7 @@ const Label = styled.div`
|
|||||||
gap: 4px;
|
gap: 4px;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
margin-bottom: 16px;
|
margin-bottom: 16px;
|
||||||
font-size: 13px;
|
font-size: 14px;
|
||||||
color: var(--ant-color-text-secondary);
|
|
||||||
`;
|
`;
|
||||||
|
|
||||||
interface AccessControlFormProps {
|
interface AccessControlFormProps {
|
||||||
@@ -230,7 +231,9 @@ const AccessControlForm = forwardRef((props: AccessControlFormProps, ref) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleOnPolicyChange = async (policy: string) => {
|
const handleOnPolicyChange = async (e: RadioChangeEvent) => {
|
||||||
|
console.log('policy changed:', e.target.value);
|
||||||
|
const policy = e.target.value;
|
||||||
if (policy === ALLOWED_PRINCIPALS_POLICY) {
|
if (policy === ALLOWED_PRINCIPALS_POLICY) {
|
||||||
form.setFieldsValue({ users: formDataCacheRef.current?.users || [] });
|
form.setFieldsValue({ users: formDataCacheRef.current?.users || [] });
|
||||||
} else {
|
} else {
|
||||||
@@ -396,82 +399,72 @@ const AccessControlForm = forwardRef((props: AccessControlFormProps, ref) => {
|
|||||||
: undefined
|
: undefined
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Label>{intl.formatMessage({ id: 'models.table.accessScope' })}</Label>
|
<Label>
|
||||||
|
{intl.formatMessage({ id: 'models.table.accessScope' })}
|
||||||
<Form.Item<AccessControlFormData>
|
<Tooltip
|
||||||
name="access_policy"
|
title={
|
||||||
style={{
|
<TooltipList
|
||||||
marginBottom: 16
|
list={buildAccessScopeTips(
|
||||||
}}
|
allowedUsersOverride,
|
||||||
>
|
prependedPolicies
|
||||||
<CardRadioGroup
|
)}
|
||||||
onChange={handleOnPolicyChange}
|
></TooltipList>
|
||||||
options={[
|
}
|
||||||
...prependedPolicies.map((p) => ({
|
|
||||||
label: intl.formatMessage({ id: p.labelId }),
|
|
||||||
description: intl.formatMessage({ id: p.tipsId ?? p.labelId }),
|
|
||||||
value: p.policyValue
|
|
||||||
})),
|
|
||||||
{
|
|
||||||
label: intl.formatMessage({
|
|
||||||
id: 'models.accessSettings.authed'
|
|
||||||
}),
|
|
||||||
description: intl.formatMessage({
|
|
||||||
id: 'models.accessSettings.authed.tips'
|
|
||||||
}),
|
|
||||||
value: 'authed'
|
|
||||||
},
|
|
||||||
allowedUsersOverride
|
|
||||||
? {
|
|
||||||
label: intl.formatMessage({
|
|
||||||
id: allowedUsersOverride.labelId
|
|
||||||
}),
|
|
||||||
description: intl.formatMessage({
|
|
||||||
id:
|
|
||||||
allowedUsersOverride.tipsId ??
|
|
||||||
'models.accessSettings.allowedUsers.tips'
|
|
||||||
}),
|
|
||||||
value: allowedUsersOverride.policyValue
|
|
||||||
}
|
|
||||||
: {
|
|
||||||
label: intl.formatMessage({
|
|
||||||
id: 'models.accessSettings.allowedUsers'
|
|
||||||
}),
|
|
||||||
description: intl.formatMessage({
|
|
||||||
id: 'models.accessSettings.allowedUsers.tips'
|
|
||||||
}),
|
|
||||||
value: ALLOWED_PRINCIPALS_POLICY
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: intl.formatMessage({
|
|
||||||
id: 'models.accessSettings.public'
|
|
||||||
}),
|
|
||||||
description: intl.formatMessage({
|
|
||||||
id: 'models.accessSettings.public.desc'
|
|
||||||
}),
|
|
||||||
value: 'public'
|
|
||||||
}
|
|
||||||
]}
|
|
||||||
/>
|
|
||||||
</Form.Item>
|
|
||||||
{allowedUsersOverride?.Action && accessPolicy === overridePolicyValue && (
|
|
||||||
<Flex
|
|
||||||
justify="space-between"
|
|
||||||
align="center"
|
|
||||||
style={{ marginBottom: 8 }}
|
|
||||||
>
|
>
|
||||||
<Label style={{ marginBottom: 0 }}>
|
<QuestionCircleOutlined />
|
||||||
{intl.formatMessage({
|
</Tooltip>
|
||||||
id: 'models.accessSettings.grantedPrincipals'
|
</Label>
|
||||||
})}
|
|
||||||
</Label>
|
<Flex
|
||||||
<allowedUsersOverride.Action
|
align="center"
|
||||||
form={form}
|
justify="space-between"
|
||||||
routeId={currentData?.id}
|
style={{ marginBottom: 16, height: 40 }}
|
||||||
action={action}
|
>
|
||||||
/>
|
<Form.Item<AccessControlFormData> name="access_policy" noStyle>
|
||||||
</Flex>
|
<Radio.Group
|
||||||
)}
|
onChange={handleOnPolicyChange}
|
||||||
|
options={[
|
||||||
|
...prependedPolicies.map((p) => ({
|
||||||
|
label: intl.formatMessage({ id: p.labelId }),
|
||||||
|
value: p.policyValue
|
||||||
|
})),
|
||||||
|
{
|
||||||
|
label: intl.formatMessage({
|
||||||
|
id: 'models.accessSettings.authed'
|
||||||
|
}),
|
||||||
|
value: 'authed'
|
||||||
|
},
|
||||||
|
allowedUsersOverride
|
||||||
|
? {
|
||||||
|
label: intl.formatMessage({
|
||||||
|
id: allowedUsersOverride.labelId
|
||||||
|
}),
|
||||||
|
value: allowedUsersOverride.policyValue
|
||||||
|
}
|
||||||
|
: {
|
||||||
|
label: intl.formatMessage({
|
||||||
|
id: 'models.accessSettings.allowedUsers'
|
||||||
|
}),
|
||||||
|
value: ALLOWED_PRINCIPALS_POLICY
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: intl.formatMessage({
|
||||||
|
id: 'models.accessSettings.public'
|
||||||
|
}),
|
||||||
|
value: 'public'
|
||||||
|
}
|
||||||
|
]}
|
||||||
|
></Radio.Group>
|
||||||
|
</Form.Item>
|
||||||
|
{allowedUsersOverride?.Action &&
|
||||||
|
accessPolicy === overridePolicyValue && (
|
||||||
|
<allowedUsersOverride.Action
|
||||||
|
form={form}
|
||||||
|
routeId={currentData?.id}
|
||||||
|
action={action}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</Flex>
|
||||||
{accessPolicy === 'public' && (
|
{accessPolicy === 'public' && (
|
||||||
<div style={{ marginBlock: '16px 12px' }}>
|
<div style={{ marginBlock: '16px 12px' }}>
|
||||||
<AlertBlockInfo
|
<AlertBlockInfo
|
||||||
|
|||||||
Reference in New Issue
Block a user