ScopeSentry/static/assets/Node-DFd49utC.js

2 lines
6.0 KiB
JavaScript
Raw Normal View History

2024-06-17 14:41:04 +00:00
import{_ as e}from"./ContentWrap.vue_vue_type_script_setup_true_lang-CLuWlWlx.js";import{d as t,N as a,O as o,e as l,X as i,Q as n,r,a3 as s,Y as d,o as m,c as u,w as p,a as c,f,H as g,t as h,$ as v,E as y,j as _,a0 as x,l as b}from"./index-rxu9Faad.js";import{a as j,E as w}from"./el-col-BKZxb-_G.js";import{E as T}from"./el-tag-DFTmA9-y.js";import{_ as S}from"./Table.vue_vue_type_script_lang-COxZJx7A.js";import{u as N}from"./useTable-DOtBbJYW.js";import{_ as k}from"./Dialog.vue_vue_type_style_index_0_lang-D0fkHpTu.js";import{_ as C}from"./Configuration.vue_vue_type_script_setup_true_lang-BEgpu-3k.js";import{b as E,g as W,d as F}from"./index-BaLibEYg.js";import"./el-card-C0XrHsE5.js";import"./el-tooltip-l0sNRNKZ.js";import"./el-popper-BJkW0SkV.js";import"./el-checkbox-BVo36Tmv.js";import"./useInput-D-eMIzLG.js";import"./debounce-rCtyPgGe.js";import"./el-select-FArs2pTf.js";import"./el-image-viewer-CCnBYOdA.js";import"./tsxHelper-CyxpWgl3.js";import"./el-dropdown-item-CgW2TRYg.js";import"./castArray-B4xEQihS.js";import"./refs-ClXC3KCu.js";import"./index-CQSTts3C.js";import"./raf-P5NVVAw8.js";import"./el-form-item-BWEP-xeg.js";import"./el-switch-BRO8MrN9.js";import"./el-divider-CWb5e3hf.js";import"./el-text-BLRhP_03.js";import"./index-Cr6_Qzhf.js";const U={class:"mb-10px"},H={style:{position:"relative",top:"12px"}},z={key:0};function M(e){return"function"==typeof e||"[object Object]"===Object.prototype.toString.call(e)&&!x(e)}const R=t({__name:"Node",setup(t){const{t:x}=b(),R=a([{field:"selection",type:"selection",width:"55"},{field:"name",label:x("node.nodeName"),minWidth:20},{field:"maxTaskNum",label:x("configuration.maxTaskNum"),minWidth:10,formatter:(e,t,a)=>o(T,{type:"info"},(()=>a))},{field:"running",label:x("node.taskCount"),minWidth:10,formatter:(e,t,a)=>o(T,{round:!0,effect:"plain",hit:!0},(()=>a))},{field:"finished",label:x("node.finished"),minWidth:10,formatter:(e,t,a)=>o(T,{round:!0,effect:"plain",hit:!0},(()=>a))},{field:"cpuNum",label:x("node.nodeUsageCpu"),minWidth:20,formatter:(e,t,a)=>{let l=parseFloat(a);return l=parseFloat(l.toFixed(2)),o(T,{round:!0,effect:"plain",hit:!0,type:l<50?"":l<80?"warning":"danger"},(()=>l+"%"))}},{field:"memNum",label:x("node.nodeUsageMemory"),minWidth:20,formatter:(e,t,a)=>{let l=parseFloat(a);return l=parseFloat(l.toFixed(2)),o(T,{round:!0,effect:"plain",hit:!0,type:l<50?"":l<80?"warning":"danger"},(()=>l+"%"))}},{field:"state",label:x("node.nodeStatus"),minWidth:20,formatter:(e,t,a)=>o(T,{type:"1"===a?"success":"2"===a?"warning":"danger",effect:"light",hit:!0},(()=>x("1"===a?"node.statusRun":"2"===a?"node.statusStop":"node.statusError")))},{field:"updateTime",label:x("node.updateTime"),minWidth:20},{field:"action",label:x("tableDemo.action"),minWidth:30,formatter:(e,t,a)=>{let o,r;return l(n,null,[l(i,{type:"success",size:"small",onClick:()=>le(e)},M(o=x("node.log"))?o:{default:()=>[o]}),l(i,{type:"primary",size:"small",onClick:()=>Q(e)},M(r=x("common.config"))?r:{default:()=>[r]})])}}]),{tableRegister:V,tableState:A,tableMethods:D}=N({fetchDataApi:async()=>({list:(await W()).data.list})}),{loading:I,dataList:L,currentPage:O,pageSize:P}=A,{getList:$,getElTableExpose:J}=D;function q(){return{background:"var(--el-fill-color-light)"}}const B=r(!1),G=()=>{B.value=!1},K=a({name:"",maxTaskNum:"",state:"",dirscanThread:"",portscanThread:"",crawlerThread:"",urlThread:"",urlMaxNum:""}),Q=async e=>{K.name=e.name,K.maxTaskNum=e.maxTaskNum,K.dirscanThread=e.dirscanThread,K.portscanThread=e.portscanThread,K.crawlerThread=e.crawlerThread,K.urlThread=e.urlThread,K.urlMaxNum=e.urlMaxNum,K.state=e.state,B.value=!0},X=r(!1),Y=r([]),Z=async()=>{window.confirm("Are you sure you want to delete the selected data?")&&await(async()=>{const e=await J(),t=(null==e?void 0:e.getSelectionRows())||[];Y.value=t.map((e=>e.name)),X.value=!0;try{await F(Y.value),X.value=!1,$()}catch(a){X.value=!1,$()}})()},ee=r(!1),te=()=>{ee.value=!1},ae=r(""),oe=r(),le=async e=>{const t=await E(e.name);ae.value=t.logs,ee.value=!0;const a="https:"===window.location.protocol?"wss://":"ws://",o=window.location.host,l=new Web