allinssl/frontend/static/js/index-DaCSte6N.js

2 lines
8.8 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

import{d as e,c as l,o as t,a,m as r,s,r as o,$ as n,h as i,e as c,Q as d,k as u,I as v,L as m,j as f,f as p,B as g,W as w,V as b}from"./main-DVBEmEFd.js";import{g as x}from"./public-CEhf9I7z.js";import{u as _,N as h}from"./index-sztGZ9nB.js";import{F as k,C as y,a as T}from"./Flow-DQcSWrVi.js";const z={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 32 32"},C=e({name:"ArrowRight",render:function(e,r){return t(),l("svg",z,r[0]||(r[0]=[a("path",{d:"M18 6l-1.43 1.393L24.15 15H4v2h20.15l-7.58 7.573L18 26l10-10L18 6z",fill:"currentColor"},null,-1)]))}}),$={stateText:"_stateText_g1gmz_64",success:"_success_g1gmz_65",warning:"_warning_g1gmz_66",error:"_error_g1gmz_67",info:"_info_g1gmz_68",default:"_default_g1gmz_69",cardHover:"_cardHover_g1gmz_73",quickEntryCard:"_quickEntryCard_g1gmz_82",workflow:"_workflow_g1gmz_92",iconWrapper:"_iconWrapper_g1gmz_96",title:"_title_g1gmz_101",cert:"_cert_g1gmz_106",monitor:"_monitor_g1gmz_120",tableText:"_tableText_g1gmz_150",viewAllButton:"_viewAllButton_g1gmz_154"},j=r("home-store",(()=>{const e=o(!1),l=o({workflow:{count:0,active:0,failure:0},cert:{count:0,will:0,end:0},site_monitor:{count:0,exception:0},workflow_history:[]}),{handleError:t}=_();return{loading:e,overviewData:l,fetchOverviewData:async()=>{try{e.value=!0;const{data:t,status:a}=await x().fetch();if(a){const{workflow:e,cert:a,site_monitor:r,workflow_history:s}=t;l.value={workflow:{count:(null==e?void 0:e.count)||0,active:(null==e?void 0:e.active)||0,failure:(null==e?void 0:e.failure)||0},cert:{count:(null==a?void 0:a.count)||0,will:(null==a?void 0:a.will)||0,end:(null==a?void 0:a.end)||0},site_monitor:{count:(null==r?void 0:r.count)||0,exception:(null==r?void 0:r.exception)||0},workflow_history:s||[]}}}catch(a){t(a).defalut(n("t_3_1745833936770"))}finally{e.value=!1}}}})),W=()=>{const e=j();return{...e,...s(e)}};const D=()=>{const{overviewData:e}=W(),l=i(),t=e=>{switch(e){case 1:return"success";case 0:return"warning";case-1:return"error";default:return"default"}},a=e=>{switch(e){case 1:return"成功";case 0:return"正在运行";case-1:return"失败";default:return"未知"}},r=e=>new Date(e).toLocaleString();return{overviewData:e,navigateToWorkflow:(e="")=>{l.push("/auto-deploy"+(e?`?type=${e}`:""))},navigateToCert:(e="")=>{l.push("/cert-apply"+(e?`?type=${e}`:""))},navigateToMonitor:(e="")=>{l.push("/monitor"+(e?`?type=${e}`:""))},navigateToCertManage:(e="")=>{l.push("/cert-manage")},getWorkflowStateType:t,getWorkflowStateText:a,formatExecTime:r,createColumns:()=>[{title:n("t_2_1745289353944"),key:"name"},{title:n("t_0_1746590054456"),key:"state",render:e=>{const l=t(e.state),r=a(e.state);return c(d,{type:l,class:`${$.stateText} ${$[l]}`},"function"==typeof(s=r)||"[object Object]"===Object.prototype.toString.call(s)&&!u(s)?r:{default:()=>[r]});var s}},{title:n("t_1_1746590060448"),key:"mode",render:e=>c("span",{class:$.tableText},[e.mode||"未知"])},{title:n("t_4_1745227838558"),key:"exec_time",render:e=>c("span",{class:$.tableText},[r(e.exec_time)])}]}},E=e({name:"HomeView",setup(){const{fetchOverviewData:e,loading:l}=W(),{overviewData:t,navigateToWorkflow:a,navigateToCert:r,navigateToMonitor:s,navigateToCertManage:o,createColumns:n}=D(),i=n();return v(e),()=>c("div",{class:"mx-auto max-w-[1600px] w-full p-6"},[c(h,{show:l.value},{default:()=>[c("div",{class:"flex flex-col h-full gap-8 overflow-auto"},[c("div",{class:"grid grid-cols-1 md:grid-cols-3 gap-4"},[c("div",{onClick:()=>a(),class:"cursor-pointer relative"},[c("div",{class:"absolute right-0 top-0 w-24 h-24 rounded-full bg-blue-50 dark:bg-blue-900/30 opacity-70 -z-10"},null),c(m,{class:"transition-all duration-300 rounded-[0.6rem]",hoverable:!0,bordered:!1},{default:()=>[c("div",{class:"flex items-center justify-center"},[c("div",{class:"flex-1"},[c("div",{class:$.tableText},[f("自动化工作流")]),c("div",{class:"flex items-center space-x-5"},[c("div",null,[c("span",{class:"text-[2.4rem] font-bold"},[t.value.workflow.count]),c("p",{class:$.tableText},[f("总数量")])]),c("div",{class:"border-l-2 dark:border-gray-600 pl-[2rem] ml-[3rem]"},[c("div",{class:"flex items-center space-x-1"},[c("span",{class:"w-4 h-4 rounded-full mr-[.6rem] bg-green-500"},null),c("span",{class:$.tableText},[f("已启用:"),t.value.workflow.active])]),c("div",{class:"flex items-center space-x-1 mt-3"},[c("span",{class:"w-4 h-4 rounded-full mr-[.6rem] bg-red-500"},null),c("span",{class:$.tableText},[f("执行失败:"),t.value.workflow.failure])])])])]),c("div",{class:$.workflowIcon},[c(p,{size:"28"},{default:()=>[c(k,null,null)]})])])]})]),c("div",{onClick:()=>o(),class:"cursor-pointer relative"},[c("div",{class:"absolute right-0 top-0 w-24 h-24 rounded-full bg-blue-50 dark:bg-blue-900/30 opacity-70 -z-10"},null),c(m,{class:"transition-all duration-300 rounded-[0.6rem]",hoverable:!0,bordered:!1},{default:()=>[c("div",{class:"flex items-center justify-center"},[c("div",{class:"flex-1"},[c("div",{class:$.tableText},[f("证书管理")]),c("div",{class:"flex items-center space-x-5"},[c("div",null,[c("span",{class:"text-[2.4rem] font-bold"},[t.value.cert.count]),c("p",{class:$.tableText},[f("总数量")])]),c("div",{class:"border-l-2 dark:border-gray-600 pl-[2rem] ml-[3rem]"},[c("div",{class:"flex items-center space-x-1"},[c("span",{class:"w-4 h-4 rounded-full mr-[.6rem] bg-yellow-500"},null),c("span",{class:$.tableText},[f("即将到期:"),t.value.cert.will])]),c("div",{class:"flex items-center space-x-1 mt-3"},[c("span",{class:"w-4 h-4 rounded-full mr-[.6rem] bg-red-500"},null),c("span",{class:$.tableText},[f("已到期:"),t.value.cert.end])])])])]),c("div",{class:$.certIcon},[c(p,{size:"28"},{default:()=>[c(y,null,null)]})])])]})]),c("div",{onClick:()=>s(),class:"cursor-pointer relative"},[c("div",{class:"absolute right-0 top-0 w-24 h-24 rounded-full bg-blue-50 dark:bg-blue-900/30 opacity-70 -z-10"},null),c(m,{class:"transition-all duration-300 rounded-[0.6rem]",hoverable:!0,bordered:!1},{default:()=>[c("div",{class:"flex items-center justify-center"},[c("div",{class:"flex-1"},[c("div",{class:$.tableText},[f("实时监控")]),c("div",{class:"flex items-center space-x-5"},[c("div",null,[c("span",{class:"text-[2.4rem] font-bold"},[t.value.site_monitor.count]),c("p",{class:$.tableText},[f("总数量")])]),c("div",{class:"border-l-2 dark:border-gray-600 pl-[2rem] ml-[3rem]"},[c("div",{class:"flex items-center space-x-1"},[c("span",{class:"w-4 h-4 rounded-full mr-[.6rem] bg-red-500"},null),c("span",{class:$.tableText},[f("异常数量:"),t.value.site_monitor.exception])])])])]),c("div",{class:$.monitorIcon},[c(p,{size:"28"},{default:()=>[c(T,null,null)]})])])]})])]),c(m,{class:"rounded-[0.6rem] transition-all duration-300",hoverable:!0,bordered:!1},{default:()=>[c("div",{class:"flex justify-between items-center mb-4"},[c("div",{class:$.tableText},[f("最近工作流执行记录")]),c(g,{text:!0,onClick:()=>a(),class:$.viewAllButton},{default:()=>[f("查看全部"),c(p,{class:"ml-1"},{default:()=>[c(C,null,null)]})]})]),t.value.workflow_history.length>0?c(w,{columns:i,data:t.value.workflow_history,bordered:!1,size:"small",singleLine:!1,rowClassName:()=>"border-none",class:"border-none",style:{"--n-td-border-color":"transparent","--n-th-border-color":"transparent","--n-border-color":"transparent","--n-border-radius":"0"}},null):c(b,{description:"暂无工作流执行记录"},null)]}),c("div",{class:"grid grid-cols-1 md:grid-cols-3 gap-4"},[c("div",{onClick:()=>a("create"),class:"cursor-pointer"},[c(m,{class:`${$.quickEntryCard} ${$.workflow} transition-all duration-300`,hoverable:!0,bordered:!1},{default:()=>[c("div",{class:"flex items-center p-6"},[c("div",{class:`${$.iconWrapper} mr-6`},[c(p,{size:"32"},{default:()=>[c(k,null,null)]})]),c("div",{class:"flex-1"},[c("div",{class:`${$.title} text-[1.8rem] font-medium mb-3`},[f("创建工作流")]),c("div",{class:$.tableText},[f("点击创建自动化工作流程,提高效率")])])])]})]),c("div",{onClick:()=>r(),class:"cursor-pointer"},[c(m,{class:`${$.quickEntryCard} ${$.cert} transition-all duration-300 rounded-[0.6rem]`,hoverable:!0,bordered:!1},{default:()=>[c("div",{class:"flex items-center p-6"},[c("div",{class:`${$.iconWrapper} mr-6`},[c(p,{size:"32"},{default:()=>[c(y,null,null)]})]),c("div",{class:"flex-1"},[c("div",{class:`${$.title} text-[1.8rem] font-medium mb-3`},[f("申请证书")]),c("div",{class:$.tableText},[f("点击申请和管理SSL证书保障安全")])])])]})]),c("div",{onClick:()=>s("create"),class:"cursor-pointer"},[c(m,{class:`${$.quickEntryCard} ${$.monitor} transition-all duration-300 rounded-[0.6rem]`,hoverable:!0,bordered:!1},{default:()=>[c("div",{class:"flex items-center p-6"},[c("div",{class:`${$.iconWrapper} mr-6`},[c(p,{size:"32"},{default:()=>[c(T,null,null)]})]),c("div",{class:"flex-1"},[c("div",{class:`${$.title} text-[1.8rem] font-medium mb-3`},[f("添加监控")]),c("div",{class:$.tableText},[f("点击设置网站监控,实时掌握运行状态")])])])]})])])])]})])}});export{E as default};