feat(web,plugin): P1 跨插件引用 — 前端 Phase 4
- plugins.ts: PluginFieldSchema 新增 ref_plugin/ref_fallback_label, PluginEntitySchema 新增 is_public - pluginData.ts: 新增 resolveRefLabels/getPluginEntityRegistry API - EntitySelect: 支持 refPlugin 跨插件查询,目标不可用时降级为禁用 Input - PluginCRUDPage: 表格列解析引用标签(蓝色 Tag),entity_select 表单传 refPlugin/fallbackLabel
This commit is contained in:
@@ -171,3 +171,40 @@ export async function getPluginTimeseries(
|
||||
);
|
||||
return data.data;
|
||||
}
|
||||
|
||||
// ─── 跨插件引用 API ──────────────────────────────────────────────────
|
||||
|
||||
export interface ResolveLabelsResult {
|
||||
labels: Record<string, Record<string, string | null>>;
|
||||
meta: Record<string, {
|
||||
target_plugin: string;
|
||||
target_entity: string;
|
||||
label_field: string;
|
||||
plugin_installed: boolean;
|
||||
}>;
|
||||
}
|
||||
|
||||
export async function resolveRefLabels(
|
||||
pluginId: string,
|
||||
entity: string,
|
||||
fields: Record<string, string[]>,
|
||||
): Promise<ResolveLabelsResult> {
|
||||
const { data } = await client.post<{ success: boolean; data: ResolveLabelsResult }>(
|
||||
`/plugins/${pluginId}/${entity}/resolve-labels`,
|
||||
{ fields },
|
||||
);
|
||||
return data.data;
|
||||
}
|
||||
|
||||
export interface PublicEntity {
|
||||
manifest_id: string;
|
||||
entity_name: string;
|
||||
display_name: string;
|
||||
}
|
||||
|
||||
export async function getPluginEntityRegistry(): Promise<PublicEntity[]> {
|
||||
const { data } = await client.get<{ success: boolean; data: PublicEntity[] }>(
|
||||
'/plugin-registry/entities',
|
||||
);
|
||||
return data.data;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user