@yuku123/z-cognition-component 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ConceptsPage-BH4lEiVn.cjs +1 -0
- package/dist/{ConceptsPage-0GGsA1U2.js → ConceptsPage-C8nsSzRc.js} +1 -1
- package/dist/OntologyDetailPage-BnrMC9RD.cjs +1 -0
- package/dist/OntologyDetailPage-DIsWePGJ.js +130 -0
- package/dist/OntologyInferPage-BhHrVjSM.js +114 -0
- package/dist/OntologyInferPage-FoVA-toR.cjs +4 -0
- package/dist/OntologyListPage-ClYfQsCI.cjs +1 -0
- package/dist/OntologyListPage-DJnVZ_19.js +118 -0
- package/dist/OntologyMaterializePage-CUPoItSa.cjs +4 -0
- package/dist/OntologyMaterializePage-DxxtArEt.js +128 -0
- package/dist/OntologyNodesPage-B93kbY3c.cjs +1 -0
- package/dist/OntologyNodesPage-C68cRXHu.js +105 -0
- package/dist/OntologyValidatePage-40ZvGGH4.cjs +4 -0
- package/dist/OntologyValidatePage-WX4sAfzY.js +136 -0
- package/dist/{TermDetailPage-DvGL-fe0.js → TermDetailPage-BiF5UVM5.js} +1 -1
- package/dist/TermDetailPage-DQcYkPdm.cjs +1 -0
- package/dist/{TermsPage-B_xTQR5N.js → TermsPage-BJWfX1hw.js} +9 -9
- package/dist/TermsPage-CE3E3fG-.cjs +1 -0
- package/dist/api-BVrIcAFp.js +67 -0
- package/dist/api-D5Hgcud4.cjs +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +3 -3
- package/dist/pages.cjs +1 -1
- package/dist/pages.js +34 -16
- package/package.json +1 -1
- package/dist/ConceptsPage-DXVhBUzW.cjs +0 -1
- package/dist/TermDetailPage-DHNi7J_B.cjs +0 -1
- package/dist/TermsPage-B8CnXbTP.cjs +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),a=require("react"),S=require("react-router-dom"),t=require("antd"),p=require("@ant-design/icons"),h=require("./api.cjs"),l=require("./EvidenceFormList-CQNgMNCG.cjs"),{TextArea:b}=t.Input;function v(){const x=S.useNavigate(),[y,g]=a.useState([]),[j,c]=a.useState(!1),[d,u]=a.useState(""),[w,r]=a.useState(!1),[I,m]=a.useState(!1),[o]=t.Form.useForm(),i=async(n=d)=>{c(!0);try{g(await h.cognitionApi.listConcepts({domain:n}))}catch(s){t.message.error(s.message)}finally{c(!1)}};a.useEffect(()=>{i()},[]);const f=async()=>{const n=await o.validateFields();m(!0);try{await h.cognitionApi.createConcept({...n,actor:n.actor||"console",note:n.note||"console create"}),t.message.success(`概念 ${n.conceptKey} 已登记`),r(!1),o.resetFields(),await i()}catch(s){t.message.error(s.field?`${s.field}: ${s.message}`:s.message)}finally{m(!1)}};return e.jsxs("div",{children:[e.jsxs(t.Space,{wrap:!0,style:{marginBottom:16},children:[e.jsx(t.Input,{placeholder:"域(如 trade)",allowClear:!0,style:{width:180},value:d,onChange:n=>u(n.target.value),onPressEnter:()=>i()}),e.jsx(t.Button,{icon:e.jsx(p.ReloadOutlined,{}),onClick:()=>{u(""),i("")},children:"重置"}),e.jsx(t.Button,{type:"primary",icon:e.jsx(p.PlusOutlined,{}),onClick:()=>r(!0),children:"新建概念"})]}),e.jsx(t.Table,{rowKey:"conceptKey",size:"middle",loading:j,dataSource:y,pagination:{pageSize:20,showSizeChanger:!1},columns:[{title:"conceptKey",dataIndex:"conceptKey",width:200},{title:"名称",dataIndex:"name",width:180},{title:"类型",dataIndex:"conceptType",width:120,render:n=>e.jsx(t.Tag,{children:n})},{title:"域",dataIndex:"domain",width:120},{title:"父概念",dataIndex:"parentKey",width:180,render:n=>n||"—"},{title:"版本",dataIndex:"revisionNo",width:70,render:n=>`r${n}`},{title:"定义",dataIndex:"definition",ellipsis:!0},{title:"操作",width:110,render:(n,s)=>e.jsx(t.Button,{size:"small",onClick:()=>x(`/cognition/impact?subjectType=concept&subjectKey=${encodeURIComponent(s.conceptKey)}`),children:"影响面"})}]}),e.jsx(t.Modal,{title:"新建概念(证据必填)",open:w,onCancel:()=>r(!1),onOk:f,confirmLoading:I,width:800,destroyOnHidden:!0,children:e.jsxs(t.Form,{form:o,layout:"vertical",children:[e.jsxs(t.Space,{size:"large",wrap:!0,children:[e.jsx(t.Form.Item,{name:"conceptKey",label:"conceptKey",rules:[{required:!0,message:"必填"},{pattern:l.KEY_PATTERN,message:"^[a-z][a-z0-9_.-]{1,127}$"}],children:e.jsx(t.Input,{style:{width:240},placeholder:"order"})}),e.jsx(t.Form.Item,{name:"name",label:"名称",rules:[{required:!0,message:"必填"}],children:e.jsx(t.Input,{style:{width:200},placeholder:"订单"})}),e.jsx(t.Form.Item,{name:"conceptType",label:"类型",rules:[{required:!0,message:"必填"}],initialValue:"ENTITY",children:e.jsx(t.Select,{style:{width:140},options:l.CONCEPT_TYPES.map(n=>({value:n,label:n}))})}),e.jsx(t.Form.Item,{name:"domain",label:"域",children:e.jsx(t.Input,{style:{width:140}})}),e.jsx(t.Form.Item,{name:"parentKey",label:"父概念",children:e.jsx(t.Input,{style:{width:180}})})]}),e.jsx(t.Form.Item,{name:"definition",label:"定义",rules:[{required:!0,message:"必填"}],children:e.jsx(b,{rows:3})}),e.jsx(t.Form.Item,{label:"证据(至少一条)",required:!0,children:e.jsx(l.EvidenceFormList,{})})]})})]})}exports.default=v;
|
|
@@ -60,7 +60,7 @@ function H() {
|
|
|
60
60
|
d,
|
|
61
61
|
{
|
|
62
62
|
size: "small",
|
|
63
|
-
onClick: () => w(`/impact?subjectType=concept&subjectKey=${encodeURIComponent(n.conceptKey)}`),
|
|
63
|
+
onClick: () => w(`/cognition/impact?subjectType=concept&subjectKey=${encodeURIComponent(n.conceptKey)}`),
|
|
64
64
|
children: "影响面"
|
|
65
65
|
}
|
|
66
66
|
)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),d=require("react"),g=require("react-router-dom"),s=require("antd"),f=require("@ant-design/icons"),t=require("./api-D5Hgcud4.cjs");function y(){const[h]=g.useSearchParams(),r=h.get("id")||"",[l,m]=d.useState(null),[a,c]=d.useState(null),[p,o]=d.useState(!1),x=async()=>{if(r){o(!0);try{m(await t.ontologyApi.getSchema(r))}catch(i){s.message.error(i.message)}try{c(await t.ontologyApi.stats(r))}catch{c(null)}finally{o(!1)}}};if(d.useEffect(()=>{x()},[r]),!r)return e.jsx(s.Alert,{type:"warning",message:"缺少本体 ID(?id=xxx)"});const u=[{title:"类名",dataIndex:"name",key:"name",width:180},{title:"显示名",dataIndex:"label",key:"label",width:140},{title:"父类",key:"superClasses",render:(i,n)=>(t.field(n,"superClasses")||[]).join(", ")||"—"},{title:"互斥",key:"disjointWith",render:(i,n)=>(t.field(n,"disjointWith")||[]).join(", ")||"—"},{title:"描述",dataIndex:"description",ellipsis:!0}],j=[{title:"属性名",dataIndex:"name",key:"name",width:160},{title:"类型",dataIndex:"kind",key:"kind",width:100,render:i=>e.jsx(s.Tag,{children:i})},{title:"domain",dataIndex:"domain",width:120},{title:"range",dataIndex:"range",width:120},{title:"显示名",dataIndex:"label",width:120},{title:"特征",key:"traits",render:(i,n)=>e.jsxs(s.Space,{size:4,wrap:!0,children:[n.transitive?e.jsx(s.Tag,{color:"blue",children:"传递"}):null,n.symmetric?e.jsx(s.Tag,{color:"purple",children:"对称"}):null,t.field(n,"inverseOf")?e.jsxs(s.Tag,{children:["逆: ",t.field(n,"inverseOf")]}):null]})}];return e.jsx(s.Spin,{spinning:p,children:l?e.jsxs(e.Fragment,{children:[e.jsxs(s.Descriptions,{bordered:!0,size:"small",column:2,style:{marginBottom:16},children:[e.jsx(s.Descriptions.Item,{label:"本体 ID",children:l.id}),e.jsx(s.Descriptions.Item,{label:"名称",children:l.name}),e.jsx(s.Descriptions.Item,{label:"版本",children:l.version}),e.jsx(s.Descriptions.Item,{label:"更新时间",children:t.field(l,"updatedAt")||t.field(l,"createdAt")||"—"}),e.jsx(s.Descriptions.Item,{label:"描述",span:2,children:l.description||"—"}),e.jsx(s.Descriptions.Item,{label:"前缀",span:2,children:Object.entries(l.prefixes||{}).map(([i,n])=>e.jsxs(s.Tag,{children:[i," = ",n]},i))})]}),a?e.jsx(s.Card,{size:"small",title:"运行统计",style:{marginBottom:16},extra:e.jsx(s.Button,{size:"small",icon:e.jsx(f.ReloadOutlined,{}),onClick:x,children:"刷新"}),children:e.jsxs(s.Space,{size:"large",wrap:!0,children:[e.jsxs("span",{children:["类节点 ",e.jsx("b",{children:t.field(a,"classNodes")})]}),e.jsxs("span",{children:["实例节点 ",e.jsx("b",{children:t.field(a,"individualNodes")})]}),e.jsxs("span",{children:["节点总数 ",e.jsx("b",{children:t.field(a,"nodeCount")})]}),e.jsxs("span",{children:["关系总数 ",e.jsx("b",{children:t.field(a,"edgeCount")})]}),e.jsxs("span",{children:["显式陈述 ",e.jsx("b",{children:t.field(a,"explicitStatements")})]}),e.jsxs("span",{children:["推理陈述 ",e.jsx("b",{children:t.field(a,"inferredStatements")})]}),e.jsxs("span",{children:["工作空间 ",e.jsx("b",{children:t.field(a,"workspace")})]}),e.jsxs("span",{children:["最近物化 ",e.jsx("b",{children:t.field(a,"lastMaterializedAt")||"—"})]})]})}):null,e.jsx(s.Card,{size:"small",title:`类定义(${(l.classes||[]).length})`,style:{marginBottom:16},children:e.jsx(s.Table,{rowKey:i=>i.name,size:"small",columns:u,dataSource:l.classes||[],pagination:!1})}),e.jsx(s.Card,{size:"small",title:`属性定义(${(l.properties||[]).length})`,children:e.jsx(s.Table,{rowKey:i=>i.name,size:"small",columns:j,dataSource:l.properties||[],pagination:!1})})]}):e.jsx(s.Alert,{type:"info",message:"加载中或未找到该本体"})})}exports.default=y;
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { jsx as e, jsxs as n, Fragment as z } from "react/jsx-runtime";
|
|
2
|
+
import { useState as c, useEffect as C } from "react";
|
|
3
|
+
import { useSearchParams as j } from "react-router-dom";
|
|
4
|
+
import { Alert as g, Spin as v, Descriptions as s, Tag as o, Card as m, Space as f, Button as A, Table as y, message as O } from "antd";
|
|
5
|
+
import { ReloadOutlined as B } from "@ant-design/icons";
|
|
6
|
+
import { f as l, o as b } from "./api-BVrIcAFp.js";
|
|
7
|
+
function W() {
|
|
8
|
+
const [x] = j(), d = x.get("id") || "", [i, I] = c(null), [r, h] = c(null), [w, p] = c(!1), u = async () => {
|
|
9
|
+
if (d) {
|
|
10
|
+
p(!0);
|
|
11
|
+
try {
|
|
12
|
+
I(await b.getSchema(d));
|
|
13
|
+
} catch (t) {
|
|
14
|
+
O.error(t.message);
|
|
15
|
+
}
|
|
16
|
+
try {
|
|
17
|
+
h(await b.stats(d));
|
|
18
|
+
} catch {
|
|
19
|
+
h(null);
|
|
20
|
+
} finally {
|
|
21
|
+
p(!1);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
if (C(() => {
|
|
26
|
+
u();
|
|
27
|
+
}, [d]), !d)
|
|
28
|
+
return /* @__PURE__ */ e(g, { type: "warning", message: "缺少本体 ID(?id=xxx)" });
|
|
29
|
+
const S = [
|
|
30
|
+
{ title: "类名", dataIndex: "name", key: "name", width: 180 },
|
|
31
|
+
{ title: "显示名", dataIndex: "label", key: "label", width: 140 },
|
|
32
|
+
{ title: "父类", key: "superClasses", render: (t, a) => (l(a, "superClasses") || []).join(", ") || "—" },
|
|
33
|
+
{ title: "互斥", key: "disjointWith", render: (t, a) => (l(a, "disjointWith") || []).join(", ") || "—" },
|
|
34
|
+
{ title: "描述", dataIndex: "description", ellipsis: !0 }
|
|
35
|
+
], k = [
|
|
36
|
+
{ title: "属性名", dataIndex: "name", key: "name", width: 160 },
|
|
37
|
+
{ title: "类型", dataIndex: "kind", key: "kind", width: 100, render: (t) => /* @__PURE__ */ e(o, { children: t }) },
|
|
38
|
+
{ title: "domain", dataIndex: "domain", width: 120 },
|
|
39
|
+
{ title: "range", dataIndex: "range", width: 120 },
|
|
40
|
+
{ title: "显示名", dataIndex: "label", width: 120 },
|
|
41
|
+
{ title: "特征", key: "traits", render: (t, a) => /* @__PURE__ */ n(f, { size: 4, wrap: !0, children: [
|
|
42
|
+
a.transitive ? /* @__PURE__ */ e(o, { color: "blue", children: "传递" }) : null,
|
|
43
|
+
a.symmetric ? /* @__PURE__ */ e(o, { color: "purple", children: "对称" }) : null,
|
|
44
|
+
l(a, "inverseOf") ? /* @__PURE__ */ n(o, { children: [
|
|
45
|
+
"逆: ",
|
|
46
|
+
l(a, "inverseOf")
|
|
47
|
+
] }) : null
|
|
48
|
+
] }) }
|
|
49
|
+
];
|
|
50
|
+
return /* @__PURE__ */ e(v, { spinning: w, children: i ? /* @__PURE__ */ n(z, { children: [
|
|
51
|
+
/* @__PURE__ */ n(s, { bordered: !0, size: "small", column: 2, style: { marginBottom: 16 }, children: [
|
|
52
|
+
/* @__PURE__ */ e(s.Item, { label: "本体 ID", children: i.id }),
|
|
53
|
+
/* @__PURE__ */ e(s.Item, { label: "名称", children: i.name }),
|
|
54
|
+
/* @__PURE__ */ e(s.Item, { label: "版本", children: i.version }),
|
|
55
|
+
/* @__PURE__ */ e(s.Item, { label: "更新时间", children: l(i, "updatedAt") || l(i, "createdAt") || "—" }),
|
|
56
|
+
/* @__PURE__ */ e(s.Item, { label: "描述", span: 2, children: i.description || "—" }),
|
|
57
|
+
/* @__PURE__ */ e(s.Item, { label: "前缀", span: 2, children: Object.entries(i.prefixes || {}).map(([t, a]) => /* @__PURE__ */ n(o, { children: [
|
|
58
|
+
t,
|
|
59
|
+
" = ",
|
|
60
|
+
a
|
|
61
|
+
] }, t)) })
|
|
62
|
+
] }),
|
|
63
|
+
r ? /* @__PURE__ */ e(
|
|
64
|
+
m,
|
|
65
|
+
{
|
|
66
|
+
size: "small",
|
|
67
|
+
title: "运行统计",
|
|
68
|
+
style: { marginBottom: 16 },
|
|
69
|
+
extra: /* @__PURE__ */ e(A, { size: "small", icon: /* @__PURE__ */ e(B, {}), onClick: u, children: "刷新" }),
|
|
70
|
+
children: /* @__PURE__ */ n(f, { size: "large", wrap: !0, children: [
|
|
71
|
+
/* @__PURE__ */ n("span", { children: [
|
|
72
|
+
"类节点 ",
|
|
73
|
+
/* @__PURE__ */ e("b", { children: l(r, "classNodes") })
|
|
74
|
+
] }),
|
|
75
|
+
/* @__PURE__ */ n("span", { children: [
|
|
76
|
+
"实例节点 ",
|
|
77
|
+
/* @__PURE__ */ e("b", { children: l(r, "individualNodes") })
|
|
78
|
+
] }),
|
|
79
|
+
/* @__PURE__ */ n("span", { children: [
|
|
80
|
+
"节点总数 ",
|
|
81
|
+
/* @__PURE__ */ e("b", { children: l(r, "nodeCount") })
|
|
82
|
+
] }),
|
|
83
|
+
/* @__PURE__ */ n("span", { children: [
|
|
84
|
+
"关系总数 ",
|
|
85
|
+
/* @__PURE__ */ e("b", { children: l(r, "edgeCount") })
|
|
86
|
+
] }),
|
|
87
|
+
/* @__PURE__ */ n("span", { children: [
|
|
88
|
+
"显式陈述 ",
|
|
89
|
+
/* @__PURE__ */ e("b", { children: l(r, "explicitStatements") })
|
|
90
|
+
] }),
|
|
91
|
+
/* @__PURE__ */ n("span", { children: [
|
|
92
|
+
"推理陈述 ",
|
|
93
|
+
/* @__PURE__ */ e("b", { children: l(r, "inferredStatements") })
|
|
94
|
+
] }),
|
|
95
|
+
/* @__PURE__ */ n("span", { children: [
|
|
96
|
+
"工作空间 ",
|
|
97
|
+
/* @__PURE__ */ e("b", { children: l(r, "workspace") })
|
|
98
|
+
] }),
|
|
99
|
+
/* @__PURE__ */ n("span", { children: [
|
|
100
|
+
"最近物化 ",
|
|
101
|
+
/* @__PURE__ */ e("b", { children: l(r, "lastMaterializedAt") || "—" })
|
|
102
|
+
] })
|
|
103
|
+
] })
|
|
104
|
+
}
|
|
105
|
+
) : null,
|
|
106
|
+
/* @__PURE__ */ e(m, { size: "small", title: `类定义(${(i.classes || []).length})`, style: { marginBottom: 16 }, children: /* @__PURE__ */ e(
|
|
107
|
+
y,
|
|
108
|
+
{
|
|
109
|
+
rowKey: (t) => t.name,
|
|
110
|
+
size: "small",
|
|
111
|
+
columns: S,
|
|
112
|
+
dataSource: i.classes || [],
|
|
113
|
+
pagination: !1
|
|
114
|
+
}
|
|
115
|
+
) }),
|
|
116
|
+
/* @__PURE__ */ e(m, { size: "small", title: `属性定义(${(i.properties || []).length})`, children: /* @__PURE__ */ e(
|
|
117
|
+
y,
|
|
118
|
+
{
|
|
119
|
+
rowKey: (t) => t.name,
|
|
120
|
+
size: "small",
|
|
121
|
+
columns: k,
|
|
122
|
+
dataSource: i.properties || [],
|
|
123
|
+
pagination: !1
|
|
124
|
+
}
|
|
125
|
+
) })
|
|
126
|
+
] }) : /* @__PURE__ */ e(g, { type: "info", message: "加载中或未找到该本体" }) });
|
|
127
|
+
}
|
|
128
|
+
export {
|
|
129
|
+
W as default
|
|
130
|
+
};
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { jsx as e, jsxs as l, Fragment as I } from "react/jsx-runtime";
|
|
2
|
+
import { useState as d } from "react";
|
|
3
|
+
import { useSearchParams as S } from "react-router-dom";
|
|
4
|
+
import { Alert as T, Spin as j, Card as s, Space as o, Input as v, Button as z, Table as y, message as $, Tag as a } from "antd";
|
|
5
|
+
import { ThunderboltOutlined as C } from "@ant-design/icons";
|
|
6
|
+
import { f as r, o as B } from "./api-BVrIcAFp.js";
|
|
7
|
+
import { parseSnapshot as A } from "./OntologyValidatePage-WX4sAfzY.js";
|
|
8
|
+
const { TextArea: O } = v;
|
|
9
|
+
function q() {
|
|
10
|
+
const [g] = S(), c = g.get("id") || "", [m, f] = d(
|
|
11
|
+
`{
|
|
12
|
+
"individuals": [],
|
|
13
|
+
"statements": []
|
|
14
|
+
}`
|
|
15
|
+
), [n, p] = d(null), [x, h] = d(!1), b = async () => {
|
|
16
|
+
h(!0), p(null);
|
|
17
|
+
try {
|
|
18
|
+
p(await B.infer(c, A(m)));
|
|
19
|
+
} catch (t) {
|
|
20
|
+
$.error(t.message);
|
|
21
|
+
} finally {
|
|
22
|
+
h(!1);
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
if (!c)
|
|
26
|
+
return /* @__PURE__ */ e(T, { type: "warning", message: "缺少本体 ID(?id=xxx)" });
|
|
27
|
+
const w = [
|
|
28
|
+
{ title: "主体", dataIndex: "subject", key: "subject", width: 180 },
|
|
29
|
+
{ title: "谓词", dataIndex: "predicate", key: "predicate", width: 160 },
|
|
30
|
+
{ title: "客体", dataIndex: "object", key: "object", width: 180 },
|
|
31
|
+
{
|
|
32
|
+
title: "性质",
|
|
33
|
+
key: "nature",
|
|
34
|
+
width: 140,
|
|
35
|
+
render: (t, i) => /* @__PURE__ */ l(o, { size: 4, children: [
|
|
36
|
+
i.inferred ? /* @__PURE__ */ e(a, { color: "blue", children: "推理" }) : /* @__PURE__ */ e(a, { children: "显式" }),
|
|
37
|
+
i.literal ? /* @__PURE__ */ e(a, { color: "orange", children: "字面量" }) : null
|
|
38
|
+
] })
|
|
39
|
+
}
|
|
40
|
+
], k = [
|
|
41
|
+
{ title: "key", dataIndex: "key", key: "key", width: 200 },
|
|
42
|
+
{ title: "名称", dataIndex: "name", key: "name", width: 160 },
|
|
43
|
+
{
|
|
44
|
+
title: "显式类型",
|
|
45
|
+
dataIndex: "types",
|
|
46
|
+
key: "types",
|
|
47
|
+
width: 200,
|
|
48
|
+
render: (t) => (t || []).map((i) => /* @__PURE__ */ e(a, { children: i }, i))
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
title: "推理类型",
|
|
52
|
+
dataIndex: "inferredTypes",
|
|
53
|
+
key: "inferredTypes",
|
|
54
|
+
render: (t, i) => (r(i, "inferredTypes") || []).map((u) => /* @__PURE__ */ e(a, { color: "blue", children: u }, u))
|
|
55
|
+
}
|
|
56
|
+
];
|
|
57
|
+
return /* @__PURE__ */ l(j, { spinning: x, children: [
|
|
58
|
+
/* @__PURE__ */ e(s, { size: "small", title: "推理输入(OntologySnapshot)", style: { marginBottom: 16 }, children: /* @__PURE__ */ l(o, { direction: "vertical", style: { width: "100%" }, children: [
|
|
59
|
+
/* @__PURE__ */ e(
|
|
60
|
+
O,
|
|
61
|
+
{
|
|
62
|
+
rows: 10,
|
|
63
|
+
value: m,
|
|
64
|
+
onChange: (t) => f(t.target.value),
|
|
65
|
+
placeholder: '{"individuals": [], "statements": []}'
|
|
66
|
+
}
|
|
67
|
+
),
|
|
68
|
+
/* @__PURE__ */ e(z, { type: "primary", icon: /* @__PURE__ */ e(C, {}), onClick: b, children: "开始推理" })
|
|
69
|
+
] }) }),
|
|
70
|
+
n ? /* @__PURE__ */ l(I, { children: [
|
|
71
|
+
/* @__PURE__ */ e(s, { size: "small", title: "推理概览", style: { marginBottom: 16 }, children: /* @__PURE__ */ l(o, { size: "large", wrap: !0, children: [
|
|
72
|
+
/* @__PURE__ */ l("span", { children: [
|
|
73
|
+
"显式陈述 ",
|
|
74
|
+
/* @__PURE__ */ e("b", { children: r(n, "explicitStatements") })
|
|
75
|
+
] }),
|
|
76
|
+
/* @__PURE__ */ l("span", { children: [
|
|
77
|
+
"推理陈述 ",
|
|
78
|
+
/* @__PURE__ */ e("b", { children: r(n, "inferredStatements") })
|
|
79
|
+
] }),
|
|
80
|
+
/* @__PURE__ */ l("span", { children: [
|
|
81
|
+
"显式类型 ",
|
|
82
|
+
/* @__PURE__ */ e("b", { children: r(n, "explicitTypes") })
|
|
83
|
+
] }),
|
|
84
|
+
/* @__PURE__ */ l("span", { children: [
|
|
85
|
+
"推理类型 ",
|
|
86
|
+
/* @__PURE__ */ e("b", { children: r(n, "inferredTypes") })
|
|
87
|
+
] })
|
|
88
|
+
] }) }),
|
|
89
|
+
/* @__PURE__ */ e(s, { size: "small", title: `个体(${(n.individuals || []).length})`, style: { marginBottom: 16 }, children: /* @__PURE__ */ e(
|
|
90
|
+
y,
|
|
91
|
+
{
|
|
92
|
+
rowKey: "key",
|
|
93
|
+
size: "small",
|
|
94
|
+
columns: k,
|
|
95
|
+
dataSource: n.individuals || [],
|
|
96
|
+
pagination: !1
|
|
97
|
+
}
|
|
98
|
+
) }),
|
|
99
|
+
/* @__PURE__ */ e(s, { size: "small", title: `陈述(${(n.statements || []).length})`, children: /* @__PURE__ */ e(
|
|
100
|
+
y,
|
|
101
|
+
{
|
|
102
|
+
rowKey: (t, i) => `${t.subject}-${t.predicate}-${t.object}-${i}`,
|
|
103
|
+
size: "small",
|
|
104
|
+
columns: w,
|
|
105
|
+
dataSource: n.statements || [],
|
|
106
|
+
pagination: !1
|
|
107
|
+
}
|
|
108
|
+
) })
|
|
109
|
+
] }) : null
|
|
110
|
+
] });
|
|
111
|
+
}
|
|
112
|
+
export {
|
|
113
|
+
q as default
|
|
114
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),l=require("react"),g=require("react-router-dom"),t=require("antd"),f=require("@ant-design/icons"),a=require("./api-D5Hgcud4.cjs"),b=require("./OntologyValidatePage-40ZvGGH4.cjs"),{TextArea:S}=t.Input;function T(){const[h]=g.useSearchParams(),r=h.get("id")||"",[d,x]=l.useState(`{
|
|
2
|
+
"individuals": [],
|
|
3
|
+
"statements": []
|
|
4
|
+
}`),[n,o]=l.useState(null),[p,c]=l.useState(!1),y=async()=>{c(!0),o(null);try{o(await a.ontologyApi.infer(r,b.parseSnapshot(d)))}catch(s){t.message.error(s.message)}finally{c(!1)}};if(!r)return e.jsx(t.Alert,{type:"warning",message:"缺少本体 ID(?id=xxx)"});const m=[{title:"主体",dataIndex:"subject",key:"subject",width:180},{title:"谓词",dataIndex:"predicate",key:"predicate",width:160},{title:"客体",dataIndex:"object",key:"object",width:180},{title:"性质",key:"nature",width:140,render:(s,i)=>e.jsxs(t.Space,{size:4,children:[i.inferred?e.jsx(t.Tag,{color:"blue",children:"推理"}):e.jsx(t.Tag,{children:"显式"}),i.literal?e.jsx(t.Tag,{color:"orange",children:"字面量"}):null]})}],j=[{title:"key",dataIndex:"key",key:"key",width:200},{title:"名称",dataIndex:"name",key:"name",width:160},{title:"显式类型",dataIndex:"types",key:"types",width:200,render:s=>(s||[]).map(i=>e.jsx(t.Tag,{children:i},i))},{title:"推理类型",dataIndex:"inferredTypes",key:"inferredTypes",render:(s,i)=>(a.field(i,"inferredTypes")||[]).map(u=>e.jsx(t.Tag,{color:"blue",children:u},u))}];return e.jsxs(t.Spin,{spinning:p,children:[e.jsx(t.Card,{size:"small",title:"推理输入(OntologySnapshot)",style:{marginBottom:16},children:e.jsxs(t.Space,{direction:"vertical",style:{width:"100%"},children:[e.jsx(S,{rows:10,value:d,onChange:s=>x(s.target.value),placeholder:'{"individuals": [], "statements": []}'}),e.jsx(t.Button,{type:"primary",icon:e.jsx(f.ThunderboltOutlined,{}),onClick:y,children:"开始推理"})]})}),n?e.jsxs(e.Fragment,{children:[e.jsx(t.Card,{size:"small",title:"推理概览",style:{marginBottom:16},children:e.jsxs(t.Space,{size:"large",wrap:!0,children:[e.jsxs("span",{children:["显式陈述 ",e.jsx("b",{children:a.field(n,"explicitStatements")})]}),e.jsxs("span",{children:["推理陈述 ",e.jsx("b",{children:a.field(n,"inferredStatements")})]}),e.jsxs("span",{children:["显式类型 ",e.jsx("b",{children:a.field(n,"explicitTypes")})]}),e.jsxs("span",{children:["推理类型 ",e.jsx("b",{children:a.field(n,"inferredTypes")})]})]})}),e.jsx(t.Card,{size:"small",title:`个体(${(n.individuals||[]).length})`,style:{marginBottom:16},children:e.jsx(t.Table,{rowKey:"key",size:"small",columns:j,dataSource:n.individuals||[],pagination:!1})}),e.jsx(t.Card,{size:"small",title:`陈述(${(n.statements||[]).length})`,children:e.jsx(t.Table,{rowKey:(s,i)=>`${s.subject}-${s.predicate}-${s.object}-${i}`,size:"small",columns:m,dataSource:n.statements||[],pagination:!1})})]}):null]})}exports.default=T;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),r=require("react"),k=require("react-router-dom"),s=require("antd"),g=require("@ant-design/icons"),m=require("./api-D5Hgcud4.cjs"),{TextArea:p}=s.Input;function v(){const i=k.useNavigate(),[o,l]=r.useState([]),[y,h]=r.useState(!1),[j,c]=r.useState(!1),[f,x]=r.useState(!1),[d]=s.Form.useForm(),a=async()=>{h(!0);try{l(await m.ontologyApi.listSchemas())}catch(t){s.message.error(t.message)}finally{h(!1)}};r.useEffect(()=>{a()},[]);const w=async()=>{const t=await d.validateFields();x(!0);try{const n={id:t.id,name:t.name,version:t.version||"1.0.0",description:t.description||"",prefixes:t.prefixes?u(t.prefixes,"前缀"):{},classes:t.classes?u(t.classes,"类定义"):[],properties:t.properties?u(t.properties,"属性定义"):[]};await m.ontologyApi.registerSchema(n),s.message.success(`本体 ${n.id} 已登记`),c(!1),d.resetFields(),await a()}catch(n){s.message.error(n.message)}finally{x(!1)}},I=async t=>{try{await m.ontologyApi.deleteSchema(t),s.message.success(`本体 ${t} 已删除`),await a()}catch(n){s.message.error(n.message)}},S=[{title:"本体 ID",dataIndex:"id",key:"id",width:180},{title:"名称",dataIndex:"name",key:"name",width:160},{title:"版本",dataIndex:"version",key:"version",width:90,render:t=>e.jsx(s.Tag,{children:t})},{title:"类数",key:"classes",width:80,render:(t,n)=>(n.classes||[]).length},{title:"属性数",key:"properties",width:80,render:(t,n)=>(n.properties||[]).length},{title:"描述",dataIndex:"description",key:"description",ellipsis:!0},{title:"操作",key:"op",width:170,render:(t,n)=>e.jsxs(s.Space,{size:"small",children:[e.jsx(s.Button,{size:"small",type:"link",onClick:()=>i(`/ontology/detail?id=${encodeURIComponent(n.id)}`),children:"详情"}),e.jsx(s.Button,{size:"small",type:"link",onClick:()=>i(`/ontology/nodes?id=${encodeURIComponent(n.id)}`),children:"图谱"}),e.jsx(s.Popconfirm,{title:`删除本体 ${n.id}?`,onConfirm:()=>I(n.id),children:e.jsx(s.Button,{size:"small",type:"link",danger:!0,children:"删除"})})]})}];return e.jsxs("div",{children:[e.jsxs(s.Space,{style:{marginBottom:12},children:[e.jsx(s.Button,{type:"primary",icon:e.jsx(g.PlusOutlined,{}),onClick:()=>c(!0),children:"登记本体"}),e.jsx(s.Button,{icon:e.jsx(g.ReloadOutlined,{}),onClick:a,children:"刷新"}),e.jsxs("span",{style:{color:"#999",fontSize:12},children:["共 ",o.length," 个本体"]})]}),e.jsx(s.Table,{rowKey:"id",size:"small",columns:S,dataSource:o,loading:y,pagination:!1}),e.jsx(s.Modal,{title:"登记本体 Schema",open:j,onCancel:()=>c(!1),onOk:w,confirmLoading:f,width:720,destroyOnClose:!0,children:e.jsxs(s.Form,{form:d,layout:"vertical",initialValues:{version:"1.0.0"},children:[e.jsx(s.Form.Item,{name:"id",label:"本体 ID",rules:[{required:!0,message:"必填"}],children:e.jsx(s.Input,{placeholder:"如 core-ontology"})}),e.jsx(s.Form.Item,{name:"name",label:"名称",rules:[{required:!0,message:"必填"}],children:e.jsx(s.Input,{placeholder:"如 核心本体"})}),e.jsx(s.Form.Item,{name:"version",label:"版本",children:e.jsx(s.Input,{placeholder:"1.0.0"})}),e.jsx(s.Form.Item,{name:"description",label:"描述",children:e.jsx(s.Input,{placeholder:"这个本体管什么"})}),e.jsx(s.Form.Item,{name:"prefixes",label:"前缀映射(JSON)",children:e.jsx(p,{rows:2,placeholder:'{"ex": "http://example.org/"}'})}),e.jsx(s.Form.Item,{name:"classes",label:"类定义(JSON 数组)",children:e.jsx(p,{rows:4,placeholder:'[{"name":"Person","label":"人"}]'})}),e.jsx(s.Form.Item,{name:"properties",label:"属性定义(JSON 数组)",children:e.jsx(p,{rows:4,placeholder:'[{"name":"knows","kind":"OBJECT"}]'})})]})})]})}function u(i,o){try{return JSON.parse(i)}catch(l){throw new Error(`${o} 不是合法 JSON:${l.message}`)}}exports.default=v;
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { jsxs as r, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { useState as m, useEffect as J } from "react";
|
|
3
|
+
import { useNavigate as $ } from "react-router-dom";
|
|
4
|
+
import { Form as s, Space as I, Button as l, Table as z, Modal as N, Input as a, message as n, Tag as F, Popconfirm as P } from "antd";
|
|
5
|
+
import { PlusOutlined as R, ReloadOutlined as T } from "@ant-design/icons";
|
|
6
|
+
import { o as y } from "./api-BVrIcAFp.js";
|
|
7
|
+
const { TextArea: f } = a;
|
|
8
|
+
function A() {
|
|
9
|
+
const o = $(), [c, p] = m([]), [v, w] = m(!1), [x, h] = m(!1), [S, k] = m(!1), [u] = s.useForm(), d = async () => {
|
|
10
|
+
w(!0);
|
|
11
|
+
try {
|
|
12
|
+
p(await y.listSchemas());
|
|
13
|
+
} catch (t) {
|
|
14
|
+
n.error(t.message);
|
|
15
|
+
} finally {
|
|
16
|
+
w(!1);
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
J(() => {
|
|
20
|
+
d();
|
|
21
|
+
}, []);
|
|
22
|
+
const O = async () => {
|
|
23
|
+
const t = await u.validateFields();
|
|
24
|
+
k(!0);
|
|
25
|
+
try {
|
|
26
|
+
const i = {
|
|
27
|
+
id: t.id,
|
|
28
|
+
name: t.name,
|
|
29
|
+
version: t.version || "1.0.0",
|
|
30
|
+
description: t.description || "",
|
|
31
|
+
prefixes: t.prefixes ? g(t.prefixes, "前缀") : {},
|
|
32
|
+
classes: t.classes ? g(t.classes, "类定义") : [],
|
|
33
|
+
properties: t.properties ? g(t.properties, "属性定义") : []
|
|
34
|
+
};
|
|
35
|
+
await y.registerSchema(i), n.success(`本体 ${i.id} 已登记`), h(!1), u.resetFields(), await d();
|
|
36
|
+
} catch (i) {
|
|
37
|
+
n.error(i.message);
|
|
38
|
+
} finally {
|
|
39
|
+
k(!1);
|
|
40
|
+
}
|
|
41
|
+
}, b = async (t) => {
|
|
42
|
+
try {
|
|
43
|
+
await y.deleteSchema(t), n.success(`本体 ${t} 已删除`), await d();
|
|
44
|
+
} catch (i) {
|
|
45
|
+
n.error(i.message);
|
|
46
|
+
}
|
|
47
|
+
}, C = [
|
|
48
|
+
{ title: "本体 ID", dataIndex: "id", key: "id", width: 180 },
|
|
49
|
+
{ title: "名称", dataIndex: "name", key: "name", width: 160 },
|
|
50
|
+
{ title: "版本", dataIndex: "version", key: "version", width: 90, render: (t) => /* @__PURE__ */ e(F, { children: t }) },
|
|
51
|
+
{ title: "类数", key: "classes", width: 80, render: (t, i) => (i.classes || []).length },
|
|
52
|
+
{ title: "属性数", key: "properties", width: 80, render: (t, i) => (i.properties || []).length },
|
|
53
|
+
{ title: "描述", dataIndex: "description", key: "description", ellipsis: !0 },
|
|
54
|
+
{
|
|
55
|
+
title: "操作",
|
|
56
|
+
key: "op",
|
|
57
|
+
width: 170,
|
|
58
|
+
render: (t, i) => /* @__PURE__ */ r(I, { size: "small", children: [
|
|
59
|
+
/* @__PURE__ */ e(l, { size: "small", type: "link", onClick: () => o(`/ontology/detail?id=${encodeURIComponent(i.id)}`), children: "详情" }),
|
|
60
|
+
/* @__PURE__ */ e(l, { size: "small", type: "link", onClick: () => o(`/ontology/nodes?id=${encodeURIComponent(i.id)}`), children: "图谱" }),
|
|
61
|
+
/* @__PURE__ */ e(P, { title: `删除本体 ${i.id}?`, onConfirm: () => b(i.id), children: /* @__PURE__ */ e(l, { size: "small", type: "link", danger: !0, children: "删除" }) })
|
|
62
|
+
] })
|
|
63
|
+
}
|
|
64
|
+
];
|
|
65
|
+
return /* @__PURE__ */ r("div", { children: [
|
|
66
|
+
/* @__PURE__ */ r(I, { style: { marginBottom: 12 }, children: [
|
|
67
|
+
/* @__PURE__ */ e(l, { type: "primary", icon: /* @__PURE__ */ e(R, {}), onClick: () => h(!0), children: "登记本体" }),
|
|
68
|
+
/* @__PURE__ */ e(l, { icon: /* @__PURE__ */ e(T, {}), onClick: d, children: "刷新" }),
|
|
69
|
+
/* @__PURE__ */ r("span", { style: { color: "#999", fontSize: 12 }, children: [
|
|
70
|
+
"共 ",
|
|
71
|
+
c.length,
|
|
72
|
+
" 个本体"
|
|
73
|
+
] })
|
|
74
|
+
] }),
|
|
75
|
+
/* @__PURE__ */ e(
|
|
76
|
+
z,
|
|
77
|
+
{
|
|
78
|
+
rowKey: "id",
|
|
79
|
+
size: "small",
|
|
80
|
+
columns: C,
|
|
81
|
+
dataSource: c,
|
|
82
|
+
loading: v,
|
|
83
|
+
pagination: !1
|
|
84
|
+
}
|
|
85
|
+
),
|
|
86
|
+
/* @__PURE__ */ e(
|
|
87
|
+
N,
|
|
88
|
+
{
|
|
89
|
+
title: "登记本体 Schema",
|
|
90
|
+
open: x,
|
|
91
|
+
onCancel: () => h(!1),
|
|
92
|
+
onOk: O,
|
|
93
|
+
confirmLoading: S,
|
|
94
|
+
width: 720,
|
|
95
|
+
destroyOnClose: !0,
|
|
96
|
+
children: /* @__PURE__ */ r(s, { form: u, layout: "vertical", initialValues: { version: "1.0.0" }, children: [
|
|
97
|
+
/* @__PURE__ */ e(s.Item, { name: "id", label: "本体 ID", rules: [{ required: !0, message: "必填" }], children: /* @__PURE__ */ e(a, { placeholder: "如 core-ontology" }) }),
|
|
98
|
+
/* @__PURE__ */ e(s.Item, { name: "name", label: "名称", rules: [{ required: !0, message: "必填" }], children: /* @__PURE__ */ e(a, { placeholder: "如 核心本体" }) }),
|
|
99
|
+
/* @__PURE__ */ e(s.Item, { name: "version", label: "版本", children: /* @__PURE__ */ e(a, { placeholder: "1.0.0" }) }),
|
|
100
|
+
/* @__PURE__ */ e(s.Item, { name: "description", label: "描述", children: /* @__PURE__ */ e(a, { placeholder: "这个本体管什么" }) }),
|
|
101
|
+
/* @__PURE__ */ e(s.Item, { name: "prefixes", label: "前缀映射(JSON)", children: /* @__PURE__ */ e(f, { rows: 2, placeholder: '{"ex": "http://example.org/"}' }) }),
|
|
102
|
+
/* @__PURE__ */ e(s.Item, { name: "classes", label: "类定义(JSON 数组)", children: /* @__PURE__ */ e(f, { rows: 4, placeholder: '[{"name":"Person","label":"人"}]' }) }),
|
|
103
|
+
/* @__PURE__ */ e(s.Item, { name: "properties", label: "属性定义(JSON 数组)", children: /* @__PURE__ */ e(f, { rows: 4, placeholder: '[{"name":"knows","kind":"OBJECT"}]' }) })
|
|
104
|
+
] })
|
|
105
|
+
}
|
|
106
|
+
)
|
|
107
|
+
] });
|
|
108
|
+
}
|
|
109
|
+
function g(o, c) {
|
|
110
|
+
try {
|
|
111
|
+
return JSON.parse(o);
|
|
112
|
+
} catch (p) {
|
|
113
|
+
throw new Error(`${c} 不是合法 JSON:${p.message}`);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
export {
|
|
117
|
+
A as default
|
|
118
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),n=require("react"),D=require("react-router-dom"),s=require("antd"),z=require("@ant-design/icons"),l=require("./api-D5Hgcud4.cjs"),C=require("./OntologyValidatePage-40ZvGGH4.cjs"),{TextArea:q}=s.Input;function A(){var x;const[j]=D.useSearchParams(),r=j.get("id")||"",[a,f]=n.useState("source"),[c,y]=n.useState("default"),[o,u]=n.useState(""),[p,S]=n.useState(`{
|
|
2
|
+
"individuals": [],
|
|
3
|
+
"statements": []
|
|
4
|
+
}`),[v,h]=n.useState([]),[i,d]=n.useState(null),[b,m]=n.useState(!1);n.useEffect(()=>{r&&l.ontologyApi.listSources().then(h).catch(()=>h([]))},[r]);const I=async()=>{m(!0),d(null);try{if(a==="source"){if(!o.trim()){s.message.warning("按来源物化需要指定 source");return}d(await l.ontologyApi.materialize(r,o.trim(),c))}else d(await l.ontologyApi.materializeInline(r,C.parseSnapshot(p),c))}catch(t){s.message.error(t.message)}finally{m(!1)}};if(!r)return e.jsx(s.Alert,{type:"warning",message:"缺少本体 ID(?id=xxx)"});const g=((x=i==null?void 0:i.validation)==null?void 0:x.issues)||[];return e.jsxs(s.Spin,{spinning:b,children:[e.jsx(s.Card,{size:"small",title:"物化输入",style:{marginBottom:16},children:e.jsxs(s.Space,{direction:"vertical",style:{width:"100%"},size:12,children:[e.jsxs(s.Space,{wrap:!0,children:[e.jsx(s.Select,{style:{width:200},value:a,onChange:f,options:[{value:"source",label:"按来源物化"},{value:"inline",label:"内联快照物化"}]}),e.jsx(s.Input,{style:{width:220},placeholder:"工作空间",value:c,onChange:t=>y(t.target.value)}),a==="source"?e.jsx(s.Select,{style:{width:280},placeholder:"选择数据源",value:o||void 0,onChange:u,showSearch:!0,options:v.map(t=>({value:t.id,label:t.description?`${t.id} — ${t.description}`:t.id})),notFoundContent:null}):null,e.jsx(s.Button,{type:"primary",icon:e.jsx(z.DatabaseOutlined,{}),onClick:I,children:"执行物化"})]}),a==="source"?e.jsx(s.Input,{style:{width:420},placeholder:"source ID(可直接输入)",value:o,onChange:t=>u(t.target.value)}):e.jsx(q,{rows:10,value:p,onChange:t=>S(t.target.value),placeholder:'{"individuals": [], "statements": []}'})]})}),i?e.jsxs(s.Card,{size:"small",title:"物化报告",children:[e.jsxs(s.Descriptions,{bordered:!0,size:"small",column:2,style:{marginBottom:12},children:[e.jsx(s.Descriptions.Item,{label:"本体",children:l.field(i,"ontologyId")}),e.jsx(s.Descriptions.Item,{label:"工作空间",children:l.field(i,"workspace")}),e.jsx(s.Descriptions.Item,{label:"来源",children:l.field(i,"sourceId")||"(内联)"}),e.jsxs(s.Descriptions.Item,{label:"耗时",children:[l.field(i,"durationMs")," ms"]}),e.jsx(s.Descriptions.Item,{label:"类节点",children:l.field(i,"classNodes")}),e.jsx(s.Descriptions.Item,{label:"实例节点",children:l.field(i,"individualNodes")}),e.jsx(s.Descriptions.Item,{label:"边",children:l.field(i,"edges")}),e.jsx(s.Descriptions.Item,{label:"物化时间",children:l.field(i,"materializedAt")||"—"})]}),e.jsxs(s.Space,{size:"large",wrap:!0,style:{marginBottom:8},children:[e.jsxs("span",{children:["显式陈述 ",e.jsx("b",{children:l.field(i,"explicitStatements")})]}),e.jsxs("span",{children:["推理陈述 ",e.jsx("b",{children:l.field(i,"inferredStatements")})]})]}),g.length?e.jsx("div",{children:g.map((t,w)=>e.jsxs(s.Tag,{color:t.severity==="ERROR"?"red":"orange",children:[t.code," ",t.message]},w))}):e.jsx(s.Tag,{color:"green",children:"物化通过,无校验问题"})]}):null]})}exports.default=A;
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { jsx as e, jsxs as r } from "react/jsx-runtime";
|
|
2
|
+
import { useState as i, useEffect as j } from "react";
|
|
3
|
+
import { useSearchParams as E } from "react-router-dom";
|
|
4
|
+
import { Alert as N, Spin as P, Card as I, Space as m, Select as S, Input as p, Button as T, Descriptions as a, Tag as z, message as x } from "antd";
|
|
5
|
+
import { DatabaseOutlined as $ } from "@ant-design/icons";
|
|
6
|
+
import { o as h, f as n } from "./api-BVrIcAFp.js";
|
|
7
|
+
import { parseSnapshot as F } from "./OntologyValidatePage-WX4sAfzY.js";
|
|
8
|
+
const { TextArea: L } = p;
|
|
9
|
+
function U() {
|
|
10
|
+
var w;
|
|
11
|
+
const [C] = E(), o = C.get("id") || "", [s, k] = i("source"), [d, A] = i("default"), [c, g] = i(""), [f, B] = i(`{
|
|
12
|
+
"individuals": [],
|
|
13
|
+
"statements": []
|
|
14
|
+
}`), [D, v] = i([]), [l, u] = i(null), [R, y] = i(!1);
|
|
15
|
+
j(() => {
|
|
16
|
+
o && h.listSources().then(v).catch(() => v([]));
|
|
17
|
+
}, [o]);
|
|
18
|
+
const M = async () => {
|
|
19
|
+
y(!0), u(null);
|
|
20
|
+
try {
|
|
21
|
+
if (s === "source") {
|
|
22
|
+
if (!c.trim()) {
|
|
23
|
+
x.warning("按来源物化需要指定 source");
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
u(await h.materialize(o, c.trim(), d));
|
|
27
|
+
} else
|
|
28
|
+
u(await h.materializeInline(o, F(f), d));
|
|
29
|
+
} catch (t) {
|
|
30
|
+
x.error(t.message);
|
|
31
|
+
} finally {
|
|
32
|
+
y(!1);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
if (!o)
|
|
36
|
+
return /* @__PURE__ */ e(N, { type: "warning", message: "缺少本体 ID(?id=xxx)" });
|
|
37
|
+
const b = ((w = l == null ? void 0 : l.validation) == null ? void 0 : w.issues) || [];
|
|
38
|
+
return /* @__PURE__ */ r(P, { spinning: R, children: [
|
|
39
|
+
/* @__PURE__ */ e(I, { size: "small", title: "物化输入", style: { marginBottom: 16 }, children: /* @__PURE__ */ r(m, { direction: "vertical", style: { width: "100%" }, size: 12, children: [
|
|
40
|
+
/* @__PURE__ */ r(m, { wrap: !0, children: [
|
|
41
|
+
/* @__PURE__ */ e(
|
|
42
|
+
S,
|
|
43
|
+
{
|
|
44
|
+
style: { width: 200 },
|
|
45
|
+
value: s,
|
|
46
|
+
onChange: k,
|
|
47
|
+
options: [
|
|
48
|
+
{ value: "source", label: "按来源物化" },
|
|
49
|
+
{ value: "inline", label: "内联快照物化" }
|
|
50
|
+
]
|
|
51
|
+
}
|
|
52
|
+
),
|
|
53
|
+
/* @__PURE__ */ e(
|
|
54
|
+
p,
|
|
55
|
+
{
|
|
56
|
+
style: { width: 220 },
|
|
57
|
+
placeholder: "工作空间",
|
|
58
|
+
value: d,
|
|
59
|
+
onChange: (t) => A(t.target.value)
|
|
60
|
+
}
|
|
61
|
+
),
|
|
62
|
+
s === "source" ? /* @__PURE__ */ e(
|
|
63
|
+
S,
|
|
64
|
+
{
|
|
65
|
+
style: { width: 280 },
|
|
66
|
+
placeholder: "选择数据源",
|
|
67
|
+
value: c || void 0,
|
|
68
|
+
onChange: g,
|
|
69
|
+
showSearch: !0,
|
|
70
|
+
options: D.map((t) => ({ value: t.id, label: t.description ? `${t.id} — ${t.description}` : t.id })),
|
|
71
|
+
notFoundContent: null
|
|
72
|
+
}
|
|
73
|
+
) : null,
|
|
74
|
+
/* @__PURE__ */ e(T, { type: "primary", icon: /* @__PURE__ */ e($, {}), onClick: M, children: "执行物化" })
|
|
75
|
+
] }),
|
|
76
|
+
s === "source" ? /* @__PURE__ */ e(
|
|
77
|
+
p,
|
|
78
|
+
{
|
|
79
|
+
style: { width: 420 },
|
|
80
|
+
placeholder: "source ID(可直接输入)",
|
|
81
|
+
value: c,
|
|
82
|
+
onChange: (t) => g(t.target.value)
|
|
83
|
+
}
|
|
84
|
+
) : /* @__PURE__ */ e(
|
|
85
|
+
L,
|
|
86
|
+
{
|
|
87
|
+
rows: 10,
|
|
88
|
+
value: f,
|
|
89
|
+
onChange: (t) => B(t.target.value),
|
|
90
|
+
placeholder: '{"individuals": [], "statements": []}'
|
|
91
|
+
}
|
|
92
|
+
)
|
|
93
|
+
] }) }),
|
|
94
|
+
l ? /* @__PURE__ */ r(I, { size: "small", title: "物化报告", children: [
|
|
95
|
+
/* @__PURE__ */ r(a, { bordered: !0, size: "small", column: 2, style: { marginBottom: 12 }, children: [
|
|
96
|
+
/* @__PURE__ */ e(a.Item, { label: "本体", children: n(l, "ontologyId") }),
|
|
97
|
+
/* @__PURE__ */ e(a.Item, { label: "工作空间", children: n(l, "workspace") }),
|
|
98
|
+
/* @__PURE__ */ e(a.Item, { label: "来源", children: n(l, "sourceId") || "(内联)" }),
|
|
99
|
+
/* @__PURE__ */ r(a.Item, { label: "耗时", children: [
|
|
100
|
+
n(l, "durationMs"),
|
|
101
|
+
" ms"
|
|
102
|
+
] }),
|
|
103
|
+
/* @__PURE__ */ e(a.Item, { label: "类节点", children: n(l, "classNodes") }),
|
|
104
|
+
/* @__PURE__ */ e(a.Item, { label: "实例节点", children: n(l, "individualNodes") }),
|
|
105
|
+
/* @__PURE__ */ e(a.Item, { label: "边", children: n(l, "edges") }),
|
|
106
|
+
/* @__PURE__ */ e(a.Item, { label: "物化时间", children: n(l, "materializedAt") || "—" })
|
|
107
|
+
] }),
|
|
108
|
+
/* @__PURE__ */ r(m, { size: "large", wrap: !0, style: { marginBottom: 8 }, children: [
|
|
109
|
+
/* @__PURE__ */ r("span", { children: [
|
|
110
|
+
"显式陈述 ",
|
|
111
|
+
/* @__PURE__ */ e("b", { children: n(l, "explicitStatements") })
|
|
112
|
+
] }),
|
|
113
|
+
/* @__PURE__ */ r("span", { children: [
|
|
114
|
+
"推理陈述 ",
|
|
115
|
+
/* @__PURE__ */ e("b", { children: n(l, "inferredStatements") })
|
|
116
|
+
] })
|
|
117
|
+
] }),
|
|
118
|
+
b.length ? /* @__PURE__ */ e("div", { children: b.map((t, O) => /* @__PURE__ */ r(z, { color: t.severity === "ERROR" ? "red" : "orange", children: [
|
|
119
|
+
t.code,
|
|
120
|
+
" ",
|
|
121
|
+
t.message
|
|
122
|
+
] }, O)) }) : /* @__PURE__ */ e(z, { color: "green", children: "物化通过,无校验问题" })
|
|
123
|
+
] }) : null
|
|
124
|
+
] });
|
|
125
|
+
}
|
|
126
|
+
export {
|
|
127
|
+
U as default
|
|
128
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),l=require("react"),f=require("react-router-dom"),s=require("antd"),S=require("@ant-design/icons"),p=require("./api-D5Hgcud4.cjs");function k(){const[m]=f.useSearchParams(),n=m.get("id")||"",[i,x]=l.useState("default"),[o,c]=l.useState([]),[d,u]=l.useState([]),[h,y]=l.useState(!1),r=async(a=i)=>{if(n){y(!0);try{c(await p.ontologyApi.listClasses(n,a))}catch(t){s.message.error(`类列表取数失败:${t.message}`),c([])}try{u(await p.ontologyApi.listIndividuals(n,a))}catch(t){s.message.error(`实例列表取数失败:${t.message}`),u([])}finally{y(!1)}}};l.useEffect(()=>{r("default")},[n]);const g=[{title:"key",dataIndex:"key",key:"key",width:240},{title:"标签",dataIndex:"labels",key:"labels",width:200,render:a=>(a||[]).map(t=>e.jsx(s.Tag,{children:t},t))},{title:"属性",dataIndex:"properties",key:"properties",render:a=>e.jsx(s.Space,{size:4,wrap:!0,children:Object.entries(a||{}).map(([t,j])=>e.jsxs(s.Tag,{color:"default",children:[t,"=",String(j)]},t))})}];return n?e.jsxs(s.Spin,{spinning:h,children:[e.jsxs(s.Space,{style:{marginBottom:12},children:[e.jsx(s.Input,{style:{width:220},placeholder:"工作空间(默认 default)",value:i,onChange:a=>x(a.target.value),onPressEnter:()=>r()}),e.jsx(s.Button,{type:"primary",icon:e.jsx(S.ReloadOutlined,{}),onClick:()=>r(),children:"刷新"}),e.jsxs("span",{style:{color:"#999",fontSize:12},children:["本体 ",n]})]}),e.jsx(s.Tabs,{items:[{key:"classes",label:`类(${o.length})`,children:e.jsx(s.Card,{size:"small",children:e.jsx(s.Table,{rowKey:"key",size:"small",columns:g,dataSource:o,pagination:!1})})},{key:"individuals",label:`实例(${d.length})`,children:e.jsx(s.Card,{size:"small",children:e.jsx(s.Table,{rowKey:"key",size:"small",columns:g,dataSource:d,pagination:!1})})}]})]}):e.jsx(s.Alert,{type:"warning",message:"缺少本体 ID(?id=xxx)"})}exports.default=k;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { jsx as e, jsxs as l } from "react/jsx-runtime";
|
|
2
|
+
import { useState as r, useEffect as v } from "react";
|
|
3
|
+
import { useSearchParams as z } from "react-router-dom";
|
|
4
|
+
import { Alert as C, Spin as $, Space as y, Input as j, Button as O, Tabs as P, Card as f, Table as g, message as h, Tag as k } from "antd";
|
|
5
|
+
import { ReloadOutlined as T } from "@ant-design/icons";
|
|
6
|
+
import { o as w } from "./api-BVrIcAFp.js";
|
|
7
|
+
function N() {
|
|
8
|
+
const [x] = z(), s = x.get("id") || "", [n, I] = r("default"), [o, d] = r([]), [c, m] = r([]), [S, p] = r(!1), i = async (a = n) => {
|
|
9
|
+
if (s) {
|
|
10
|
+
p(!0);
|
|
11
|
+
try {
|
|
12
|
+
d(await w.listClasses(s, a));
|
|
13
|
+
} catch (t) {
|
|
14
|
+
h.error(`类列表取数失败:${t.message}`), d([]);
|
|
15
|
+
}
|
|
16
|
+
try {
|
|
17
|
+
m(await w.listIndividuals(s, a));
|
|
18
|
+
} catch (t) {
|
|
19
|
+
h.error(`实例列表取数失败:${t.message}`), m([]);
|
|
20
|
+
} finally {
|
|
21
|
+
p(!1);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
v(() => {
|
|
26
|
+
i("default");
|
|
27
|
+
}, [s]);
|
|
28
|
+
const u = [
|
|
29
|
+
{ title: "key", dataIndex: "key", key: "key", width: 240 },
|
|
30
|
+
{
|
|
31
|
+
title: "标签",
|
|
32
|
+
dataIndex: "labels",
|
|
33
|
+
key: "labels",
|
|
34
|
+
width: 200,
|
|
35
|
+
render: (a) => (a || []).map((t) => /* @__PURE__ */ e(k, { children: t }, t))
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
title: "属性",
|
|
39
|
+
dataIndex: "properties",
|
|
40
|
+
key: "properties",
|
|
41
|
+
render: (a) => /* @__PURE__ */ e(y, { size: 4, wrap: !0, children: Object.entries(a || {}).map(([t, b]) => /* @__PURE__ */ l(k, { color: "default", children: [
|
|
42
|
+
t,
|
|
43
|
+
"=",
|
|
44
|
+
String(b)
|
|
45
|
+
] }, t)) })
|
|
46
|
+
}
|
|
47
|
+
];
|
|
48
|
+
return s ? /* @__PURE__ */ l($, { spinning: S, children: [
|
|
49
|
+
/* @__PURE__ */ l(y, { style: { marginBottom: 12 }, children: [
|
|
50
|
+
/* @__PURE__ */ e(
|
|
51
|
+
j,
|
|
52
|
+
{
|
|
53
|
+
style: { width: 220 },
|
|
54
|
+
placeholder: "工作空间(默认 default)",
|
|
55
|
+
value: n,
|
|
56
|
+
onChange: (a) => I(a.target.value),
|
|
57
|
+
onPressEnter: () => i()
|
|
58
|
+
}
|
|
59
|
+
),
|
|
60
|
+
/* @__PURE__ */ e(O, { type: "primary", icon: /* @__PURE__ */ e(T, {}), onClick: () => i(), children: "刷新" }),
|
|
61
|
+
/* @__PURE__ */ l("span", { style: { color: "#999", fontSize: 12 }, children: [
|
|
62
|
+
"本体 ",
|
|
63
|
+
s
|
|
64
|
+
] })
|
|
65
|
+
] }),
|
|
66
|
+
/* @__PURE__ */ e(
|
|
67
|
+
P,
|
|
68
|
+
{
|
|
69
|
+
items: [
|
|
70
|
+
{
|
|
71
|
+
key: "classes",
|
|
72
|
+
label: `类(${o.length})`,
|
|
73
|
+
children: /* @__PURE__ */ e(f, { size: "small", children: /* @__PURE__ */ e(
|
|
74
|
+
g,
|
|
75
|
+
{
|
|
76
|
+
rowKey: "key",
|
|
77
|
+
size: "small",
|
|
78
|
+
columns: u,
|
|
79
|
+
dataSource: o,
|
|
80
|
+
pagination: !1
|
|
81
|
+
}
|
|
82
|
+
) })
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
key: "individuals",
|
|
86
|
+
label: `实例(${c.length})`,
|
|
87
|
+
children: /* @__PURE__ */ e(f, { size: "small", children: /* @__PURE__ */ e(
|
|
88
|
+
g,
|
|
89
|
+
{
|
|
90
|
+
rowKey: "key",
|
|
91
|
+
size: "small",
|
|
92
|
+
columns: u,
|
|
93
|
+
dataSource: c,
|
|
94
|
+
pagination: !1
|
|
95
|
+
}
|
|
96
|
+
) })
|
|
97
|
+
}
|
|
98
|
+
]
|
|
99
|
+
}
|
|
100
|
+
)
|
|
101
|
+
] }) : /* @__PURE__ */ e(C, { type: "warning", message: "缺少本体 ID(?id=xxx)" });
|
|
102
|
+
}
|
|
103
|
+
export {
|
|
104
|
+
N as default
|
|
105
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),n=require("react"),k=require("react-router-dom"),s=require("antd"),O=require("@ant-design/icons"),o=require("./api-D5Hgcud4.cjs"),{TextArea:R}=s.Input,A={ERROR:"red",WARNING:"orange",INFO:"blue"};function q(){const[u]=k.useSearchParams(),a=u.get("id")||"",[i,S]=n.useState("source"),[h,j]=n.useState("default"),[l,p]=n.useState(""),[g,w]=n.useState(`{
|
|
2
|
+
"individuals": [],
|
|
3
|
+
"statements": []
|
|
4
|
+
}`),[f,x]=n.useState([]),[r,d]=n.useState(null),[v,y]=n.useState(!1);n.useEffect(()=>{a&&o.ontologyApi.listSources().then(x).catch(()=>x([]))},[a]);const C=async()=>{y(!0),d(null);try{if(i==="source"){if(!l.trim()){s.message.warning("按来源校验需要指定 source");return}d(await o.ontologyApi.validateSource(a,l.trim(),h))}else d(await o.ontologyApi.validate(a,m(g)))}catch(t){s.message.error(t.message)}finally{y(!1)}},I=[{title:"级别",dataIndex:"severity",key:"severity",width:90,render:t=>e.jsx(s.Tag,{color:A[t]||"default",children:t})},{title:"编码",dataIndex:"code",key:"code",width:160},{title:"主体",dataIndex:"subject",key:"subject",width:160},{title:"谓词",dataIndex:"predicate",key:"predicate",width:140},{title:"说明",dataIndex:"message",key:"message"}];if(!a)return e.jsx(s.Alert,{type:"warning",message:"缺少本体 ID(?id=xxx)"});const c=(r==null?void 0:r.issues)||[];return e.jsxs(s.Spin,{spinning:v,children:[e.jsx(s.Card,{size:"small",style:{marginBottom:16},children:e.jsxs(s.Space,{direction:"vertical",style:{width:"100%"},size:12,children:[e.jsxs(s.Space,{wrap:!0,children:[e.jsx(s.Select,{style:{width:180},value:i,onChange:S,options:[{value:"source",label:"按来源校验"},{value:"inline",label:"内联快照校验"}]}),e.jsx(s.Input,{style:{width:220},placeholder:"工作空间",value:h,onChange:t=>j(t.target.value)}),i==="source"?e.jsx(s.Select,{style:{width:280},placeholder:"选择或输入数据源",value:l||void 0,onChange:p,showSearch:!0,options:f.map(t=>({value:t.id,label:t.description?`${t.id} — ${t.description}`:t.id})),notFoundContent:null}):null,e.jsx(s.Button,{type:"primary",icon:e.jsx(O.CheckCircleOutlined,{}),onClick:C,children:"执行校验"})]}),i==="source"?e.jsx(s.Input,{style:{width:420},placeholder:"source ID(可直接输入)",value:l,onChange:t=>p(t.target.value)}):e.jsx(R,{rows:10,value:g,onChange:t=>w(t.target.value),placeholder:'{"individuals": [], "statements": []}'})]})}),r?e.jsxs(s.Card,{size:"small",title:`校验结果(${c.length} 条问题)`,children:[e.jsxs(s.Space,{size:"large",wrap:!0,style:{marginBottom:c.length?12:0},children:[e.jsxs("span",{children:["错误 ",e.jsx("b",{children:o.field(r,"errorCount","error_count")})]}),e.jsxs("span",{children:["警告 ",e.jsx("b",{children:o.field(r,"warningCount","warning_count")})]}),e.jsxs("span",{children:["提示 ",e.jsx("b",{children:o.field(r,"infoCount","info_count")})]})]}),c.length===0?e.jsx(s.Alert,{type:"success",message:"校验通过,未发现问题"}):e.jsx(s.Table,{rowKey:(t,b)=>`${t.code}-${b}`,size:"small",columns:I,dataSource:c,pagination:!1})]}):null]})}function m(u){try{return JSON.parse(u)}catch(a){throw new Error(`快照不是合法 JSON:${a.message}`)}}exports.default=q;exports.parseSnapshot=m;
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
2
|
+
import { useState as s, useEffect as j } from "react";
|
|
3
|
+
import { useSearchParams as A } from "react-router-dom";
|
|
4
|
+
import { Alert as S, Spin as T, Card as C, Space as u, Select as x, Input as g, Button as _, Table as B, message as I, Tag as D } from "antd";
|
|
5
|
+
import { CheckCircleOutlined as F } from "@ant-design/icons";
|
|
6
|
+
import { o as h, f as p } from "./api-BVrIcAFp.js";
|
|
7
|
+
const { TextArea: J } = g, L = { ERROR: "red", WARNING: "orange", INFO: "blue" };
|
|
8
|
+
function q() {
|
|
9
|
+
const [c] = A(), a = c.get("id") || "", [o, b] = s("source"), [m, k] = s("default"), [i, y] = s(""), [f, O] = s(`{
|
|
10
|
+
"individuals": [],
|
|
11
|
+
"statements": []
|
|
12
|
+
}`), [R, w] = s([]), [r, d] = s(null), [$, v] = s(!1);
|
|
13
|
+
j(() => {
|
|
14
|
+
a && h.listSources().then(w).catch(() => w([]));
|
|
15
|
+
}, [a]);
|
|
16
|
+
const z = async () => {
|
|
17
|
+
v(!0), d(null);
|
|
18
|
+
try {
|
|
19
|
+
if (o === "source") {
|
|
20
|
+
if (!i.trim()) {
|
|
21
|
+
I.warning("按来源校验需要指定 source");
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
d(await h.validateSource(a, i.trim(), m));
|
|
25
|
+
} else
|
|
26
|
+
d(await h.validate(a, P(f)));
|
|
27
|
+
} catch (e) {
|
|
28
|
+
I.error(e.message);
|
|
29
|
+
} finally {
|
|
30
|
+
v(!1);
|
|
31
|
+
}
|
|
32
|
+
}, E = [
|
|
33
|
+
{ title: "级别", dataIndex: "severity", key: "severity", width: 90, render: (e) => /* @__PURE__ */ t(D, { color: L[e] || "default", children: e }) },
|
|
34
|
+
{ title: "编码", dataIndex: "code", key: "code", width: 160 },
|
|
35
|
+
{ title: "主体", dataIndex: "subject", key: "subject", width: 160 },
|
|
36
|
+
{ title: "谓词", dataIndex: "predicate", key: "predicate", width: 140 },
|
|
37
|
+
{ title: "说明", dataIndex: "message", key: "message" }
|
|
38
|
+
];
|
|
39
|
+
if (!a)
|
|
40
|
+
return /* @__PURE__ */ t(S, { type: "warning", message: "缺少本体 ID(?id=xxx)" });
|
|
41
|
+
const l = (r == null ? void 0 : r.issues) || [];
|
|
42
|
+
return /* @__PURE__ */ n(T, { spinning: $, children: [
|
|
43
|
+
/* @__PURE__ */ t(C, { size: "small", style: { marginBottom: 16 }, children: /* @__PURE__ */ n(u, { direction: "vertical", style: { width: "100%" }, size: 12, children: [
|
|
44
|
+
/* @__PURE__ */ n(u, { wrap: !0, children: [
|
|
45
|
+
/* @__PURE__ */ t(
|
|
46
|
+
x,
|
|
47
|
+
{
|
|
48
|
+
style: { width: 180 },
|
|
49
|
+
value: o,
|
|
50
|
+
onChange: b,
|
|
51
|
+
options: [
|
|
52
|
+
{ value: "source", label: "按来源校验" },
|
|
53
|
+
{ value: "inline", label: "内联快照校验" }
|
|
54
|
+
]
|
|
55
|
+
}
|
|
56
|
+
),
|
|
57
|
+
/* @__PURE__ */ t(
|
|
58
|
+
g,
|
|
59
|
+
{
|
|
60
|
+
style: { width: 220 },
|
|
61
|
+
placeholder: "工作空间",
|
|
62
|
+
value: m,
|
|
63
|
+
onChange: (e) => k(e.target.value)
|
|
64
|
+
}
|
|
65
|
+
),
|
|
66
|
+
o === "source" ? /* @__PURE__ */ t(
|
|
67
|
+
x,
|
|
68
|
+
{
|
|
69
|
+
style: { width: 280 },
|
|
70
|
+
placeholder: "选择或输入数据源",
|
|
71
|
+
value: i || void 0,
|
|
72
|
+
onChange: y,
|
|
73
|
+
showSearch: !0,
|
|
74
|
+
options: R.map((e) => ({ value: e.id, label: e.description ? `${e.id} — ${e.description}` : e.id })),
|
|
75
|
+
notFoundContent: null
|
|
76
|
+
}
|
|
77
|
+
) : null,
|
|
78
|
+
/* @__PURE__ */ t(_, { type: "primary", icon: /* @__PURE__ */ t(F, {}), onClick: z, children: "执行校验" })
|
|
79
|
+
] }),
|
|
80
|
+
o === "source" ? /* @__PURE__ */ t(
|
|
81
|
+
g,
|
|
82
|
+
{
|
|
83
|
+
style: { width: 420 },
|
|
84
|
+
placeholder: "source ID(可直接输入)",
|
|
85
|
+
value: i,
|
|
86
|
+
onChange: (e) => y(e.target.value)
|
|
87
|
+
}
|
|
88
|
+
) : /* @__PURE__ */ t(
|
|
89
|
+
J,
|
|
90
|
+
{
|
|
91
|
+
rows: 10,
|
|
92
|
+
value: f,
|
|
93
|
+
onChange: (e) => O(e.target.value),
|
|
94
|
+
placeholder: '{"individuals": [], "statements": []}'
|
|
95
|
+
}
|
|
96
|
+
)
|
|
97
|
+
] }) }),
|
|
98
|
+
r ? /* @__PURE__ */ n(C, { size: "small", title: `校验结果(${l.length} 条问题)`, children: [
|
|
99
|
+
/* @__PURE__ */ n(u, { size: "large", wrap: !0, style: { marginBottom: l.length ? 12 : 0 }, children: [
|
|
100
|
+
/* @__PURE__ */ n("span", { children: [
|
|
101
|
+
"错误 ",
|
|
102
|
+
/* @__PURE__ */ t("b", { children: p(r, "errorCount", "error_count") })
|
|
103
|
+
] }),
|
|
104
|
+
/* @__PURE__ */ n("span", { children: [
|
|
105
|
+
"警告 ",
|
|
106
|
+
/* @__PURE__ */ t("b", { children: p(r, "warningCount", "warning_count") })
|
|
107
|
+
] }),
|
|
108
|
+
/* @__PURE__ */ n("span", { children: [
|
|
109
|
+
"提示 ",
|
|
110
|
+
/* @__PURE__ */ t("b", { children: p(r, "infoCount", "info_count") })
|
|
111
|
+
] })
|
|
112
|
+
] }),
|
|
113
|
+
l.length === 0 ? /* @__PURE__ */ t(S, { type: "success", message: "校验通过,未发现问题" }) : /* @__PURE__ */ t(
|
|
114
|
+
B,
|
|
115
|
+
{
|
|
116
|
+
rowKey: (e, N) => `${e.code}-${N}`,
|
|
117
|
+
size: "small",
|
|
118
|
+
columns: E,
|
|
119
|
+
dataSource: l,
|
|
120
|
+
pagination: !1
|
|
121
|
+
}
|
|
122
|
+
)
|
|
123
|
+
] }) : null
|
|
124
|
+
] });
|
|
125
|
+
}
|
|
126
|
+
function P(c) {
|
|
127
|
+
try {
|
|
128
|
+
return JSON.parse(c);
|
|
129
|
+
} catch (a) {
|
|
130
|
+
throw new Error(`快照不是合法 JSON:${a.message}`);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
export {
|
|
134
|
+
q as default,
|
|
135
|
+
P as parseSnapshot
|
|
136
|
+
};
|
|
@@ -74,7 +74,7 @@ function Ee() {
|
|
|
74
74
|
}));
|
|
75
75
|
return /* @__PURE__ */ o(ae, { spinning: M, children: [
|
|
76
76
|
/* @__PURE__ */ o(F, { style: { marginBottom: 16 }, wrap: !0, children: [
|
|
77
|
-
/* @__PURE__ */ e(p, { icon: /* @__PURE__ */ e(oe, {}), onClick: () => q("/terms"), children: "返回列表" }),
|
|
77
|
+
/* @__PURE__ */ e(p, { icon: /* @__PURE__ */ e(oe, {}), onClick: () => q("/cognition/terms"), children: "返回列表" }),
|
|
78
78
|
/* @__PURE__ */ e(p, { icon: /* @__PURE__ */ e(de, {}), onClick: h, children: "刷新" }),
|
|
79
79
|
/* @__PURE__ */ e(p, { type: "primary", icon: /* @__PURE__ */ e(ce, {}), disabled: !i, onClick: Q, children: "编辑(生成新版本)" }),
|
|
80
80
|
/* @__PURE__ */ e(g, { style: { width: 300 }, placeholder: "left", value: v, onChange: A, options: K }),
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),n=require("react"),E=require("react-router-dom"),t=require("antd"),d=require("@ant-design/icons"),o=require("./api.cjs"),u=require("./EvidenceFormList-CQNgMNCG.cjs"),{TextArea:V}=t.Input;function G(){const[O]=E.useSearchParams(),$=E.useNavigate(),l=O.get("key")||"",[i,k]=n.useState(null),[f,B]=n.useState([]),[y,C]=n.useState([]),[R,I]=n.useState(!0),[v,w]=n.useState(""),[q,m]=n.useState(!1),[N,b]=n.useState(!1),[h]=t.Form.useForm(),[p,T]=n.useState(null),[x,S]=n.useState(null),[K,D]=n.useState(!1),[a,L]=n.useState(null),c=n.useCallback(async()=>{var s,r;if(l){I(!0),w("");try{const[j,_,g]=await Promise.all([o.cognitionApi.getTerm(l),o.cognitionApi.listTermEvidence(l),o.cognitionApi.listTermRevisions(l)]);k(j),B(_||[]),C(g||[]);const A=(s=(g||[])[0])==null?void 0:s.revisionNo,U=(r=(g||[])[1])==null?void 0:r.revisionNo;S(A??null),T(U??A??null)}catch(j){w(j.message)}finally{I(!1)}}},[l]);if(n.useEffect(()=>{c()},[c]),!l)return e.jsx(t.Alert,{type:"warning",showIcon:!0,message:"缺少 ?key= 参数"});const z=()=>{h.setFieldsValue({...i,aliases:i.aliases||[],evidences:u.toEvidenceFormValues(f)}),m(!0)},P=async()=>{const s=await h.validateFields();b(!0);try{await o.cognitionApi.updateTerm(l,{...s,termKey:l,actor:s.actor||"console",note:s.note||"console update"}),t.message.success("已生成新 revision"),m(!1),await c()}catch(r){t.message.error(r.field?`${r.field}: ${r.message}`:r.message)}finally{b(!1)}},M=async s=>{try{await o.cognitionApi.rollbackTerm(l,s,`console rollback to r${s}`),t.message.success(`已回滚到 r${s}(生成新 revision,历史不改写)`),await c()}catch(r){t.message.error(r.message)}},H=async()=>{if(p==null||x==null){t.message.warning("先选两个 revision");return}try{L(await o.cognitionApi.diffTerm(l,p,x)),D(!0)}catch(s){t.message.error(s.message)}},F=y.map(s=>({value:s.revisionNo,label:`r${s.revisionNo} · ${s.createdAt} · ${s.actor||"-"} · ${s.note||""}`}));return e.jsxs(t.Spin,{spinning:R,children:[e.jsxs(t.Space,{style:{marginBottom:16},wrap:!0,children:[e.jsx(t.Button,{icon:e.jsx(d.ArrowLeftOutlined,{}),onClick:()=>$("/cognition/terms"),children:"返回列表"}),e.jsx(t.Button,{icon:e.jsx(d.ReloadOutlined,{}),onClick:c,children:"刷新"}),e.jsx(t.Button,{type:"primary",icon:e.jsx(d.EditOutlined,{}),disabled:!i,onClick:z,children:"编辑(生成新版本)"}),e.jsx(t.Select,{style:{width:300},placeholder:"left",value:p,onChange:T,options:F}),e.jsx(t.Select,{style:{width:300},placeholder:"right",value:x,onChange:S,options:F}),e.jsx(t.Button,{icon:e.jsx(d.DiffOutlined,{}),onClick:H,children:"版本对比"})]}),v?e.jsx(t.Alert,{type:"error",showIcon:!0,message:v,style:{marginBottom:16}}):null,i?e.jsxs(e.Fragment,{children:[e.jsxs(t.Descriptions,{bordered:!0,size:"small",column:2,style:{marginBottom:16},children:[e.jsx(t.Descriptions.Item,{label:"termKey",children:e.jsx(t.Typography.Text,{code:!0,children:i.termKey})}),e.jsx(t.Descriptions.Item,{label:"规范名",children:i.canonical}),e.jsxs(t.Descriptions.Item,{label:"状态",children:[e.jsx(t.Tag,{color:u.STATUS_COLOR[i.status]||"blue",children:i.status}),i.supersededBy?e.jsxs("span",{children:["→ ",i.supersededBy]}):null]}),e.jsxs(t.Descriptions.Item,{label:"当前版本",children:["r",i.revisionNo]}),e.jsx(t.Descriptions.Item,{label:"域",children:i.domain||"—"}),e.jsx(t.Descriptions.Item,{label:"owner",children:i.owner||"—"}),e.jsx(t.Descriptions.Item,{label:"绑定概念",children:i.conceptKey||"—"}),e.jsx(t.Descriptions.Item,{label:"更新时间",children:i.updatedAt}),e.jsx(t.Descriptions.Item,{label:"别名",span:2,children:(i.aliases||[]).length?i.aliases.map(s=>e.jsx(t.Tag,{children:s},s)):"—"}),e.jsx(t.Descriptions.Item,{label:"定义",span:2,children:i.definition})]}),e.jsxs(t.Typography.Title,{level:5,children:["证据(当前版本 r",i.revisionNo,")"]}),e.jsx(t.Table,{rowKey:"id",size:"small",style:{marginBottom:24},dataSource:f,pagination:!1,columns:[{title:"类型",dataIndex:"evidenceType",width:140},{title:"refId",dataIndex:"refId"},{title:"snapshotHash",dataIndex:"snapshotHash",width:200},{title:"版本",dataIndex:"revisionNo",width:80,render:s=>`r${s}`},{title:"采集时间",dataIndex:"capturedAt",width:190}]}),e.jsx(t.Typography.Title,{level:5,children:"版本历史(回滚不改写历史,只追加新 revision)"}),e.jsx(t.Table,{rowKey:"revisionNo",size:"small",dataSource:y,pagination:!1,columns:[{title:"版本",dataIndex:"revisionNo",width:80,render:s=>`r${s}`},{title:"时间",dataIndex:"createdAt",width:190},{title:"操作人",dataIndex:"actor",width:140},{title:"说明",dataIndex:"note"},{title:"操作",width:120,render:(s,r)=>e.jsx(t.Popconfirm,{title:`回滚到 r${r.revisionNo}?`,description:"会以该版本内容生成一条新的 revision",onConfirm:()=>M(r.revisionNo),children:e.jsx(t.Button,{size:"small",icon:e.jsx(d.RollbackOutlined,{}),children:"回滚"})})}]})]}):null,e.jsx(t.Modal,{title:`编辑 ${l}`,open:q,onCancel:()=>m(!1),onOk:P,confirmLoading:N,width:820,destroyOnHidden:!0,children:e.jsxs(t.Form,{form:h,layout:"vertical",children:[e.jsxs(t.Space,{size:"large",wrap:!0,children:[e.jsx(t.Form.Item,{name:"canonical",label:"规范名",rules:[{required:!0,message:"必填"}],children:e.jsx(t.Input,{style:{width:240}})}),e.jsx(t.Form.Item,{name:"status",label:"状态",rules:[{required:!0}],children:e.jsx(t.Select,{style:{width:140},options:u.TERM_STATUSES.map(s=>({value:s,label:s}))})}),e.jsx(t.Form.Item,{name:"supersededBy",label:"替代项(DEPRECATED 必填)",children:e.jsx(t.Input,{style:{width:180}})}),e.jsx(t.Form.Item,{name:"domain",label:"域",children:e.jsx(t.Input,{style:{width:140}})}),e.jsx(t.Form.Item,{name:"owner",label:"owner",children:e.jsx(t.Input,{style:{width:140}})})]}),e.jsx(t.Form.Item,{name:"aliases",label:"别名",children:e.jsx(t.Select,{mode:"tags",tokenSeparators:[","]})}),e.jsx(t.Form.Item,{name:"conceptKey",label:"绑定概念",children:e.jsx(t.Input,{})}),e.jsx(t.Form.Item,{name:"definition",label:"定义",rules:[{required:!0,message:"必填"}],children:e.jsx(V,{rows:3})}),e.jsx(t.Form.Item,{name:"note",label:"变更说明",children:e.jsx(t.Input,{placeholder:"console update"})}),e.jsx(t.Form.Item,{label:"证据(至少一条;本次提交即本版本证据)",required:!0,children:e.jsx(u.EvidenceFormList,{})})]})}),e.jsx(t.Modal,{title:a?`${a.subjectKey}: r${a.leftRevision} → r${a.rightRevision}`:"版本对比",open:K,onCancel:()=>D(!1),footer:null,width:720,children:e.jsx(t.Table,{rowKey:s=>s.field,size:"small",pagination:!1,dataSource:a?a.changes:[],columns:[{title:"字段",dataIndex:"field",width:140},{title:"左",dataIndex:"left",render:s=>e.jsx(t.Typography.Text,{delete:s!=="",children:s??"—"})},{title:"右",dataIndex:"right",render:s=>e.jsx(t.Typography.Text,{strong:!0,children:s??"—"})}]})})]})}exports.default=G;
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { jsxs as d, jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import { useState as o, useEffect as A } from "react";
|
|
3
3
|
import { useNavigate as O } from "react-router-dom";
|
|
4
|
-
import { Input as r, Form as a, Space as
|
|
4
|
+
import { Input as r, Form as a, Space as y, Select as h, Button as u, Table as z, Modal as F, message as p, Tag as f } from "antd";
|
|
5
5
|
import { SearchOutlined as I, ReloadOutlined as R, PlusOutlined as $ } from "@ant-design/icons";
|
|
6
6
|
import { cognitionApi as b } from "./api.js";
|
|
7
7
|
import { T as v, K as P, a as L, S as _ } from "./EvidenceFormList-097ICr7D.js";
|
|
8
8
|
const { TextArea: N } = r;
|
|
9
9
|
function D() {
|
|
10
|
-
const C = O(), [T, S] = o([]), [x,
|
|
11
|
-
|
|
10
|
+
const C = O(), [T, S] = o([]), [x, g] = o(!1), [n, s] = o({ q: "", domain: "", status: "" }), [K, c] = o(!1), [E, w] = o(!1), [m] = a.useForm(), i = async (t = n) => {
|
|
11
|
+
g(!0);
|
|
12
12
|
try {
|
|
13
13
|
S(await b.listTerms(t));
|
|
14
14
|
} catch (l) {
|
|
15
15
|
p.error(l.message);
|
|
16
16
|
} finally {
|
|
17
|
-
|
|
17
|
+
g(!1);
|
|
18
18
|
}
|
|
19
19
|
};
|
|
20
20
|
A(() => {
|
|
@@ -22,7 +22,7 @@ function D() {
|
|
|
22
22
|
}, []);
|
|
23
23
|
const k = async () => {
|
|
24
24
|
const t = await m.validateFields();
|
|
25
|
-
|
|
25
|
+
w(!0);
|
|
26
26
|
try {
|
|
27
27
|
await b.createTerm({
|
|
28
28
|
...t,
|
|
@@ -33,14 +33,14 @@ function D() {
|
|
|
33
33
|
} catch (l) {
|
|
34
34
|
p.error(l.field ? `${l.field}: ${l.message}` : l.message);
|
|
35
35
|
} finally {
|
|
36
|
-
|
|
36
|
+
w(!1);
|
|
37
37
|
}
|
|
38
38
|
}, q = [
|
|
39
39
|
{
|
|
40
40
|
title: "termKey",
|
|
41
41
|
dataIndex: "termKey",
|
|
42
42
|
width: 200,
|
|
43
|
-
render: (t) => /* @__PURE__ */ e("a", { onClick: () => C(`/terms/detail?key=${encodeURIComponent(t)}`), children: t })
|
|
43
|
+
render: (t) => /* @__PURE__ */ e("a", { onClick: () => C(`/cognition/terms/detail?key=${encodeURIComponent(t)}`), children: t })
|
|
44
44
|
},
|
|
45
45
|
{ title: "规范名", dataIndex: "canonical", width: 160 },
|
|
46
46
|
{
|
|
@@ -65,7 +65,7 @@ function D() {
|
|
|
65
65
|
{ title: "更新时间", dataIndex: "updatedAt", width: 190 }
|
|
66
66
|
];
|
|
67
67
|
return /* @__PURE__ */ d("div", { children: [
|
|
68
|
-
/* @__PURE__ */ d(
|
|
68
|
+
/* @__PURE__ */ d(y, { wrap: !0, style: { marginBottom: 16 }, children: [
|
|
69
69
|
/* @__PURE__ */ e(
|
|
70
70
|
r,
|
|
71
71
|
{
|
|
@@ -129,7 +129,7 @@ function D() {
|
|
|
129
129
|
width: 820,
|
|
130
130
|
destroyOnHidden: !0,
|
|
131
131
|
children: /* @__PURE__ */ d(a, { form: m, layout: "vertical", children: [
|
|
132
|
-
/* @__PURE__ */ d(
|
|
132
|
+
/* @__PURE__ */ d(y, { size: "large", wrap: !0, children: [
|
|
133
133
|
/* @__PURE__ */ e(
|
|
134
134
|
a.Item,
|
|
135
135
|
{
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),n=require("react"),f=require("react-router-dom"),t=require("antd"),d=require("@ant-design/icons"),x=require("./api.cjs"),o=require("./EvidenceFormList-CQNgMNCG.cjs"),{TextArea:T}=t.Input;function v(){const p=f.useNavigate(),[j,g]=n.useState([]),[y,m]=n.useState(!1),[r,i]=n.useState({q:"",domain:"",status:""}),[w,c]=n.useState(!1),[I,h]=n.useState(!1),[u]=t.Form.useForm(),l=async(a=r)=>{m(!0);try{g(await x.cognitionApi.listTerms(a))}catch(s){t.message.error(s.message)}finally{m(!1)}};n.useEffect(()=>{l()},[]);const S=async()=>{const a=await u.validateFields();h(!0);try{await x.cognitionApi.createTerm({...a,status:a.status||"ACTIVE",actor:a.actor||"console",note:a.note||"console create"}),t.message.success(`术语 ${a.termKey} 已登记`),c(!1),u.resetFields(),await l()}catch(s){t.message.error(s.field?`${s.field}: ${s.message}`:s.message)}finally{h(!1)}},b=[{title:"termKey",dataIndex:"termKey",width:200,render:a=>e.jsx("a",{onClick:()=>p(`/cognition/terms/detail?key=${encodeURIComponent(a)}`),children:a})},{title:"规范名",dataIndex:"canonical",width:160},{title:"别名",dataIndex:"aliases",render:a=>a&&a.length?a.map(s=>e.jsx(t.Tag,{children:s},s)):e.jsx("span",{style:{color:"#bbb"},children:"—"})},{title:"域",dataIndex:"domain",width:120},{title:"状态",dataIndex:"status",width:110,render:a=>e.jsx(t.Tag,{color:o.STATUS_COLOR[a]||"blue",children:a})},{title:"概念",dataIndex:"conceptKey",width:160,render:a=>a||e.jsx("span",{style:{color:"#bbb"},children:"—"})},{title:"版本",dataIndex:"revisionNo",width:70,render:a=>`r${a}`},{title:"更新时间",dataIndex:"updatedAt",width:190}];return e.jsxs("div",{children:[e.jsxs(t.Space,{wrap:!0,style:{marginBottom:16},children:[e.jsx(t.Input,{placeholder:"按 key / 规范名 / 别名搜索",allowClear:!0,prefix:e.jsx(d.SearchOutlined,{}),style:{width:260},value:r.q,onChange:a=>i({...r,q:a.target.value}),onPressEnter:()=>l()}),e.jsx(t.Input,{placeholder:"域(如 trade)",allowClear:!0,style:{width:160},value:r.domain,onChange:a=>i({...r,domain:a.target.value}),onPressEnter:()=>l()}),e.jsx(t.Select,{placeholder:"状态",allowClear:!0,style:{width:140},value:r.status||void 0,onChange:a=>i({...r,status:a||""}),options:o.TERM_STATUSES.map(a=>({value:a,label:a}))}),e.jsx(t.Button,{icon:e.jsx(d.SearchOutlined,{}),onClick:()=>l(),children:"查询"}),e.jsx(t.Button,{icon:e.jsx(d.ReloadOutlined,{}),onClick:()=>{i({q:"",domain:"",status:""}),l({})},children:"重置"}),e.jsx(t.Button,{type:"primary",icon:e.jsx(d.PlusOutlined,{}),onClick:()=>c(!0),children:"新建术语"})]}),e.jsx(t.Table,{rowKey:"termKey",size:"middle",loading:y,columns:b,dataSource:j,pagination:{pageSize:20,showSizeChanger:!1},scroll:{x:1100}}),e.jsx(t.Modal,{title:"新建术语(证据必填)",open:w,onCancel:()=>c(!1),onOk:S,confirmLoading:I,width:820,destroyOnHidden:!0,children:e.jsxs(t.Form,{form:u,layout:"vertical",children:[e.jsxs(t.Space,{size:"large",wrap:!0,children:[e.jsx(t.Form.Item,{name:"termKey",label:"termKey",rules:[{required:!0,message:"必填"},{pattern:o.KEY_PATTERN,message:"^[a-z][a-z0-9_.-]{1,127}$"}],children:e.jsx(t.Input,{style:{width:260},placeholder:"order.gmv"})}),e.jsx(t.Form.Item,{name:"canonical",label:"规范名",rules:[{required:!0,message:"必填"}],children:e.jsx(t.Input,{style:{width:220},placeholder:"成交总额"})}),e.jsx(t.Form.Item,{name:"domain",label:"域",children:e.jsx(t.Input,{style:{width:140},placeholder:"trade"})}),e.jsx(t.Form.Item,{name:"owner",label:"owner",children:e.jsx(t.Input,{style:{width:140},placeholder:"@team"})}),e.jsx(t.Form.Item,{name:"status",label:"状态",initialValue:"ACTIVE",children:e.jsx(t.Select,{style:{width:130},options:o.TERM_STATUSES.map(a=>({value:a,label:a}))})})]}),e.jsx(t.Form.Item,{name:"aliases",label:"别名",children:e.jsx(t.Select,{mode:"tags",placeholder:"回车追加",tokenSeparators:[","]})}),e.jsx(t.Form.Item,{name:"conceptKey",label:"绑定概念(可空)",children:e.jsx(t.Input,{placeholder:"order"})}),e.jsx(t.Form.Item,{name:"definition",label:"定义",rules:[{required:!0,message:"必填"}],children:e.jsx(T,{rows:3,placeholder:"一句话说清口径;口径细节写到规则/指标,别塞进定义"})}),e.jsx(t.Form.Item,{name:"note",label:"变更说明",children:e.jsx(t.Input,{placeholder:"console create"})}),e.jsx(t.Form.Item,{label:"证据(至少一条)",required:!0,children:e.jsx(o.EvidenceFormList,{})})]})})]})}exports.default=v;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
const $ = "/api/ontology", d = "token", T = "z_ctc_token";
|
|
2
|
+
class f extends Error {
|
|
3
|
+
constructor(t, n) {
|
|
4
|
+
super(n && (n.message || n.error) ? n.message || n.error : `HTTP ${t}`), this.status = t, this.body = n;
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
function h() {
|
|
8
|
+
try {
|
|
9
|
+
return localStorage.getItem(d) || localStorage.getItem(T) || "";
|
|
10
|
+
} catch {
|
|
11
|
+
return "";
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
async function s(e, t, n) {
|
|
15
|
+
const i = { Accept: "application/json" };
|
|
16
|
+
n !== void 0 && (i["Content-Type"] = "application/json");
|
|
17
|
+
const o = h();
|
|
18
|
+
o && (i.Authorization = `Bearer ${o}`);
|
|
19
|
+
const l = await fetch(`${$}${t}`, {
|
|
20
|
+
method: e,
|
|
21
|
+
headers: i,
|
|
22
|
+
body: n === void 0 ? void 0 : JSON.stringify(n)
|
|
23
|
+
}), u = await l.text();
|
|
24
|
+
let c = null;
|
|
25
|
+
if (u)
|
|
26
|
+
try {
|
|
27
|
+
c = JSON.parse(u);
|
|
28
|
+
} catch {
|
|
29
|
+
c = { error: u };
|
|
30
|
+
}
|
|
31
|
+
if (!l.ok) throw new f(l.status, c);
|
|
32
|
+
return c;
|
|
33
|
+
}
|
|
34
|
+
const r = (e) => {
|
|
35
|
+
const t = Object.entries(e || {}).filter(([, n]) => n != null && n !== "").map(([n, i]) => `${encodeURIComponent(n)}=${encodeURIComponent(i)}`);
|
|
36
|
+
return t.length ? `?${t.join("&")}` : "";
|
|
37
|
+
}, a = encodeURIComponent;
|
|
38
|
+
function p(e, t, n) {
|
|
39
|
+
if (!e) return;
|
|
40
|
+
const i = n || t.replace(/[A-Z]/g, (o) => "_" + o.toLowerCase());
|
|
41
|
+
return e[t] !== void 0 ? e[t] : e[i];
|
|
42
|
+
}
|
|
43
|
+
const E = {
|
|
44
|
+
// --- schema 管理 ---
|
|
45
|
+
listSchemas: () => s("GET", "/schemas"),
|
|
46
|
+
getSchema: (e) => s("GET", `/schemas/${a(e)}`),
|
|
47
|
+
registerSchema: (e) => s("POST", "/schemas", e),
|
|
48
|
+
deleteSchema: (e) => s("DELETE", `/schemas/${a(e)}`),
|
|
49
|
+
// --- 运行时 / 图查询 ---
|
|
50
|
+
listSources: () => s("GET", "/sources"),
|
|
51
|
+
listClasses: (e, t) => s("GET", `/${a(e)}/classes${r({ workspace: t })}`),
|
|
52
|
+
listIndividuals: (e, t) => s("GET", `/${a(e)}/individuals${r({ workspace: t })}`),
|
|
53
|
+
listInstances: (e, t, n) => s("GET", `/${a(e)}/instances${r({ className: t, workspace: n })}`),
|
|
54
|
+
listNeighbors: (e, t, n, i) => s("GET", `/${a(e)}/neighbors${r({ key: t, depth: n, workspace: i })}`),
|
|
55
|
+
subgraph: (e, t, n, i) => s("GET", `/${a(e)}/subgraph${r({ keys: t, depth: n, workspace: i })}`),
|
|
56
|
+
stats: (e, t) => s("GET", `/${a(e)}/stats${r({ workspace: t })}`),
|
|
57
|
+
// --- 校验 / 推理 / 物化 ---
|
|
58
|
+
validate: (e, t) => s("POST", `/${a(e)}/validate`, t),
|
|
59
|
+
validateSource: (e, t, n) => s("GET", `/${a(e)}/validate-source${r({ source: t, workspace: n })}`),
|
|
60
|
+
infer: (e, t) => s("POST", `/${a(e)}/infer`, t),
|
|
61
|
+
materialize: (e, t, n) => s("POST", `/${a(e)}/materialize${r({ source: t, workspace: n })}`),
|
|
62
|
+
materializeInline: (e, t, n) => s("POST", `/${a(e)}/materialize-inline${r({ workspace: n })}`, t)
|
|
63
|
+
};
|
|
64
|
+
export {
|
|
65
|
+
p as f,
|
|
66
|
+
E as o
|
|
67
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const $="/api/ontology",d="token",T="z_ctc_token";class f extends Error{constructor(t,n){super(n&&(n.message||n.error)?n.message||n.error:`HTTP ${t}`),this.status=t,this.body=n}}function h(){try{return localStorage.getItem(d)||localStorage.getItem(T)||""}catch{return""}}async function s(e,t,n){const r={Accept:"application/json"};n!==void 0&&(r["Content-Type"]="application/json");const o=h();o&&(r.Authorization=`Bearer ${o}`);const l=await fetch(`${$}${t}`,{method:e,headers:r,body:n===void 0?void 0:JSON.stringify(n)}),u=await l.text();let c=null;if(u)try{c=JSON.parse(u)}catch{c={error:u}}if(!l.ok)throw new f(l.status,c);return c}const a=e=>{const t=Object.entries(e||{}).filter(([,n])=>n!=null&&n!=="").map(([n,r])=>`${encodeURIComponent(n)}=${encodeURIComponent(r)}`);return t.length?`?${t.join("&")}`:""},i=encodeURIComponent;function p(e,t,n){if(!e)return;const r=n||t.replace(/[A-Z]/g,o=>"_"+o.toLowerCase());return e[t]!==void 0?e[t]:e[r]}const E={listSchemas:()=>s("GET","/schemas"),getSchema:e=>s("GET",`/schemas/${i(e)}`),registerSchema:e=>s("POST","/schemas",e),deleteSchema:e=>s("DELETE",`/schemas/${i(e)}`),listSources:()=>s("GET","/sources"),listClasses:(e,t)=>s("GET",`/${i(e)}/classes${a({workspace:t})}`),listIndividuals:(e,t)=>s("GET",`/${i(e)}/individuals${a({workspace:t})}`),listInstances:(e,t,n)=>s("GET",`/${i(e)}/instances${a({className:t,workspace:n})}`),listNeighbors:(e,t,n,r)=>s("GET",`/${i(e)}/neighbors${a({key:t,depth:n,workspace:r})}`),subgraph:(e,t,n,r)=>s("GET",`/${i(e)}/subgraph${a({keys:t,depth:n,workspace:r})}`),stats:(e,t)=>s("GET",`/${i(e)}/stats${a({workspace:t})}`),validate:(e,t)=>s("POST",`/${i(e)}/validate`,t),validateSource:(e,t,n)=>s("GET",`/${i(e)}/validate-source${a({source:t,workspace:n})}`),infer:(e,t)=>s("POST",`/${i(e)}/infer`,t),materialize:(e,t,n)=>s("POST",`/${i(e)}/materialize${a({source:t,workspace:n})}`),materializeInline:(e,t,n)=>s("POST",`/${i(e)}/materialize-inline${a({workspace:n})}`,t)};exports.field=p;exports.ontologyApi=E;
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./api.cjs"),t=require("./EvidenceFormList-CQNgMNCG.cjs"),r=require("./TermsPage-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./api.cjs"),t=require("./EvidenceFormList-CQNgMNCG.cjs"),r=require("./TermsPage-CE3E3fG-.cjs"),T=require("./TermDetailPage-DQcYkPdm.cjs"),o=require("./ConceptsPage-BH4lEiVn.cjs"),E=require("./ResolvePage-BDb56PdI.cjs"),a=require("./ImpactPage-BMvZUgTJ.cjs"),i=require("./DocsPage-CmGTg0A3.cjs");exports.ApiError=e.ApiError;exports.TOKEN_KEY=e.TOKEN_KEY;exports.cognitionApi=e.cognitionApi;exports.getToken=e.getToken;exports.setToken=e.setToken;exports.CONCEPT_TYPES=t.CONCEPT_TYPES;exports.EVIDENCE_TYPES=t.EVIDENCE_TYPES;exports.KEY_PATTERN=t.KEY_PATTERN;exports.STATUS_COLOR=t.STATUS_COLOR;exports.TERM_STATUSES=t.TERM_STATUSES;exports.TermsPage=r.default;exports.TermDetailPage=T.default;exports.ConceptsPage=o.default;exports.ResolvePage=E.default;exports.ImpactPage=a.default;exports.DocsPage=i.default;
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ApiError as o, TOKEN_KEY as r, cognitionApi as t, getToken as s, setToken as T } from "./api.js";
|
|
2
2
|
import { C as E, E as p, K as m, S as P, T as g } from "./EvidenceFormList-097ICr7D.js";
|
|
3
|
-
import { default as x } from "./TermsPage-
|
|
4
|
-
import { default as d } from "./TermDetailPage-
|
|
5
|
-
import { default as C } from "./ConceptsPage-
|
|
3
|
+
import { default as x } from "./TermsPage-BJWfX1hw.js";
|
|
4
|
+
import { default as d } from "./TermDetailPage-BiF5UVM5.js";
|
|
5
|
+
import { default as C } from "./ConceptsPage-C8nsSzRc.js";
|
|
6
6
|
import { default as i } from "./ResolvePage-CmrRVFkA.js";
|
|
7
7
|
import { default as A } from "./ImpactPage-BiajQqHA.js";
|
|
8
8
|
import { default as K } from "./DocsPage-DNkkd9Sm.js";
|
package/dist/pages.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),e=require("react"),t=require("@ant-design/icons"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),e=require("react"),t=require("@ant-design/icons"),s=e.lazy(()=>Promise.resolve().then(()=>require("./TermsPage-CE3E3fG-.cjs"))),l=e.lazy(()=>Promise.resolve().then(()=>require("./TermDetailPage-DQcYkPdm.cjs"))),a=e.lazy(()=>Promise.resolve().then(()=>require("./ConceptsPage-BH4lEiVn.cjs"))),r=e.lazy(()=>Promise.resolve().then(()=>require("./ResolvePage-BDb56PdI.cjs"))),c=e.lazy(()=>Promise.resolve().then(()=>require("./ImpactPage-BMvZUgTJ.cjs"))),m=e.lazy(()=>Promise.resolve().then(()=>require("./DocsPage-CmGTg0A3.cjs"))),g=e.lazy(()=>Promise.resolve().then(()=>require("./OntologyListPage-ClYfQsCI.cjs"))),y=e.lazy(()=>Promise.resolve().then(()=>require("./OntologyDetailPage-BnrMC9RD.cjs"))),u=e.lazy(()=>Promise.resolve().then(()=>require("./OntologyNodesPage-B93kbY3c.cjs"))),d=e.lazy(()=>Promise.resolve().then(()=>require("./OntologyValidatePage-40ZvGGH4.cjs"))),p=e.lazy(()=>Promise.resolve().then(()=>require("./OntologyInferPage-FoVA-toR.cjs"))),h=e.lazy(()=>Promise.resolve().then(()=>require("./OntologyMaterializePage-CUPoItSa.cjs"))),P={title:"z-cognition 业务认知域",short:"z-cognition"},n=[{key:"/ontology/schemas",label:"本体列表",icon:o.jsx(t.ApartmentOutlined,{}),desc:"注册 / 查询 / 删除 schema"},{key:"/ontology/detail",label:"本体详情",icon:o.jsx(t.ReadOutlined,{}),desc:"类定义 / 属性 / 统计"},{key:"/ontology/nodes",label:"类与实例",icon:o.jsx(t.PartitionOutlined,{}),desc:"图侧节点浏览"},{key:"/ontology/validate",label:"校验",icon:o.jsx(t.CheckCircleOutlined,{}),desc:"来源 / 快照两套口径"},{key:"/ontology/infer",label:"推理",icon:o.jsx(t.ThunderboltOutlined,{}),desc:"隐含类型与陈述"},{key:"/ontology/materialize",label:"物化",icon:o.jsx(t.DatabaseOutlined,{}),desc:"落成图节点与边"}],i=[{key:"/cognition/terms",label:"术语",icon:o.jsx(t.TagsOutlined,{}),desc:"登记 / 版本 / 回滚"},{key:"/cognition/concepts",label:"概念",icon:o.jsx(t.PartitionOutlined,{}),desc:"六类概念与父子关系"},{key:"/cognition/resolve",label:"消歧",icon:o.jsx(t.SearchOutlined,{}),desc:"词 → 术语 + 证据"},{key:"/cognition/impact",label:"影响面",icon:o.jsx(t.BranchesOutlined,{}),desc:"改之前先看谁引用"},{key:"/cognition/docs",label:"说明",icon:o.jsx(t.ReadOutlined,{}),desc:"能力与 API 清单"}],v=[{title:"本体管理",icon:"🧩",items:n},{title:"业务认知",icon:"🧠",items:i}],O=[{path:"/cognition/terms",Component:s},{path:"/cognition/terms/detail",Component:l},{path:"/cognition/concepts",Component:a},{path:"/cognition/resolve",Component:r},{path:"/cognition/impact",Component:c},{path:"/cognition/docs",Component:m},{path:"/ontology/schemas",Component:g},{path:"/ontology/detail",Component:y},{path:"/ontology/nodes",Component:u},{path:"/ontology/validate",Component:d},{path:"/ontology/infer",Component:p},{path:"/ontology/materialize",Component:h}];exports.appMeta=P;exports.menuItems=i;exports.menuSections=v;exports.ontologyMenuItems=n;exports.routes=O;
|
package/dist/pages.js
CHANGED
|
@@ -1,22 +1,40 @@
|
|
|
1
1
|
import { jsx as t } from "react/jsx-runtime";
|
|
2
2
|
import { lazy as o } from "react";
|
|
3
|
-
import { TagsOutlined as
|
|
4
|
-
const
|
|
5
|
-
{ key: "/
|
|
3
|
+
import { TagsOutlined as i, PartitionOutlined as e, SearchOutlined as c, BranchesOutlined as a, ReadOutlined as n, ApartmentOutlined as l, CheckCircleOutlined as s, ThunderboltOutlined as m, DatabaseOutlined as p } from "@ant-design/icons";
|
|
4
|
+
const g = o(() => import("./TermsPage-BJWfX1hw.js")), r = o(() => import("./TermDetailPage-BiF5UVM5.js")), d = o(() => import("./ConceptsPage-C8nsSzRc.js")), y = o(() => import("./ResolvePage-CmrRVFkA.js")), h = o(() => import("./ImpactPage-BiajQqHA.js")), C = o(() => import("./DocsPage-DNkkd9Sm.js")), O = o(() => import("./OntologyListPage-DJnVZ_19.js")), u = o(() => import("./OntologyDetailPage-DIsWePGJ.js")), P = o(() => import("./OntologyNodesPage-C68cRXHu.js")), b = o(() => import("./OntologyValidatePage-WX4sAfzY.js")), k = o(() => import("./OntologyInferPage-BhHrVjSM.js")), f = o(() => import("./OntologyMaterializePage-DxxtArEt.js")), M = { title: "z-cognition 业务认知域", short: "z-cognition" }, z = [
|
|
5
|
+
{ key: "/ontology/schemas", label: "本体列表", icon: /* @__PURE__ */ t(l, {}), desc: "注册 / 查询 / 删除 schema" },
|
|
6
|
+
{ key: "/ontology/detail", label: "本体详情", icon: /* @__PURE__ */ t(n, {}), desc: "类定义 / 属性 / 统计" },
|
|
7
|
+
{ key: "/ontology/nodes", label: "类与实例", icon: /* @__PURE__ */ t(e, {}), desc: "图侧节点浏览" },
|
|
8
|
+
{ key: "/ontology/validate", label: "校验", icon: /* @__PURE__ */ t(s, {}), desc: "来源 / 快照两套口径" },
|
|
9
|
+
{ key: "/ontology/infer", label: "推理", icon: /* @__PURE__ */ t(m, {}), desc: "隐含类型与陈述" },
|
|
10
|
+
{ key: "/ontology/materialize", label: "物化", icon: /* @__PURE__ */ t(p, {}), desc: "落成图节点与边" }
|
|
11
|
+
], v = [
|
|
12
|
+
{ key: "/cognition/terms", label: "术语", icon: /* @__PURE__ */ t(i, {}), desc: "登记 / 版本 / 回滚" },
|
|
6
13
|
{ key: "/cognition/concepts", label: "概念", icon: /* @__PURE__ */ t(e, {}), desc: "六类概念与父子关系" },
|
|
7
|
-
{ key: "/cognition/resolve", label: "消歧", icon: /* @__PURE__ */ t(
|
|
8
|
-
{ key: "/cognition/impact", label: "影响面", icon: /* @__PURE__ */ t(
|
|
9
|
-
{ key: "/cognition/docs", label: "说明", icon: /* @__PURE__ */ t(
|
|
10
|
-
],
|
|
11
|
-
{
|
|
12
|
-
{
|
|
13
|
-
|
|
14
|
-
{ path: "/cognition/
|
|
15
|
-
{ path: "/cognition/
|
|
16
|
-
{ path: "/cognition/
|
|
14
|
+
{ key: "/cognition/resolve", label: "消歧", icon: /* @__PURE__ */ t(c, {}), desc: "词 → 术语 + 证据" },
|
|
15
|
+
{ key: "/cognition/impact", label: "影响面", icon: /* @__PURE__ */ t(a, {}), desc: "改之前先看谁引用" },
|
|
16
|
+
{ key: "/cognition/docs", label: "说明", icon: /* @__PURE__ */ t(n, {}), desc: "能力与 API 清单" }
|
|
17
|
+
], x = [
|
|
18
|
+
{ title: "本体管理", icon: "🧩", items: z },
|
|
19
|
+
{ title: "业务认知", icon: "🧠", items: v }
|
|
20
|
+
], A = [
|
|
21
|
+
{ path: "/cognition/terms", Component: g },
|
|
22
|
+
{ path: "/cognition/terms/detail", Component: r },
|
|
23
|
+
{ path: "/cognition/concepts", Component: d },
|
|
24
|
+
{ path: "/cognition/resolve", Component: y },
|
|
25
|
+
{ path: "/cognition/impact", Component: h },
|
|
26
|
+
{ path: "/cognition/docs", Component: C },
|
|
27
|
+
{ path: "/ontology/schemas", Component: O },
|
|
28
|
+
{ path: "/ontology/detail", Component: u },
|
|
29
|
+
{ path: "/ontology/nodes", Component: P },
|
|
30
|
+
{ path: "/ontology/validate", Component: b },
|
|
31
|
+
{ path: "/ontology/infer", Component: k },
|
|
32
|
+
{ path: "/ontology/materialize", Component: f }
|
|
17
33
|
];
|
|
18
34
|
export {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
35
|
+
M as appMeta,
|
|
36
|
+
v as menuItems,
|
|
37
|
+
x as menuSections,
|
|
38
|
+
z as ontologyMenuItems,
|
|
39
|
+
A as routes
|
|
22
40
|
};
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),a=require("react"),S=require("react-router-dom"),t=require("antd"),p=require("@ant-design/icons"),h=require("./api.cjs"),l=require("./EvidenceFormList-CQNgMNCG.cjs"),{TextArea:b}=t.Input;function v(){const x=S.useNavigate(),[y,g]=a.useState([]),[j,c]=a.useState(!1),[d,u]=a.useState(""),[w,i]=a.useState(!1),[I,m]=a.useState(!1),[o]=t.Form.useForm(),r=async(n=d)=>{c(!0);try{g(await h.cognitionApi.listConcepts({domain:n}))}catch(s){t.message.error(s.message)}finally{c(!1)}};a.useEffect(()=>{r()},[]);const f=async()=>{const n=await o.validateFields();m(!0);try{await h.cognitionApi.createConcept({...n,actor:n.actor||"console",note:n.note||"console create"}),t.message.success(`概念 ${n.conceptKey} 已登记`),i(!1),o.resetFields(),await r()}catch(s){t.message.error(s.field?`${s.field}: ${s.message}`:s.message)}finally{m(!1)}};return e.jsxs("div",{children:[e.jsxs(t.Space,{wrap:!0,style:{marginBottom:16},children:[e.jsx(t.Input,{placeholder:"域(如 trade)",allowClear:!0,style:{width:180},value:d,onChange:n=>u(n.target.value),onPressEnter:()=>r()}),e.jsx(t.Button,{icon:e.jsx(p.ReloadOutlined,{}),onClick:()=>{u(""),r("")},children:"重置"}),e.jsx(t.Button,{type:"primary",icon:e.jsx(p.PlusOutlined,{}),onClick:()=>i(!0),children:"新建概念"})]}),e.jsx(t.Table,{rowKey:"conceptKey",size:"middle",loading:j,dataSource:y,pagination:{pageSize:20,showSizeChanger:!1},columns:[{title:"conceptKey",dataIndex:"conceptKey",width:200},{title:"名称",dataIndex:"name",width:180},{title:"类型",dataIndex:"conceptType",width:120,render:n=>e.jsx(t.Tag,{children:n})},{title:"域",dataIndex:"domain",width:120},{title:"父概念",dataIndex:"parentKey",width:180,render:n=>n||"—"},{title:"版本",dataIndex:"revisionNo",width:70,render:n=>`r${n}`},{title:"定义",dataIndex:"definition",ellipsis:!0},{title:"操作",width:110,render:(n,s)=>e.jsx(t.Button,{size:"small",onClick:()=>x(`/impact?subjectType=concept&subjectKey=${encodeURIComponent(s.conceptKey)}`),children:"影响面"})}]}),e.jsx(t.Modal,{title:"新建概念(证据必填)",open:w,onCancel:()=>i(!1),onOk:f,confirmLoading:I,width:800,destroyOnHidden:!0,children:e.jsxs(t.Form,{form:o,layout:"vertical",children:[e.jsxs(t.Space,{size:"large",wrap:!0,children:[e.jsx(t.Form.Item,{name:"conceptKey",label:"conceptKey",rules:[{required:!0,message:"必填"},{pattern:l.KEY_PATTERN,message:"^[a-z][a-z0-9_.-]{1,127}$"}],children:e.jsx(t.Input,{style:{width:240},placeholder:"order"})}),e.jsx(t.Form.Item,{name:"name",label:"名称",rules:[{required:!0,message:"必填"}],children:e.jsx(t.Input,{style:{width:200},placeholder:"订单"})}),e.jsx(t.Form.Item,{name:"conceptType",label:"类型",rules:[{required:!0,message:"必填"}],initialValue:"ENTITY",children:e.jsx(t.Select,{style:{width:140},options:l.CONCEPT_TYPES.map(n=>({value:n,label:n}))})}),e.jsx(t.Form.Item,{name:"domain",label:"域",children:e.jsx(t.Input,{style:{width:140}})}),e.jsx(t.Form.Item,{name:"parentKey",label:"父概念",children:e.jsx(t.Input,{style:{width:180}})})]}),e.jsx(t.Form.Item,{name:"definition",label:"定义",rules:[{required:!0,message:"必填"}],children:e.jsx(b,{rows:3})}),e.jsx(t.Form.Item,{label:"证据(至少一条)",required:!0,children:e.jsx(l.EvidenceFormList,{})})]})})]})}exports.default=v;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),n=require("react"),E=require("react-router-dom"),t=require("antd"),d=require("@ant-design/icons"),o=require("./api.cjs"),u=require("./EvidenceFormList-CQNgMNCG.cjs"),{TextArea:V}=t.Input;function G(){const[O]=E.useSearchParams(),$=E.useNavigate(),l=O.get("key")||"",[i,k]=n.useState(null),[f,B]=n.useState([]),[y,C]=n.useState([]),[R,I]=n.useState(!0),[v,w]=n.useState(""),[q,m]=n.useState(!1),[N,b]=n.useState(!1),[h]=t.Form.useForm(),[p,T]=n.useState(null),[x,S]=n.useState(null),[K,D]=n.useState(!1),[a,L]=n.useState(null),c=n.useCallback(async()=>{var s,r;if(l){I(!0),w("");try{const[j,_,g]=await Promise.all([o.cognitionApi.getTerm(l),o.cognitionApi.listTermEvidence(l),o.cognitionApi.listTermRevisions(l)]);k(j),B(_||[]),C(g||[]);const A=(s=(g||[])[0])==null?void 0:s.revisionNo,U=(r=(g||[])[1])==null?void 0:r.revisionNo;S(A??null),T(U??A??null)}catch(j){w(j.message)}finally{I(!1)}}},[l]);if(n.useEffect(()=>{c()},[c]),!l)return e.jsx(t.Alert,{type:"warning",showIcon:!0,message:"缺少 ?key= 参数"});const z=()=>{h.setFieldsValue({...i,aliases:i.aliases||[],evidences:u.toEvidenceFormValues(f)}),m(!0)},P=async()=>{const s=await h.validateFields();b(!0);try{await o.cognitionApi.updateTerm(l,{...s,termKey:l,actor:s.actor||"console",note:s.note||"console update"}),t.message.success("已生成新 revision"),m(!1),await c()}catch(r){t.message.error(r.field?`${r.field}: ${r.message}`:r.message)}finally{b(!1)}},M=async s=>{try{await o.cognitionApi.rollbackTerm(l,s,`console rollback to r${s}`),t.message.success(`已回滚到 r${s}(生成新 revision,历史不改写)`),await c()}catch(r){t.message.error(r.message)}},H=async()=>{if(p==null||x==null){t.message.warning("先选两个 revision");return}try{L(await o.cognitionApi.diffTerm(l,p,x)),D(!0)}catch(s){t.message.error(s.message)}},F=y.map(s=>({value:s.revisionNo,label:`r${s.revisionNo} · ${s.createdAt} · ${s.actor||"-"} · ${s.note||""}`}));return e.jsxs(t.Spin,{spinning:R,children:[e.jsxs(t.Space,{style:{marginBottom:16},wrap:!0,children:[e.jsx(t.Button,{icon:e.jsx(d.ArrowLeftOutlined,{}),onClick:()=>$("/terms"),children:"返回列表"}),e.jsx(t.Button,{icon:e.jsx(d.ReloadOutlined,{}),onClick:c,children:"刷新"}),e.jsx(t.Button,{type:"primary",icon:e.jsx(d.EditOutlined,{}),disabled:!i,onClick:z,children:"编辑(生成新版本)"}),e.jsx(t.Select,{style:{width:300},placeholder:"left",value:p,onChange:T,options:F}),e.jsx(t.Select,{style:{width:300},placeholder:"right",value:x,onChange:S,options:F}),e.jsx(t.Button,{icon:e.jsx(d.DiffOutlined,{}),onClick:H,children:"版本对比"})]}),v?e.jsx(t.Alert,{type:"error",showIcon:!0,message:v,style:{marginBottom:16}}):null,i?e.jsxs(e.Fragment,{children:[e.jsxs(t.Descriptions,{bordered:!0,size:"small",column:2,style:{marginBottom:16},children:[e.jsx(t.Descriptions.Item,{label:"termKey",children:e.jsx(t.Typography.Text,{code:!0,children:i.termKey})}),e.jsx(t.Descriptions.Item,{label:"规范名",children:i.canonical}),e.jsxs(t.Descriptions.Item,{label:"状态",children:[e.jsx(t.Tag,{color:u.STATUS_COLOR[i.status]||"blue",children:i.status}),i.supersededBy?e.jsxs("span",{children:["→ ",i.supersededBy]}):null]}),e.jsxs(t.Descriptions.Item,{label:"当前版本",children:["r",i.revisionNo]}),e.jsx(t.Descriptions.Item,{label:"域",children:i.domain||"—"}),e.jsx(t.Descriptions.Item,{label:"owner",children:i.owner||"—"}),e.jsx(t.Descriptions.Item,{label:"绑定概念",children:i.conceptKey||"—"}),e.jsx(t.Descriptions.Item,{label:"更新时间",children:i.updatedAt}),e.jsx(t.Descriptions.Item,{label:"别名",span:2,children:(i.aliases||[]).length?i.aliases.map(s=>e.jsx(t.Tag,{children:s},s)):"—"}),e.jsx(t.Descriptions.Item,{label:"定义",span:2,children:i.definition})]}),e.jsxs(t.Typography.Title,{level:5,children:["证据(当前版本 r",i.revisionNo,")"]}),e.jsx(t.Table,{rowKey:"id",size:"small",style:{marginBottom:24},dataSource:f,pagination:!1,columns:[{title:"类型",dataIndex:"evidenceType",width:140},{title:"refId",dataIndex:"refId"},{title:"snapshotHash",dataIndex:"snapshotHash",width:200},{title:"版本",dataIndex:"revisionNo",width:80,render:s=>`r${s}`},{title:"采集时间",dataIndex:"capturedAt",width:190}]}),e.jsx(t.Typography.Title,{level:5,children:"版本历史(回滚不改写历史,只追加新 revision)"}),e.jsx(t.Table,{rowKey:"revisionNo",size:"small",dataSource:y,pagination:!1,columns:[{title:"版本",dataIndex:"revisionNo",width:80,render:s=>`r${s}`},{title:"时间",dataIndex:"createdAt",width:190},{title:"操作人",dataIndex:"actor",width:140},{title:"说明",dataIndex:"note"},{title:"操作",width:120,render:(s,r)=>e.jsx(t.Popconfirm,{title:`回滚到 r${r.revisionNo}?`,description:"会以该版本内容生成一条新的 revision",onConfirm:()=>M(r.revisionNo),children:e.jsx(t.Button,{size:"small",icon:e.jsx(d.RollbackOutlined,{}),children:"回滚"})})}]})]}):null,e.jsx(t.Modal,{title:`编辑 ${l}`,open:q,onCancel:()=>m(!1),onOk:P,confirmLoading:N,width:820,destroyOnHidden:!0,children:e.jsxs(t.Form,{form:h,layout:"vertical",children:[e.jsxs(t.Space,{size:"large",wrap:!0,children:[e.jsx(t.Form.Item,{name:"canonical",label:"规范名",rules:[{required:!0,message:"必填"}],children:e.jsx(t.Input,{style:{width:240}})}),e.jsx(t.Form.Item,{name:"status",label:"状态",rules:[{required:!0}],children:e.jsx(t.Select,{style:{width:140},options:u.TERM_STATUSES.map(s=>({value:s,label:s}))})}),e.jsx(t.Form.Item,{name:"supersededBy",label:"替代项(DEPRECATED 必填)",children:e.jsx(t.Input,{style:{width:180}})}),e.jsx(t.Form.Item,{name:"domain",label:"域",children:e.jsx(t.Input,{style:{width:140}})}),e.jsx(t.Form.Item,{name:"owner",label:"owner",children:e.jsx(t.Input,{style:{width:140}})})]}),e.jsx(t.Form.Item,{name:"aliases",label:"别名",children:e.jsx(t.Select,{mode:"tags",tokenSeparators:[","]})}),e.jsx(t.Form.Item,{name:"conceptKey",label:"绑定概念",children:e.jsx(t.Input,{})}),e.jsx(t.Form.Item,{name:"definition",label:"定义",rules:[{required:!0,message:"必填"}],children:e.jsx(V,{rows:3})}),e.jsx(t.Form.Item,{name:"note",label:"变更说明",children:e.jsx(t.Input,{placeholder:"console update"})}),e.jsx(t.Form.Item,{label:"证据(至少一条;本次提交即本版本证据)",required:!0,children:e.jsx(u.EvidenceFormList,{})})]})}),e.jsx(t.Modal,{title:a?`${a.subjectKey}: r${a.leftRevision} → r${a.rightRevision}`:"版本对比",open:K,onCancel:()=>D(!1),footer:null,width:720,children:e.jsx(t.Table,{rowKey:s=>s.field,size:"small",pagination:!1,dataSource:a?a.changes:[],columns:[{title:"字段",dataIndex:"field",width:140},{title:"左",dataIndex:"left",render:s=>e.jsx(t.Typography.Text,{delete:s!=="",children:s??"—"})},{title:"右",dataIndex:"right",render:s=>e.jsx(t.Typography.Text,{strong:!0,children:s??"—"})}]})})]})}exports.default=G;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),n=require("react"),f=require("react-router-dom"),t=require("antd"),d=require("@ant-design/icons"),x=require("./api.cjs"),o=require("./EvidenceFormList-CQNgMNCG.cjs"),{TextArea:T}=t.Input;function v(){const p=f.useNavigate(),[j,g]=n.useState([]),[y,m]=n.useState(!1),[r,i]=n.useState({q:"",domain:"",status:""}),[w,c]=n.useState(!1),[I,h]=n.useState(!1),[u]=t.Form.useForm(),l=async(a=r)=>{m(!0);try{g(await x.cognitionApi.listTerms(a))}catch(s){t.message.error(s.message)}finally{m(!1)}};n.useEffect(()=>{l()},[]);const S=async()=>{const a=await u.validateFields();h(!0);try{await x.cognitionApi.createTerm({...a,status:a.status||"ACTIVE",actor:a.actor||"console",note:a.note||"console create"}),t.message.success(`术语 ${a.termKey} 已登记`),c(!1),u.resetFields(),await l()}catch(s){t.message.error(s.field?`${s.field}: ${s.message}`:s.message)}finally{h(!1)}},b=[{title:"termKey",dataIndex:"termKey",width:200,render:a=>e.jsx("a",{onClick:()=>p(`/terms/detail?key=${encodeURIComponent(a)}`),children:a})},{title:"规范名",dataIndex:"canonical",width:160},{title:"别名",dataIndex:"aliases",render:a=>a&&a.length?a.map(s=>e.jsx(t.Tag,{children:s},s)):e.jsx("span",{style:{color:"#bbb"},children:"—"})},{title:"域",dataIndex:"domain",width:120},{title:"状态",dataIndex:"status",width:110,render:a=>e.jsx(t.Tag,{color:o.STATUS_COLOR[a]||"blue",children:a})},{title:"概念",dataIndex:"conceptKey",width:160,render:a=>a||e.jsx("span",{style:{color:"#bbb"},children:"—"})},{title:"版本",dataIndex:"revisionNo",width:70,render:a=>`r${a}`},{title:"更新时间",dataIndex:"updatedAt",width:190}];return e.jsxs("div",{children:[e.jsxs(t.Space,{wrap:!0,style:{marginBottom:16},children:[e.jsx(t.Input,{placeholder:"按 key / 规范名 / 别名搜索",allowClear:!0,prefix:e.jsx(d.SearchOutlined,{}),style:{width:260},value:r.q,onChange:a=>i({...r,q:a.target.value}),onPressEnter:()=>l()}),e.jsx(t.Input,{placeholder:"域(如 trade)",allowClear:!0,style:{width:160},value:r.domain,onChange:a=>i({...r,domain:a.target.value}),onPressEnter:()=>l()}),e.jsx(t.Select,{placeholder:"状态",allowClear:!0,style:{width:140},value:r.status||void 0,onChange:a=>i({...r,status:a||""}),options:o.TERM_STATUSES.map(a=>({value:a,label:a}))}),e.jsx(t.Button,{icon:e.jsx(d.SearchOutlined,{}),onClick:()=>l(),children:"查询"}),e.jsx(t.Button,{icon:e.jsx(d.ReloadOutlined,{}),onClick:()=>{i({q:"",domain:"",status:""}),l({})},children:"重置"}),e.jsx(t.Button,{type:"primary",icon:e.jsx(d.PlusOutlined,{}),onClick:()=>c(!0),children:"新建术语"})]}),e.jsx(t.Table,{rowKey:"termKey",size:"middle",loading:y,columns:b,dataSource:j,pagination:{pageSize:20,showSizeChanger:!1},scroll:{x:1100}}),e.jsx(t.Modal,{title:"新建术语(证据必填)",open:w,onCancel:()=>c(!1),onOk:S,confirmLoading:I,width:820,destroyOnHidden:!0,children:e.jsxs(t.Form,{form:u,layout:"vertical",children:[e.jsxs(t.Space,{size:"large",wrap:!0,children:[e.jsx(t.Form.Item,{name:"termKey",label:"termKey",rules:[{required:!0,message:"必填"},{pattern:o.KEY_PATTERN,message:"^[a-z][a-z0-9_.-]{1,127}$"}],children:e.jsx(t.Input,{style:{width:260},placeholder:"order.gmv"})}),e.jsx(t.Form.Item,{name:"canonical",label:"规范名",rules:[{required:!0,message:"必填"}],children:e.jsx(t.Input,{style:{width:220},placeholder:"成交总额"})}),e.jsx(t.Form.Item,{name:"domain",label:"域",children:e.jsx(t.Input,{style:{width:140},placeholder:"trade"})}),e.jsx(t.Form.Item,{name:"owner",label:"owner",children:e.jsx(t.Input,{style:{width:140},placeholder:"@team"})}),e.jsx(t.Form.Item,{name:"status",label:"状态",initialValue:"ACTIVE",children:e.jsx(t.Select,{style:{width:130},options:o.TERM_STATUSES.map(a=>({value:a,label:a}))})})]}),e.jsx(t.Form.Item,{name:"aliases",label:"别名",children:e.jsx(t.Select,{mode:"tags",placeholder:"回车追加",tokenSeparators:[","]})}),e.jsx(t.Form.Item,{name:"conceptKey",label:"绑定概念(可空)",children:e.jsx(t.Input,{placeholder:"order"})}),e.jsx(t.Form.Item,{name:"definition",label:"定义",rules:[{required:!0,message:"必填"}],children:e.jsx(T,{rows:3,placeholder:"一句话说清口径;口径细节写到规则/指标,别塞进定义"})}),e.jsx(t.Form.Item,{name:"note",label:"变更说明",children:e.jsx(t.Input,{placeholder:"console create"})}),e.jsx(t.Form.Item,{label:"证据(至少一条)",required:!0,children:e.jsx(o.EvidenceFormList,{})})]})})]})}exports.default=v;
|