UNPKG

p3x-redis-ui-material

Version:

💿 P3X Redis UI triple frontend — Angular + React/MUI + Vue/Vuetify with 54 languages, 7 themes, Socket.IO, desktop notifications, and full feature parity

1 lines • 7.57 kB
import{A as e,C as t,Ct as n,D as r,E as i,G as a,J as o,K as s,M as c,T as l,X as u,Yt as d,_ as f,g as p,ht as m,it as h,nt as g,t as ee,w as _,y as v}from"./i18n.store-Bbsc3Bab.js";import{t as y}from"./_plugin-vue_export-helper-D1H5elb2.js";import{c as b,m as x,t as S}from"./VList-v6BtQFeD.js";import{t as C}from"./VTextField-Cly86AKT.js";import{t as w}from"./redis-state.store-Bg6EmgAE.js";import"./redis-state-DodmMOrr.js";import{t as T}from"./common.store-Cvd7gD49.js";import"./common-DKIejnu1.js";import{i as E}from"./socket.service-uJHysVIS.js";import{t as D}from"./P3xrButton-ChR905DO.js";import{d as O}from"./key-type-base-CMdmuQhl.js";import{t as k}from"./P3xrAccordion-Ch6mG6NP.js";var A={class:`p3xr-key-type-content`},j={style:{display:`flex`,width:`100%`}},M={style:{flex:`1`,"font-weight":`500`}},N={style:{"word-break":`break-all`}},P={style:{padding:`16px`}},F={class:`p3xr-prob-controls`},I={style:{display:`flex`,width:`100%`}},L={style:{flex:`1`,"font-weight":`500`}},R=y(c({__name:`KeyProbabilistic`,props:{response:{},value:{},valueBuffer:{},keyName:{},valueFormat:{}},emits:[`refresh`],setup(c,{emit:y}){let R=c,z=y,B=t(()=>ee().strings),V=t(()=>w().connection?.readonly===!0),H=T(),U=t(()=>R.response?.type||``),W=m(``),G=m(1),K=m(.5),q=m([]),J=m(!1),Y=null,X=t(()=>{try{let e;if(typeof R.value==`object`&&R.value!==null&&!ArrayBuffer.isView(R.value)?e=R.value:typeof R.value==`string`?e=JSON.parse(R.value):ArrayBuffer.isView(R.value)&&(e=JSON.parse(new TextDecoder().decode(R.value))),e&&typeof e==`object`)return Object.entries(e).map(([e,t])=>({key:e,value:t}))}catch{}return[]});a(()=>{U.value===`topk`&&$()}),s(()=>clearInterval(Y)),g(()=>R.value,()=>{U.value===`topk`&&$()}),g(J,e=>{clearInterval(Y),e&&(Y=setInterval(()=>{z(`refresh`),U.value===`topk`&&$()},1e4))});async function Z(){if(W.value.trim())try{await E({action:`probabilistic/add`,payload:{key:R.keyName,type:U.value,item:W.value.trim(),increment:G.value}}),H.toast(O(B.value?.page?.key?.probabilistic?.addedSuccessfully)),W.value=``,z(`refresh`),U.value===`topk`&&$()}catch(e){H.toast(e.message)}}async function te(){if(W.value.trim())try{let e=(await E({action:`probabilistic/check`,payload:{key:R.keyName,type:U.value,item:W.value.trim()}})).result===1;H.toast(`"${W.value}" — ${O(e?B.value?.page?.key?.probabilistic?.exists:B.value?.page?.key?.probabilistic?.doesNotExist)}`)}catch(e){H.toast(e.message)}}async function ne(){if(W.value.trim())try{await H.confirm({message:O(B.value?.confirm?.delete)}),await E({action:`probabilistic/delete`,payload:{key:R.keyName,type:U.value,item:W.value.trim()}}),H.toast(O(B.value?.page?.key?.probabilistic?.deletedSuccessfully)),W.value=``,z(`refresh`)}catch(e){e?.message&&H.toast(e.message)}}async function re(){if(W.value.trim())try{let e=await E({action:`probabilistic/check`,payload:{key:R.keyName,type:U.value,item:W.value.trim()}}),t=Array.isArray(e.result)?e.result[0]:e.result;H.toast(`"${W.value}" — ${O(B.value?.page?.key?.probabilistic?.topkCount)}: ${t}`)}catch(e){H.toast(e.message)}}async function Q(){try{let e=await E({action:`probabilistic/check`,payload:{key:R.keyName,type:U.value,quantile:K.value}}),t=Array.isArray(e.result)?e.result[0]:e.result;H.toast(`${O(B.value?.page?.key?.probabilistic?.quantile)} ${K.value} = ${t}`)}catch(e){H.toast(e.message)}}async function ie(){try{await H.confirm({message:O(B.value?.page?.key?.probabilistic?.resetConfirm)}),await E({action:`probabilistic/delete`,payload:{key:R.keyName,type:`tdigest`}}),H.toast(`Reset`),z(`refresh`)}catch(e){e?.message&&H.toast(e.message)}}async function $(){try{q.value=(await E({action:`probabilistic/check`,payload:{key:R.keyName,type:`topk`}})).result||[]}catch{q.value=[]}}return(t,a)=>(o(),r(`div`,A,[a[15]||=_(`br`,null,null,-1),e(k,{title:n(O)(B.value?.page?.key?.probabilistic?.info),"accordion-key":`prob-info`},{actions:h(()=>[e(D,{icon:J.value?`mdi-checkbox-marked`:`mdi-checkbox-blank-outline`,label:n(O)(B.value?.label?.autoRefresh),breakpoint:1280,color:`inherit`,onClick:a[0]||=f(e=>J.value=!J.value,[`stop`])},null,8,[`icon`,`label`]),J.value?i(``,!0):(o(),l(D,{key:0,icon:`mdi-refresh`,label:n(O)(B.value?.intention?.refresh),breakpoint:1280,color:`inherit`,onClick:a[1]||=f(e=>{z(`refresh`),U.value===`topk`&&$()},[`stop`])},null,8,[`label`]))]),default:h(()=>[e(S,{density:`compact`},{default:h(()=>[(o(!0),r(v,null,u(X.value,(t,n)=>(o(),r(v,{key:t.key},[e(b,null,{default:h(()=>[_(`div`,j,[_(`span`,M,d(t.key),1),_(`span`,N,d(String(t.value)),1)])]),_:2},1024),n<X.value.length-1?(o(),l(x,{key:0})):i(``,!0)],64))),128))]),_:1})]),_:1},8,[`title`]),a[16]||=_(`br`,null,null,-1),e(k,{title:U.value===`topk`?n(O)(B.value?.page?.key?.probabilistic?.topkList):n(O)(B.value?.page?.key?.probabilistic?.addItem),"accordion-key":`prob-actions`},{default:h(()=>[_(`div`,P,[_(`div`,F,[U.value===`tdigest`?(o(),l(C,{key:0,density:`compact`,variant:`outlined`,"hide-details":``,type:`number`,class:`p3xr-ts-field`,label:n(O)(B.value?.form?.key?.field?.value),modelValue:W.value,"onUpdate:modelValue":a[2]||=e=>W.value=e,onKeyup:a[3]||=p(e=>Z(),[`enter`])},null,8,[`label`,`modelValue`])):(o(),l(C,{key:1,density:`compact`,variant:`outlined`,"hide-details":``,style:{flex:`1`,"min-width":`200px`},label:n(O)(B.value?.page?.key?.probabilistic?.item),modelValue:W.value,"onUpdate:modelValue":a[4]||=e=>W.value=e,onKeyup:a[5]||=p(e=>Z(),[`enter`])},null,8,[`label`,`modelValue`])),U.value===`cms`?(o(),l(C,{key:2,density:`compact`,variant:`outlined`,"hide-details":``,type:`number`,style:{"max-width":`120px`},label:n(O)(B.value?.form?.key?.field?.increment),modelValue:G.value,"onUpdate:modelValue":a[6]||=e=>G.value=e,modelModifiers:{number:!0}},null,8,[`label`,`modelValue`])):i(``,!0),U.value===`tdigest`?(o(),l(C,{key:3,density:`compact`,variant:`outlined`,"hide-details":``,type:`number`,step:`0.1`,style:{"max-width":`120px`},label:n(O)(B.value?.page?.key?.probabilistic?.quantile),modelValue:K.value,"onUpdate:modelValue":a[7]||=e=>K.value=e,modelModifiers:{number:!0},onKeyup:a[8]||=p(e=>Q(),[`enter`])},null,8,[`label`,`modelValue`])):i(``,!0),V.value?i(``,!0):(o(),l(D,{key:4,icon:`mdi-plus`,label:n(O)(B.value?.intention?.add),raised:``,color:`primary`,onClick:a[9]||=e=>Z()},null,8,[`label`])),U.value===`bloom`||U.value===`cuckoo`?(o(),l(D,{key:5,icon:`mdi-magnify`,label:n(O)(B.value?.page?.key?.probabilistic?.checkItem),raised:``,color:`primary`,onClick:a[10]||=e=>te()},null,8,[`label`])):i(``,!0),U.value===`cuckoo`&&!V.value?(o(),l(D,{key:6,icon:`mdi-delete`,label:n(O)(B.value?.intention?.delete),raised:``,color:`primary`,onClick:a[11]||=e=>ne()},null,8,[`label`])):i(``,!0),U.value===`cms`?(o(),l(D,{key:7,icon:`mdi-magnify`,label:n(O)(B.value?.page?.key?.probabilistic?.queryCount),raised:``,color:`primary`,onClick:a[12]||=e=>re()},null,8,[`label`])):i(``,!0),U.value===`tdigest`?(o(),l(D,{key:8,icon:`mdi-chart-bar`,label:n(O)(B.value?.page?.key?.probabilistic?.quantile),raised:``,color:`primary`,onClick:a[13]||=e=>Q()},null,8,[`label`])):i(``,!0),U.value===`tdigest`&&!V.value?(o(),l(D,{key:9,icon:`mdi-undo`,label:`Reset`,raised:``,color:`warning`,onClick:a[14]||=e=>ie()})):i(``,!0)])]),U.value===`topk`&&q.value.length>0?(o(),r(v,{key:0},[e(x),e(S,{density:`compact`},{default:h(()=>[(o(!0),r(v,null,u(q.value,(t,n)=>(o(),r(v,{key:n},[e(b,null,{default:h(()=>[_(`div`,I,[_(`span`,L,d(t.item),1),_(`span`,null,d(t.count),1)])]),_:2},1024),n<q.value.length-1?(o(),l(x,{key:0})):i(``,!0)],64))),128))]),_:1})],64)):i(``,!0)]),_:1},8,[`title`])]))}}),[[`__scopeId`,`data-v-ea9b5633`]]);export{R as default};