PageSourceSearch

https://0x.kz/build/assets/ConfigAdd-B8UsuhQz.js

js 0x.kz collected 2026-10-09 04:37:22 UTC 6,771 bytes, 1 lines download raw bytes

1import{o as p,g as O,h as r,b as l,u as o,a as e,i as j,e as g,v,c as y,F as R,j as S,t as T,f as x,m as D}from"./app-DVhk9hEg.js";import{r as F,K as i}from"./vue-sonner-X19j5VTV.js";import{Y as G,G as Y,V as z}from"./dialog-B1KZN6xf.js";import{h as K,S as A}from"./transition-CLaDrR5O.js";import{r as E}from"./XMarkIcon-B221X_Ru.js";import{r as N}from"./PlusIcon-TEM0Z4gZ.js";/* empty css            */import"./keyboard-BzxerdJT.js";const L={class:"fixed inset-0 overflow-y-auto"},M={class:"flex min-h-full items-center justify-center p-4"},P={class:"mb-7"},q={class:"mb-4 flex h-12 w-12 items-center justify-center rounded-xl bg-indigo-50"},H={class:"space-y-5"},I={class:"mb-3 flex items-center justify-between"},J={key:0,class:"space-y-3"},Q=["onUpdate:modelValue"],W=["onUpdate:modelValue"],X=["onClick"],Z={key:1,class:"rounded-xl border border-dashed border-slate-300 px-5 py-6 text-center"},ee={class:"mt-7 flex gap-3"},te=["disabled"],ce={__name:"ConfigAdd",emits:["close","refresh"],setup(se,{emit:U}){const k=U,_=x(!0),d=x(!1),h=x(""),w=x(""),u=x([]);function V(){u.value.push({key:"",value:""})}function B(c){u.value.splice(c,1)}function b(){_.value=!1,setTimeout(()=>{k("close")},150)}async function $(){var f,a;const c=h.value.trim(),t=w.value.trim();if(!c){i.error("Введите Name");return}if(!t){i.error("Введите Key");return}if(d.value)return;const s={};for(const n of u.value){const m=n.key.trim(),C=n.value.trim();if(!(!m&&!C)){if(!m){i.error("Укажите ключ для всех полей raw");return}if(Object.prototype.hasOwnProperty.call(s,m)){i.error(`Ключ "${m}" указан несколько раз`);return}s[m]=C}}d.value=!0;try{await D.post("/api/config",{name:c,key:t,raw:s}),i.success("Config успешно создан"),k("refresh"),b()}catch(n){console.error(n),i.error(((a=(f=n==null?void 0:n.response)==null?void 0:f.data)==null?void 0:a.message)||"Не удалось создать config")}finally{d.value=!1}}return(c,t)=>(p(),O(o(A),{as:"template",show:_.value},{default:r(()=>[l(o(G),{class:"relative z-50",onClose:b},{default:r(()=>[l(o(K),{as:"template",enter:"ease-out duration-200","enter-from":"opacity-0","enter-to":"opacity-100",leave:"ease-in duration-150","leave-from":"opacity-100","leave-to":"opacity-0"},{default:r(()=>[...t[2]||(t[2]=[e("div",{class:"fixed inset-0 bg-slate-900/30 backdrop-blur-sm"},null,-1)])]),_:1}),e("div",L,[e("div",M,[l(o(K),{as:"template",enter:"ease-out duration-200","enter-from":"opacity-0 translate-y-3 scale-95","enter-to":"opacity-100 translate-y-0 scale-100",leave:"ease-in duration-150","leave-from":"opacity-100 translate-y-0 scale-100","leave-to":"opacity-0 translate-y-3 scale-95"},{default:r(()=>[l(o(Y),{class:"relative w-full max-w-2xl overflow-hidden rounded-2xl bg-white p-7 shadow-2xl ring-1 ring-slate-200"},{default:r(()=>[e("button",{type:"button",onClick:b,class:"absolute right-5 top-5 flex h-9 w-9 items-center justify-center rounded-lg text-slate-400 transition hover:bg-slate-100 hover:text-slate-600"},[l(o(E),{class:"h-5 w-5"})]),e("div",P,[e("div",q,[l(o(N),{class:"h-6 w-6 text-indigo-600"})]),l(o(z),{class:"text-xl font-bold text-slate-900"},{default:r(()=>[...t[3]||(t[3]=[j(" Добавить config ",-1)])]),_:1}),t[4]||(t[4]=e("p",{class:"mt-1 text-sm text-slate-500"}," Укажите название, ключ и необходимые поля raw. ",-1))]),e("div",H,[e("div",null,[t[5]||(t[5]=e("label",{class:"mb-2 block text-sm font-medium text-slate-700"}," Name ",-1)),g(e("input",{"onUpdate:modelValue":t[0]||(t[0]=s=>h.value=s),type:"text",placeholder:"Например: Поля",class:"block w-full rounded-xl border border-slate-200 bg-slate-50 px-4 py-3 text-sm text-slate-900 outline-none transition placeholder:text-slate-400 focus:border-indigo-500 focus:bg-white focus:ring-4 focus:ring-indigo-50"},null,512),[[v,h.value]])]),e("div",null,[t[6]||(t[6]=e("label",{class:"mb-2 block text-sm font-medium text-slate-700"}," Key ",-1)),g(e("input",{"onUpdate:modelValue":t[1]||(t[1]=s=>w.value=s),type:"text",placeholder:"Например: fields",class:"block w-full rounded-xl border border-slate-200 bg-slate-50 px-4 py-3 text-sm text-slate-900 outline-none transition placeholder:text-slate-400 focus:border-indigo-500 focus:bg-white focus:ring-4 focus:ring-indigo-50"},null,512),[[v,w.value]])]),e("div",null,[e("div",I,[t[8]||(t[8]=e("div",null,[e("label",{class:"block text-sm font-medium text-slate-700"}," Raw "),e("p",{class:"mt-1 text-xs text-slate-400"}," Добавьте нужное количество ключей и значений. ")],-1)),e("button",{type:"button",onClick:V,class:"inline-flex items-center gap-1.5 rounded-lg bg-indigo-50 px-3 py-2 text-sm font-semibold text-indigo-600 transition hover:bg-indigo-100"},[l(o(N),{class:"h-4 w-4"}
1),t[7]||(t[7]=j(" Добавить поле ",-1))])]),u.value.length?(p(),y("div",J,[(p(!0),y(R,null,S(u.value,(s,f)=>(p(),y("div",{key:f,class:"flex items-center gap-3"},[g(e("input",{"onUpdate:modelValue":a=>s.key=a,type:"text",placeholder:"Ключ",class:"min-w-0 flex-1 rounded-xl border border-slate-200 bg-slate-50 px-4 py-3 text-sm text-slate-900 outline-none transition placeholder:text-slate-400 focus:border-indigo-500 focus:bg-white focus:ring-4 focus:ring-indigo-50"},null,8,Q),[[v,s.key]]),g(e("input",{"onUpdate:modelValue":a=>s.value=a,type:"text",placeholder:"Значение",class:"min-w-0 flex-1 rounded-xl border border-slate-200 bg-slate-50 px-4 py-3 text-sm text-slate-900 outline-none transition placeholder:text-slate-400 focus:border-indigo-500 focus:bg-white focus:ring-4 focus:ring-indigo-50"},null,8,W),[[v,s.value]]),e("button",{type:"button",onClick:a=>B(f),title:"Удалить",class:"flex h-11 w-11 shrink-0 items-center justify-center rounded-xl bg-red-50 text-red-500 transition hover:bg-red-100 hover:text-red-600"},[l(o(F),{class:"h-5 w-5"})],8,X)]))),128))])):(p(),y("div",Z,[t[9]||(t[9]=e("p",{class:"text-sm text-slate-400"}," Поля raw пока не добавлены ",-1)),e("button",{type:"button",onClick:V,class:"mt-3 text-sm font-semibold text-indigo-600 hover:text-indigo-500"}," + Добавить первое поле ")]))])]),e("div",ee,[e("button",{type:"button",onClick:b,class:"flex-1 rounded-xl border border-slate-200 bg-white px-4 py-3 text-sm font-semibold text-slate-700 transition hover:bg-slate-50"}," Отмена "),e("button",{type:"button",onClick:$,disabled:d.value,class:"flex-1 rounded-xl bg-indigo-600 px-4 py-3 text-sm font-semibold text-white shadow-sm transition hover:bg-indigo-500 disabled:cursor-not-allowed disabled:opacity-60"},T(d.value?"Создание...":"Добавить"),9,te)])]),_:1})]),_:1})])])]),_:1})]),_:1},8,["show"]))}};export{ce as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.