import{p as v,s as w,o as a,e as o,z as e,f as t,P as p,Q as y,R as C,g as c,J as $,F as f,A as g,j as l,h as m,k as S,w as A,S as z}from"./vue-CSzJdJby.js";import"./daterangepicker-i3LpM03M.js";import{$ as k}from"./jquery-BALIvAru.js";import{m as N}from"./moment-CMyQs7Vz.js";import{_ as x}from"./ring-alt-BtllWDs8.js";import{U as M}from"./index-ncPPdFzC.js";const P={class:"modal fade",id:"analyzeModal",tabindex:"-1",role:"dialog","aria-labelledby":"analyzeModalLabel","aria-hidden":"true"},U={class:"modal-dialog",role:"document"},D={class:"modal-content"},E=e("div",{class:"modal-header"},[e("h5",{class:"modal-title",id:"analyzeModalLabel"},"ANALYZE"),t(),e("button",{type:"button",class:"btn-close","data-bs-dismiss":"modal","aria-label":"Close"})],-1),T={class:"modal-body"},L={id:"analyzeForm"},Y={class:"mb-3"},F={class:"row"},V=e("legend",{class:"col-form-label col-sm-2 pt-0"},"When",-1),H={class:"col-sm-10"},Z={class:"form-check form-check-inline"},B=e("label",{class:"form-check-label",for:"analyzeNow"}," Now ",-1),I={class:"form-check form-check-inline"},W={class:"form-check-label",for:"analyzeScheduled"},q={type:"button",id:"analyzeScheduledTime",class:"btn btn-outline-secondary"},j=e("i",{class:"fa fa-clock-o"},null,-1),X=["value","disabled"],J={class:"modal-footer"},Q=e("button",{type:"button",class:"btn btn-secondary","data-bs-dismiss":"modal"},"Close",-1),yt={__name:"AnalyzeModal",emits:["apply"],setup(r,{emit:u}){const n=v("now"),d=v(N());w(()=>{const h={singleDatePicker:!0,timePicker:!0,timePicker24Hour:!0,timePickerSeconds:!1};k("#analyzeScheduledTime").daterangepicker(k.extend({startDate:d.value},h),function(i){d.value=i})});const _=u;return(h,i)=>(a(),o("div",P,[e("div",U,[e("div",D,[E,t(),e("div",T,[e("form",L,[e("fieldset",Y,[e("div",F,[V,t(),e("div",H,[e("div",Z,[p(e("input",{class:"form-check-input",type:"radio",id:"analyzeNow","onUpdate:modelValue":i[0]||(i[0]=s=>n.value=s),value:"now",checked:""},null,512),[[y,n.value]]),t(),B]),t(),e("div",I,[e("label",W,[p(e("input",{class:"form-check-input",type:"radio",id:"analyzeScheduled","onUpdate:modelValue":i[1]||(i[1]=s=>n.value=s),value:"scheduled"},null,512),[[y,n.value]]),t(`
                      Scheduled
                    `)])]),t(),p(e("div",null,[e("button",q,[j,t(`
                       
                      `),e("span",null,c(d.value.toString()),1)]),t(),e("input",{type:"hidden",name:"datetime",value:d.value.utc().format("YYYY-MM-DDTHH:mm:ss[Z]"),disabled:n.value!="scheduled"},null,8,X)],512),[[C,n.value=="scheduled"]])])])])])]),t(),e("div",J,[Q,t(),e("button",{id:"buttonAnalyzeApply",type:"button",class:"btn btn-primary",onClick:i[2]||(i[2]=s=>_("apply")),"data-bs-dismiss":"modal"},`
            Apply
          `)])])])]))}},G={key:0},K={"data-bs-toggle":"collapse",href:"#collapseScheduledAnalyzes","aria-expanded":"false","aria-controls":"collapseScheduledAnalyzes"},O=e("i",{class:"fa fa-clock-o"},null,-1),R={class:"list list-unstyled collapse border rounded p-1",id:"collapseScheduledAnalyzes"},ee={class:"pb-1 text-body-secondary"},te={class:"mb-0 text-truncate"},se={class:"bg-light small"},ae={key:0},oe=["href"],ne=["href"],le=["title"],ce=["onClick"],ie={key:1},de=e("img",{id:"loadingIndicator",src:x,class:"fa-fw"},null,-1),re={key:2},me={key:3},kt={__name:"ScheduledAnalyzes",props:["scheduledAnalyzes"],emits:["cancel"],setup(r,{emit:u}){const n=$("instance"),d=$("dbName"),_=u;return(h,i)=>r.scheduledAnalyzes.length?(a(),o("div",G,[e("a",K,[O,t(" "+c(r.scheduledAnalyzes.length)+` scheduled analyzes
    `,1)]),t(),e("ul",R,[(a(!0),o(f,null,g(r.scheduledAnalyzes,s=>(a(),o("li",ee,[e("pre",te,[t("        "),e("code",se,[t("ANALYZE"),s.table?(a(),o("span",ae,[t(),e("a",{href:`/server/${l(n).agentAddress}/${l(n).agentPort}/maintenance/${l(d)}/schema/${s.schema}`},c(s.schema),9,oe),t("."),e("a",{href:`/server/${l(n).agentAddress}/${l(n).agentPort}/maintenance/${l(d)}/schema/${s.schema}/table/${s.table}`},c(s.table),9,ne)])):m("",!0),t(`
        `)]),t(`
        `)]),t(),s.status=="todo"?(a(),o(f,{key:0},[e("em",null,[t(`
            scheduled
            `),e("span",{title:s.datetime.toString()},[S(l(M),{time:s.datetime},{default:A(({timeAgo:b})=>[t(c(b),1)]),_:2},1032,["time"])],8,le)]),t(),s.status=="todo"?(a(),o("button",{key:0,class:"btn btn-sm btn-outline-secondary py-0",onClick:b=>_("cancel",s.id)},`
            Cancel
          `,8,ce)):m("",!0)],64)):s.status=="doing"?(a(),o("em",ie,[de,t(`
            in progress
          `)])):s.status=="canceled"?(a(),o("em",re,"canceled")):(a(),o("em",me,c(s.status),1))]))),256))])])):m("",!0)}},ue={key:0},_e={"data-bs-toggle":"collapse",href:"#collapseScheduledReindexes","aria-expanded":"false","aria-controls":"collapseScheduledReindexes"},he=e("i",{class:"fa fa-clock-o"},null,-1),be={class:"list list-unstyled collapse border rounded p-1",id:"collapseScheduledReindexes"},pe={class:"pb-1 text-body-secondary"},$e={class:"mb-0 text-truncate"},fe={class:"bg-light small"},ve={key:0},ye={key:1},ke=["href"],ge=["href"],Se={key:2},Ae=["href"],xe=["title"],Me=["onClick"],we={key:1},Ce=e("img",{id:"loadingIndicator",src:x,class:"fa-fw"},null,-1),Ne={key:2},ze={key:3},gt={__name:"ScheduledReindexes",props:["scheduledReindexes"],emits:["cancel"],setup(r,{emit:u}){const n=$("instance"),d=$("dbName"),_=u;return(h,i)=>r.scheduledReindexes.length?(a(),o("div",ue,[e("a",_e,[he,t(" "+c(r.scheduledReindexes.length)+` scheduled reindexes
    `,1)]),t(),e("ul",be,[(a(!0),o(f,null,g(r.scheduledReindexes,s=>(a(),o("li",pe,[e("pre",$e,[t("        "),e("code",fe,[t(`REINDEX
        `),!s.table&&!s.index?(a(),o("span",ve," DATABASE "+c(s.dbname),1)):m("",!0),t(`
        `),s.table?(a(),o("span",ye,[t(` TABLE
        `),e("a",{href:`/server/${l(n).agentAddress}/${l(n).agentPort}/maintenance/${l(d)}/schema/${s.schema}`},c(s.schema),9,ke),t("."),e("a",{href:`/server/${l(n).agentAddress}/${l(n).agentPort}/maintenance/${l(d)}/schema/${s.schema}/table/${s.table}`},c(s.table),9,ge)])):m("",!0),s.index?(a(),o("span",Se,[t(" INDEX "),e("a",{href:`/server/${l(n).agentAddress}/${l(n).agentPort}/maintenance/${l(d)}/schema/${s.schema}`},c(s.schema),9,Ae),t("."+c(s.index)+`
        `,1)])):m("",!0),t(`
        `)]),t(`
        `)]),t(),s.status=="todo"?(a(),o(f,{key:0},[e("em",null,[t(`
            scheduled
            `),e("span",{title:s.datetime.toString()},[S(l(M),{time:s.datetime},{default:A(({timeAgo:b})=>[t(c(b),1)]),_:2},1032,["time"])],8,xe)]),t(),s.status=="todo"?(a(),o("button",{key:0,class:"btn btn-sm btn-outline-secondary py-0",onClick:b=>_("cancel",s.id)},`
            Cancel
          `,8,Me)):m("",!0)],64)):s.status=="doing"?(a(),o("em",we,[Ce,t(`
            in progress
          `)])):s.status=="canceled"?(a(),o("em",Ne,"canceled")):(a(),o("em",ze,c(s.status),1))]))),256))])])):m("",!0)}},Pe={key:0},Ue={"data-bs-toggle":"collapse",href:"#collapseScheduledVacuums","aria-expanded":"false","aria-controls":"collapseScheduledVacuums"},De=e("i",{class:"fa fa-clock-o"},null,-1),Ee={class:"list list-unstyled collapse border rounded p-1",id:"collapseScheduledVacuums"},Te={class:"pb-1 text-body-secondary"},Le={class:"mb-0 text-truncate"},Ye={class:"bg-light small"},Fe={key:0},Ve={key:1},He=["href"],Ze=["href"],Be=["title"],Ie=["onClick"],We={key:1},qe=e("img",{id:"loadingIndicator",src:x,class:"fa-fw"},null,-1),je={key:2},Xe={key:3},St={__name:"ScheduledVacuums",props:["scheduledVacuums"],emits:["cancel"],setup(r,{emit:u}){const n=$("instance"),d=$("dbName"),_=u;return(h,i)=>r.scheduledVacuums.length?(a(),o("div",Pe,[e("a",Ue,[De,t(" "+c(r.scheduledVacuums.length)+` scheduled vacuums
    `,1)]),t(),e("ul",Ee,[(a(!0),o(f,null,g(r.scheduledVacuums,s=>(a(),o("li",Te,[e("pre",Le,[t("        "),e("code",Ye,[t(`VACUUM
        `),s.mode?(a(),o("span",Fe," ("+c(s.mode.toUpperCase())+")",1)):m("",!0),t(`
        `),s.table?(a(),o("span",Ve,[t(),e("a",{href:`/server/${l(n).agentAddress}/${l(n).agentPort}/maintenance/${l(d)}/schema/${s.schema}`},c(s.schema),9,He),t("."),e("a",{href:`/server/${l(n).agentAddress}/${l(n).agentPort}/maintenance/${l(d)}/schema/${s.schema}/table/${s.table}`},c(s.table),9,Ze)])):m("",!0),t(`
        `)]),t(`
        `)]),t(),s.status=="todo"?(a(),o(f,{key:0},[e("em",null,[t(`
            scheduled
            `),e("span",{title:s.datetime.toString()},[S(l(M),{time:s.datetime},{default:A(({timeAgo:b})=>[t(c(b),1)]),_:2},1032,["time"])],8,Be)]),t(),s.status=="todo"?(a(),o("button",{key:0,class:"btn btn-sm btn-outline-secondary py-0",onClick:b=>_("cancel",s.id)},`
            Cancel
          `,8,Ie)):m("",!0)],64)):s.status=="doing"?(a(),o("em",We,[qe,t(`
            in progress
          `)])):s.status=="canceled"?(a(),o("em",je,"canceled")):(a(),o("em",Xe,c(s.status),1))]))),256))])])):m("",!0)}},Je={class:"modal fade",id:"vacuumModal",tabindex:"-1",role:"dialog","aria-labelledby":"vacuumModalLabel","aria-hidden":"true"},Qe={class:"modal-dialog",role:"document"},Ge={class:"modal-content"},Ke=e("div",{class:"modal-header"},[e("h5",{class:"modal-title",id:"vacuumModalLabel"},"VACUUM"),t(),e("button",{type:"button",class:"btn-close","data-bs-dismiss":"modal","aria-label":"Close"})],-1),Oe={class:"modal-body"},Re={id:"vacuumForm"},et=z(`<div class="mb-3 row"><div class="col-sm-2">Mode</div> <div class="col-sm-10"><div class="form-check"><input class="form-check-input" type="checkbox" id="vacuumModeAnalyze" name="mode" value="analyze"> <label class="form-check-label" for="vacuumModeAnalyze"> ANALYZE </label> <small class="form-text text-body-secondary"> Updates statistics after the vacuum. </small></div> <div class="form-check"><input class="form-check-input" type="checkbox" id="vacuumModeFull" name="mode" value="full"> <label class="form-check-label" for="vacuumModeFull"> FULL </label> <small class="form-text text-body-secondary">
                    Can reclaim more space but takes more time and exclusively locks the table.
                    <span class="text-danger">Use with caution!</span></small></div> <div class="form-check"><input class="form-check-input" type="checkbox" id="vacuumModeFreeze" name="mode" value="freeze"> <label class="form-check-label" for="vacuumModeFreeze"> FREEZE </label> <small class="form-text text-body-secondary">
                    Selects aggressive &quot;freezing&quot; of tuples. Equivalent to performing VACUUM with the
                    <em><code>vacuum_freeze_min_age</code></em> parameter set to zero.
                  </small></div></div></div>`,1),tt={class:"mb-3"},st={class:"row"},at=e("legend",{class:"col-form-label col-sm-2 pt-0"},"When",-1),ot={class:"col-sm-10"},nt={class:"form-check form-check-inline"},lt=e("label",{class:"form-check-label",for:"vacuumNow"}," Now ",-1),ct={class:"form-check form-check-inline"},it={class:"form-check-label",for:"vacuumScheduled"},dt={type:"button",id:"vacuumScheduledTime",class:"btn btn-outline-secondary"},rt=e("i",{class:"fa fa-clock-o"},null,-1),mt=["value","disabled"],ut={class:"modal-footer"},_t=e("button",{type:"button",class:"btn btn-secondary","data-bs-dismiss":"modal"},"Close",-1),At={__name:"VacuumModal",emits:["apply"],setup(r,{emit:u}){const n=v("now"),d=v(N());w(()=>{const h={singleDatePicker:!0,timePicker:!0,timePicker24Hour:!0,timePickerSeconds:!1};k("#vacuumScheduledTime").daterangepicker(k.extend({startDate:d.value},h),function(i){d.value=i})});const _=u;return(h,i)=>(a(),o("div",Je,[e("div",Qe,[e("div",Ge,[Ke,t(),e("div",Oe,[e("form",Re,[et,t(),e("fieldset",tt,[e("div",st,[at,t(),e("div",ot,[e("div",nt,[p(e("input",{class:"form-check-input",type:"radio",id:"vacuumNow","onUpdate:modelValue":i[0]||(i[0]=s=>n.value=s),value:"now",checked:""},null,512),[[y,n.value]]),t(),lt]),t(),e("div",ct,[e("label",it,[p(e("input",{class:"form-check-input",type:"radio",id:"vacuumScheduled","onUpdate:modelValue":i[1]||(i[1]=s=>n.value=s),value:"scheduled"},null,512),[[y,n.value]]),t(`
                      Scheduled
                    `)])]),t(),p(e("div",null,[e("button",dt,[rt,t(`
                       
                      `),e("span",null,c(d.value.toString()),1)]),t(),e("input",{type:"hidden",name:"datetime",value:d.value.utc().format("YYYY-MM-DDTHH:mm:ss[Z]"),disabled:n.value!="scheduled"},null,8,mt)],512),[[C,n.value=="scheduled"]])])])])])]),t(),e("div",ut,[_t,t(),e("button",{id:"buttonVacuumApply",type:"button",class:"btn btn-primary",onClick:i[2]||(i[2]=s=>_("apply")),"data-bs-dismiss":"modal"},`
            Apply
          `)])])])]))}};export{kt as _,St as a,gt as b,yt as c,At as d};
