@yuku123/z-ops-frontend-component 0.1.0 → 0.2.1
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/z-ops-component.es.js +2050 -510
- package/dist/z-ops-component.umd.js +16 -5
- package/package.json +2 -2
- package/src/components/OpsApp.jsx +19 -0
- package/src/components/RdApp.jsx +15 -0
- package/src/components/ResourceApp.jsx +16 -0
- package/src/index.js +5 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(I,C){typeof exports=="object"&&typeof module<"u"?C(exports,require("react"),require("antd"),require("@ant-design/icons"),require("axios")):typeof define=="function"&&define.amd?define(["exports","react","antd","@ant-design/icons","axios"],C):(I=typeof globalThis<"u"?globalThis:I||self,C(I.ZOpsFrontendComponent={},I.React,I.antd,I.icons,I.axios))})(this,(function(I,C,s,O,xt){"use strict";function yt(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const a=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,a.get?a:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const h=yt(C);var le={exports:{}},X={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.js
|
|
4
4
|
*
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var
|
|
9
|
+
*/var _e;function vt(){if(_e)return X;_e=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function r(a,l,i){var o=null;if(i!==void 0&&(o=""+i),l.key!==void 0&&(o=""+l.key),"key"in l){i={};for(var c in l)c!=="key"&&(i[c]=l[c])}else i=l;return l=i.ref,{$$typeof:e,type:a,key:o,ref:l!==void 0?l:null,props:i}}return X.Fragment=t,X.jsx=r,X.jsxs=r,X}var Z={};/**
|
|
10
10
|
* @license React
|
|
11
11
|
* react-jsx-runtime.development.js
|
|
12
12
|
*
|
|
@@ -14,10 +14,21 @@
|
|
|
14
14
|
*
|
|
15
15
|
* This source code is licensed under the MIT license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var
|
|
17
|
+
*/var Fe;function bt(){return Fe||(Fe=1,process.env.NODE_ENV!=="production"&&(function(){function e(f){if(f==null)return null;if(typeof f=="function")return f.$$typeof===Oe?null:f.displayName||f.name||null;if(typeof f=="string")return f;switch(f){case g:return"Fragment";case y:return"Profiler";case k:return"StrictMode";case T:return"Suspense";case A:return"SuspenseList";case re:return"Activity"}if(typeof f=="object")switch(typeof f.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),f.$$typeof){case w:return"Portal";case N:return f.displayName||"Context";case S:return(f._context.displayName||"Context")+".Consumer";case _:var R=f.render;return f=f.displayName,f||(f=R.displayName||R.name||"",f=f!==""?"ForwardRef("+f+")":"ForwardRef"),f;case q:return R=f.displayName||null,R!==null?R:e(f.type)||"Memo";case V:R=f._payload,f=f._init;try{return e(f(R))}catch{}}return null}function t(f){return""+f}function r(f){try{t(f);var R=!1}catch{R=!0}if(R){R=console;var P=R.error,L=typeof Symbol=="function"&&Symbol.toStringTag&&f[Symbol.toStringTag]||f.constructor.name||"Object";return P.call(R,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",L),t(f)}}function a(f){if(f===g)return"<>";if(typeof f=="object"&&f!==null&&f.$$typeof===V)return"<...>";try{var R=e(f);return R?"<"+R+">":"<...>"}catch{return"<...>"}}function l(){var f=ne.A;return f===null?null:f.getOwner()}function i(){return Error("react-stack-top-frame")}function o(f){if(ae.call(f,"key")){var R=Object.getOwnPropertyDescriptor(f,"key").get;if(R&&R.isReactWarning)return!1}return f.key!==void 0}function c(f,R){function P(){ht||(ht=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",R))}P.isReactWarning=!0,Object.defineProperty(f,"key",{get:P,configurable:!0})}function d(){var f=e(this.type);return ft[f]||(ft[f]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),f=this.props.ref,f!==void 0?f:null}function p(f,R,P,L,ge,Le){var D=P.ref;return f={$$typeof:b,type:f,key:R,props:P,_owner:L},(D!==void 0?D:null)!==null?Object.defineProperty(f,"ref",{enumerable:!1,get:d}):Object.defineProperty(f,"ref",{enumerable:!1,value:null}),f._store={},Object.defineProperty(f._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(f,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(f,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:ge}),Object.defineProperty(f,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:Le}),Object.freeze&&(Object.freeze(f.props),Object.freeze(f)),f}function u(f,R,P,L,ge,Le){var D=R.children;if(D!==void 0)if(L)if(pe(D)){for(L=0;L<D.length;L++)m(D[L]);Object.freeze&&Object.freeze(D)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else m(D);if(ae.call(R,"key")){D=e(f);var K=Object.keys(R).filter(function(pn){return pn!=="key"});L=0<K.length?"{key: someKey, "+K.join(": ..., ")+": ...}":"{key: someKey}",gt[D+L]||(K=0<K.length?"{"+K.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
18
18
|
let props = %s;
|
|
19
19
|
<%s {...props} />
|
|
20
20
|
React keys must be passed directly to JSX without using spread:
|
|
21
21
|
let props = %s;
|
|
22
|
-
<%s key={someKey} {...props} />`,S,w,B,w),ie[w+S]=!0)}if(w=null,y!==void 0&&(E(y),w=""+y),h(n)&&(E(n.key),w=""+n.key),"key"in n){y={};for(var H in n)H!=="key"&&(y[H]=n[H])}else y=n;return w&&g(y,typeof s=="function"?s.displayName||s.name||"Unknown":s),k(s,w,y,m(),U,K)}function I(s){C(s)?s._store&&(s._store.validated=1):typeof s=="object"&&s!==null&&s.$$typeof===Y&&(s._payload.status==="fulfilled"?C(s._payload.value)&&s._payload.value._store&&(s._payload.value._store.validated=1):s._store&&(s._store.validated=1))}function C(s){return typeof s=="object"&&s!==null&&s.$$typeof===R}var T=i,R=Symbol.for("react.transitional.element"),P=Symbol.for("react.portal"),x=Symbol.for("react.fragment"),A=Symbol.for("react.strict_mode"),u=Symbol.for("react.profiler"),O=Symbol.for("react.consumer"),W=Symbol.for("react.context"),M=Symbol.for("react.forward_ref"),v=Symbol.for("react.suspense"),_=Symbol.for("react.suspense_list"),ke=Symbol.for("react.memo"),Y=Symbol.for("react.lazy"),Te=Symbol.for("react.activity"),Re=Symbol.for("react.client.reference"),G=T.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,se=Object.prototype.hasOwnProperty,Ae=Array.isArray,J=console.createTask?console.createTask:function(){return null};T={react_stack_bottom_frame:function(s){return s()}};var le,re={},ae=T.react_stack_bottom_frame.bind(T,c)(),ne=J(j(c)),ie={};L.Fragment=x,L.jsx=function(s,n,y){var S=1e4>G.recentlyCreatedOwnerStacks++;return o(s,n,y,!1,S?Error("react-stack-top-frame"):ae,S?J(j(s)):ne)},L.jsxs=function(s,n,y){var S=1e4>G.recentlyCreatedOwnerStacks++;return o(s,n,y,!0,S?Error("react-stack-top-frame"):ae,S?J(j(s)):ne)}})()),L}var Q;function ue(){return Q||(Q=1,process.env.NODE_ENV==="production"?V.exports=ce():V.exports=de()),V.exports}var e=ue();let q="/api";function pe(l){q=l||"/api"}function r(){return oe.create({baseURL:q,timeout:1e4})}const a=l=>{const p=l.data;return p&&typeof p=="object"&&"code"in p&&"data"in p?p.code!==0&&p.code!==200?Promise.reject(new Error(p.msg||p.message||"请求失败")):p.data:p},D={list:()=>r().get("/ops/deployment/list").then(a),get:l=>r().get(`/ops/deployment/${l}`).then(a),create:l=>r().post("/ops/deployment",l).then(a),update:l=>r().put("/ops/deployment",l).then(a),delete:l=>r().delete(`/ops/deployment/${l}`).then(a),deploy:l=>r().post(`/ops/deployment/deploy/${l}`).then(a),log:l=>r().get(`/ops/deployment/log/${l}`).then(a)},F={list:()=>r().get("/ops/target/list").then(a),get:l=>r().get(`/ops/target/${l}`).then(a),create:l=>r().post("/ops/target",l).then(a),update:l=>r().put("/ops/target",l).then(a),delete:l=>r().delete(`/ops/target/${l}`).then(a)},z={list:()=>r().get("/ops/environment/list").then(a),get:l=>r().get(`/ops/environment/${l}`).then(a),create:l=>r().post("/ops/environment",l).then(a),update:l=>r().put("/ops/environment",l).then(a),delete:l=>r().delete(`/ops/environment/${l}`).then(a)},$={list:l=>r().get("/ops/record/list",{params:l?{unitId:l}:{}}).then(a),get:l=>r().get(`/ops/record/${l}`).then(a)},me={list:l=>r().get("/ops/webhook/list",{params:l?{unitId:l}:{}}).then(a),create:l=>r().post("/ops/webhook",l).then(a),update:l=>r().put("/ops/webhook",l).then(a),delete:l=>r().delete(`/ops/webhook/${l}`).then(a),url:l=>r().get(`/ops/webhook/url/${l}`).then(a)},he={page:l=>r().post("/image/page",l).then(a),list:()=>r().get("/image/list").then(a),get:l=>r().get("/image/get",{params:{id:l}}).then(a),add:l=>r().post("/image",l).then(a),update:l=>r().post("/image/update",l).then(a),delete:l=>r().post("/image/delete",null,{params:{id:l}}).then(a),tags:l=>r().get("/image/tags",{params:{imageId:l}}).then(a),addTag:l=>r().post("/image/tag",l).then(a),deleteTag:l=>r().post("/image/tag/delete",null,{params:{id:l}}).then(a)},ge={list:l=>r().get("/ops/image-tag/list",{params:{imageId:l}}).then(a),create:l=>r().post("/ops/image-tag",l).then(a),delete:l=>r().delete(`/ops/image-tag/${l}`).then(a)},ee={page:l=>r().post("/image-build/page",l).then(a),list:()=>r().get("/image-build/list").then(a),get:l=>r().get("/image-build/get",{params:{id:l}}).then(a),add:l=>r().post("/image-build",l).then(a)},te={list:()=>r().get("/v1/bucket").then(a)},xe=()=>{const[l,p]=i.useState([]),[E,j]=i.useState(!1),[m,c]=i.useState(!1),[h,g]=i.useState(null),[f]=t.Form.useForm(),k=async()=>{j(!0);try{p(await F.list()||[])}catch{t.message.error("加载失败")}finally{j(!1)}};i.useEffect(()=>{k()},[]);const o=()=>{g(null),f.resetFields(),f.setFieldsValue({type:"k8s",status:"ENABLE",port:22}),c(!0)},I=x=>{g(x),f.setFieldsValue(x),c(!0)},C=x=>{t.Modal.confirm({title:"确认删除",content:`删除 ${x.name}?`,onOk:async()=>{await F.delete(x.id),t.message.success("删除成功"),k()}})},T=async()=>{try{const x=await f.validateFields();h?await F.update({...x,id:h.id}):await F.create(x),t.message.success(h?"更新成功":"创建成功"),c(!1),k()}catch{}},R={k8s:{text:"K8s",color:"blue"},docker:{text:"Docker",color:"cyan"},vm:{text:"VM",color:"orange"},serverless:{text:"Serverless",color:"purple"}},P=[{title:"名称",dataIndex:"name",width:150},{title:"类型",dataIndex:"type",width:110,render:x=>{const A=R[x]||{text:x,color:"default"};return e.jsx(t.Tag,{color:A.color,children:A.text})}},{title:"主机",dataIndex:"host",ellipsis:!0},{title:"端口",dataIndex:"port",width:70},{title:"命名空间",dataIndex:"namespace",width:120},{title:"状态",dataIndex:"status",width:80,render:x=>e.jsx(t.Tag,{color:x==="ENABLE"?"green":"red",children:x==="ENABLE"?"启用":"禁用"})},{title:"操作",width:160,render:(x,A)=>e.jsxs(t.Space,{size:"small",children:[e.jsx(t.Button,{size:"small",type:"text",icon:e.jsx(b.EditOutlined,{}),onClick:()=>I(A),children:"编辑"}),e.jsx(t.Button,{size:"small",type:"text",danger:!0,icon:e.jsx(b.DeleteOutlined,{}),onClick:()=>C(A),children:"删除"})]})}];return e.jsxs("div",{style:{padding:24},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:24},children:[e.jsxs("div",{children:[e.jsx("h2",{style:{margin:0,fontSize:20,fontWeight:600},children:"渠道管理"}),e.jsx("span",{style:{color:"#8a8f98",fontSize:14},children:"管理部署目标 (Kubernetes / Docker / VM)"})]}),e.jsx(t.Button,{type:"primary",icon:e.jsx(b.PlusOutlined,{}),onClick:o,children:"新建渠道"})]}),e.jsx("div",{style:{background:"rgba(255,255,255,0.02)",border:"1px solid rgba(255,255,255,0.06)",borderRadius:8,padding:16},children:e.jsx(t.Table,{columns:P,dataSource:l,loading:E,rowKey:"id",pagination:{pageSize:10},locale:{emptyText:"暂无部署目标"}})}),e.jsx(t.Drawer,{title:h?"编辑渠道":"新建渠道",placement:"right",width:520,open:m,onClose:()=>c(!1),children:e.jsxs(t.Form,{form:f,layout:"vertical",onFinish:T,children:[e.jsx(t.Form.Item,{name:"name",label:"名称",rules:[{required:!0}],children:e.jsx(t.Input,{placeholder:"如: prod-k8s-cluster"})}),e.jsx(t.Form.Item,{name:"type",label:"类型",rules:[{required:!0}],children:e.jsxs(t.Select,{children:[e.jsx(t.Select.Option,{value:"k8s",children:"Kubernetes"}),e.jsx(t.Select.Option,{value:"docker",children:"Docker"}),e.jsx(t.Select.Option,{value:"vm",children:"虚拟机"}),e.jsx(t.Select.Option,{value:"serverless",children:"Serverless"})]})}),e.jsxs(t.Space,{style:{display:"flex"},size:"middle",children:[e.jsx(t.Form.Item,{name:"host",label:"主机地址",rules:[{required:!0}],style:{flex:1},children:e.jsx(t.Input,{placeholder:"192.168.1.100"})}),e.jsx(t.Form.Item,{name:"port",label:"端口",children:e.jsx(t.InputNumber,{min:1,max:65535})})]}),e.jsxs(t.Space,{style:{display:"flex"},size:"middle",children:[e.jsx(t.Form.Item,{name:"username",label:"用户名",style:{flex:1},children:e.jsx(t.Input,{placeholder:"root"})}),e.jsx(t.Form.Item,{name:"namespace",label:"命名空间",style:{flex:1},children:e.jsx(t.Input,{placeholder:"default"})})]}),e.jsx(t.Form.Item,{name:"authPath",label:"密钥路径",children:e.jsx(t.Input,{placeholder:"~/.ssh/id_rsa"})}),e.jsx(t.Form.Item,{name:"description",label:"描述",children:e.jsx(t.Input.TextArea,{rows:2})}),e.jsx(t.Form.Item,{name:"status",label:"状态",initialValue:"ENABLE",children:e.jsxs(t.Select,{children:[e.jsx(t.Select.Option,{value:"ENABLE",children:"启用"}),e.jsx(t.Select.Option,{value:"DISABLE",children:"禁用"})]})}),e.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:12,paddingTop:24,borderTop:"1px solid rgba(255,255,255,0.06)"},children:[e.jsx(t.Button,{onClick:()=>c(!1),children:"取消"}),e.jsx(t.Button,{type:"primary",htmlType:"submit",children:"保存"})]})]})})]})},fe=()=>{const[l,p]=i.useState([]),[E,j]=i.useState([]),[m,c]=i.useState(!1),[h,g]=i.useState(!1),[f,k]=i.useState(null),[o]=t.Form.useForm(),I=async()=>{c(!0);try{const[u,O]=await Promise.all([z.list(),F.list()]);p(u||[]),j(O||[])}catch{t.message.error("加载失败")}finally{c(!1)}};i.useEffect(()=>{I()},[]);const C=()=>{k(null),o.resetFields(),o.setFieldsValue({status:"ENABLE",sort:0,autoDeploy:0}),g(!0)},T=u=>{k(u),o.setFieldsValue(u),g(!0)},R=u=>{t.Modal.confirm({title:"确认删除",content:`删除环境 ${u.name}?`,onOk:async()=>{await z.delete(u.id),t.message.success("删除成功"),I()}})},P=async()=>{try{const u=await o.validateFields(),O={...u,autoDeploy:u.autoDeploy?1:0};f?await z.update({...O,id:f.id}):await z.create(O),t.message.success(f?"更新成功":"创建成功"),g(!1),I()}catch{}},x=Object.fromEntries(E.map(u=>[u.id,u.name])),A=[{title:"名称",dataIndex:"name",width:120},{title:"编码",dataIndex:"code",width:100},{title:"关联渠道",dataIndex:"targetId",width:140,render:u=>x[u]||"-"},{title:"自动部署",dataIndex:"autoDeploy",width:90,render:u=>u?e.jsx(t.Tag,{color:"green",children:"是"}):e.jsx(t.Tag,{children:"否"})},{title:"描述",dataIndex:"description",ellipsis:!0},{title:"状态",dataIndex:"status",width:80,render:u=>e.jsx(t.Tag,{color:u==="ENABLE"?"green":"red",children:u==="ENABLE"?"启用":"禁用"})},{title:"操作",width:160,render:(u,O)=>e.jsxs(t.Space,{size:"small",children:[e.jsx(t.Button,{size:"small",type:"text",icon:e.jsx(b.EditOutlined,{}),onClick:()=>T(O),children:"编辑"}),e.jsx(t.Button,{size:"small",type:"text",danger:!0,icon:e.jsx(b.DeleteOutlined,{}),onClick:()=>R(O),children:"删除"})]})}];return e.jsxs("div",{style:{padding:24},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:24},children:[e.jsxs("div",{children:[e.jsx("h2",{style:{margin:0,fontSize:20,fontWeight:600},children:"环境管理"}),e.jsx("span",{style:{color:"#8a8f98",fontSize:14},children:"管理部署环境 (开发 / 测试 / 预发 / 生产)"})]}),e.jsx(t.Button,{type:"primary",icon:e.jsx(b.PlusOutlined,{}),onClick:C,children:"新建环境"})]}),e.jsx("div",{style:{background:"rgba(255,255,255,0.02)",border:"1px solid rgba(255,255,255,0.06)",borderRadius:8,padding:16},children:e.jsx(t.Table,{columns:A,dataSource:l,loading:m,rowKey:"id",pagination:{pageSize:10},locale:{emptyText:"暂无环境"}})}),e.jsx(t.Drawer,{title:f?"编辑环境":"新建环境",placement:"right",width:520,open:h,onClose:()=>g(!1),children:e.jsxs(t.Form,{form:o,layout:"vertical",onFinish:P,children:[e.jsxs(t.Space,{style:{display:"flex"},size:"middle",children:[e.jsx(t.Form.Item,{name:"name",label:"名称",rules:[{required:!0}],style:{flex:1},children:e.jsx(t.Input,{placeholder:"如: 生产环境"})}),e.jsx(t.Form.Item,{name:"code",label:"编码",rules:[{required:!0}],style:{flex:1},children:e.jsx(t.Input,{placeholder:"如: prod"})})]}),e.jsx(t.Form.Item,{name:"targetId",label:"关联部署渠道",children:e.jsx(t.Select,{allowClear:!0,placeholder:"选择部署目标",children:E.map(u=>e.jsx(t.Select.Option,{value:u.id,children:u.name},u.id))})}),e.jsxs(t.Space,{style:{display:"flex"},size:"middle",children:[e.jsx(t.Form.Item,{name:"sort",label:"排序",style:{flex:1},children:e.jsx(t.InputNumber,{min:0})}),e.jsx(t.Form.Item,{name:"autoDeploy",label:"自动部署",valuePropName:"checked",style:{flex:1},children:e.jsx(t.Switch,{})})]}),e.jsx(t.Form.Item,{name:"description",label:"描述",children:e.jsx(t.Input.TextArea,{rows:2})}),e.jsx(t.Form.Item,{name:"config",label:"配置 (JSON)",children:e.jsx(t.Input.TextArea,{rows:3})}),e.jsx(t.Form.Item,{name:"status",label:"状态",initialValue:"ENABLE",children:e.jsxs(t.Select,{children:[e.jsx(t.Select.Option,{value:"ENABLE",children:"启用"}),e.jsx(t.Select.Option,{value:"DISABLE",children:"禁用"})]})}),e.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:12,paddingTop:24,borderTop:"1px solid rgba(255,255,255,0.06)"},children:[e.jsx(t.Button,{onClick:()=>g(!1),children:"取消"}),e.jsx(t.Button,{type:"primary",htmlType:"submit",children:"保存"})]})]})})]})},ye=()=>{const[l,p]=i.useState([]),[E,j]=i.useState(!1),[m,c]=i.useState(!1),[h,g]=i.useState(!1),[f,k]=i.useState(null),[o,I]=i.useState(null),[C,T]=i.useState(""),[R]=t.Form.useForm(),P=async()=>{j(!0);try{p(await D.list()||[])}catch{t.message.error("加载失败")}finally{j(!1)}};i.useEffect(()=>{P()},[]);const x=()=>{k(null),R.resetFields(),R.setFieldsValue({status:"ENABLE",gitBranch:"main"}),c(!0)},A=v=>{k(v),R.setFieldsValue(v),c(!0)},u=v=>{t.Modal.confirm({title:"确认删除",content:`删除 ${v.name}?`,onOk:async()=>{await D.delete(v.id),t.message.success("删除成功"),P()}})},O=async v=>{I(v.id),g(!0),T(`正在部署...
|
|
23
|
-
`);try{const _=await D.deploy(v.id);T(_||"部署完成")}catch(_){T("部署失败: "+(_.message||"未知错误"))}finally{I(null)}},W=async()=>{try{const v=await R.validateFields();f?await D.update({...v,id:f.id}):await D.create(v),t.message.success(f?"更新成功":"创建成功"),c(!1),P()}catch{}},M=[{title:"名称",dataIndex:"name",width:150},{title:"Git 仓库",dataIndex:"gitRepo",ellipsis:!0},{title:"分支",dataIndex:"gitBranch",width:100},{title:"工作目录",dataIndex:"workDir",ellipsis:!0},{title:"状态",dataIndex:"status",width:80,render:v=>e.jsx(t.Tag,{color:v==="ENABLE"?"green":"red",children:v==="ENABLE"?"启用":"禁用"})},{title:"操作",width:240,render:(v,_)=>e.jsxs(t.Space,{size:"small",children:[e.jsx(t.Button,{size:"small",type:"text",icon:e.jsx(b.PlayCircleOutlined,{spin:o===_.id}),onClick:()=>O(_),disabled:o!==null,children:o===_.id?"部署中":"部署"}),e.jsx(t.Button,{size:"small",type:"text",icon:e.jsx(b.EditOutlined,{}),onClick:()=>A(_),children:"编辑"}),e.jsx(t.Button,{size:"small",type:"text",danger:!0,icon:e.jsx(b.DeleteOutlined,{}),onClick:()=>u(_),children:"删除"})]})}];return e.jsxs("div",{style:{padding:24},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:24},children:[e.jsxs("div",{children:[e.jsx("h2",{style:{margin:0,fontSize:20,fontWeight:600},children:"部署单元"}),e.jsx("span",{style:{color:"#8a8f98",fontSize:14},children:"管理 Git 仓库部署配置"})]}),e.jsx(t.Button,{type:"primary",icon:e.jsx(b.PlusOutlined,{}),onClick:x,children:"新建部署单元"})]}),e.jsx("div",{style:{background:"rgba(255,255,255,0.02)",border:"1px solid rgba(255,255,255,0.06)",borderRadius:8,padding:16},children:e.jsx(t.Table,{columns:M,dataSource:l,loading:E,rowKey:"id",pagination:{pageSize:10},locale:{emptyText:"暂无部署单元"}})}),e.jsx(t.Drawer,{title:f?"编辑部署单元":"新建部署单元",placement:"right",width:520,open:m,onClose:()=>c(!1),children:e.jsxs(t.Form,{form:R,layout:"vertical",onFinish:W,children:[e.jsx(t.Form.Item,{name:"name",label:"名称",rules:[{required:!0}],children:e.jsx(t.Input,{placeholder:"如: z-agent-backend"})}),e.jsx(t.Form.Item,{name:"description",label:"描述",children:e.jsx(t.Input.TextArea,{rows:2})}),e.jsx(t.Form.Item,{name:"status",label:"状态",initialValue:"ENABLE",children:e.jsxs(t.Select,{children:[e.jsx(t.Select.Option,{value:"ENABLE",children:"启用"}),e.jsx(t.Select.Option,{value:"DISABLE",children:"禁用"})]})}),e.jsx(t.Form.Item,{name:"gitRepo",label:"Git 仓库地址",rules:[{required:!0}],children:e.jsx(t.Input,{placeholder:"https://github.com/username/repo.git"})}),e.jsx(t.Form.Item,{name:"gitBranch",label:"分支",initialValue:"main",children:e.jsx(t.Input,{placeholder:"main"})}),e.jsx(t.Form.Item,{name:"workDir",label:"本地工作目录",rules:[{required:!0}],children:e.jsx(t.Input,{placeholder:"/deploy/my-app"})}),e.jsx(t.Form.Item,{name:"buildCommand",label:"构建命令",children:e.jsx(t.Input.TextArea,{rows:2,placeholder:"mvn clean package -DskipTests"})}),e.jsx(t.Form.Item,{name:"deployCommand",label:"部署命令",children:e.jsx(t.Input.TextArea,{rows:2})}),e.jsx(t.Form.Item,{name:"healthCheckUrl",label:"健康检查 URL",children:e.jsx(t.Input,{placeholder:"http://localhost:8080/actuator/health"})}),e.jsx(t.Form.Item,{name:"envVars",label:"环境变量 (JSON)",children:e.jsx(t.Input.TextArea,{rows:3})}),e.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:12,paddingTop:24,borderTop:"1px solid rgba(255,255,255,0.06)"},children:[e.jsx(t.Button,{onClick:()=>c(!1),children:"取消"}),e.jsx(t.Button,{type:"primary",htmlType:"submit",children:"保存"})]})]})}),e.jsx(t.Drawer,{title:e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx(b.SyncOutlined,{spin:o!==null}),e.jsx("span",{children:o?"部署中":"部署完成"})]}),placement:"right",width:600,open:h,onClose:()=>g(!1),children:e.jsx("pre",{style:{background:"#0a0a0f",color:"#d0d6e0",padding:16,borderRadius:6,fontFamily:"monospace",fontSize:12,lineHeight:1.6,maxHeight:500,overflow:"auto",whiteSpace:"pre-wrap"},children:C})})]})},je=()=>{const[l,p]=i.useState([]),[E,j]=i.useState([]),[m,c]=i.useState(null),[h,g]=i.useState(!1);i.useEffect(()=>{(async()=>{try{const o=await D.list()||[];j(o),o.length&&c(o[0].id)}catch{t.message.error("加载部署单元失败")}})()},[]),i.useEffect(()=>{if(!m){p([]);return}(async()=>{g(!0);try{p(await $.list(m)||[])}catch{t.message.error("加载记录失败")}finally{g(!1)}})()},[m]);const f={SUCCESS:{text:"成功",color:"green"},FAILED:{text:"失败",color:"red"},RUNNING:{text:"运行中",color:"processing"},PENDING:{text:"等待中",color:"default"}},k=[{title:"ID",dataIndex:"id",width:60},{title:"分支",dataIndex:"branch",width:120},{title:"Commit",dataIndex:"commitId",width:100,ellipsis:!0,render:o=>o?e.jsx("code",{children:o.substring(0,8)}):"-"},{title:"部署人",dataIndex:"deployer",width:100},{title:"触发方式",dataIndex:"triggerType",width:100,render:o=>({MANUAL:"手动",WEBHOOK:"Webhook",SCHEDULE:"定时"})[o]||o||"-"},{title:"开始时间",dataIndex:"startedAt",width:170},{title:"结束时间",dataIndex:"finishedAt",width:170},{title:"状态",dataIndex:"status",width:90,render:o=>{const I=f[o]||{text:o,color:"default"};return e.jsx(t.Tag,{color:I.color,children:I.text})}},{title:"结果",dataIndex:"result",ellipsis:!0}];return e.jsxs("div",{style:{padding:24},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:24},children:[e.jsxs("div",{children:[e.jsx("h2",{style:{margin:0,fontSize:20,fontWeight:600},children:"部署记录"}),e.jsx("span",{style:{color:"#8a8f98",fontSize:14},children:"查看历史部署记录"})]}),e.jsxs(t.Space,{children:[e.jsx("span",{style:{color:"#8a8f98"},children:"部署单元:"}),e.jsx(t.Select,{value:m,onChange:c,style:{width:240},children:E.map(o=>e.jsx(t.Select.Option,{value:o.id,children:o.name},o.id))})]})]}),e.jsx("div",{style:{background:"rgba(255,255,255,0.02)",border:"1px solid rgba(255,255,255,0.06)",borderRadius:8,padding:16},children:e.jsx(t.Table,{columns:k,dataSource:l,loading:h,rowKey:"id",pagination:{pageSize:10},locale:{emptyText:"暂无部署记录"}})})]})},be=()=>{const[l,p]=i.useState([]),[E,j]=i.useState(!1),m=async()=>{j(!0);try{p(await te.list()||[])}catch{t.message.error("加载 Bucket 列表失败")}finally{j(!1)}};i.useEffect(()=>{m()},[]);const c=[{title:"Bucket 名称",dataIndex:"name",copyable:!0},{title:"创建时间",dataIndex:"createdAt",width:180},{title:"存储类型",dataIndex:"storageClass",width:100,render:h=>h||"标准"},{title:"区域",dataIndex:"region",width:100},{title:"对象数",dataIndex:"objectCount",width:100,render:h=>h??"-"},{title:"用量",dataIndex:"sizeGb",width:100,render:h=>h!=null?`${h} GB`:"-"}];return e.jsxs("div",{style:{padding:24},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:24},children:[e.jsxs("div",{children:[e.jsxs("h2",{style:{margin:0,fontSize:20,fontWeight:600},children:[e.jsx(b.FolderOpenOutlined,{style:{marginRight:8}}),"对象存储"]}),e.jsx("span",{style:{color:"#8a8f98",fontSize:14},children:"OSS Bucket 与文件目录"})]}),e.jsx(t.Button,{icon:e.jsx(b.ReloadOutlined,{}),onClick:m,children:"刷新"})]}),e.jsx("div",{style:{background:"rgba(255,255,255,0.02)",border:"1px solid rgba(255,255,255,0.06)",borderRadius:8,padding:16},children:e.jsx(t.Table,{columns:c,dataSource:l,loading:E,rowKey:"name",pagination:{pageSize:10},locale:{emptyText:"暂无 Bucket"}})})]})},Se=()=>e.jsxs("div",{style:{padding:24},children:[e.jsxs("h2",{style:{margin:"0 0 8px",fontSize:20,fontWeight:600},children:[e.jsx(b.GlobalOutlined,{style:{marginRight:8}}),"域名管理"]}),e.jsx("p",{style:{color:"#8a8f98",marginBottom:24},children:"管理已绑定的域名与 SSL 证书"}),e.jsx("div",{style:{background:"rgba(255,255,255,0.02)",border:"1px solid rgba(255,255,255,0.06)",borderRadius:8,padding:48},children:e.jsx(t.Empty,{description:"后端 API 开发中,敬请期待"})})]}),we=()=>e.jsxs("div",{style:{padding:24},children:[e.jsxs("h2",{style:{margin:"0 0 8px",fontSize:20,fontWeight:600},children:[e.jsx(b.DesktopOutlined,{style:{marginRight:8}}),"ECS 管理"]}),e.jsx("p",{style:{color:"#8a8f98",marginBottom:24},children:"查看与管理云服务器实例"}),e.jsx("div",{style:{background:"rgba(255,255,255,0.02)",border:"1px solid rgba(255,255,255,0.06)",borderRadius:8,padding:48},children:e.jsx(t.Empty,{description:"后端 API 开发中,敬请期待"})})]}),Ee=()=>e.jsxs("div",{style:{padding:24},children:[e.jsxs("h2",{style:{margin:"0 0 8px",fontSize:20,fontWeight:600},children:[e.jsx(b.DatabaseOutlined,{style:{marginRight:8}}),"RDS 管理"]}),e.jsx("p",{style:{color:"#8a8f98",marginBottom:24},children:"查看云数据库实例与慢查询监控"}),e.jsx("div",{style:{background:"rgba(255,255,255,0.02)",border:"1px solid rgba(255,255,255,0.06)",borderRadius:8,padding:48},children:e.jsx(t.Empty,{description:"后端 API 开发中,敬请期待"})})]}),ve=()=>{const[l,p]=i.useState([]),[E,j]=i.useState(!1),m=async()=>{j(!0);try{p(await ee.list()||[])}catch{t.message.error("加载构建记录失败")}finally{j(!1)}};i.useEffect(()=>{m()},[]);const c={SUCCESS:{text:"成功",color:"green"},FAILED:{text:"失败",color:"red"},BUILDING:{text:"构建中",color:"processing"}},h=[{title:"ID",dataIndex:"id",width:60},{title:"镜像名",dataIndex:"imageName",width:160},{title:"应用名",dataIndex:"appName",width:120},{title:"分支",dataIndex:"branch",width:120},{title:"环境",dataIndex:"env",width:80},{title:"状态",dataIndex:"status",width:90,render:g=>{const f=c[g]||{text:g,color:"default"};return e.jsx(t.Tag,{color:f.color,children:f.text})}},{title:"镜像版本",dataIndex:"imageTag",width:140,ellipsis:!0},{title:"构建时间",dataIndex:"createdAt",width:170}];return e.jsxs("div",{style:{padding:24},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:24},children:[e.jsxs("div",{children:[e.jsxs("h2",{style:{margin:0,fontSize:20,fontWeight:600},children:[e.jsx(b.ToolOutlined,{style:{marginRight:8}}),"镜像构建"]}),e.jsx("span",{style:{color:"#8a8f98",fontSize:14},children:"镜像构建记录"})]}),e.jsx(t.Button,{icon:e.jsx(b.ReloadOutlined,{}),onClick:m,children:"刷新"})]}),e.jsx("div",{style:{background:"rgba(255,255,255,0.02)",border:"1px solid rgba(255,255,255,0.06)",borderRadius:8,padding:16},children:e.jsx(t.Table,{columns:h,dataSource:l,loading:E,rowKey:"id",pagination:{pageSize:10},locale:{emptyText:"暂无构建记录"}})})]})},Ie=()=>e.jsxs("div",{style:{padding:24},children:[e.jsxs("h2",{style:{margin:"0 0 8px",fontSize:20,fontWeight:600},children:[e.jsx(b.CalendarOutlined,{style:{marginRight:8}}),"迭代管理"]}),e.jsx("p",{style:{color:"#8a8f98",marginBottom:24},children:"管理研发迭代与里程碑"}),e.jsx("div",{style:{background:"rgba(255,255,255,0.02)",border:"1px solid rgba(255,255,255,0.06)",borderRadius:8,padding:48},children:e.jsx(t.Empty,{description:"后端 API 开发中,敬请期待"})})]});d.ChannelPage=xe,d.DeliveryPage=fe,d.DeploymentPage=ye,d.DomainPage=Se,d.EcsPage=we,d.RdOpsPage=ve,d.RdsPage=Ee,d.ResourceOssPage=be,d.SprintPage=Ie,d.TaskPage=je,d.configureApiBaseURL=pe,d.deploymentUnitApi=D,d.environmentApi=z,d.imageApi=he,d.imageBuildApi=ee,d.imageTagApi=ge,d.ossBucketApi=te,d.recordApi=$,d.targetApi=F,d.webhookApi=me,Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})}));
|
|
22
|
+
<%s key={someKey} {...props} />`,L,D,K,D),gt[D+L]=!0)}if(D=null,P!==void 0&&(r(P),D=""+P),o(R)&&(r(R.key),D=""+R.key),"key"in R){P={};for(var De in R)De!=="key"&&(P[De]=R[De])}else P=R;return D&&c(P,typeof f=="function"?f.displayName||f.name||"Unknown":f),p(f,D,P,l(),ge,Le)}function m(f){x(f)?f._store&&(f._store.validated=1):typeof f=="object"&&f!==null&&f.$$typeof===V&&(f._payload.status==="fulfilled"?x(f._payload.value)&&f._payload.value._store&&(f._payload.value._store.validated=1):f._store&&(f._store.validated=1))}function x(f){return typeof f=="object"&&f!==null&&f.$$typeof===b}var v=C,b=Symbol.for("react.transitional.element"),w=Symbol.for("react.portal"),g=Symbol.for("react.fragment"),k=Symbol.for("react.strict_mode"),y=Symbol.for("react.profiler"),S=Symbol.for("react.consumer"),N=Symbol.for("react.context"),_=Symbol.for("react.forward_ref"),T=Symbol.for("react.suspense"),A=Symbol.for("react.suspense_list"),q=Symbol.for("react.memo"),V=Symbol.for("react.lazy"),re=Symbol.for("react.activity"),Oe=Symbol.for("react.client.reference"),ne=v.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ae=Object.prototype.hasOwnProperty,pe=Array.isArray,$=console.createTask?console.createTask:function(){return null};v={react_stack_bottom_frame:function(f){return f()}};var ht,ft={},mt=v.react_stack_bottom_frame.bind(v,i)(),pt=$(a(i)),gt={};Z.Fragment=g,Z.jsx=function(f,R,P){var L=1e4>ne.recentlyCreatedOwnerStacks++;return u(f,R,P,!1,L?Error("react-stack-top-frame"):mt,L?$(a(f)):pt)},Z.jsxs=function(f,R,P){var L=1e4>ne.recentlyCreatedOwnerStacks++;return u(f,R,P,!0,L?Error("react-stack-top-frame"):mt,L?$(a(f)):pt)}})()),Z}var Ne;function wt(){return Ne||(Ne=1,process.env.NODE_ENV==="production"?le.exports=vt():le.exports=bt()),le.exports}var n=wt();let $e="/api";function Et(e){$e=e||"/api"}function E(){return xt.create({baseURL:$e,timeout:1e4})}const j=e=>{const t=e.data;return t&&typeof t=="object"&&"code"in t&&"data"in t?t.code!==0&&t.code!==200?Promise.reject(new Error(t.msg||t.message||"请求失败")):t.data:t},Y={list:()=>E().get("/ops/deployment/list").then(j),get:e=>E().get(`/ops/deployment/${e}`).then(j),create:e=>E().post("/ops/deployment",e).then(j),update:e=>E().put("/ops/deployment",e).then(j),delete:e=>E().delete(`/ops/deployment/${e}`).then(j),deploy:e=>E().post(`/ops/deployment/deploy/${e}`).then(j),log:e=>E().get(`/ops/deployment/log/${e}`).then(j)},G={list:()=>E().get("/ops/target/list").then(j),get:e=>E().get(`/ops/target/${e}`).then(j),create:e=>E().post("/ops/target",e).then(j),update:e=>E().put("/ops/target",e).then(j),delete:e=>E().delete(`/ops/target/${e}`).then(j)},Q={list:()=>E().get("/ops/environment/list").then(j),get:e=>E().get(`/ops/environment/${e}`).then(j),create:e=>E().post("/ops/environment",e).then(j),update:e=>E().put("/ops/environment",e).then(j),delete:e=>E().delete(`/ops/environment/${e}`).then(j)},Be={list:e=>E().get("/ops/record/list",{params:e?{unitId:e}:{}}).then(j),get:e=>E().get(`/ops/record/${e}`).then(j)},jt={list:e=>E().get("/ops/webhook/list",{params:e?{unitId:e}:{}}).then(j),create:e=>E().post("/ops/webhook",e).then(j),update:e=>E().put("/ops/webhook",e).then(j),delete:e=>E().delete(`/ops/webhook/${e}`).then(j),url:e=>E().get(`/ops/webhook/url/${e}`).then(j)},St={page:e=>E().post("/image/page",e).then(j),list:()=>E().get("/image/list").then(j),get:e=>E().get("/image/get",{params:{id:e}}).then(j),add:e=>E().post("/image",e).then(j),update:e=>E().post("/image/update",e).then(j),delete:e=>E().post("/image/delete",null,{params:{id:e}}).then(j),tags:e=>E().get("/image/tags",{params:{imageId:e}}).then(j),addTag:e=>E().post("/image/tag",e).then(j),deleteTag:e=>E().post("/image/tag/delete",null,{params:{id:e}}).then(j)},Rt={list:e=>E().get("/ops/image-tag/list",{params:{imageId:e}}).then(j),create:e=>E().post("/ops/image-tag",e).then(j),delete:e=>E().delete(`/ops/image-tag/${e}`).then(j)},Me={page:e=>E().post("/image-build/page",e).then(j),list:()=>E().get("/image-build/list").then(j),get:e=>E().get("/image-build/get",{params:{id:e}}).then(j),add:e=>E().post("/image-build",e).then(j)},ze={list:()=>E().get("/v1/bucket").then(j)},Ct=()=>{const[e,t]=C.useState([]),[r,a]=C.useState(!1),[l,i]=C.useState(!1),[o,c]=C.useState(null),[d]=s.Form.useForm(),p=async()=>{a(!0);try{t(await G.list()||[])}catch{s.message.error("加载失败")}finally{a(!1)}};C.useEffect(()=>{p()},[]);const u=()=>{c(null),d.resetFields(),d.setFieldsValue({type:"k8s",status:"ENABLE",port:22}),i(!0)},m=g=>{c(g),d.setFieldsValue(g),i(!0)},x=g=>{s.Modal.confirm({title:"确认删除",content:`删除 ${g.name}?`,onOk:async()=>{await G.delete(g.id),s.message.success("删除成功"),p()}})},v=async()=>{try{const g=await d.validateFields();o?await G.update({...g,id:o.id}):await G.create(g),s.message.success(o?"更新成功":"创建成功"),i(!1),p()}catch{}},b={k8s:{text:"K8s",color:"blue"},docker:{text:"Docker",color:"cyan"},vm:{text:"VM",color:"orange"},serverless:{text:"Serverless",color:"purple"}},w=[{title:"名称",dataIndex:"name",width:150},{title:"类型",dataIndex:"type",width:110,render:g=>{const k=b[g]||{text:g,color:"default"};return n.jsx(s.Tag,{color:k.color,children:k.text})}},{title:"主机",dataIndex:"host",ellipsis:!0},{title:"端口",dataIndex:"port",width:70},{title:"命名空间",dataIndex:"namespace",width:120},{title:"状态",dataIndex:"status",width:80,render:g=>n.jsx(s.Tag,{color:g==="ENABLE"?"green":"red",children:g==="ENABLE"?"启用":"禁用"})},{title:"操作",width:160,render:(g,k)=>n.jsxs(s.Space,{size:"small",children:[n.jsx(s.Button,{size:"small",type:"text",icon:n.jsx(O.EditOutlined,{}),onClick:()=>m(k),children:"编辑"}),n.jsx(s.Button,{size:"small",type:"text",danger:!0,icon:n.jsx(O.DeleteOutlined,{}),onClick:()=>x(k),children:"删除"})]})}];return n.jsxs("div",{style:{padding:24},children:[n.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:24},children:[n.jsxs("div",{children:[n.jsx("h2",{style:{margin:0,fontSize:20,fontWeight:600},children:"渠道管理"}),n.jsx("span",{style:{color:"#8a8f98",fontSize:14},children:"管理部署目标 (Kubernetes / Docker / VM)"})]}),n.jsx(s.Button,{type:"primary",icon:n.jsx(O.PlusOutlined,{}),onClick:u,children:"新建渠道"})]}),n.jsx("div",{style:{background:"rgba(255,255,255,0.02)",border:"1px solid rgba(255,255,255,0.06)",borderRadius:8,padding:16},children:n.jsx(s.Table,{columns:w,dataSource:e,loading:r,rowKey:"id",pagination:{pageSize:10},locale:{emptyText:"暂无部署目标"}})}),n.jsx(s.Drawer,{title:o?"编辑渠道":"新建渠道",placement:"right",width:520,open:l,onClose:()=>i(!1),children:n.jsxs(s.Form,{form:d,layout:"vertical",onFinish:v,children:[n.jsx(s.Form.Item,{name:"name",label:"名称",rules:[{required:!0}],children:n.jsx(s.Input,{placeholder:"如: prod-k8s-cluster"})}),n.jsx(s.Form.Item,{name:"type",label:"类型",rules:[{required:!0}],children:n.jsxs(s.Select,{children:[n.jsx(s.Select.Option,{value:"k8s",children:"Kubernetes"}),n.jsx(s.Select.Option,{value:"docker",children:"Docker"}),n.jsx(s.Select.Option,{value:"vm",children:"虚拟机"}),n.jsx(s.Select.Option,{value:"serverless",children:"Serverless"})]})}),n.jsxs(s.Space,{style:{display:"flex"},size:"middle",children:[n.jsx(s.Form.Item,{name:"host",label:"主机地址",rules:[{required:!0}],style:{flex:1},children:n.jsx(s.Input,{placeholder:"192.168.1.100"})}),n.jsx(s.Form.Item,{name:"port",label:"端口",children:n.jsx(s.InputNumber,{min:1,max:65535})})]}),n.jsxs(s.Space,{style:{display:"flex"},size:"middle",children:[n.jsx(s.Form.Item,{name:"username",label:"用户名",style:{flex:1},children:n.jsx(s.Input,{placeholder:"root"})}),n.jsx(s.Form.Item,{name:"namespace",label:"命名空间",style:{flex:1},children:n.jsx(s.Input,{placeholder:"default"})})]}),n.jsx(s.Form.Item,{name:"authPath",label:"密钥路径",children:n.jsx(s.Input,{placeholder:"~/.ssh/id_rsa"})}),n.jsx(s.Form.Item,{name:"description",label:"描述",children:n.jsx(s.Input.TextArea,{rows:2})}),n.jsx(s.Form.Item,{name:"status",label:"状态",initialValue:"ENABLE",children:n.jsxs(s.Select,{children:[n.jsx(s.Select.Option,{value:"ENABLE",children:"启用"}),n.jsx(s.Select.Option,{value:"DISABLE",children:"禁用"})]})}),n.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:12,paddingTop:24,borderTop:"1px solid rgba(255,255,255,0.06)"},children:[n.jsx(s.Button,{onClick:()=>i(!1),children:"取消"}),n.jsx(s.Button,{type:"primary",htmlType:"submit",children:"保存"})]})]})})]})},kt=()=>{const[e,t]=C.useState([]),[r,a]=C.useState([]),[l,i]=C.useState(!1),[o,c]=C.useState(!1),[d,p]=C.useState(null),[u]=s.Form.useForm(),m=async()=>{i(!0);try{const[y,S]=await Promise.all([Q.list(),G.list()]);t(y||[]),a(S||[])}catch{s.message.error("加载失败")}finally{i(!1)}};C.useEffect(()=>{m()},[]);const x=()=>{p(null),u.resetFields(),u.setFieldsValue({status:"ENABLE",sort:0,autoDeploy:0}),c(!0)},v=y=>{p(y),u.setFieldsValue(y),c(!0)},b=y=>{s.Modal.confirm({title:"确认删除",content:`删除环境 ${y.name}?`,onOk:async()=>{await Q.delete(y.id),s.message.success("删除成功"),m()}})},w=async()=>{try{const y=await u.validateFields(),S={...y,autoDeploy:y.autoDeploy?1:0};d?await Q.update({...S,id:d.id}):await Q.create(S),s.message.success(d?"更新成功":"创建成功"),c(!1),m()}catch{}},g=Object.fromEntries(r.map(y=>[y.id,y.name])),k=[{title:"名称",dataIndex:"name",width:120},{title:"编码",dataIndex:"code",width:100},{title:"关联渠道",dataIndex:"targetId",width:140,render:y=>g[y]||"-"},{title:"自动部署",dataIndex:"autoDeploy",width:90,render:y=>y?n.jsx(s.Tag,{color:"green",children:"是"}):n.jsx(s.Tag,{children:"否"})},{title:"描述",dataIndex:"description",ellipsis:!0},{title:"状态",dataIndex:"status",width:80,render:y=>n.jsx(s.Tag,{color:y==="ENABLE"?"green":"red",children:y==="ENABLE"?"启用":"禁用"})},{title:"操作",width:160,render:(y,S)=>n.jsxs(s.Space,{size:"small",children:[n.jsx(s.Button,{size:"small",type:"text",icon:n.jsx(O.EditOutlined,{}),onClick:()=>v(S),children:"编辑"}),n.jsx(s.Button,{size:"small",type:"text",danger:!0,icon:n.jsx(O.DeleteOutlined,{}),onClick:()=>b(S),children:"删除"})]})}];return n.jsxs("div",{style:{padding:24},children:[n.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:24},children:[n.jsxs("div",{children:[n.jsx("h2",{style:{margin:0,fontSize:20,fontWeight:600},children:"环境管理"}),n.jsx("span",{style:{color:"#8a8f98",fontSize:14},children:"管理部署环境 (开发 / 测试 / 预发 / 生产)"})]}),n.jsx(s.Button,{type:"primary",icon:n.jsx(O.PlusOutlined,{}),onClick:x,children:"新建环境"})]}),n.jsx("div",{style:{background:"rgba(255,255,255,0.02)",border:"1px solid rgba(255,255,255,0.06)",borderRadius:8,padding:16},children:n.jsx(s.Table,{columns:k,dataSource:e,loading:l,rowKey:"id",pagination:{pageSize:10},locale:{emptyText:"暂无环境"}})}),n.jsx(s.Drawer,{title:d?"编辑环境":"新建环境",placement:"right",width:520,open:o,onClose:()=>c(!1),children:n.jsxs(s.Form,{form:u,layout:"vertical",onFinish:w,children:[n.jsxs(s.Space,{style:{display:"flex"},size:"middle",children:[n.jsx(s.Form.Item,{name:"name",label:"名称",rules:[{required:!0}],style:{flex:1},children:n.jsx(s.Input,{placeholder:"如: 生产环境"})}),n.jsx(s.Form.Item,{name:"code",label:"编码",rules:[{required:!0}],style:{flex:1},children:n.jsx(s.Input,{placeholder:"如: prod"})})]}),n.jsx(s.Form.Item,{name:"targetId",label:"关联部署渠道",children:n.jsx(s.Select,{allowClear:!0,placeholder:"选择部署目标",children:r.map(y=>n.jsx(s.Select.Option,{value:y.id,children:y.name},y.id))})}),n.jsxs(s.Space,{style:{display:"flex"},size:"middle",children:[n.jsx(s.Form.Item,{name:"sort",label:"排序",style:{flex:1},children:n.jsx(s.InputNumber,{min:0})}),n.jsx(s.Form.Item,{name:"autoDeploy",label:"自动部署",valuePropName:"checked",style:{flex:1},children:n.jsx(s.Switch,{})})]}),n.jsx(s.Form.Item,{name:"description",label:"描述",children:n.jsx(s.Input.TextArea,{rows:2})}),n.jsx(s.Form.Item,{name:"config",label:"配置 (JSON)",children:n.jsx(s.Input.TextArea,{rows:3})}),n.jsx(s.Form.Item,{name:"status",label:"状态",initialValue:"ENABLE",children:n.jsxs(s.Select,{children:[n.jsx(s.Select.Option,{value:"ENABLE",children:"启用"}),n.jsx(s.Select.Option,{value:"DISABLE",children:"禁用"})]})}),n.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:12,paddingTop:24,borderTop:"1px solid rgba(255,255,255,0.06)"},children:[n.jsx(s.Button,{onClick:()=>c(!1),children:"取消"}),n.jsx(s.Button,{type:"primary",htmlType:"submit",children:"保存"})]})]})})]})},It=()=>{const[e,t]=C.useState([]),[r,a]=C.useState(!1),[l,i]=C.useState(!1),[o,c]=C.useState(!1),[d,p]=C.useState(null),[u,m]=C.useState(null),[x,v]=C.useState(""),[b]=s.Form.useForm(),w=async()=>{a(!0);try{t(await Y.list()||[])}catch{s.message.error("加载失败")}finally{a(!1)}};C.useEffect(()=>{w()},[]);const g=()=>{p(null),b.resetFields(),b.setFieldsValue({status:"ENABLE",gitBranch:"main"}),i(!0)},k=T=>{p(T),b.setFieldsValue(T),i(!0)},y=T=>{s.Modal.confirm({title:"确认删除",content:`删除 ${T.name}?`,onOk:async()=>{await Y.delete(T.id),s.message.success("删除成功"),w()}})},S=async T=>{m(T.id),c(!0),v(`正在部署...
|
|
23
|
+
`);try{const A=await Y.deploy(T.id);v(A||"部署完成")}catch(A){v("部署失败: "+(A.message||"未知错误"))}finally{m(null)}},N=async()=>{try{const T=await b.validateFields();d?await Y.update({...T,id:d.id}):await Y.create(T),s.message.success(d?"更新成功":"创建成功"),i(!1),w()}catch{}},_=[{title:"名称",dataIndex:"name",width:150},{title:"Git 仓库",dataIndex:"gitRepo",ellipsis:!0},{title:"分支",dataIndex:"gitBranch",width:100},{title:"工作目录",dataIndex:"workDir",ellipsis:!0},{title:"状态",dataIndex:"status",width:80,render:T=>n.jsx(s.Tag,{color:T==="ENABLE"?"green":"red",children:T==="ENABLE"?"启用":"禁用"})},{title:"操作",width:240,render:(T,A)=>n.jsxs(s.Space,{size:"small",children:[n.jsx(s.Button,{size:"small",type:"text",icon:n.jsx(O.PlayCircleOutlined,{spin:u===A.id}),onClick:()=>S(A),disabled:u!==null,children:u===A.id?"部署中":"部署"}),n.jsx(s.Button,{size:"small",type:"text",icon:n.jsx(O.EditOutlined,{}),onClick:()=>k(A),children:"编辑"}),n.jsx(s.Button,{size:"small",type:"text",danger:!0,icon:n.jsx(O.DeleteOutlined,{}),onClick:()=>y(A),children:"删除"})]})}];return n.jsxs("div",{style:{padding:24},children:[n.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:24},children:[n.jsxs("div",{children:[n.jsx("h2",{style:{margin:0,fontSize:20,fontWeight:600},children:"部署单元"}),n.jsx("span",{style:{color:"#8a8f98",fontSize:14},children:"管理 Git 仓库部署配置"})]}),n.jsx(s.Button,{type:"primary",icon:n.jsx(O.PlusOutlined,{}),onClick:g,children:"新建部署单元"})]}),n.jsx("div",{style:{background:"rgba(255,255,255,0.02)",border:"1px solid rgba(255,255,255,0.06)",borderRadius:8,padding:16},children:n.jsx(s.Table,{columns:_,dataSource:e,loading:r,rowKey:"id",pagination:{pageSize:10},locale:{emptyText:"暂无部署单元"}})}),n.jsx(s.Drawer,{title:d?"编辑部署单元":"新建部署单元",placement:"right",width:520,open:l,onClose:()=>i(!1),children:n.jsxs(s.Form,{form:b,layout:"vertical",onFinish:N,children:[n.jsx(s.Form.Item,{name:"name",label:"名称",rules:[{required:!0}],children:n.jsx(s.Input,{placeholder:"如: z-agent-backend"})}),n.jsx(s.Form.Item,{name:"description",label:"描述",children:n.jsx(s.Input.TextArea,{rows:2})}),n.jsx(s.Form.Item,{name:"status",label:"状态",initialValue:"ENABLE",children:n.jsxs(s.Select,{children:[n.jsx(s.Select.Option,{value:"ENABLE",children:"启用"}),n.jsx(s.Select.Option,{value:"DISABLE",children:"禁用"})]})}),n.jsx(s.Form.Item,{name:"gitRepo",label:"Git 仓库地址",rules:[{required:!0}],children:n.jsx(s.Input,{placeholder:"https://github.com/username/repo.git"})}),n.jsx(s.Form.Item,{name:"gitBranch",label:"分支",initialValue:"main",children:n.jsx(s.Input,{placeholder:"main"})}),n.jsx(s.Form.Item,{name:"workDir",label:"本地工作目录",rules:[{required:!0}],children:n.jsx(s.Input,{placeholder:"/deploy/my-app"})}),n.jsx(s.Form.Item,{name:"buildCommand",label:"构建命令",children:n.jsx(s.Input.TextArea,{rows:2,placeholder:"mvn clean package -DskipTests"})}),n.jsx(s.Form.Item,{name:"deployCommand",label:"部署命令",children:n.jsx(s.Input.TextArea,{rows:2})}),n.jsx(s.Form.Item,{name:"healthCheckUrl",label:"健康检查 URL",children:n.jsx(s.Input,{placeholder:"http://localhost:8080/actuator/health"})}),n.jsx(s.Form.Item,{name:"envVars",label:"环境变量 (JSON)",children:n.jsx(s.Input.TextArea,{rows:3})}),n.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:12,paddingTop:24,borderTop:"1px solid rgba(255,255,255,0.06)"},children:[n.jsx(s.Button,{onClick:()=>i(!1),children:"取消"}),n.jsx(s.Button,{type:"primary",htmlType:"submit",children:"保存"})]})]})}),n.jsx(s.Drawer,{title:n.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[n.jsx(O.SyncOutlined,{spin:u!==null}),n.jsx("span",{children:u?"部署中":"部署完成"})]}),placement:"right",width:600,open:o,onClose:()=>c(!1),children:n.jsx("pre",{style:{background:"#0a0a0f",color:"#d0d6e0",padding:16,borderRadius:6,fontFamily:"monospace",fontSize:12,lineHeight:1.6,maxHeight:500,overflow:"auto",whiteSpace:"pre-wrap"},children:x})})]})},Tt=()=>{const[e,t]=C.useState([]),[r,a]=C.useState([]),[l,i]=C.useState(null),[o,c]=C.useState(!1);C.useEffect(()=>{(async()=>{try{const u=await Y.list()||[];a(u),u.length&&i(u[0].id)}catch{s.message.error("加载部署单元失败")}})()},[]),C.useEffect(()=>{if(!l){t([]);return}(async()=>{c(!0);try{t(await Be.list(l)||[])}catch{s.message.error("加载记录失败")}finally{c(!1)}})()},[l]);const d={SUCCESS:{text:"成功",color:"green"},FAILED:{text:"失败",color:"red"},RUNNING:{text:"运行中",color:"processing"},PENDING:{text:"等待中",color:"default"}},p=[{title:"ID",dataIndex:"id",width:60},{title:"分支",dataIndex:"branch",width:120},{title:"Commit",dataIndex:"commitId",width:100,ellipsis:!0,render:u=>u?n.jsx("code",{children:u.substring(0,8)}):"-"},{title:"部署人",dataIndex:"deployer",width:100},{title:"触发方式",dataIndex:"triggerType",width:100,render:u=>({MANUAL:"手动",WEBHOOK:"Webhook",SCHEDULE:"定时"})[u]||u||"-"},{title:"开始时间",dataIndex:"startedAt",width:170},{title:"结束时间",dataIndex:"finishedAt",width:170},{title:"状态",dataIndex:"status",width:90,render:u=>{const m=d[u]||{text:u,color:"default"};return n.jsx(s.Tag,{color:m.color,children:m.text})}},{title:"结果",dataIndex:"result",ellipsis:!0}];return n.jsxs("div",{style:{padding:24},children:[n.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:24},children:[n.jsxs("div",{children:[n.jsx("h2",{style:{margin:0,fontSize:20,fontWeight:600},children:"部署记录"}),n.jsx("span",{style:{color:"#8a8f98",fontSize:14},children:"查看历史部署记录"})]}),n.jsxs(s.Space,{children:[n.jsx("span",{style:{color:"#8a8f98"},children:"部署单元:"}),n.jsx(s.Select,{value:l,onChange:i,style:{width:240},children:r.map(u=>n.jsx(s.Select.Option,{value:u.id,children:u.name},u.id))})]})]}),n.jsx("div",{style:{background:"rgba(255,255,255,0.02)",border:"1px solid rgba(255,255,255,0.06)",borderRadius:8,padding:16},children:n.jsx(s.Table,{columns:p,dataSource:e,loading:o,rowKey:"id",pagination:{pageSize:10},locale:{emptyText:"暂无部署记录"}})})]})};/**
|
|
24
|
+
* react-router v7.18.0
|
|
25
|
+
*
|
|
26
|
+
* Copyright (c) Remix Software Inc.
|
|
27
|
+
*
|
|
28
|
+
* This source code is licensed under the MIT license found in the
|
|
29
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
30
|
+
*
|
|
31
|
+
* @license MIT
|
|
32
|
+
*/var xe=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,Pt=/^[\\/]{2}/;function At(e,t){return t+e.replace(/\\/g,"/")}function F(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function U(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function ye({pathname:e="/",search:t="",hash:r=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}function ve(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substring(r),e=e.substring(0,r));let a=e.indexOf("?");a>=0&&(t.search=e.substring(a),e=e.substring(0,a)),e&&(t.pathname=e)}return t}function Ue(e,t,r="/"){return Ot(e,t,r,!1)}function Ot(e,t,r,a,l){let i=typeof t=="string"?ve(t):t,o=H(i.pathname||"/",r);if(o==null)return null;let c=Lt(e),d=null,p=Vt(o);for(let u=0;d==null&&u<c.length;++u)d=Wt(c[u],p,a);return d}function Lt(e){let t=We(e);return Dt(t),t}function We(e,t=[],r=[],a="",l=!1){let i=(o,c,d=l,p)=>{let u={relativePath:p===void 0?o.path||"":p,caseSensitive:o.caseSensitive===!0,childrenIndex:c,route:o};if(u.relativePath.startsWith("/")){if(!u.relativePath.startsWith(a)&&d)return;F(u.relativePath.startsWith(a),`Absolute route path "${u.relativePath}" nested under path "${a}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),u.relativePath=u.relativePath.slice(a.length)}let m=B([a,u.relativePath]),x=r.concat(u);o.children&&o.children.length>0&&(F(o.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${m}".`),We(o.children,t,x,m,d)),!(o.path==null&&!o.index)&&t.push({path:m,score:zt(m,o.index),routesMeta:x.map((v,b)=>{let[w,g]=Ye(v.relativePath,v.caseSensitive,b===x.length-1);return{...v,matcher:w,compiledParams:g}})})};return e.forEach((o,c)=>{var d;if(o.path===""||!((d=o.path)!=null&&d.includes("?")))i(o,c);else for(let p of Ve(o.path))i(o,c,!0,p)}),t}function Ve(e){let t=e.split("/");if(t.length===0)return[];let[r,...a]=t,l=r.endsWith("?"),i=r.replace(/\?$/,"");if(a.length===0)return l?[i,""]:[i];let o=Ve(a.join("/")),c=[];return c.push(...o.map(d=>d===""?i:[i,d].join("/"))),l&&c.push(...o),c.map(d=>e.startsWith("/")&&d===""?"/":d)}function Dt(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:Ut(t.routesMeta.map(a=>a.childrenIndex),r.routesMeta.map(a=>a.childrenIndex)))}var _t=/^:[\w-]+$/,Ft=3,Nt=2,$t=1,Bt=10,Mt=-2,He=e=>e==="*";function zt(e,t){let r=e.split("/"),a=r.length;return r.some(He)&&(a+=Mt),t&&(a+=Nt),r.filter(l=>!He(l)).reduce((l,i)=>l+(_t.test(i)?Ft:i===""?$t:Bt),a)}function Ut(e,t){return e.length===t.length&&e.slice(0,-1).every((a,l)=>a===t[l])?e[e.length-1]-t[t.length-1]:0}function Wt(e,t,r=!1){let{routesMeta:a}=e,l={},i="/",o=[];for(let c=0;c<a.length;++c){let d=a[c],p=c===a.length-1,u=i==="/"?t:t.slice(i.length)||"/",m={path:d.relativePath,caseSensitive:d.caseSensitive,end:p},x=d.matcher&&d.compiledParams?qe(m,u,d.matcher,d.compiledParams):ie(m,u),v=d.route;if(!x&&p&&r&&!a[a.length-1].route.index&&(x=ie({path:d.relativePath,caseSensitive:d.caseSensitive,end:!1},u)),!x)return null;Object.assign(l,x.params),o.push({params:l,pathname:B([i,x.pathname]),pathnameBase:Yt(B([i,x.pathnameBase])),route:v}),x.pathnameBase!=="/"&&(i=B([i,x.pathnameBase]))}return o}function ie(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,a]=Ye(e.path,e.caseSensitive,e.end);return qe(e,t,r,a)}function qe(e,t,r,a){let l=t.match(r);if(!l)return null;let i=l[0],o=i.replace(/(.)\/+$/,"$1"),c=l.slice(1);return{params:a.reduce((p,{paramName:u,isOptional:m},x)=>{if(u==="*"){let b=c[x]||"";o=i.slice(0,i.length-b.length).replace(/(.)\/+$/,"$1")}const v=c[x];return m&&!v?p[u]=void 0:p[u]=(v||"").replace(/%2F/g,"/"),p},{}),pathname:i,pathnameBase:o,pattern:e}}function Ye(e,t=!1,r=!0){U(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let a=[],l="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,c,d,p,u)=>{if(a.push({paramName:c,isOptional:d!=null}),d){let m=u.charAt(p+o.length);return m&&m!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(a.push({paramName:"*"}),l+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?l+="\\/*$":e!==""&&e!=="/"&&(l+="(?:(?=\\/|$))"),[new RegExp(l,t?void 0:"i"),a]}function Vt(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return U(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function H(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,a=e.charAt(r);return a&&a!=="/"?null:e.slice(r)||"/"}function Ht(e,t="/"){let{pathname:r,search:a="",hash:l=""}=typeof e=="string"?ve(e):e,i;return r?(r=Ke(r),r.startsWith("/")?i=Ge(r.substring(1),"/"):i=Ge(r,t)):i=t,{pathname:i,search:Gt(a),hash:Jt(l)}}function Ge(e,t){let r=oe(t).split("/");return e.split("/").forEach(l=>{l===".."?r.length>1&&r.pop():l!=="."&&r.push(l)}),r.length>1?r.join("/"):"/"}function be(e,t,r,a){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(a)}]. Please separate it out to the \`to.${r}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function qt(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function Je(e){let t=qt(e);return t.map((r,a)=>a===t.length-1?r.pathname:r.pathnameBase)}function we(e,t,r,a=!1){let l;typeof e=="string"?l=ve(e):(l={...e},F(!l.pathname||!l.pathname.includes("?"),be("?","pathname","search",l)),F(!l.pathname||!l.pathname.includes("#"),be("#","pathname","hash",l)),F(!l.search||!l.search.includes("#"),be("#","search","hash",l)));let i=e===""||l.pathname==="",o=i?"/":l.pathname,c;if(o==null)c=r;else{let m=t.length-1;if(!a&&o.startsWith("..")){let x=o.split("/");for(;x[0]==="..";)x.shift(),m-=1;l.pathname=x.join("/")}c=m>=0?t[m]:"/"}let d=Ht(l,c),p=o&&o!=="/"&&o.endsWith("/"),u=(i||o===".")&&r.endsWith("/");return!d.pathname.endsWith("/")&&(p||u)&&(d.pathname+="/"),d}var Ke=e=>e.replace(/[\\/]{2,}/g,"/"),B=e=>Ke(e.join("/")),oe=e=>e.replace(/\/+$/,""),Yt=e=>oe(e).replace(/^\/*/,"/"),Gt=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,Jt=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,Kt=class{constructor(e,t,r,a=!1){this.status=e,this.statusText=t||"",this.internal=a,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}};function Xt(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function Zt(e){let t=e.map(r=>r.route.path).filter(Boolean);return B(t)||"/"}var Xe=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Ze(e,t){let r=e;if(typeof r!="string"||!xe.test(r))return{absoluteURL:void 0,isExternal:!1,to:r};let a=r,l=!1;if(Xe)try{let i=new URL(window.location.href),o=Pt.test(r)?new URL(At(r,i.protocol)):new URL(r),c=H(o.pathname,t);o.origin===i.origin&&c!=null?r=c+o.search+o.hash:l=!0}catch{U(!1,`<Link to="${r}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:a,isExternal:l,to:r}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var Qe=["POST","PUT","PATCH","DELETE"];new Set(Qe);var Qt=["GET",...Qe];new Set(Qt);var er=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function tr(e){try{return er.includes(new URL(e).protocol)}catch{return!1}}var J=h.createContext(null);J.displayName="DataRouter";var se=h.createContext(null);se.displayName="DataRouterState";var et=h.createContext(!1);function rr(){return h.useContext(et)}var tt=h.createContext({isTransitioning:!1});tt.displayName="ViewTransition";var nr=h.createContext(new Map);nr.displayName="Fetchers";var ar=h.createContext(null);ar.displayName="Await";var M=h.createContext(null);M.displayName="Navigation";var Ee=h.createContext(null);Ee.displayName="Location";var z=h.createContext({outlet:null,matches:[],isDataRoute:!1});z.displayName="Route";var je=h.createContext(null);je.displayName="RouteError";var rt="REACT_ROUTER_ERROR",lr="REDIRECT",ir="ROUTE_ERROR_RESPONSE";function or(e){if(e.startsWith(`${rt}:${lr}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.location=="string"&&typeof t.reloadDocument=="boolean"&&typeof t.replace=="boolean")return t}catch{}}function sr(e){if(e.startsWith(`${rt}:${ir}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new Kt(t.status,t.statusText,t.data)}catch{}}function ur(e,{relative:t}={}){F(ue(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:a}=h.useContext(M),{hash:l,pathname:i,search:o}=ee(e,{relative:t}),c=i;return r!=="/"&&(c=i==="/"?r:B([r,i])),a.createHref({pathname:c,search:o,hash:l})}function ue(){return h.useContext(Ee)!=null}function W(){return F(ue(),"useLocation() may be used only in the context of a <Router> component."),h.useContext(Ee).location}var nt="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function at(e){h.useContext(M).static||h.useLayoutEffect(e)}function cr(){let{isDataRoute:e}=h.useContext(z);return e?Rr():dr()}function dr(){F(ue(),"useNavigate() may be used only in the context of a <Router> component.");let e=h.useContext(J),{basename:t,navigator:r}=h.useContext(M),{matches:a}=h.useContext(z),{pathname:l}=W(),i=JSON.stringify(Je(a)),o=h.useRef(!1);return at(()=>{o.current=!0}),h.useCallback((d,p={})=>{if(U(o.current,nt),!o.current)return;if(typeof d=="number"){r.go(d);return}let u=we(d,JSON.parse(i),l,p.relative==="path");e==null&&t!=="/"&&(u.pathname=u.pathname==="/"?t:B([t,u.pathname])),(p.replace?r.replace:r.push)(u,p.state,p)},[t,r,i,l,e])}var hr=h.createContext(null);function fr(e){let t=h.useContext(z).outlet;return h.useMemo(()=>t&&h.createElement(hr.Provider,{value:e},t),[t,e])}function ee(e,{relative:t}={}){let{matches:r}=h.useContext(z),{pathname:a}=W(),l=JSON.stringify(Je(r));return h.useMemo(()=>we(e,JSON.parse(l),a,t==="path"),[e,l,a,t])}function mr(e,t,r){F(ue(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:a}=h.useContext(M),{matches:l}=h.useContext(z),i=l[l.length-1],o=i?i.params:{},c=i?i.pathname:"/",d=i?i.pathnameBase:"/",p=i&&i.route;{let g=p&&p.path||"";ot(c,!p||g.endsWith("*")||g.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${c}" (under <Route path="${g}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
33
|
+
|
|
34
|
+
Please change the parent <Route path="${g}"> to <Route path="${g==="/"?"*":`${g}/*`}">.`)}let u=W(),m;m=u;let x=m.pathname||"/",v=x;if(d!=="/"){let g=d.replace(/^\//,"").split("/");v="/"+x.replace(/^\//,"").split("/").slice(g.length).join("/")}let b=r&&r.state.matches.length?r.state.matches.map(g=>Object.assign(g,{route:r.manifest[g.route.id]||g.route})):Ue(e,{pathname:v});return U(p||b!=null,`No routes matched location "${m.pathname}${m.search}${m.hash}" `),U(b==null||b[b.length-1].route.element!==void 0||b[b.length-1].route.Component!==void 0||b[b.length-1].route.lazy!==void 0,`Matched leaf route at location "${m.pathname}${m.search}${m.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`),vr(b&&b.map(g=>Object.assign({},g,{params:Object.assign({},o,g.params),pathname:B([d,a.encodeLocation?a.encodeLocation(g.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:g.pathname]),pathnameBase:g.pathnameBase==="/"?d:B([d,a.encodeLocation?a.encodeLocation(g.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:g.pathnameBase])})),l,r)}function pr(){let e=Sr(),t=Xt(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,a="rgba(200,200,200, 0.5)",l={padding:"0.5rem",backgroundColor:a},i={padding:"2px 4px",backgroundColor:a},o=null;return console.error("Error handled by React Router default ErrorBoundary:",e),o=h.createElement(h.Fragment,null,h.createElement("p",null,"💿 Hey developer 👋"),h.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",h.createElement("code",{style:i},"ErrorBoundary")," or"," ",h.createElement("code",{style:i},"errorElement")," prop on your route.")),h.createElement(h.Fragment,null,h.createElement("h2",null,"Unexpected Application Error!"),h.createElement("h3",{style:{fontStyle:"italic"}},t),r?h.createElement("pre",{style:l},r):null,o)}var gr=h.createElement(pr,null),lt=class extends h.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const r=sr(e.digest);r&&(e=r)}let t=e!==void 0?h.createElement(z.Provider,{value:this.props.routeContext},h.createElement(je.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?h.createElement(xr,{error:e},t):t}};lt.contextType=et;var Se=new WeakMap;function xr({children:e,error:t}){let{basename:r}=h.useContext(M);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let a=or(t.digest);if(a){let l=Se.get(t);if(l)throw l;let i=Ze(a.location,r),o=i.absoluteURL||i.to;if(tr(o))throw new Error("Invalid redirect location");if(Xe&&!Se.get(t))if(i.isExternal||a.reloadDocument)window.location.href=o;else{const c=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:a.replace}));throw Se.set(t,c),c}return h.createElement("meta",{httpEquiv:"refresh",content:`0;url=${o}`})}}return e}function yr({routeContext:e,match:t,children:r}){let a=h.useContext(J);return a&&a.static&&a.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=t.route.id),h.createElement(z.Provider,{value:e},r)}function vr(e,t=[],r){let a=r==null?void 0:r.state;if(e==null){if(!a)return null;if(a.errors)e=a.matches;else if(t.length===0&&!a.initialized&&a.matches.length>0)e=a.matches;else return null}let l=e,i=a==null?void 0:a.errors;if(i!=null){let u=l.findIndex(m=>m.route.id&&(i==null?void 0:i[m.route.id])!==void 0);F(u>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(i).join(",")}`),l=l.slice(0,Math.min(l.length,u+1))}let o=!1,c=-1;if(r&&a){o=a.renderFallback;for(let u=0;u<l.length;u++){let m=l[u];if((m.route.HydrateFallback||m.route.hydrateFallbackElement)&&(c=u),m.route.id){let{loaderData:x,errors:v}=a,b=m.route.loader&&!x.hasOwnProperty(m.route.id)&&(!v||v[m.route.id]===void 0);if(m.route.lazy||b){r.isStatic&&(o=!0),c>=0?l=l.slice(0,c+1):l=[l[0]];break}}}}let d=r==null?void 0:r.onError,p=a&&d?(u,m)=>{var x,v;d(u,{location:a.location,params:((v=(x=a.matches)==null?void 0:x[0])==null?void 0:v.params)??{},pattern:Zt(a.matches),errorInfo:m})}:void 0;return l.reduceRight((u,m,x)=>{let v,b=!1,w=null,g=null;a&&(v=i&&m.route.id?i[m.route.id]:void 0,w=m.route.errorElement||gr,o&&(c<0&&x===0?(ot("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),b=!0,g=null):c===x&&(b=!0,g=m.route.hydrateFallbackElement||null)));let k=t.concat(l.slice(0,x+1)),y=()=>{let S;return v?S=w:b?S=g:m.route.Component?S=h.createElement(m.route.Component,null):m.route.element?S=m.route.element:S=u,h.createElement(yr,{match:m,routeContext:{outlet:u,matches:k,isDataRoute:a!=null},children:S})};return a&&(m.route.ErrorBoundary||m.route.errorElement||x===0)?h.createElement(lt,{location:a.location,revalidation:a.revalidation,component:w,error:v,children:y(),routeContext:{outlet:null,matches:k,isDataRoute:!0},onError:p}):y()},null)}function Re(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function br(e){let t=h.useContext(J);return F(t,Re(e)),t}function wr(e){let t=h.useContext(se);return F(t,Re(e)),t}function Er(e){let t=h.useContext(z);return F(t,Re(e)),t}function Ce(e){let t=Er(e),r=t.matches[t.matches.length-1];return F(r.route.id,`${e} can only be used on routes that contain a unique "id"`),r.route.id}function jr(){return Ce("useRouteId")}function Sr(){var a;let e=h.useContext(je),t=wr("useRouteError"),r=Ce("useRouteError");return e!==void 0?e:(a=t.errors)==null?void 0:a[r]}function Rr(){let{router:e}=br("useNavigate"),t=Ce("useNavigate"),r=h.useRef(!1);return at(()=>{r.current=!0}),h.useCallback(async(l,i={})=>{U(r.current,nt),r.current&&(typeof l=="number"?await e.navigate(l):await e.navigate(l,{fromRouteId:t,...i}))},[e,t])}var it={};function ot(e,t,r){!t&&!it[e]&&(it[e]=!0,U(!1,r))}h.memo(Cr);function Cr({routes:e,manifest:t,future:r,state:a,isStatic:l,onError:i}){return mr(e,void 0,{manifest:t,state:a,isStatic:l,onError:i})}function ke(e){return fr(e.context)}var ce="get",de="application/x-www-form-urlencoded";function he(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function kr(e){return he(e)&&e.tagName.toLowerCase()==="button"}function Ir(e){return he(e)&&e.tagName.toLowerCase()==="form"}function Tr(e){return he(e)&&e.tagName.toLowerCase()==="input"}function Pr(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Ar(e,t){return e.button===0&&(!t||t==="_self")&&!Pr(e)}var fe=null;function Or(){if(fe===null)try{new FormData(document.createElement("form"),0),fe=!1}catch{fe=!0}return fe}var Lr=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Ie(e){return e!=null&&!Lr.has(e)?(U(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${de}"`),null):e}function Dr(e,t){let r,a,l,i,o;if(Ir(e)){let c=e.getAttribute("action");a=c?H(c,t):null,r=e.getAttribute("method")||ce,l=Ie(e.getAttribute("enctype"))||de,i=new FormData(e)}else if(kr(e)||Tr(e)&&(e.type==="submit"||e.type==="image")){let c=e.form;if(c==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let d=e.getAttribute("formaction")||c.getAttribute("action");if(a=d?H(d,t):null,r=e.getAttribute("formmethod")||c.getAttribute("method")||ce,l=Ie(e.getAttribute("formenctype"))||Ie(c.getAttribute("enctype"))||de,i=new FormData(c,e),!Or()){let{name:p,type:u,value:m}=e;if(u==="image"){let x=p?`${p}.`:"";i.append(`${x}x`,"0"),i.append(`${x}y`,"0")}else p&&i.append(p,m)}}else{if(he(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=ce,a=null,l=de,o=e}return i&&l==="text/plain"&&(o=i,i=void 0),{action:a,method:r.toLowerCase(),encType:l,formData:i,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Te(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function st(e,t,r,a){let l=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return r?l.pathname.endsWith("/")?l.pathname=`${l.pathname}_.${a}`:l.pathname=`${l.pathname}.${a}`:l.pathname==="/"?l.pathname=`_root.${a}`:t&&H(l.pathname,t)==="/"?l.pathname=`${oe(t)}/_root.${a}`:l.pathname=`${oe(l.pathname)}.${a}`,l}async function _r(e,t){if(e.id in t)return t[e.id];try{let r=await import(e.module);return t[e.id]=r,r}catch(r){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(r),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function Fr(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function Nr(e,t,r){let a=await Promise.all(e.map(async l=>{let i=t.routes[l.route.id];if(i){let o=await _r(i,r);return o.links?o.links():[]}return[]}));return zr(a.flat(1).filter(Fr).filter(l=>l.rel==="stylesheet"||l.rel==="preload").map(l=>l.rel==="stylesheet"?{...l,rel:"prefetch",as:"style"}:{...l,rel:"prefetch"}))}function ut(e,t,r,a,l,i){let o=(d,p)=>r[p]?d.route.id!==r[p].route.id:!0,c=(d,p)=>{var u;return r[p].pathname!==d.pathname||((u=r[p].route.path)==null?void 0:u.endsWith("*"))&&r[p].params["*"]!==d.params["*"]};return i==="assets"?t.filter((d,p)=>o(d,p)||c(d,p)):i==="data"?t.filter((d,p)=>{var m;let u=a.routes[d.route.id];if(!u||!u.hasLoader)return!1;if(o(d,p)||c(d,p))return!0;if(d.route.shouldRevalidate){let x=d.route.shouldRevalidate({currentUrl:new URL(l.pathname+l.search+l.hash,window.origin),currentParams:((m=r[0])==null?void 0:m.params)||{},nextUrl:new URL(e,window.origin),nextParams:d.params,defaultShouldRevalidate:!0});if(typeof x=="boolean")return x}return!0}):[]}function $r(e,t,{includeHydrateFallback:r}={}){return Br(e.map(a=>{let l=t.routes[a.route.id];if(!l)return[];let i=[l.module];return l.clientActionModule&&(i=i.concat(l.clientActionModule)),l.clientLoaderModule&&(i=i.concat(l.clientLoaderModule)),r&&l.hydrateFallbackModule&&(i=i.concat(l.hydrateFallbackModule)),l.imports&&(i=i.concat(l.imports)),i}).flat(1))}function Br(e){return[...new Set(e)]}function Mr(e){let t={},r=Object.keys(e).sort();for(let a of r)t[a]=e[a];return t}function zr(e,t){let r=new Set;return new Set(t),e.reduce((a,l)=>{let i=JSON.stringify(Mr(l));return r.has(i)||(r.add(i),a.push({key:i,link:l})),a},[])}function Pe(){let e=h.useContext(J);return Te(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function Ur(){let e=h.useContext(se);return Te(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var Ae=h.createContext(void 0);Ae.displayName="FrameworkContext";function me(){let e=h.useContext(Ae);return Te(e,"You must render this element inside a <HydratedRouter> element"),e}function Wr(e,t){let r=h.useContext(Ae),[a,l]=h.useState(!1),[i,o]=h.useState(!1),{onFocus:c,onBlur:d,onMouseEnter:p,onMouseLeave:u,onTouchStart:m}=t,x=h.useRef(null);h.useEffect(()=>{if(e==="render"&&o(!0),e==="viewport"){let w=k=>{k.forEach(y=>{o(y.isIntersecting)})},g=new IntersectionObserver(w,{threshold:.5});return x.current&&g.observe(x.current),()=>{g.disconnect()}}},[e]),h.useEffect(()=>{if(a){let w=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(w)}}},[a]);let v=()=>{l(!0)},b=()=>{l(!1),o(!1)};return r?e!=="intent"?[i,x,{}]:[i,x,{onFocus:te(c,v),onBlur:te(d,b),onMouseEnter:te(p,v),onMouseLeave:te(u,b),onTouchStart:te(m,v)}]:[!1,x,{}]}function te(e,t){return r=>{e&&e(r),r.defaultPrevented||t(r)}}function Vr({page:e,...t}){let r=rr(),{nonce:a}=me(),{router:l}=Pe(),i=h.useMemo(()=>Ue(l.routes,e,l.basename),[l.routes,e,l.basename]);return i?(t.nonce==null&&a&&(t={...t,nonce:a}),r?h.createElement(qr,{page:e,matches:i,...t}):h.createElement(Yr,{page:e,matches:i,...t})):null}function Hr(e){let{manifest:t,routeModules:r}=me(),[a,l]=h.useState([]);return h.useEffect(()=>{let i=!1;return Nr(e,t,r).then(o=>{i||l(o)}),()=>{i=!0}},[e,t,r]),a}function qr({page:e,matches:t,...r}){let a=W(),{future:l}=me(),{basename:i}=Pe(),o=h.useMemo(()=>{if(e===a.pathname+a.search+a.hash)return[];let c=st(e,i,l.v8_trailingSlashAwareDataRequests,"rsc"),d=!1,p=[];for(let u of t)typeof u.route.shouldRevalidate=="function"?d=!0:p.push(u.route.id);return d&&p.length>0&&c.searchParams.set("_routes",p.join(",")),[c.pathname+c.search]},[i,l.v8_trailingSlashAwareDataRequests,e,a,t]);return h.createElement(h.Fragment,null,o.map(c=>h.createElement("link",{key:c,rel:"prefetch",as:"fetch",href:c,...r})))}function Yr({page:e,matches:t,...r}){let a=W(),{future:l,manifest:i,routeModules:o}=me(),{basename:c}=Pe(),{loaderData:d,matches:p}=Ur(),u=h.useMemo(()=>ut(e,t,p,i,a,"data"),[e,t,p,i,a]),m=h.useMemo(()=>ut(e,t,p,i,a,"assets"),[e,t,p,i,a]),x=h.useMemo(()=>{if(e===a.pathname+a.search+a.hash)return[];let w=new Set,g=!1;if(t.forEach(y=>{var N;let S=i.routes[y.route.id];!S||!S.hasLoader||(!u.some(_=>_.route.id===y.route.id)&&y.route.id in d&&((N=o[y.route.id])!=null&&N.shouldRevalidate)||S.hasClientLoader?g=!0:w.add(y.route.id))}),w.size===0)return[];let k=st(e,c,l.v8_trailingSlashAwareDataRequests,"data");return g&&w.size>0&&k.searchParams.set("_routes",t.filter(y=>w.has(y.route.id)).map(y=>y.route.id).join(",")),[k.pathname+k.search]},[c,l.v8_trailingSlashAwareDataRequests,d,a,i,u,t,e,o]),v=h.useMemo(()=>$r(m,i),[m,i]),b=Hr(m);return h.createElement(h.Fragment,null,x.map(w=>h.createElement("link",{key:w,rel:"prefetch",as:"fetch",href:w,...r})),v.map(w=>h.createElement("link",{key:w,rel:"modulepreload",href:w,...r})),b.map(({key:w,link:g})=>h.createElement("link",{key:w,nonce:r.nonce,...g,crossOrigin:g.crossOrigin??r.crossOrigin})))}function Gr(...e){return t=>{e.forEach(r=>{typeof r=="function"?r(t):r!=null&&(r.current=t)})}}var Jr=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{Jr&&(window.__reactRouterVersion="7.18.0")}catch{}var ct=h.forwardRef(function({onClick:t,discover:r="render",prefetch:a="none",relative:l,reloadDocument:i,replace:o,mask:c,state:d,target:p,to:u,preventScrollReset:m,viewTransition:x,defaultShouldRevalidate:v,...b},w){let{basename:g,navigator:k,useTransitions:y}=h.useContext(M),S=typeof u=="string"&&xe.test(u),N=Ze(u,g);u=N.to;let _=ur(u,{relative:l}),T=W(),A=null;if(c){let $=we(c,[],T.mask?T.mask.pathname:"/",!0);g!=="/"&&($.pathname=$.pathname==="/"?g:B([g,$.pathname])),A=k.createHref($)}let[q,V,re]=Wr(a,b),Oe=Qr(u,{replace:o,mask:c,state:d,target:p,preventScrollReset:m,relative:l,viewTransition:x,defaultShouldRevalidate:v,useTransitions:y});function ne($){t&&t($),$.defaultPrevented||Oe($)}let ae=!(N.isExternal||i),pe=h.createElement("a",{...b,...re,href:(ae?A:void 0)||N.absoluteURL||_,onClick:ae?ne:t,ref:Gr(w,V),target:p,"data-discover":!S&&r==="render"?"true":void 0});return q&&!S?h.createElement(h.Fragment,null,pe,h.createElement(Vr,{page:_})):pe});ct.displayName="Link";var Kr=h.forwardRef(function({"aria-current":t="page",caseSensitive:r=!1,className:a="",end:l=!1,style:i,to:o,viewTransition:c,children:d,...p},u){let m=ee(o,{relative:p.relative}),x=W(),v=h.useContext(se),{navigator:b,basename:w}=h.useContext(M),g=v!=null&&an(m)&&c===!0,k=b.encodeLocation?b.encodeLocation(m).pathname:m.pathname,y=x.pathname,S=v&&v.navigation&&v.navigation.location?v.navigation.location.pathname:null;r||(y=y.toLowerCase(),S=S?S.toLowerCase():null,k=k.toLowerCase()),S&&w&&(S=H(S,w)||S);const N=k!=="/"&&k.endsWith("/")?k.length-1:k.length;let _=y===k||!l&&y.startsWith(k)&&y.charAt(N)==="/",T=S!=null&&(S===k||!l&&S.startsWith(k)&&S.charAt(k.length)==="/"),A={isActive:_,isPending:T,isTransitioning:g},q=_?t:void 0,V;typeof a=="function"?V=a(A):V=[a,_?"active":null,T?"pending":null,g?"transitioning":null].filter(Boolean).join(" ");let re=typeof i=="function"?i(A):i;return h.createElement(ct,{...p,"aria-current":q,className:V,ref:u,style:re,to:o,viewTransition:c},typeof d=="function"?d(A):d)});Kr.displayName="NavLink";var Xr=h.forwardRef(({discover:e="render",fetcherKey:t,navigate:r,reloadDocument:a,replace:l,state:i,method:o=ce,action:c,onSubmit:d,relative:p,preventScrollReset:u,viewTransition:m,defaultShouldRevalidate:x,...v},b)=>{let{useTransitions:w}=h.useContext(M),g=rn(),k=nn(c,{relative:p}),y=o.toLowerCase()==="get"?"get":"post",S=typeof c=="string"&&xe.test(c),N=_=>{if(d&&d(_),_.defaultPrevented)return;_.preventDefault();let T=_.nativeEvent.submitter,A=(T==null?void 0:T.getAttribute("formmethod"))||o,q=()=>g(T||_.currentTarget,{fetcherKey:t,method:A,navigate:r,replace:l,state:i,relative:p,preventScrollReset:u,viewTransition:m,defaultShouldRevalidate:x});w&&r!==!1?h.startTransition(()=>q()):q()};return h.createElement("form",{ref:b,method:y,action:k,onSubmit:a?d:N,...v,"data-discover":!S&&e==="render"?"true":void 0})});Xr.displayName="Form";function Zr(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function dt(e){let t=h.useContext(J);return F(t,Zr(e)),t}function Qr(e,{target:t,replace:r,mask:a,state:l,preventScrollReset:i,relative:o,viewTransition:c,defaultShouldRevalidate:d,useTransitions:p}={}){let u=cr(),m=W(),x=ee(e,{relative:o});return h.useCallback(v=>{if(Ar(v,t)){v.preventDefault();let b=r!==void 0?r:ye(m)===ye(x),w=()=>u(e,{replace:b,mask:a,state:l,preventScrollReset:i,relative:o,viewTransition:c,defaultShouldRevalidate:d});p?h.startTransition(()=>w()):w()}},[m,u,x,r,a,l,t,e,i,o,c,d,p])}var en=0,tn=()=>`__${String(++en)}__`;function rn(){let{router:e}=dt("useSubmit"),{basename:t}=h.useContext(M),r=jr(),a=e.fetch,l=e.navigate;return h.useCallback(async(i,o={})=>{let{action:c,method:d,encType:p,formData:u,body:m}=Dr(i,t);if(o.navigate===!1){let x=o.fetcherKey||tn();await a(x,r,o.action||c,{defaultShouldRevalidate:o.defaultShouldRevalidate,preventScrollReset:o.preventScrollReset,formData:u,body:m,formMethod:o.method||d,formEncType:o.encType||p,flushSync:o.flushSync})}else await l(o.action||c,{defaultShouldRevalidate:o.defaultShouldRevalidate,preventScrollReset:o.preventScrollReset,formData:u,body:m,formMethod:o.method||d,formEncType:o.encType||p,replace:o.replace,state:o.state,fromRouteId:r,flushSync:o.flushSync,viewTransition:o.viewTransition})},[a,l,t,r])}function nn(e,{relative:t}={}){let{basename:r}=h.useContext(M),a=h.useContext(z);F(a,"useFormAction must be used inside a RouteContext");let[l]=a.matches.slice(-1),i={...ee(e||".",{relative:t})},o=W();if(e==null){i.search=o.search;let c=new URLSearchParams(i.search),d=c.getAll("index");if(d.some(u=>u==="")){c.delete("index"),d.filter(m=>m).forEach(m=>c.append("index",m));let u=c.toString();i.search=u?`?${u}`:""}}return(!e||e===".")&&l.route.index&&(i.search=i.search?i.search.replace(/^\?/,"?index&"):"?index"),r!=="/"&&(i.pathname=i.pathname==="/"?r:B([r,i.pathname])),ye(i)}function an(e,{relative:t}={}){let r=h.useContext(tt);F(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:a}=dt("useViewTransitionState"),l=ee(e,{relative:t});if(!r.isTransitioning)return!1;let i=H(r.currentLocation.pathname,a)||r.currentLocation.pathname,o=H(r.nextLocation.pathname,a)||r.nextLocation.pathname;return ie(l.pathname,o)!=null||ie(l.pathname,i)!=null}const ln=()=>n.jsx(ke,{}),on=()=>n.jsx(ke,{}),sn=()=>n.jsx(ke,{}),un=()=>{const[e,t]=C.useState([]),[r,a]=C.useState(!1),l=async()=>{a(!0);try{t(await ze.list()||[])}catch{s.message.error("加载 Bucket 列表失败")}finally{a(!1)}};C.useEffect(()=>{l()},[]);const i=[{title:"Bucket 名称",dataIndex:"name",copyable:!0},{title:"创建时间",dataIndex:"createdAt",width:180},{title:"存储类型",dataIndex:"storageClass",width:100,render:o=>o||"标准"},{title:"区域",dataIndex:"region",width:100},{title:"对象数",dataIndex:"objectCount",width:100,render:o=>o??"-"},{title:"用量",dataIndex:"sizeGb",width:100,render:o=>o!=null?`${o} GB`:"-"}];return n.jsxs("div",{style:{padding:24},children:[n.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:24},children:[n.jsxs("div",{children:[n.jsxs("h2",{style:{margin:0,fontSize:20,fontWeight:600},children:[n.jsx(O.FolderOpenOutlined,{style:{marginRight:8}}),"对象存储"]}),n.jsx("span",{style:{color:"#8a8f98",fontSize:14},children:"OSS Bucket 与文件目录"})]}),n.jsx(s.Button,{icon:n.jsx(O.ReloadOutlined,{}),onClick:l,children:"刷新"})]}),n.jsx("div",{style:{background:"rgba(255,255,255,0.02)",border:"1px solid rgba(255,255,255,0.06)",borderRadius:8,padding:16},children:n.jsx(s.Table,{columns:i,dataSource:e,loading:r,rowKey:"name",pagination:{pageSize:10},locale:{emptyText:"暂无 Bucket"}})})]})},cn=()=>n.jsxs("div",{style:{padding:24},children:[n.jsxs("h2",{style:{margin:"0 0 8px",fontSize:20,fontWeight:600},children:[n.jsx(O.GlobalOutlined,{style:{marginRight:8}}),"域名管理"]}),n.jsx("p",{style:{color:"#8a8f98",marginBottom:24},children:"管理已绑定的域名与 SSL 证书"}),n.jsx("div",{style:{background:"rgba(255,255,255,0.02)",border:"1px solid rgba(255,255,255,0.06)",borderRadius:8,padding:48},children:n.jsx(s.Empty,{description:"后端 API 开发中,敬请期待"})})]}),dn=()=>n.jsxs("div",{style:{padding:24},children:[n.jsxs("h2",{style:{margin:"0 0 8px",fontSize:20,fontWeight:600},children:[n.jsx(O.DesktopOutlined,{style:{marginRight:8}}),"ECS 管理"]}),n.jsx("p",{style:{color:"#8a8f98",marginBottom:24},children:"查看与管理云服务器实例"}),n.jsx("div",{style:{background:"rgba(255,255,255,0.02)",border:"1px solid rgba(255,255,255,0.06)",borderRadius:8,padding:48},children:n.jsx(s.Empty,{description:"后端 API 开发中,敬请期待"})})]}),hn=()=>n.jsxs("div",{style:{padding:24},children:[n.jsxs("h2",{style:{margin:"0 0 8px",fontSize:20,fontWeight:600},children:[n.jsx(O.DatabaseOutlined,{style:{marginRight:8}}),"RDS 管理"]}),n.jsx("p",{style:{color:"#8a8f98",marginBottom:24},children:"查看云数据库实例与慢查询监控"}),n.jsx("div",{style:{background:"rgba(255,255,255,0.02)",border:"1px solid rgba(255,255,255,0.06)",borderRadius:8,padding:48},children:n.jsx(s.Empty,{description:"后端 API 开发中,敬请期待"})})]}),fn=()=>{const[e,t]=C.useState([]),[r,a]=C.useState(!1),l=async()=>{a(!0);try{t(await Me.list()||[])}catch{s.message.error("加载构建记录失败")}finally{a(!1)}};C.useEffect(()=>{l()},[]);const i={SUCCESS:{text:"成功",color:"green"},FAILED:{text:"失败",color:"red"},BUILDING:{text:"构建中",color:"processing"}},o=[{title:"ID",dataIndex:"id",width:60},{title:"镜像名",dataIndex:"imageName",width:160},{title:"应用名",dataIndex:"appName",width:120},{title:"分支",dataIndex:"branch",width:120},{title:"环境",dataIndex:"env",width:80},{title:"状态",dataIndex:"status",width:90,render:c=>{const d=i[c]||{text:c,color:"default"};return n.jsx(s.Tag,{color:d.color,children:d.text})}},{title:"镜像版本",dataIndex:"imageTag",width:140,ellipsis:!0},{title:"构建时间",dataIndex:"createdAt",width:170}];return n.jsxs("div",{style:{padding:24},children:[n.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:24},children:[n.jsxs("div",{children:[n.jsxs("h2",{style:{margin:0,fontSize:20,fontWeight:600},children:[n.jsx(O.ToolOutlined,{style:{marginRight:8}}),"镜像构建"]}),n.jsx("span",{style:{color:"#8a8f98",fontSize:14},children:"镜像构建记录"})]}),n.jsx(s.Button,{icon:n.jsx(O.ReloadOutlined,{}),onClick:l,children:"刷新"})]}),n.jsx("div",{style:{background:"rgba(255,255,255,0.02)",border:"1px solid rgba(255,255,255,0.06)",borderRadius:8,padding:16},children:n.jsx(s.Table,{columns:o,dataSource:e,loading:r,rowKey:"id",pagination:{pageSize:10},locale:{emptyText:"暂无构建记录"}})})]})},mn=()=>n.jsxs("div",{style:{padding:24},children:[n.jsxs("h2",{style:{margin:"0 0 8px",fontSize:20,fontWeight:600},children:[n.jsx(O.CalendarOutlined,{style:{marginRight:8}}),"迭代管理"]}),n.jsx("p",{style:{color:"#8a8f98",marginBottom:24},children:"管理研发迭代与里程碑"}),n.jsx("div",{style:{background:"rgba(255,255,255,0.02)",border:"1px solid rgba(255,255,255,0.06)",borderRadius:8,padding:48},children:n.jsx(s.Empty,{description:"后端 API 开发中,敬请期待"})})]});I.ChannelPage=Ct,I.DeliveryPage=kt,I.DeploymentPage=It,I.DomainPage=cn,I.EcsPage=dn,I.OpsApp=ln,I.RdApp=on,I.RdOpsPage=fn,I.RdsPage=hn,I.ResourceApp=sn,I.ResourceOssPage=un,I.SprintPage=mn,I.TaskPage=Tt,I.configureApiBaseURL=Et,I.deploymentUnitApi=Y,I.environmentApi=Q,I.imageApi=St,I.imageBuildApi=Me,I.imageTagApi=Rt,I.ossBucketApi=ze,I.recordApi=Be,I.targetApi=G,I.webhookApi=jt,Object.defineProperty(I,Symbol.toStringTag,{value:"Module"})}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yuku123/z-ops-frontend-component",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "z-ops 共享前端组件 - 运维中心/资源管理/研发协同页面组件",
|
|
6
6
|
"keywords": [
|
|
@@ -53,4 +53,4 @@
|
|
|
53
53
|
"@ant-design/icons": "^6.0.0",
|
|
54
54
|
"axios": "^1.7.0"
|
|
55
55
|
}
|
|
56
|
-
}
|
|
56
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {Outlet} from 'react-router-dom';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 运维中心路由壳 (与主壳 z-opc-main-starter-frontend 的 /ops/* 路由对应)
|
|
6
|
+
* - /ops/channel -> 渠道管理
|
|
7
|
+
* - /ops/delivery -> 环境管理
|
|
8
|
+
* - /ops/deployment -> 部署单元
|
|
9
|
+
* - /ops/task -> 部署记录
|
|
10
|
+
* 资源管理子路由 (在主壳中独立挂载):
|
|
11
|
+
* - /resource/* -> 资源管理
|
|
12
|
+
* 研发协同子路由 (在主壳中独立挂载):
|
|
13
|
+
* - /rd/* -> 研发协同
|
|
14
|
+
*/
|
|
15
|
+
const OpsApp = () => {
|
|
16
|
+
return <Outlet/>;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export default OpsApp;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {Outlet} from 'react-router-dom';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 研发协同路由壳 (与主壳 z-opc-main-starter-frontend 的 /rd/* 路由对应)
|
|
6
|
+
* 子路由(在主壳中未挂载,作为占位)
|
|
7
|
+
* - /rd/repo -> 镜像仓库
|
|
8
|
+
* - /rd/ops -> 镜像构建
|
|
9
|
+
* - /rd/sprint -> 迭代管理
|
|
10
|
+
*/
|
|
11
|
+
const RdApp = () => {
|
|
12
|
+
return <Outlet/>;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export default RdApp;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {Outlet} from 'react-router-dom';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 资源管理路由壳 (与主壳 z-opc-main-starter-frontend 的 /resource/* 路由对应)
|
|
6
|
+
* 子路由(在主壳中未挂载,作为占位)
|
|
7
|
+
* - /resource/domain -> 域名
|
|
8
|
+
* - /resource/ecs -> ECS
|
|
9
|
+
* - /resource/rds -> RDS
|
|
10
|
+
* - /resource/oss -> OSS
|
|
11
|
+
*/
|
|
12
|
+
const ResourceApp = () => {
|
|
13
|
+
return <Outlet/>;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export default ResourceApp;
|
package/src/index.js
CHANGED
|
@@ -12,6 +12,11 @@ export {default as DeliveryPage} from './components/DeliveryPage' // 环境
|
|
|
12
12
|
export {default as DeploymentPage} from './components/DeploymentPage' // 部署单元 (DeploymentUnit CRUD + deploy)
|
|
13
13
|
export {default as TaskPage} from './components/TaskPage' // 部署记录 (DeploymentRecord list)
|
|
14
14
|
|
|
15
|
+
// 路由壳 (主壳里 /ops/* 路由的 Outlet 容器)
|
|
16
|
+
export {default as OpsApp} from './components/OpsApp'
|
|
17
|
+
export {default as RdApp} from './components/RdApp'
|
|
18
|
+
export {default as ResourceApp} from './components/ResourceApp'
|
|
19
|
+
|
|
15
20
|
// 资源管理
|
|
16
21
|
export {default as ResourceOssPage} from './components/ResourceOssPage' // OSS Bucket 列表
|
|
17
22
|
export {default as DomainPage} from './components/DomainPage' // 域名管理 (占位)
|