fix: refresh Access Settings policy from /access response
Reopening the Access Settings dialog after a save could leave the
radio on the wrong policy: the form initialized `access_policy`
from the route list's snapshot, but the list isn't refreshed when
the dialog closes, so the snapshot's value silently shadowed the
just-saved policy.
Backend now returns the route's authoritative `access_policy` on
`GET /v2/model-routes/{id}/access`. Use that value when the GET
resolves, falling back to the parent snapshot only as the initial
seed so the radio isn't briefly unselected.
While we're here, widen the `access_policy` type from a closed
union to `string` — plugins can contribute additional policy
values via the `accessControl.allowedUsersOverride` slot, so the
wire type shouldn't restrict to the OSS-side enum.
This commit is contained in:
@@ -25,7 +25,13 @@ export interface ListItem {
|
||||
local_path?: string;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
access_policy: 'public' | 'authed' | 'allowed_users';
|
||||
// Built-in values are 'public' | 'authed' | 'allowed_users';
|
||||
// additional values (e.g. 'allowed_principals') may be contributed
|
||||
// by plugins via `accessControl.prependedPolicies` or by
|
||||
// overriding the default via `accessControl.allowedUsersOverride`.
|
||||
// The `(string & {})` tail keeps literal autocomplete for the
|
||||
// built-ins while still accepting plugin-defined values.
|
||||
access_policy: 'public' | 'authed' | 'allowed_users' | (string & {});
|
||||
generic_proxy?: boolean;
|
||||
gpu_selector?: {
|
||||
gpu_ids: string[];
|
||||
@@ -346,7 +352,9 @@ export interface BackendOption {
|
||||
}
|
||||
|
||||
export interface AccessControlFormData {
|
||||
access_policy: 'public' | 'authed' | 'allowed_users';
|
||||
// See `RouteItem.access_policy` for why plugin-defined values are
|
||||
// accepted alongside the built-ins.
|
||||
access_policy: 'public' | 'authed' | 'allowed_users' | (string & {});
|
||||
users: { id: number }[];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user