Files
yakpanel-core/YakPanel/static/vite/js/form-D9I7zKQp.js
2026-04-07 02:04:22 +05:30

2 lines
9.9 KiB
JavaScript

import{_ as L}from"./index.vue_vue_type_script_setup_true_lang-D8O2mMsP.js?v=1773287522785";import{iq as h,i as P,ir as I}from"./index-BTglIPU2.js?v=1773287522785";import{u as O}from"./useLoading-CZ2gSAW7.js?v=1773287522785";import{k as N,r as E,e as U,c as M,$ as A,Z as x,a0 as l,a9 as n,S as a,a8 as V,ak as W,_ as B}from"./vue-core-DJjvd5ZC.js?v=1773287522785";import{k as F,a1 as q,a6 as G,b5 as K}from"./naive-ui--dJnpVcV.js?v=1773287522785";import"./prismjs-BZPoR7_J.js?v=1773287522785";const X=[{key:"Data Permissions",label:"Data Permissions",description:"Data Permissions",select:!0,id:1,children:[{id:2,key:"SELECT",description:"SELECT--Allows users to query (read) data from the database.",select:!0,label:"Read Data"},{id:3,key:"INSERT",description:"INSERT--Allows users to insert new data into database tables.",select:!0,label:"Insert/Replace Data"},{id:4,key:"UPDATE",description:"UPDATE--Allows users to modify data in database tables.",select:!0,label:"Modify Data"},{id:5,key:"DELETE",description:"DELETE--Allows users to delete data from database tables.",select:!0,label:"Delete Data"},{key:"FILE",id:22,description:"Allows users to read or write files.",label:"File Read/Write"}]},{key:"Structure Permissions",label:"Structure Permissions",description:"Structure Permissions",select:!0,id:6,children:[{id:7,key:"CREATE",description:"Allows users to create new databases, tables, or indexes.",select:!0,label:"Create Database/Table"},{id:8,key:"ALTER",description:"Allows users to modify the structure of database tables (e.g., add or delete columns).",select:!0,label:"Modify Table Structure"},{id:9,key:"INDEX",description:"Allows users to create and delete indexes to improve query performance.",select:!0,label:"Create/Delete Index"},{id:10,key:"DROP",description:"Allows users to delete databases, tables, or indexes.",select:!0,label:"Delete Database/Table"},{id:11,key:"CREATE TEMPORARY TABLES",description:"Allows users to create temporary tables that are automatically deleted after the session ends.",select:!0,label:"Create Temporary Tables"},{id:12,key:"SHOW VIEW",description:"Allows users to view views in the database.",select:!0,label:"View Views"},{id:13,key:"CREATE ROUTINE",description:"Allows users to create stored procedures and functions.",select:!0,label:"Create Stored Procedure/Function"},{id:14,key:"ALTER ROUTINE",description:"Allows users to modify stored procedures and functions.",select:!0,label:"Modify Stored Procedure/Function"},{id:15,key:"EXECUTE",description:"Allows users to execute stored procedures and functions.",select:!0,label:"Execute Stored Procedure/Function"},{id:16,key:"CREATE VIEW",description:"Allows users to create views in the database.",select:!0,label:"Create View"},{id:17,key:"EVENT",description:"Allows users to create, modify, and delete database events.",select:!0,label:"Create/Modify/Delete Event"},{id:18,key:"TRIGGER",description:"Allows users to create and manage database triggers.",select:!0,label:"Create/Manage Trigger"}]},{key:"Management Permissions",label:"Management Permissions",description:"Management Permissions",include:!0,id:19,children:[{id:23,key:"SUPER",description:"Allows users to perform special operations, such as starting or stopping the database server.",label:"Kill Other User Processes When Max Connections Reached"},{id:24,key:"PROCESS",description:"Allows users to view the database connection processes of other users.",label:"View Other User Connections"},{id:25,key:"RELOAD",description:"Allows users to reload the database server configuration.",label:"Reload Database Configuration"},{id:26,key:"SHUTDOWN",description:"Allows users to shut down the database server.",label:"Shutdown Database Server"},{id:27,key:"SHOW DATABASES",description:"Allows users to view the list of available databases.",label:"View Available Databases"},{id:21,key:"LOCK TABLES",description:"Allows users to lock tables to control concurrent access.",select:!0,label:"Lock Tables"},{id:32,key:"REFERENCES",description:"Allows users to create and use foreign keys to maintain data integrity.",label:"Create/Use Foreign Keys"},{id:29,key:"REPLICATION CLIENT",description:"Allows users to connect as a replication client to a master-slave replication system.",label:"Connect as Replication Client to Master-Slave System"},{id:30,key:"REPLICATION SLAVE",description:"Allows users to connect as a replication slave to a master-slave replication system.",label:"Connect as Replication Slave to Master-Slave System"},{id:31,key:"CREATE USER",description:"Allows users to create, modify, and delete database user accounts.",label:"Create/Modify/Delete Database User"}]}],R=[{key:"Data Permissions",label:"Data Permissions",description:"Data Permissions",select:!0,id:1,children:[{id:2,key:"SELECT",description:"SELECT--Allows users to query (read) data from the database.",select:!0,label:"Read Data"},{id:3,key:"INSERT",description:"INSERT--Allows users to insert new data into database tables.",select:!0,label:"Insert/Replace Data"},{id:4,key:"UPDATE",description:"UPDATE--Allows users to modify data in database tables.",select:!0,label:"Modify Data"},{id:5,key:"DELETE",description:"DELETE--Allows users to delete data from database tables.",select:!0,label:"Delete Data"}]},{key:"Structure Permissions",label:"Structure Permissions",description:"Structure Permissions",select:!0,id:6,children:[{id:7,key:"CREATE",description:"Allows users to create new databases, tables, or indexes.",select:!0,label:"Create Database/Table"},{id:8,key:"ALTER",description:"Allows users to modify the structure of database tables (e.g., add or delete columns).",select:!0,label:"Modify Table Structure"},{id:9,key:"INDEX",description:"Allows users to create and delete indexes to improve query performance.",select:!0,label:"Create/Delete Index"},{id:10,key:"DROP",description:"Allows users to delete databases, tables, or indexes.",select:!0,label:"Delete Database/Table"},{id:11,key:"CREATE TEMPORARY TABLES",description:"Allows users to create temporary tables that are automatically deleted after the session ends.",select:!0,label:"Create Temporary Tables"},{id:12,key:"SHOW VIEW",description:"Allows users to view views in the database.",select:!0,label:"View Views"},{id:13,key:"CREATE ROUTINE",description:"Allows users to create stored procedures and functions.",select:!0,label:"Create Stored Procedure/Function"},{id:14,key:"ALTER ROUTINE",description:"Allows users to modify stored procedures and functions.",select:!0,label:"Modify Stored Procedure/Function"},{id:15,key:"EXECUTE",description:"Allows users to execute stored procedures and functions.",select:!0,label:"Execute Stored Procedure/Function"},{id:16,key:"CREATE VIEW",description:"Allows users to create views in the database.",select:!0,label:"Create View"},{id:17,key:"EVENT",description:"Allows users to create, modify, and delete database events.",select:!0,label:"Create/Modify/Delete Event"},{id:18,key:"TRIGGER",description:"Allows users to create and manage database triggers.",select:!0,label:"Create/Manage Trigger"}]},{key:"Management Permissions",label:"Management Permissions",description:"Management Permissions",include:!0,id:19,children:[{id:21,key:"LOCK TABLES",description:"Allows users to lock tables to control concurrent access.",select:!0,label:"Lock Tables"},{id:22,key:"REFERENCES",description:"Allows users to create and use foreign keys to maintain data integrity.",label:"Create/Use Foreign Keys"}]}],H={class:"p-16px"},$={class:"w-415px max-h-200px overflow-auto border border-solid p-12x border-#ccc"},se=N({__name:"form",props:{data:{}},setup(f,{expose:w}){const k=f,{getList:c,params:b}=k.data,p=E(null),e=U({db_name:"",tb_name:"",access:["SELECT","INSERT","UPDATE","DELETE","CREATE","ALTER","INDEX","DROP","CREATE TEMPORARY TABLES","SHOW VIEW","CREATE ROUTINE","ALTER ROUTINE","EXECUTE","CREATE VIEW","EVENT","TRIGGER","LOCK TABLES","REFERENCES"]}),d=E([]),r=E([]),m=(s,t)=>{e.db_name=s,t.tb_list.length?(r.value=t.tb_list.map(o=>({label:o.name,value:o.value,access_list:o.access_list})),y(r.value[0].value,r.value[0])):r.value=[]},y=(s,t)=>{if(e.tb_name=s,s==="*"&&t.access_list[0]==="ALL PRIVILEGES"){e.access=["SELECT","INSERT","UPDATE","DELETE","CREATE","ALTER","INDEX","DROP","CREATE TEMPORARY TABLES","SHOW VIEW","CREATE ROUTINE","ALTER ROUTINE","EXECUTE","CREATE VIEW","EVENT","TRIGGER","LOCK TABLES","REFERENCES"];return}if(s==="*"&&t.access_list[0]==="USAGE"){e.access=[];return}e.access=t.access_list},_=M(()=>{var s;return e.db_name==="*"?X:e.db_name!=="*"&&e.tb_name!=="*"?((s=R.find(t=>t.id===1))==null?void 0:s.children)||[]:R}),{loading:C,setLoading:T}=O();(async()=>{try{T(!0);const{message:s}=await h(b);P(s)&&(d.value=s.data.map(t=>({label:t.name,value:t.value,tb_list:t.tb_list})),m(d.value[0].value,d.value[0]))}finally{T(!1)}})();const S=()=>({...b,db_name:e.db_name,tb_name:e.db_name==="*"?"*":e.tb_name,access:e.access.join(","),with_grant:0});return w({onConfirm:async()=>{var s;await((s=p.value)==null?void 0:s.validate()),await I(S()),c==null||c()}}),(s,t)=>{const o=G,u=q,D=F,v=K,g=L;return A(),x("div",H,[l(g,{ref_key:"formRef",ref:p,model:a(e)},{default:n(()=>[l(D,null,{default:n(()=>[l(u,{label:s.$t("Database.Mysql.index_18")},{default:n(()=>[l(o,{class:"w-200px",loading:a(C),value:a(e).db_name,"onUpdate:value":[t[0]||(t[0]=i=>a(e).db_name=i),m],options:a(d)},null,8,["loading","value","options"])]),_:1},8,["label"]),l(u,{"show-label":!1},{default:n(()=>[a(r).length?(A(),V(o,{key:0,class:"w-200px",value:a(e).tb_name,"onUpdate:value":[t[1]||(t[1]=i=>a(e).tb_name=i),y],options:a(r)},null,8,["value","options"])):W("",!0)]),_:1})]),_:1}),l(u,{label:s.$t("Database.Mysql.index_19"),path:"access"},{default:n(()=>[B("div",$,[l(v,{"default-expand-all":"","block-line":"",cascade:"",checkable:"",selectable:!1,"check-strategy":"child","checked-keys":a(e).access,"onUpdate:checkedKeys":t[2]||(t[2]=i=>a(e).access=i),data:a(_),placeholder:s.$t("Database.Mysql.index_20")},null,8,["checked-keys","data","placeholder"])])]),_:1},8,["label"])]),_:1},8,["model"])])}}});export{se as default};