chore: access, endpoints to route targets
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
import icons from '@/components/icon-font/icons';
|
||||
import { StatusMaps } from '@/config';
|
||||
import { StatusType } from '@/config/types';
|
||||
|
||||
export const TargetStatusValueMap: Record<string, string> = {
|
||||
Active: 'active',
|
||||
Unavailable: 'unavailable'
|
||||
};
|
||||
|
||||
export const TargetStatusLabelMap = {
|
||||
[TargetStatusValueMap.Active]: 'Active',
|
||||
[TargetStatusValueMap.Unavailable]: 'Unavailable'
|
||||
};
|
||||
|
||||
export const TargetStatus: Record<string, StatusType> = {
|
||||
[TargetStatusValueMap.Active]: StatusMaps.success,
|
||||
[TargetStatusValueMap.Unavailable]: StatusMaps.error
|
||||
};
|
||||
|
||||
// actions for each row
|
||||
export const rowActionList = [
|
||||
{
|
||||
key: 'edit',
|
||||
label: 'common.button.edit',
|
||||
icon: icons.EditOutlined
|
||||
},
|
||||
{
|
||||
label: 'models.button.accessSettings',
|
||||
key: 'accessControl',
|
||||
icon: icons.Permission
|
||||
},
|
||||
{
|
||||
key: 'delete',
|
||||
label: 'common.button.delete',
|
||||
icon: icons.DeleteOutlined,
|
||||
props: {
|
||||
danger: true
|
||||
}
|
||||
}
|
||||
];
|
||||
@@ -0,0 +1,50 @@
|
||||
export interface FormData {
|
||||
name: string;
|
||||
description: string;
|
||||
categories: any[];
|
||||
meta: Record<string, any>;
|
||||
generic_proxy: boolean;
|
||||
fallback_target: {
|
||||
provider_model_name?: string;
|
||||
model_id?: number;
|
||||
provider_id?: number;
|
||||
fallback_status_codes?: string[];
|
||||
};
|
||||
targets: {
|
||||
provider_model_name?: string;
|
||||
weight?: number | null;
|
||||
model_id?: number;
|
||||
provider_id?: number;
|
||||
fallback_status_codes?: string[];
|
||||
}[];
|
||||
}
|
||||
|
||||
export interface RouteItem {
|
||||
id: number;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
deleted_at: string;
|
||||
name: string;
|
||||
description: string;
|
||||
categories: string[];
|
||||
meta: Record<string, any>;
|
||||
created_by_model: boolean;
|
||||
targets: number;
|
||||
ready_targets: number;
|
||||
access_policy: string;
|
||||
}
|
||||
|
||||
export interface RouteTarget {
|
||||
id: number;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
deleted_at: string;
|
||||
provider_model_name: string;
|
||||
weight: number | null;
|
||||
model_id: number;
|
||||
provider_id: number;
|
||||
name: string;
|
||||
route_id: number;
|
||||
state: string;
|
||||
fallback_status_codes: string[];
|
||||
}
|
||||
Reference in New Issue
Block a user