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

2 lines • 5.72 kB
import{A as e,C as t,Ct as n,D as r,E as i,J as a,M as o,R as s,T as c,Wt as ee,X as l,Yt as u,ht as d,it as f,k as p,nt as m,t as h,w as g,y as _}from"./i18n.store-B4krJCIS.js";import{t as v,x as y}from"./_plugin-vue_export-helper-67n0yneU.js";import{t as b}from"./VTooltip-UUcBbF8q.js";import{t as x}from"./redis-state.store-DPDs81ZS.js";import{t as S}from"./common.store-C_dWn4yG.js";import{i as C}from"./socket.service-B85kYQEM.js";import"./index-CBO402jT.js";import{d as w,n as T,o as te,p as E,r as ne,s as re,u as ie}from"./key-type-base-LvSh6VCU.js";import{t as ae}from"./JsonViewDialog-CF2ki0pj.js";import{t as oe}from"./KeyNewOrSetDialog-ea4_RQ1e.js";import{t as se}from"./HexMonitor-B8nJtZMF.js";import{t as ce}from"./KeyPagerInline-BQ9AtO8M.js";/* empty css */var le={class:`p3xr-key-table-header`},ue={style:{flex:`1`}},de={style:{"text-align":`right`}},fe={class:`p3xr-stream-entry-header`},D={style:{display:`flex`,"align-items":`center`,gap:`12px`}},O={style:{opacity:`0.5`,"font-size":`12px`}},k={style:{"white-space":`nowrap`}},A={class:`p3xr-stream-entry-fields`},j={style:{"min-width":`120px`,opacity:`0.7`}},M={class:`p3xr-stream-field-value`},N={key:0,style:{opacity:`0.5`}},P=v(o({__name:`KeyStream`,props:{response:{},value:{},valueBuffer:{},keyName:{},valueFormat:{}},emits:[`refresh`],setup(o,{emit:v}){let P={zn:`zh-CN`,no:`nb`,fil:`tl`};function F(e){let t=new Set;for(let[n]of e){if(t.has(n))return!0;t.add(n)}return!1}function I(e){return e?e.map(e=>{let t=e[0],n=e[1],r=[];for(let e=0;e<n.length;e+=2)r.push([n[e],n[e+1]]);let i=F(r);return{id:t,fields:r,data:i?r.map(([e,t])=>({field:e,value:t})):Object.fromEntries(r),hasDuplicateFields:i}}):[]}function L(e){return e.hasDuplicateFields?{id:e.id,fields:e.data}:{id:e.id,...e.data}}let R=o,z=v,B=h(),V=t(()=>B.strings),H=t(()=>x().connection?.readonly===!0),U=S(),W=d([]),G=d(ne(0)),K=d([]),q=d(!1),J=d(null),Y=d(!1),X=d(``);function Z(e){G.value=e,K.value=W.value.slice(e.startIndex,e.endIndex)}m(()=>R.value,()=>{let e=I(R.value);W.value=e,Z(ie(G.value,e.length))},{immediate:!0});function Q(e){try{let t=parseInt(e.slice(0,e.indexOf(`-`))),n=B.currentLang,r=P[n]||n;return new Date(t).toLocaleString(r,{year:`numeric`,month:`numeric`,day:`numeric`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}catch{return e}}function pe(){J.value={type:`append`,model:{type:`stream`,key:R.keyName}},q.value=!0}function me(e){q.value=!1,J.value=null,e&&z(`refresh`)}async function he(e){try{await U.confirm({message:w(V.value?.confirm?.deleteStreamTimestamp)}),await C({action:`key/stream-delete-timestamp`,payload:{key:R.keyName,streamTimestamp:e}}),U.toast(w(V.value?.status?.deletedStreamTimestamp)),z(`refresh`)}catch(e){e!==void 0&&U.generalHandleError(e)}}function ge(e){T(JSON.stringify(L(e),null,2))}function $(e){let t=[e.id];for(let[n,r]of e.fields)t.push(n),t.push(r);let n=new Blob([t.join(` `)],{type:`text/plain`}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=`${R.keyName}-${e.id}.txt`,i.click(),URL.revokeObjectURL(r)}function _e(e){X.value=JSON.stringify(L(e)),Y.value=!0}return(t,d)=>(a(),r(`div`,null,[e(ce,{paging:G.value,onPageChanged:Z},null,8,[`paging`]),g(`div`,le,[g(`span`,ue,u(n(w)(V.value?.page?.key?.stream?.table?.timestamp)),1),g(`span`,de,[H.value?i(``,!0):(a(),c(b,{key:0,text:n(w)(V.value?.intention?.add),location:`top`},{activator:f(({props:t})=>[e(y,s(t,{style:{cursor:`pointer`,color:`inherit`},onClick:pe}),{default:f(()=>[...d[1]||=[p(`mdi-plus`,-1)]]),_:1},16)]),_:1},8,[`text`]))])]),(a(!0),r(_,null,l(K.value,(t,m)=>(a(),r(`div`,{key:t.id,class:ee([`p3xr-stream-entry`,{"p3xr-key-table-odd":m%2==0}])},[g(`div`,fe,[g(`div`,D,[e(b,{text:Q(t.id),location:`top`},{activator:f(({props:e})=>[g(`strong`,s({ref_for:!0},e,{style:{cursor:`default`}}),u(t.id),17)]),_:2},1032,[`text`]),g(`span`,O,u(Q(t.id)),1)]),g(`span`,k,[H.value?i(``,!0):(a(),c(b,{key:0,text:n(w)(V.value?.intention?.delete),location:`top`},{activator:f(({props:n})=>[e(y,s({ref_for:!0},n,{size:`24`,class:`p3xr-key-icon`,style:{color:`rgb(var(--v-theme-error))`},onClick:e=>he(t.id)}),{default:f(()=>[...d[2]||=[p(`mdi-delete`,-1)]]),_:1},16,[`onClick`])]),_:2},1032,[`text`])),e(b,{text:n(w)(V.value?.intention?.jsonViewShow),location:`top`},{activator:f(({props:n})=>[e(y,s({ref_for:!0},n,{size:`24`,class:`p3xr-key-icon`,style:{color:`rgb(var(--v-theme-secondary))`},onClick:e=>_e(t)}),{default:f(()=>[...d[3]||=[p(`mdi-file-tree`,-1)]]),_:1},16,[`onClick`])]),_:2},1032,[`text`]),e(b,{text:n(w)(V.value?.intention?.copy),location:`top`},{activator:f(({props:n})=>[e(y,s({ref_for:!0},n,{size:`24`,class:`p3xr-key-icon`,style:{color:`rgb(var(--v-theme-secondary))`},onClick:e=>ge(t)}),{default:f(()=>[...d[4]||=[p(`mdi-content-copy`,-1)]]),_:1},16,[`onClick`])]),_:2},1032,[`text`]),e(b,{text:n(w)(V.value?.intention?.downloadBuffer),location:`top`},{activator:f(({props:n})=>[e(y,s({ref_for:!0},n,{size:`24`,class:`p3xr-key-icon`,style:{color:`rgb(var(--v-theme-secondary))`},onClick:e=>$(t)}),{default:f(()=>[...d[5]||=[p(`mdi-download`,-1)]]),_:1},16,[`onClick`])]),_:2},1032,[`text`])])]),g(`div`,A,[(a(!0),r(_,null,l(t.fields,([e,t],s)=>(a(),r(`div`,{key:`${e}-${s}`,class:`p3xr-stream-field-row`},[g(`span`,j,u(e),1),g(`span`,M,[o.valueFormat===`hex`?(a(),c(se,{key:0,value:n(E)(t)},null,8,[`value`])):(a(),r(_,{key:1},[p(u(n(E)(n(te)(t,o.valueFormat))),1),n(re)(t)?(a(),r(`span`,N,`...`)):i(``,!0)],64))])]))),128))])],2))),128)),e(oe,{open:q.value,data:J.value,onClose:me},null,8,[`open`,`data`]),e(ae,{open:Y.value,value:X.value,onClose:d[0]||=e=>Y.value=!1},null,8,[`open`,`value`])]))}}),[[`__scopeId`,`data-v-0df52adf`]]);export{P as default};