chore: 重新编译前端产物(补装CodeMirror依赖)
This commit is contained in:
1 parent
23e9e3da62
commit
4e384ca401
115 files changed
+147
-147
No files matched your search
@@ -0,0 +1 @@
|
||||
import{r as t,j as e}from"./vendor-codemirror-B1SGo4xl.js";import{f as ee,B as u,D as se,a as ae,b as oe,c as te,d as ce,e as ne,t as N}from"./index-Dungj95X.js";import{I as j}from"./input-CXoUQQLm.js";import{L as i}from"./label-CMpUoC87.js";import{B as O}from"./badge-CGJlVD3L.js";import{C as A}from"./checkbox-Bu55mX0G.js";import{T as re,a as le,b as V,c as r,d as de,e as l}from"./table-B2F10oba.js";import{S as y,a as C,b as w,c as S,d as R}from"./select-CiTqGGhE.js";import{r as M}from"./region-CNZ3vwAq.js";import{S as ie,P as pe,T as H,L as $,M as ge,C as xe,a as he,d as me}from"./vendor-icons-DmqcWdzX.js";import"./index-5FEebgvX.js";const k={aws:"AWS",aliyun:"阿里云",tencent:"腾讯云",huawei:"华为云",azure:"Azure"},ue={aws:"text-orange-400",aliyun:"text-orange-400",tencent:"text-blue-400",huawei:"text-red-400",azure:"text-blue-400"};function ke(){const D=ee(),[T,L]=t.useState([]),[F,I]=t.useState(!0),[b,Q]=t.useState(""),[f,W]=t.useState("all"),[c,d]=t.useState([]),[X,p]=t.useState(!1),[g,P]=t.useState(null),[B,z]=t.useState(!1),[a,n]=t.useState({name:"",code:"",provider:"aliyun",location:"",status:"active",endpoint:""}),x=t.useCallback(async()=>{I(!0);try{const o=(await M.list())?.list||[];L(o)}catch{L([])}finally{I(!1)}},[]);t.useEffect(()=>{x()},[x]);const h=T.filter(s=>{const o=s.name?.toLowerCase().includes(b.toLowerCase())||s.code?.toLowerCase().includes(b.toLowerCase()),v=f==="all"||s.provider===f;return o&&v}),E=h.length>0&&h.every(s=>c.includes(s.id)),q=()=>{d(E?[]:h.map(s=>s.id))},G=s=>{d(o=>o.includes(s)?o.filter(v=>v!==s):[...o,s])},J=()=>{P(null),n({name:"",code:"",provider:"aliyun",location:"",status:"active",endpoint:""}),p(!0)},K=s=>{P(s),n({name:s.name||"",code:s.code||"",provider:s.provider||"aliyun",location:s.location||"",status:s.status||"active",endpoint:s.endpoint||""}),p(!0)},U=async()=>{if(!(!a.name.trim()||!a.code.trim())){z(!0);try{g?await M.update(g.id,a):await M.create(a),p(!1),x()}catch{}finally{z(!1)}}},Y=async s=>{const o=T.find(m=>m.id===s);if(await D({title:"删除区域",description:`确定删除「${o?.name||s}」吗?此操作不可撤销。`,confirmText:"删除",variant:"destructive"}))try{await M.delete(s),N.success("区域已删除"),d(m=>m.filter(_=>_!==s)),x()}catch(m){console.error("删除区域失败:",m),N.error("删除失败")}},Z=async()=>{if(!(c.length===0||!await D({title:"批量删除区域",description:`确定删除选中的 ${c.length} 个区域吗?此操作不可撤销。`,confirmText:"批量删除",variant:"destructive"})))try{await M.batchDelete(c),N.success(`已删除 ${c.length} 个区域`),d([]),x()}catch(o){console.error("批量删除失败:",o),N.error("批量删除失败")}};return e.jsxs("div",{"code-path":"src/components/cloud/RegionManager.tsx:186:5",className:"p-6 space-y-4",children:[e.jsxs("div",{"code-path":"src/components/cloud/RegionManager.tsx:188:7",className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{"code-path":"src/components/cloud/RegionManager.tsx:189:9",className:"flex items-center gap-3 flex-1",children:[e.jsxs("div",{"code-path":"src/components/cloud/RegionManager.tsx:190:11",className:"relative w-72",children:[e.jsx(ie,{"code-path":"src/components/cloud/RegionManager.tsx:191:13",className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-500"}),e.jsx(j,{"code-path":"src/components/cloud/RegionManager.tsx:192:13",placeholder:"搜索区域名称或编码...",value:b,onChange:s=>Q(s.target.value),className:"pl-9 h-9 bg-slate-800/50 border-slate-700"})]}),e.jsxs(y,{"code-path":"src/components/cloud/RegionManager.tsx:199:11",value:f,onValueChange:W,children:[e.jsx(C,{"code-path":"src/components/cloud/RegionManager.tsx:200:13",className:"w-32 h-9 bg-slate-800/50 border-slate-700",children:e.jsx(w,{"code-path":"src/components/cloud/RegionManager.tsx:201:15"})}),e.jsxs(S,{"code-path":"src/components/cloud/RegionManager.tsx:203:13",children:[e.jsx(R,{"code-path":"src/components/cloud/RegionManager.tsx:204:15",value:"all",children:"全部云商"}),Object.entries(k).map(([s,o])=>e.jsx(R,{"code-path":"src/components/cloud/RegionManager.tsx:206:17",value:s,children:o},s))]})]})]}),e.jsxs(u,{"code-path":"src/components/cloud/RegionManager.tsx:211:9",onClick:J,className:"gap-2",children:[e.jsx(pe,{"code-path":"src/components/cloud/RegionManager.tsx:212:11",className:"h-4 w-4"}),"添加区域"]})]}),c.length>0&&e.jsxs("div",{"code-path":"src/components/cloud/RegionManager.tsx:219:9",className:"flex items-center justify-between gap-4 px-4 py-2.5 rounded-lg bg-slate-800/50 border border-slate-700",children:[e.jsxs("span",{"code-path":"src/components/cloud/RegionManager.tsx:220:11",className:"text-sm text-slate-300",children:["已选择 ",e.jsx("span",{"code-path":"src/components/cloud/RegionManager.tsx:221:17",className:"font-semibold text-slate-100",children:c.length})," 个区域"]}),e.jsxs("div",{"code-path":"src/components/cloud/RegionManager.tsx:223:11",className:"flex items-center gap-2",chilLine truncated
|
||||
Reference in new issue
Block a user