芝麻web文件管理V1.00
编辑当前文件:/home/pulsehostuk9/www/invoicer.pulsehost.co.uk/public/build/assets/UpdateAppSetting-B55bJ-4-.js
import{u as J,a7 as Y,v as G,E as Q,f as r,H as T,s as N,k as W,r as y,o as n,m as D,w as k,b as t,t as a,l as s,a as g,n as X,aE as Z,p as K,K as c,ac as ee,ad as te,c as i,N as E,O as H,J as ae,a1 as M}from"./main-WS8l16KQ.js";import{L as se}from"./LoadingIcon-CwHf8WZC.js";import{u as ne}from"./exchange-rate-MCtDo2g9.js";const ie={class:"pb-8 ml-0"},le={class:"text-sm not-italic font-medium input-label"},re={class:"w-full border-b-2 border-gray-100 border-solid pb-4"},oe={class:"box-border inline-block w-auto p-3 my-2 text-sm text-gray-600 bg-gray-200 border border-gray-200 border-solid rounded-md version"},de={class:"w-full pt-4"},pe={key:1,class:"mt-4 content"},ue={class:"rounded-md bg-primary-50 p-4 mb-3"},ce={class:"flex"},me={class:"shrink-0"},_e={class:"ml-3"},ge={class:"text-sm font-medium text-primary-800"},fe={class:"mt-2 text-sm text-primary-700"},he={class:"text-sm not-italic font-medium input-label"},ve=t("br",null,null,-1),be={class:"box-border inline-block w-auto p-3 my-2 text-sm text-gray-600 bg-gray-200 border border-gray-200 border-solid rounded-md version"},ye=["innerHTML"],xe=["innerHTML"],we={class:"text-sm not-italic font-medium input-label"},ke={class:"w-1/2 mt-2 border-2 border-gray-200 BaseTable-fixed"},Be={width:"70%",class:"p-2 text-sm truncate"},Ue={width:"30%",class:"p-2 text-sm text-right"},Se={key:0,class:"inline-block w-4 h-4 ml-3 mr-2 bg-green-500 rounded-full"},$e={key:1,class:"inline-block w-4 h-4 ml-3 mr-2 bg-red-500 rounded-full"},Ce={key:2,class:"relative flex justify-between mt-4 content"},Ne={class:"m-0 mb-3 font-medium sw-section-title"},Ke={class:"mb-8 text-sm leading-snug text-gray-500",style:{"max-width":"480px"}},Le={key:3,class:"w-full p-0 list-none"},Ve={class:"m-0 text-sm leading-8"},Ie={class:"flex flex-row items-center"},Te={key:0,class:"mr-3 text-xs text-gray-500"},ze={__name:"UpdateAppSetting",setup(De){const B=J(),q=Y(),{t:p,tm:Ee}=G.useI18n();Q(),ne();let x=r(!1),f=r(!1),U=r(""),S=r(""),$=r(""),m=r(""),h=r(null),z=r(null),d=r(!1);const C=T([{translationKey:"settings.update_app.download_zip_file",stepUrl:"/api/v1/update/download",time:null,started:!1,completed:!1},{translationKey:"settings.update_app.unzipping_package",stepUrl:"/api/v1/update/unzip",time:null,started:!1,completed:!1},{translationKey:"settings.update_app.copying_files",stepUrl:"/api/v1/update/copy",time:null,started:!1,completed:!1},{translationKey:"settings.update_app.deleting_files",stepUrl:"/api/v1/update/delete",time:null,started:!1,completed:!1},{translationKey:"settings.update_app.running_migrations",stepUrl:"/api/v1/update/migrate",time:null,started:!1,completed:!1},{translationKey:"settings.update_app.finishing_update",stepUrl:"/api/v1/update/finish",time:null,started:!1,completed:!1}]),w=T({isMinor:Boolean,installed:"",version:""});let j=r(null);window.addEventListener("beforeunload",e=>{d.value&&(e.returnValue="Update is in progress!")}),N.get("/api/v1/app/version").then(e=>{$.value=e.data.version,m.value=e.data.channel==="insider"});const A=W(()=>h.value!==null?Object.keys(h.value).every(e=>h.value[e]):!0);function F(e){switch(V(e)){case"pending":return"text-primary-800 bg-gray-200";case"finished":return"text-teal-500 bg-teal-100";case"running":return"text-blue-400 bg-blue-100";case"error":return"text-danger bg-red-200";default:return""}}async function P(){try{f.value=!0;let e=await N.get("/api/v1/check/update",{params:{channel:m?"insider":""}});if(f.value=!1,!e.data.release){B.showNotification({title:"Info!",type:"info",message:p("settings.update_app.latest_message")});return}e.data&&(w.isMinor=e.data.is_minor,w.version=e.data.release.version,U.value=e.data.release.description,S.value=e.data.release.changelog,h.value=e.data.release.extensions,x.value=!0,j.value=e.data.release.min_php_version,z.value=e.data.release.deleted_files)}catch(e){x.value=!1,f.value=!1,M(e)}}function L(){q.openDialog({title:p("general.are_you_sure"),message:p("settings.update_app.update_warning"),yesLabel:p("general.ok"),noLabel:p("general.cancel"),variant:"danger",hideNoButton:!1,size:"lg"}).then(async e=>{if(e){let u=null;if(!A.value)return B.showNotification({type:"error",message:"Your current configuration does not match the update requirements. Please try again after all the requirements are fulfilled."}),!0;for(let _=0;_
{location.reload()},3e3))}catch(v){return o.started=!1,o.completed=!0,M(v),R(o.translationKey),!1}}}})}function R(e){if(p(e).value){L();return}d.value=!1}function V(e){return e.started&&e.completed?"finished":e.started&&!e.completed?"running":!e.started&&!e.completed?"pending":"error"}return(e,u)=>{const _=y("BaseButton"),o=y("BaseDivider"),v=y("BaseHeading"),b=y("BaseIcon"),O=y("BaseSettingCard");return n(),D(O,{title:e.$t("settings.update_app.title"),description:e.$t("settings.update_app.description")},{default:k(()=>[t("div",ie,[t("label",le,a(e.$t("settings.update_app.current_version")),1),t("div",re,[t("div",oe,a(s($)),1)]),t("div",de,[g(Z,{modelValue:s(m),"onUpdate:modelValue":u[0]||(u[0]=l=>X(m)?m.value=l:m=l),label:e.$t("settings.update_app.insider_consent")},null,8,["modelValue","label"])]),g(_,{loading:s(f),disabled:s(f)||s(d),variant:"primary-outline",class:"mt-6",onClick:P},{default:k(()=>[K(a(e.$t("settings.update_app.check_update")),1)]),_:1},8,["loading","disabled"]),s(x)?(n(),D(o,{key:0,class:"mt-6 mb-4"})):c("",!0),s(x)?ee((n(),i("div",pe,[g(v,{type:"heading-title",class:"mb-2"},{default:k(()=>[K(a(e.$t("settings.update_app.avail_update")),1)]),_:1}),t("div",ue,[t("div",ce,[t("div",me,[g(b,{name:"InformationCircleIcon",class:"h-5 w-5 text-primary-400","aria-hidden":"true"})]),t("div",_e,[t("h3",ge,a(e.$t("general.note")),1),t("div",fe,[t("p",null,a(e.$t("settings.update_app.update_warning")),1)])])])]),t("label",he,a(e.$t("settings.update_app.next_version")),1),ve,t("div",be,a(w.version),1),s(U)?(n(),i("div",{key:0,class:"pl-5 mt-4 mb-2 text-sm leading-snug text-gray-500 update-description",style:{"white-space":"pre-wrap","max-width":"480px"},innerHTML:s(U)},null,8,ye)):c("",!0),s(S)?(n(),i("div",{key:1,class:"pl-5 mt-2 mb-8 text-sm leading-snug text-gray-500 update-changelog",style:{"white-space":"pre-wrap","max-width":"480px"},innerHTML:s(S)},null,8,xe)):c("",!0),t("label",we,a(e.$t("settings.update_app.requirements")),1),t("table",ke,[(n(!0),i(E,null,H(s(h),(l,I)=>(n(),i("tr",{key:I,class:"p-2 border-2 border-gray-200"},[t("td",Be,a(I),1),t("td",Ue,[l?(n(),i("span",Se)):(n(),i("span",$e))])]))),128))]),g(_,{class:"mt-10",variant:"primary",onClick:L},{default:k(()=>[K(a(e.$t("settings.update_app.update")),1)]),_:1})],512)),[[te,!s(d)]]):c("",!0),s(d)?(n(),i("div",Ce,[t("div",null,[t("h6",Ne,a(e.$t("settings.update_app.update_progress")),1),t("p",Ke,a(e.$t("settings.update_app.progress_text")),1)]),g(se,{class:"absolute right-0 h-6 m-1 animate-spin text-primary-400"})])):c("",!0),s(d)?(n(),i("ul",Le,[(n(!0),i(E,null,H(C,l=>(n(),i("li",{key:l.stepUrl,class:"flex justify-between w-full py-3 border-b border-gray-200 border-solid last:border-b-0"},[t("p",Ve,a(e.$t(l.translationKey)),1),t("div",Ie,[l.time?(n(),i("span",Te,a(l.time),1)):c("",!0),t("span",{class:ae([F(l),"block py-1 text-sm text-center uppercase rounded-full"]),style:{width:"88px"}},a(V(l)),3)])]))),128))])):c("",!0)])]),_:1},8,["title","description"])}}};export{ze as default};