dsql-admin/dsql-app/.local_dist/server/chunks/4627.js

1 line
9.2 KiB
JavaScript
Raw Normal View History

2025-01-13 08:00:21 +00:00
"use strict";exports.id=4627,exports.ids=[4627],exports.modules={23180:(e,t,a)=>{a.d(t,{A:()=>b});var l=a(8732),i=a(82015),s=a.n(i),d=a(42960),n=a(46169),r=a(72390),c=a(51339),o=a(16757),p=a(6748),u=a(27825),m=a.n(u),f=a(60424),h=a(95939),x=a(41836);function y({user:e,table:t,entry:a,url:i,query:d}){let[n,r]=s().useState(!1),c=s().useRef(null);return(0,l.jsx)("div",{className:"relative z-[1000]",children:(0,l.jsx)(x.Popover,{isOpen:n,onClickOutside:()=>r(!1),containerClassName:"z-[1000]",positions:["bottom"],align:"end",content:(0,l.jsx)("div",{className:"bg-white dark:bg-slate-900 rounded shadow-md cancel-link",children:(0,l.jsxs)("div",{className:"flex-col min-w-[200px] items-stretch gap-0",children:[(0,l.jsx)("button",{className:"plain-text justify-start py-3",onClick:()=>{navigator.clipboard.writeText(JSON.stringify(a)).then(()=>{window.alert("Post Copied"),r(!1)})},children:"Copy Object"}),(0,l.jsx)("hr",{className:"m-0"}),(0,l.jsx)("button",{className:"plain-text justify-start py-3",onClick:()=>{let a=(0,f.A)({paradigm:"JavaScript",table:t,query:d,user:e});navigator.clipboard.writeText(a||"").then(()=>{window.alert("JavaScript Type Definition Copied"),r(!1)})},children:"Copy JS Type Definition"}),(0,l.jsx)("hr",{className:"m-0"}),(0,l.jsx)("button",{className:"plain-text justify-start py-3",onClick:()=>{let a=(0,f.A)({paradigm:"TypeScript",table:t,query:d,user:e});navigator.clipboard.writeText(a||"").then(()=>{window.alert("TypeScript Type Definition Copied"),r(!1)})},children:"Copy TS Type Definition"}),(0,l.jsx)("hr",{className:"m-0"}),(0,l.jsx)("a",{href:i,className:"button plain-text justify-start py-3",children:(0,l.jsx)("span",{children:"View Entry"})})]})}),children:(0,l.jsx)("button",{onClick:()=>{r(!n)},ref:c,className:"ghost p-2",children:(0,l.jsx)(h.A,{})})})})}function b({user:e,database:t,table:a,dbSchemaData:i,richTextEditors:u,jsonTextEditors:f,dataTypes:h,entry:x,entryPage:b,confirmedDelegetedUser:N,query:g}){let w=a.fields.filter(e=>e.fieldName&&!e.fieldName.match(d.A)),j=a.fields.find(e=>"uuid"===e.fieldName),v=N?.delegated;N?.priviledges?.match(/Edit Tables/i),N?.priviledges?.match(/Delete Tables/i),N?.priviledges?.match(/Create Tables/i),N?.priviledges?.match(/Edit Entries/i);let T=N?.priviledges?.match(/Delete Entries/i);j&&w.unshift({dataType:"UUID",fieldName:"uuid",defaultField:!0}),w.unshift({dataType:"BIGINT",fieldName:"id",defaultField:!0}),w.push({dataType:"VARCHAR(250)",fieldName:"date_created",defaultField:!0}),w.push({dataType:"BIGINT",fieldName:"date_created_code",defaultField:!0}),w.push({dataType:"TIMESTAMP",fieldName:"date_created_timestamp",defaultField:!0}),w.push({dataType:"VARCHAR(250)",fieldName:"date_updated",defaultField:!0}),w.push({dataType:"BIGINT",fieldName:"date_updated_code",defaultField:!0}),w.push({dataType:"TIMESTAMP",fieldName:"date_updated_timestamp",defaultField:!0});let[_,E]=s().useState(!1),[S,C]=s().useState(!0),[k,A]=s().useState(x),[F,I]=s().useState(!1);s().useRef(null);let D=s().useRef([]),[$,R]=s().useState(`/admin/${e?.id}/databases/${t.db_slug}/tables/${a.tableName}/entries/${k.id}`),L=`${t.db_slug}-${a.tableName}-${k.id}-submit-button`;return(0,l.jsxs)("div",{className:"card col w-full overflow-hidden",children:[(0,l.jsx)("a",{href:$,onClick:e=>{let t=e.target;(t.closest(".cancel-link")||t.closest(".MuiPopover-root"))&&e.preventDefault()},className:"w-full",children:(0,l.jsxs)("div",{className:"w-full bg-slate-700 text-white py-2 px-4 rounded justify-between flex-wrap hover:bg-slate-800 cursor-pointer relative z-[1000] ",onClick:e=>{let t=e.target;t.closest(".cancel-link")||t.closest(".MuiPopover-root")||(e.ctrlKey?window.open($,"__blank"):window.location.href=$)},children:[(0,l.jsxs)("span",{children:["Entry #",k.id]}),(0,l.jsxs)("div",{className:"flex-wrap cancel-link",children:[(!v||v&&T)&&(0,l.jsx)("span",{className:"text-slate-300 hover:text-fuchsia-200 cursor-pointer"+(_?" pointer-events-none opacity-40":""),onClick:e=>{window.confirm(`Delete Entry #${k.id}?`)&&(E(!0),(0,n.A)("/api/deleteTableEntry"+window.location.search,{method:"post",body:{db