UnisKB/static/admin/assets/index-BQcbf01f.js

23 lines
57 KiB
JavaScript
Raw Normal View History

import{ay as Z,aA as lt,aB as w,aO as N,aV as ye,aF as $,aG as t,aD as n,aH as e,aI as l,aJ as c,b2 as P,ci as he,aE as g,cf as Ue,aQ as xe,aT as Y,aK as k,aS as ie,bZ as ot,c0 as Je,aC as A,b3 as we,az as it,ce as Re,b1 as H,aW as K,aX as pe,aY as de,cU as qe,bc as ve,c$ as nt,cx as st,aZ as ut,c1 as ct,b6 as Pe,bD as $e,cY as Ge,en as Se,eo as We,cD as Ve,cq as Te,ep as M,eq as De,aP as rt,er as Le,cC as je,cM as pt,cN as dt,b7 as vt,b8 as Ye,bX as Ne,bG as Xe,bH as Ie}from"./admin-DgPvPHD7.js";import{_ as mt}from"./SettingAPIKeyDialog.vue_vue_type_script_setup_true_lang-BgcuZbaB.js";const _t=""+new URL("window1-yunSyWkk.png",import.meta.url).href,ft=""+new URL("window3-DjMr2HXo.png",import.meta.url).href,gt=""+new URL("window2-D3eE6zm4.png",import.meta.url).href,ht={class:"border"},wt={class:"title p-16 bold"},yt={class:"code layout-bg border-t p-8"},At={class:"flex-between p-8"},bt={class:"bold"},kt={class:"pre-wrap p-8 pt-0"},Dt={class:"border"},$t={class:"title p-16 bold"},Vt={class:"code layout-bg border-t p-8"},xt={class:"flex-between p-8"},Ct={class:"bold"},Ot={class:"pre-wrap p-8 pt-0"},It={class:"border"},St={class:"title p-16 bold"},Ut={class:"code layout-bg border-t p-8"},Bt={class:"flex-between p-8"},Lt={class:"bold"},Et={class:"pre-wrap p-8 pt-0"},Rt=Z({__name:"EmbedDialog",props:{data:Object,apiInputParams:String},emits:["addData"],setup(R,{expose:f,emit:I}){const{application:V}=lt(),D=R,S=w(!1),y=w(""),C=w(""),d=w(""),a=N(()=>D.apiInputParams?"?"+D.apiInputParams:""),i=N(()=>D.apiInputParams?"&"+D.apiInputParams:""),x=N(()=>D.apiInputParams?"?mode=mobile&"+D.apiInputParams:"?mode=mobile");return ye(S,p=>{p||(y.value="",C.value="",d.value="")}),f({open:p=>{y.value=`<iframe
src="${V.location+p+a.value}"
style="width: 100%; height: 100%;"
frameborder="0"
allow="microphone">
</iframe>
`,C.value=`<script
async
defer
src="${V.location}api/embed?protocol=${window.location.protocol.replace(":","")}&host=${window.location.host}&token=${p}${i.value}">
<\/script>
`,d.value=`<iframe
src="${V.location+p+x.value}"
style="width: 100%; height: 100%;"
frameborder="0"
allow="microphone">
</iframe>
`,S.value=!0}}),(p,r)=>{const h=n("AppIcon"),B=n("el-button"),b=n("el-scrollbar"),s=n("el-col"),v=n("el-row"),U=n("el-dialog");return g(),$(U,{title:p.$t("views.applicationOverview.appInfo.embedInWebsite"),modelValue:S.value,"onUpdate:modelValue":r[3]||(r[3]=o=>S.value=o),width:"900",class:"embed-dialog","close-on-click-modal":!1,"close-on-press-escape":!1},{default:t(()=>[e(v,{gutter:12},{default:t(()=>[e(s,{span:8},{default:t(()=>[l("div",ht,[l("p",wt,c(p.$t("views.applicationOverview.appInfo.EmbedDialog.fullscreenModeTitle")),1),r[4]||(r[4]=l("img",{src:_t,alt:"",class:"ml-8",height:"150"},null,-1)),l("div",yt,[l("div",At,[l("span",bt,c(p.$t("views.applicationOverview.appInfo.EmbedDialog.copyInstructions")),1),e(B,{text:"",onClick:r[0]||(r[0]=o=>P(he)(y.value))},{default:t(()=>[e(h,{iconName:"app-copy"})]),_:1})]),e(b,{height:"180",always:""},{default:t(()=>[l("div",kt,c(y.value),1)]),_:1})])])]),_:1}),e(s,{span:8},{default:t(()=>[l("div",Dt,[l("p",$t,c(p.$t("views.applicationOverview.appInfo.EmbedDialog.mobileModeTitle")),1),r[5]||(r[5]=l("img",{src:ft,alt:"",class:"ml-8",height:"150"},null,-1)),l("div",Vt,[l("div",xt,[l("span",Ct,c(p.$t("views.applicationOverview.appInfo.EmbedDialog.copyInstructions")),1),e(B,{text:"",onClick:r[1]||(r[1]=o=>P(he)(d.value))},{default:t(()=>[e(h,{iconName:"app-copy"})]),_:1})]),e(b,{height:"180",always:""},{default:t(()=>[l("div",Ot,c(d.value),1)]),_:1})])])]),_:1}),e(s,{span:8},{default:t(()=>[l("div",It,[l("p",St,c(p.$t("views.applicationOverview.appInfo.EmbedDialog.floatingModeTitle")),1),r[6]||(r[6]=l("img",{src:gt,alt:"",class:"ml-8",height:"150"},null,-1)),l("div",Ut,[l("div",Bt,[l("span",Lt,c(p.$t("views.applicationOverview.appInfo.EmbedDialog.copyInstructions")),1),e(B,{text:"",onClick:r[2]||(r[2]=o=>P(he)(C.value))},{default:t(()=>[e(h,{iconName:"app-copy"})]),_:1})]),e(b,{height:"180",always:""},{default:t(()=>[l("div",Et,c(C.value),1)]),_:1})])])]),_:1})]),_:1})]),_:1},8,["title","modelValue"])}}}),Tt=Ue(Rt,[["__scopeId","data-v-3a7d81c5"]]),Pt={class:"vertical-middle lighter break-all"},zt={class:"mr-4"},Ft=Z({__name:"APIKeyDialog",emits:["addData"],setup(R,{expose:f,emit:I}){const V=xe(),{params:{id:D}}=V,S=N(()=>V.path.includes("resource-management")?"systemManage":"workspace"),y=w(),C=w(!1),d=w(!1),a=w(null);ye(C,b=>{b||(a.value=null)});function i(b){y.value.open(b,"APPLICATION")}function x(b){Je(`${A("views.applicationOverview.appInfo.APIKeyDialog.msgConfirm1")}: ${b.secret_key}?`,A("views.applicationOverview.appInfo.APIKeyDialog.msgConfirm2"),{confirmButtonText:A("common.confirm"),cancelButtonText:A("common.cancel"),confirmButtonClass:"danger"}).then(()=>{Y({type:"applicationKey",systemType:S.value}).delAPIKey(D,b.id,d).then(()=>{we(A("common.deleteSuccess")),h()})}).catch(()=>{})}async function T(b){const s={is_active:!b.is_active},v=s.is_active?A("common.status.enabled"):A("common.status.disabled");await Y({type:"applicationKey",systemType:S.value}).putAPIKey(D,b.id,s,d).then(()=>(we(v),h(),!0)).catch(()=>!1)}function p(){Y({type:"applicationKey",systemType:S.value}).postAPIKey(D,d).then(()=>{h()})}const r=()=>{h(),C.value=!0};function h(){Y({type:"applicationKey",systemType:S.value}).getAPIKey(D,d).then(b=>{var s;(s=b.data)==null||s.sort((v,U)=>v.name<U.name?1:-1),a.value=b.data})}function B(){h()}return f({open:r}),(b,s)=>{const v=n("el-button"),U=n("AppIcon"),o=n("el-table-column"),u=n("el-switch"),z=n("el-tooltip"),O=n("el-table"),L=n("el-dialog");return g(),$(L,{title:"API Key",modelValue:C.value,"onUpdate:modelValue":s[1]||(s[1]=Q=>C.value=Q),width:"800","close-on-click-modal":!1,"close-on-press-escape":!1,"align-center":""},{default:t(()=>[e(v,{type:"primary",class:"mb-16",onClick:p},{default:t(()=>[k(c(b.$t("common.create")),1)]),_:1}),e(O,{data:a.value,class:"mb-16",loading:d.value,height:"420"},{default:t(()=>[e(o,{prop:"secret_key",label:"API Key"},{default:t(({row:Q})=>[l("span",Pt,c(Q.secret_key),1),e(v,{type:"primary",text:"",onClick:G=>P(he)(Q.secret_key)},{default:t(()=>[e(U,{iconName:"app-copy"})]),_:1},8,["onClick"])]),_:1}),e(o,{label:b.$t("commo
`):"",d.value.authentication_value=p.authentication_value,d.value.authentication=p.authentication,a.value=!0},T=async p=>{p&&await p.validate((r,h)=>{if(r){const B={white_list:d.value.white_list?d.value.white_list.split(`
`):[],white_active:d.value.white_active,access_num:d.value.access_num,authentication:d.value.authentication,authentication_value:d.value.authentication_value};Y({type:"application",systemType:S.value}).putAccessToken(D,B,i).then(()=>{y("refresh"),we(A("common.settingSuccess")),a.value=!1})}})};return f({open:x}),(p,r)=>{const h=n("el-input-number"),B=n("el-form-item"),b=n("el-switch"),s=n("el-input"),v=n("el-form"),U=n("el-button"),o=n("el-dialog");return g(),$(o,{title:p.$t("views.applicationOverview.appInfo.accessControl"),modelValue:a.value,"onUpdate:modelValue":r[6]||(r[6]=u=>a.value=u),"close-on-click-modal":!1,"close-on-press-escape":!1,width:"650"},{footer:t(()=>[l("span",Mt,[e(U,{onClick:r[4]||(r[4]=ie(u=>a.value=!1,["prevent"]))},{default:t(()=>[k(c(p.$t("common.cancel")),1)]),_:1}),e(U,{type:"primary",onClick:r[5]||(r[5]=u=>T(C.value)),loading:i.value},{default:t(()=>[k(c(p.$t("common.save")),1)]),_:1},8,["loading"])])]),default:t(()=>[e(v,{"label-position":"top",ref_key:"limitFormRef",ref:C,model:d.value},{default:t(()=>[e(B,{label:p.$t("views.applicationOverview.appInfo.LimitDialog.clientQueryLimitLabel")},{default:t(()=>[e(h,{modelValue:d.value.access_num,"onUpdate:modelValue":r[0]||(r[0]=u=>d.value.access_num=u),min:0,step:1,max:1e7,"value-on-clear":0,"controls-position":"right",style:{width:"268px"},"step-strictly":""},null,8,["modelValue"]),l("span",Qt,c(p.$t("views.applicationOverview.appInfo.LimitDialog.timesDays")),1)]),_:1},8,["label"]),e(B,{label:p.$t("views.applicationOverview.appInfo.LimitDialog.whitelistLabel"),onClick:r[2]||(r[2]=ie(()=>{},["prevent"]))},{default:t(()=>[e(b,{size:"small",modelValue:d.value.white_active,"onUpdate:modelValue":r[1]||(r[1]=u=>d.value.white_active=u)},null,8,["modelValue"])]),_:1},8,["label"]),e(B,null,{default:t(()=>[e(s,{modelValue:d.value.white_list,"onUpdate:modelValue":r[3]||(r[3]=u=>d.value.white_list=u),placeholder:p.$t("views.applicationOverview.appInfo.LimitDialog.whitelistPlaceholder"),rows:10,type:"textarea"},null,8,["modelValue","placeholder"])]),_:1})]),_:1},8,["model"])]),_:1},8,["title","modelValue"])}}}),jt={class:"ml-4"},Yt={class:"mb-4 lighter"},Nt={class:"mb-16 lighter"},Xt={style:{"font-size":"13px"}},Ht={style:{"margin-left":"8px","font-size":"13px"}},Jt={style:{"margin-left":"8px",color:"#909399","font-size":"12px"}},qt=Z({__name:"XPackLimitDrawer",emits:["refresh"],setup(R,{expose:f,emit:I}){const V=it(),D=xe(),{params:{id:S}}=D,y=N(()=>D.path.includes("resource-management")?"systemManage":"workspace"),C=I,d=w([]),a=w(),i=w({access_num:0,white_active:!0,white_list:"",authentication_value:{type:"password",max_attempts:1},authentication:!1}),x=w(!1),T=w(!1);ye(x,s=>{s||(i.value={access_num:0,white_active:!0,white_list:""})});const p=s=>{var v,U;i.value.access_num=s.access_num,i.value.white_active=s.white_active,i.value.white_list=(v=s.white_list)!=null&&v.length?(U=s.white_list)==null?void 0:U.join(`
`):"",i.value.authentication_value=s.authentication_value||{type:"password"},i.value.authentication_value.type==="password"&&!i.value.authentication_value.password_value&&B(),i.value.authentication_value.max_attempts||(i.value.authentication_value.max_attempts=1),i.value.authentication=s.authentication,x.value=!0,Y({type:"application",systemType:y.value}).getChatUserAuthType().then(o=>{d.value=o.data})},r=async s=>{s&&await s.validate((v,U)=>{if(v){const o={white_list:i.value.white_list?i.value.white_list.split(`
`):[],white_active:i.value.white_active,access_num:i.value.access_num,authentication:i.value.authentication,authentication_value:i.value.authentication_value};Y({type:"application",systemType:y.value}).putAccessToken(S,o,T).then(()=>{C("refresh"),we(A("common.settingSuccess")),x.value=!1})}})};function h(s=10){const v="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",U=new Uint8Array(s);return window.crypto.getRandomValues(U),Array.from(U).map(o=>v[o%v.length]).join("")}function B(){i.value.authentication_value.password_value=h()}function b(){i.value.authentication&&!i.value.authentication_value.password_value&&(i.value.authentication_value={type:"password",password_value:h()},i.value.authentication_value.max_attempts||(i.value.authentication_value.max_attempts=1))}return f({open:p}),(s,v)=>{const U=n("el-input-number"),o=n("el-form-item"),u=n("el-switch"),z=n("el-radio"),O=n("AppIcon"),L=n("el-button"),Q=n("el-tooltip"),G=n("RefreshRight"),ce=n("el-icon"),Ae=n("el-input"),me=n("el-card"),_e=n("el-checkbox"),be=n("el-checkbox-group"),ae=n("el-radio-group"),ke=n("el-form"),ne=n("el-drawer");return g(),$(ne,{modelValue:x.value,"onUpdate:modelValue":v[14]||(v[14]=F=>x.value=F),size:"60%"},{header:t(()=>[l("h4",null,c(s.$t("views.applicationOverview.appInfo.accessControl")),1)]),footer:t(()=>[l("div",null,[e(L,{onClick:v[12]||(v[12]=ie(F=>x.value=!1,["prevent"]))},{default:t(()=>[k(c(s.$t("common.cancel")),1)]),_:1}),e(L,{type:"primary",onClick:v[13]||(v[13]=F=>r(a.value)),loading:T.value},{default:t(()=>[k(c(s.$t("common.save")),1)]),_:1},8,["loading"])])]),default:t(()=>[e(ke,{"label-position":"top",ref_key:"limitFormRef",ref:a,model:i.value,"require-asterisk-position":"right"},{default:t(()=>[e(o,{label:s.$t("views.applicationOverview.appInfo.LimitDialog.clientQueryLimitLabel")},{default:t(()=>[e(U,{modelValue:i.value.access_num,"onUpdate:modelValue":v[0]||(v[0]=F=>i.value.access_num=F),min:0,step:1,max:1e7,"value-on-clear":0,"controls-position":"right",style:{width:"268px"},"step-strictly":""},null,8,["modelValue"]),l("span",jt,c(s.$t("views.applicationOverview.appInfo.LimitDialog.timesDays")),1)]),_:1},8,["label"]),e(o,{label:s.$t("views.applicationOverview.appInfo.LimitDialog.authentication"),onClick:v[2]||(v[2]=ie(()=>{},["prevent"]))},{default:t(()=>[e(u,{size:"small",modelValue:i.value.authentication,"onUpdate:modelValue":v[1]||(v[1]=F=>i.value.authentication=F),onChange:b},null,8,["modelValue"])]),_:1},8,["label"]),i.value.authentication?(g(),$(ae,{key:0,modelValue:i.value.authentication_value.type,"onUpdate:modelValue":v[8]||(v[8]=F=>i.value.authentication_value.type=F),class:"card__radio"},{default:t(()=>{var F;return[e(me,{shadow:"never",class:Re(["mb-16",((F=i.value.authentication_value)==null?void 0:F.type)==="password"?"active":""])},{default:t(()=>[e(z,{value:"password",size:"large"},{default:t(()=>[l("p",Yt,c(s.$t("views.applicationOverview.appInfo.LimitDialog.authenticationValue")),1)]),_:1}),i.value.authentication_value.type==="password"?(g(),$(o,{key:0,class:"ml-24"},{default:t(()=>[e(Ae,{class:"authentication-append-input",modelValue:i.value.authentication_value.password_value,"onUpdate:modelValue":v[4]||(v[4]=J=>i.value.authentication_value.password_value=J),readonly:"",style:{width:"268px"}},{append:t(()=>[e(Q,{content:s.$t("common.copy"),placement:"top"},{default:t(()=>[e(L,{type:"primary",text:"",onClick:v[3]||(v[3]=J=>P(he)(i.value.authentication_value.password_value)),style:{margin:"0 0 0 4px !important"}},{default:t(()=>[e(O,{iconName:"app-copy"})]),_:1})]),_:1},8,["content"]),e(Q,{content:s.$t("common.refresh"),placement:"top"},{default:t(()=>[e(L,{onClick:B,type:"primary",text:"",style:{margin:"0 4px 0 0 !important"}},{default:t(()=>[e(ce,null,{default:t(()=>[e(G)]),_:1})]),_:1})]),_:1},8,["content"])]),_:1},8,["modelValue"])]),_:1})):H("",!0)]),_:1},8,["class"]),e(me,{shadow:"never",class:Re(["mb-16",i.value.authentication_value.type==="login"?"active":""])},{default:t(()=>{var J,se;return[e(z,{value:"login",size:"large"},{default:t(()=>[l("p",Nt,[k(c(s.$t("views.system.authent