diff --git a/composer.json b/composer.json index 29841c5..6f366db 100644 --- a/composer.json +++ b/composer.json @@ -9,7 +9,7 @@ "license": "MIT", "require": { "php": ">=8.0", - "laravel/nova": "^4.0", + "laravel/nova": "^4.0|^5.0", "spatie/cpu-load-health-check": "^1.0", "spatie/laravel-health": "^1.9", "spatie/ssl-certificate": "^2.6" diff --git a/dist/js/tool.js b/dist/js/tool.js index 6a86806..86472dc 100644 --- a/dist/js/tool.js +++ b/dist/js/tool.js @@ -1 +1 @@ -(function(e,l){typeof exports=="object"&&typeof module<"u"?l(require("vue"),require("LaravelNova")):typeof define=="function"&&define.amd?define(["vue","LaravelNova"],l):(e=typeof globalThis<"u"?globalThis:e||self,l(e.Vue,e.LaravelNova))})(this,function(e,l){"use strict";const _={class:"nova-health"},g={class:"flex items-center justify-between mb-3"},h={class:"text-xl"},f={key:0,class:"text-sm text-gray-400 ml-4"},y=["disabled","loading"],E=[e.createElementVNode("div",{class:"inline-block h-8 w-8 animate-spin rounded-full border-4 border-solid border-current border-r-transparent align-[-0.125em] text-primary-500 motion-reduce:animate-[spin_1.5s_linear_infinite]",role:"status"},null,-1)],N={key:0,class:"grid md:grid-cols-12 gap-6"},x={class:"md:col-span-4 h-full p-6 flex items-start relative overflow-hidden bg-white dark:bg-gray-800 rounded-lg shadow md:col-span-4"},V={class:"text-lg"},k={class:"text-sm mt-2"},B={key:0,class:"mt-3 grid gap-1"},b={class:"flex flex-wrap items-center"},S={class:"inline-block font-bold text-gray-500 mr-1"},D={key:1,class:"mt-3 grid gap-1 text-gray-400"},w={class:"font-bold text-gray-500"},C={class:"font-bold text-gray-500"},L={class:"font-bold text-gray-500"},z={key:2,class:"mt-3 grid gap-1"},T={class:"font-bold text-gray-500 mr-1"},j={key:3,class:"mt-3 grid gap-1"},M={key:0},F={class:"font-bold"},I={class:"ml-1"},W={key:1},H={class:"font-bold"},O={class:"ml-1"},q={key:2},A={class:"font-bold"},P={class:"ml-1"},R={class:"font-bold ml-1"},Y=e.defineComponent({__name:"Tool",props:{card:{}},setup(G){const{__:s}=l.useLocalization(),r=e.ref(!1),i=e.ref([]),c=e.ref(null);async function m(){r.value=!0,await fetch("/nova-vendor/stepanenko3/nova-health").then(n=>n.json()).then(n=>{i.value=n.checkResults;const o=new Date(n.finishedAt*1e3),d=("0"+o.getDate()).slice(-2)+"/"+("0"+(o.getMonth()+1)).slice(-2)+"/"+o.getFullYear()+" "+("0"+o.getHours()).slice(-2)+":"+("0"+o.getMinutes()).slice(-2);c.value=d}).catch(n=>{console.error("Error fetching health:",n)}),r.value=!1}e.onMounted(()=>{m()});function p(n,o){return o.hasOwnProperty(n)?o[n]:o.default}return(n,o)=>{const d=e.resolveComponent("Icon");return e.openBlock(),e.createElementBlock("div",_,[e.createElementVNode("div",g,[e.createElementVNode("span",h,e.toDisplayString(e.unref(s)("Health")),1),c.value?(e.openBlock(),e.createElementBlock("span",f,e.toDisplayString(c.value),1)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:"ml-auto shadow-lg bg-white dark:bg-gray-800 cursor-pointer w-8 h-8 flex items-center justify-center rounded-lg hover:opacity-75 transition",disabled:r.value,loading:r.value,onClick:m},[e.createVNode(d,{type:"refresh",class:"w-4 h-4"})],8,y)]),e.createElementVNode("div",{class:e.normalizeClass(["absolute flex items-center justify-center inset-0 bg-white/50 dark:bg-gray-900/80 z-20",{"opacity-0 pointer-events-none":!r.value,"relative min-h-[200px] bg-transparent":i.value.length<=0}])},E,2),i.value.length?(e.openBlock(),e.createElementBlock("div",N,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.value,t=>(e.openBlock(),e.createElementBlock("div",x,[e.createVNode(d,{width:"30",height:"30",class:e.normalizeClass(["mr-4 flex-shrink-0",p(t.status,{ok:"text-green-500",warning:"text-yellow-500",skipped:"text-blue-500",failed:"text-red-500",crashed:"text-red-500",default:"text-gray-500"})]),type:p(t.status,{ok:"check-circle",warning:"exclamation-circle",skipped:"arrow-circle-right",failed:"x-circle",crashed:"exclamation-circle",default:"dots-circle-horizontal"})},null,8,["class","type"]),e.createElementVNode("div",null,[e.createElementVNode("div",V,e.toDisplayString(t.label),1),e.createElementVNode("div",k,e.toDisplayString(t.notificationMessage||t.shortSummary),1),t.name.startsWith("OutdatedPackages")&&t?.meta?.outdated?(e.openBlock(),e.createElementBlock("div",B,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.meta.outdated,a=>(e.openBlock(),e.createElementBlock("div",b,[e.createElementVNode("span",S,e.toDisplayString(a.name),1),e.createElementVNode("span",null,e.toDisplayString(a.version)+" -> "+e.toDisplayString(a.latest),1)]))),256))])):t.name.startsWith("CpuLoad")?(e.openBlock(),e.createElementBlock("div",D,[e.createElementVNode("div",null,[e.createTextVNode(" Last minute: "),e.createElementVNode("span",w,e.toDisplayString(t.meta.last_minute)+"%",1)]),e.createElementVNode("div",null,[e.createTextVNode(" Last 5 minutes: "),e.createElementVNode("span",C,e.toDisplayString(t.meta.last_5_minutes)+"%",1)]),e.createElementVNode("div",null,[e.createTextVNode(" Last 15 minutes: "),e.createElementVNode("span",L,e.toDisplayString(t.meta.last_15_minutes)+"%",1)])])):t.name.startsWith("DatabaseTableSize")?(e.openBlock(),e.createElementBlock("div",z,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(Object.values(t.meta),a=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("div",null,[e.createElementVNode("span",T,e.toDisplayString(a.name),1),e.createElementVNode("span",null," used "+e.toDisplayString(a.actualSize)+" of "+e.toDisplayString(a.maxSize),1)])]))),256))])):t.name.startsWith("Ssl")?(e.openBlock(),e.createElementBlock("div",j,[t?.meta?.domain?(e.openBlock(),e.createElementBlock("div",M,[e.createElementVNode("span",F,e.toDisplayString(e.unref(s)("Domain"))+": ",1),e.createElementVNode("span",I,e.toDisplayString(t.meta.domain),1)])):e.createCommentVNode("",!0),t?.meta?.issuer?(e.openBlock(),e.createElementBlock("div",W,[e.createElementVNode("span",H,e.toDisplayString(e.unref(s)("Issuer"))+": ",1),e.createElementVNode("span",O,e.toDisplayString(t.meta.issuer),1)])):e.createCommentVNode("",!0),t?.meta?.expiration_date?(e.openBlock(),e.createElementBlock("div",q,[e.createElementVNode("span",A,e.toDisplayString(e.unref(s)("Expiration"))+": ",1),e.createElementVNode("span",P,e.toDisplayString(t.meta.expiration_date),1),e.createElementVNode("span",R," ("+e.toDisplayString(Math.abs(parseInt(t.meta.expiration_date_in_days)))+" "+e.toDisplayString(e.unref(s)("days"))+") ",1)])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)])]))),256))])):e.createCommentVNode("",!0)])}}});Nova.booting((G,s)=>{Nova.inertia("NovaHealth",Y)})}); +(function(e,l){typeof exports=="object"&&typeof module<"u"?l(require("vue")):typeof define=="function"&&define.amd?define(["vue"],l):(e=typeof globalThis<"u"?globalThis:e||self,l(e.Vue))})(this,function(e){"use strict";const l={class:"nova-health"},p={class:"flex items-center justify-between mb-3"},_={class:"text-xl"},g={key:0,class:"text-sm text-gray-400 ml-4"},h=["disabled","loading"],y=[e.createElementVNode("div",{class:"inline-block h-8 w-8 animate-spin rounded-full border-4 border-solid border-current border-r-transparent align-[-0.125em] text-primary-500 motion-reduce:animate-[spin_1.5s_linear_infinite]",role:"status"},null,-1)],f={key:0,class:"grid md:grid-cols-12 gap-6"},E={class:"md:col-span-4 h-full p-6 flex items-start relative overflow-hidden bg-white dark:bg-gray-800 rounded-lg shadow md:col-span-4"},N={class:"text-lg"},V={class:"text-sm mt-2"},x={key:0,class:"mt-3 grid gap-1"},k={class:"flex flex-wrap items-center"},b={class:"inline-block font-bold text-gray-500 mr-1"},B={key:1,class:"mt-3 grid gap-1 text-gray-400"},S={class:"font-bold text-gray-500"},D={class:"font-bold text-gray-500"},w={class:"font-bold text-gray-500"},C={key:2,class:"mt-3 grid gap-1"},z={class:"font-bold text-gray-500 mr-1"},L={key:3,class:"mt-3 grid gap-1"},T={key:0},j={class:"font-bold"},M={class:"ml-1"},F={key:1},I={class:"font-bold"},W={class:"ml-1"},H={key:2},O={class:"font-bold"},A={class:"ml-1"},P={class:"font-bold ml-1"},q=e.defineComponent({__name:"Tool",props:{card:{}},setup(R){const s=e.ref(!1),i=e.ref([]),d=e.ref(null);async function c(){s.value=!0,await fetch("/nova-vendor/stepanenko3/nova-health").then(n=>n.json()).then(n=>{i.value=n.checkResults;const o=new Date(n.finishedAt*1e3),r=("0"+o.getDate()).slice(-2)+"/"+("0"+(o.getMonth()+1)).slice(-2)+"/"+o.getFullYear()+" "+("0"+o.getHours()).slice(-2)+":"+("0"+o.getMinutes()).slice(-2);d.value=r}).catch(n=>{console.error("Error fetching health:",n)}),s.value=!1}e.onMounted(()=>{c()});function m(n,o){return o.hasOwnProperty(n)?o[n]:o.default}return(n,o)=>{const r=e.resolveComponent("Icon");return e.openBlock(),e.createElementBlock("div",l,[e.createElementVNode("div",p,[e.createElementVNode("span",_,e.toDisplayString(n.__("Health")),1),d.value?(e.openBlock(),e.createElementBlock("span",g,e.toDisplayString(d.value),1)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:"ml-auto shadow-lg bg-white dark:bg-gray-800 cursor-pointer w-8 h-8 flex items-center justify-center rounded-lg hover:opacity-75 transition",disabled:s.value,loading:s.value,onClick:c},[e.createVNode(r,{type:"refresh",class:"w-4 h-4"})],8,h)]),e.createElementVNode("div",{class:e.normalizeClass(["absolute flex items-center justify-center inset-0 bg-white/50 dark:bg-gray-900/80 z-20",{"opacity-0 pointer-events-none":!s.value,"relative min-h-[200px] bg-transparent":i.value.length<=0}])},y,2),i.value.length?(e.openBlock(),e.createElementBlock("div",f,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.value,t=>(e.openBlock(),e.createElementBlock("div",E,[e.createVNode(r,{width:"30",height:"30",class:e.normalizeClass(["mr-4 flex-shrink-0",m(t.status,{ok:"text-green-500",warning:"text-yellow-500",skipped:"text-blue-500",failed:"text-red-500",crashed:"text-red-500",default:"text-gray-500"})]),type:m(t.status,{ok:"check-circle",warning:"exclamation-circle",skipped:"arrow-circle-right",failed:"x-circle",crashed:"exclamation-circle",default:"dots-circle-horizontal"})},null,8,["class","type"]),e.createElementVNode("div",null,[e.createElementVNode("div",N,e.toDisplayString(t.label),1),e.createElementVNode("div",V,e.toDisplayString(t.notificationMessage||t.shortSummary),1),t.name.startsWith("OutdatedPackages")&&t?.meta?.outdated?(e.openBlock(),e.createElementBlock("div",x,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.meta.outdated,a=>(e.openBlock(),e.createElementBlock("div",k,[e.createElementVNode("span",b,e.toDisplayString(a.name),1),e.createElementVNode("span",null,e.toDisplayString(a.version)+" -> "+e.toDisplayString(a.latest),1)]))),256))])):t.name.startsWith("CpuLoad")?(e.openBlock(),e.createElementBlock("div",B,[e.createElementVNode("div",null,[e.createTextVNode(" Last minute: "),e.createElementVNode("span",S,e.toDisplayString(t.meta.last_minute)+"%",1)]),e.createElementVNode("div",null,[e.createTextVNode(" Last 5 minutes: "),e.createElementVNode("span",D,e.toDisplayString(t.meta.last_5_minutes)+"%",1)]),e.createElementVNode("div",null,[e.createTextVNode(" Last 15 minutes: "),e.createElementVNode("span",w,e.toDisplayString(t.meta.last_15_minutes)+"%",1)])])):t.name.startsWith("DatabaseTableSize")?(e.openBlock(),e.createElementBlock("div",C,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(Object.values(t.meta),a=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("div",null,[e.createElementVNode("span",z,e.toDisplayString(a.name),1),e.createElementVNode("span",null," used "+e.toDisplayString(a.actualSize)+" of "+e.toDisplayString(a.maxSize),1)])]))),256))])):t.name.startsWith("Ssl")?(e.openBlock(),e.createElementBlock("div",L,[t?.meta?.domain?(e.openBlock(),e.createElementBlock("div",T,[e.createElementVNode("span",j,e.toDisplayString(n.__("Domain"))+": ",1),e.createElementVNode("span",M,e.toDisplayString(t.meta.domain),1)])):e.createCommentVNode("",!0),t?.meta?.issuer?(e.openBlock(),e.createElementBlock("div",F,[e.createElementVNode("span",I,e.toDisplayString(n.__("Issuer"))+": ",1),e.createElementVNode("span",W,e.toDisplayString(t.meta.issuer),1)])):e.createCommentVNode("",!0),t?.meta?.expiration_date?(e.openBlock(),e.createElementBlock("div",H,[e.createElementVNode("span",O,e.toDisplayString(n.__("Expiration"))+": ",1),e.createElementVNode("span",A,e.toDisplayString(t.meta.expiration_date),1),e.createElementVNode("span",P," ("+e.toDisplayString(Math.abs(parseInt(t.meta.expiration_date_in_days)))+" "+e.toDisplayString(n.__("days"))+") ",1)])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)])]))),256))])):e.createCommentVNode("",!0)])}}});Nova.booting((R,s)=>{Nova.inertia("NovaHealth",q)})}); diff --git a/resources/js/pages/Tool.vue b/resources/js/pages/Tool.vue index 23c4c86..41ec041 100644 --- a/resources/js/pages/Tool.vue +++ b/resources/js/pages/Tool.vue @@ -175,7 +175,6 @@