Files
monibuca/plugin/console/web/assets/index-7ac94d2d.js
2024-10-07 14:14:00 +08:00

2 lines
2.6 KiB
JavaScript

import{j as C,k as c}from"./index-cc631905.js";import{T as v,B as x}from"./TableAction-45c049b5.js";import{i as F,c as b}from"./index-c14b60e2.js";import{l as k}from"./vendor-ec30964e.js";const N=Vue.createTextVNode(" 全文搜索 "),D=Vue.createTextVNode(" 实时跟踪 "),I=Vue.defineComponent({setup(B){const{t:n}=F.global,a=Vue.ref(""),l=Vue.ref(""),s=Vue.ref(!0),u=k().params.id,i=Vue.ref([]),p=Vue.computed(()=>a.value?i.value.filter(e=>e.name.indexOf(a.value)!=-1):i.value);function d(e,t=""){const o={"":"K",K:"M",M:"G",G:null};return e>1024&&o[t]?d(e/1024,o[t]):(e||0).toFixed(2).replace(".00","")+t+"B"}const V=[{title:()=>Vue.h("div",[n("名称"),Vue.h(naive.NInput,{placeholder:n("按名称过滤"),size:"small",style:{width:"80%",marginLeft:"10px"},onUpdateValue(e){a.value=e}})]),key:"name",width:100},{title:n("大小"),width:100,render(e){return Vue.h("text",d(+e.size))}}];C().then(e=>{i.value=(e==null?void 0:e.files)||[],s.value=!1});async function m(e){b.push({name:"instance_log_detail",params:{id:u,logName:e.name}})}async function f(e){const t=await c(u,!0,!1);window.open(`${t}/logrotate/api/download?file=${encodeURI(e.name)}`)}async function y(){const e=await c(u,!0,!1);window.open(`${e}/logrotate/api/find?query=${l.value}`)}async function _(){const e=await c(u,!0,!1);window.open(`${e}/logrotate/api/tail`)}const w=Vue.reactive({width:220,title:n("操作"),key:"action",render(e){return Vue.h(v,{style:"button",actions:[{label:n("打开"),type:"primary",icon:"ic:outline-delete-outline",onClick:m.bind(null,e)},{label:n("下载"),type:"primary",icon:"ic:outline-delete-outline",onClick:f.bind(null,e)}]})}});return(e,t)=>{const o=Vue.resolveComponent("n-button"),g=Vue.resolveComponent("n-layout-content"),h=Vue.resolveComponent("n-layout");return Vue.openBlock(),Vue.createBlock(h,null,{default:Vue.withCtx(()=>[Vue.createVNode(g,{"content-style":"padding: 24px;"},{default:Vue.withCtx(()=>[Vue.createVNode(Vue.unref(x),{title:e.$t("日志文件列表"),class:"table",loading:s.value,"row-class-name":"row",columns:V,dataSource:Vue.unref(p),pagination:{simple:!0},actionColumn:Vue.unref(w),"row-key":r=>r.name,"scroll-x":1090},{toolbar:Vue.withCtx(()=>[Vue.createVNode(Vue.unref(naive.NInput),{value:l.value,"onUpdate:value":t[0]||(t[0]=r=>l.value=r),style:{"margin-right":"10px"}},null,8,["value"]),Vue.createVNode(o,{"attr-type":"button",onClick:y,style:{"margin-right":"10px"}},{default:Vue.withCtx(()=>[N]),_:1}),Vue.createVNode(o,{"attr-type":"button",onClick:_},{default:Vue.withCtx(()=>[D]),_:1})]),_:1},8,["title","loading","dataSource","actionColumn","row-key"])]),_:1})]),_:1})}}});export{I as default};