1 line
1.6 KiB
JavaScript
1 line
1.6 KiB
JavaScript
import{s as c}from"./service.541fc1e6.js";import{_ as h,G as l,r as p,o as r,c as f,w as _,a as d,b as s,t as o,e as i}from"./index.868de8fa.js";const y="/api/v3",m="/api",g={name:"Sonarr",mixins:[c],props:{item:Object},components:{Generic:l},computed:{apiPath(){return this.item.legacyApi?m:y}},data:()=>({activity:null,warnings:null,errors:null,serverError:!1}),created:function(){this.fetchConfig()},methods:{fetchConfig:function(){this.fetch(`${this.apiPath}/health?apikey=${this.item.apikey}`).then(t=>{this.warnings=0,this.errors=0;for(var e=0;e<t.length;e++)t[e].type=="warning"?this.warnings++:t[e].type=="error"&&this.errors++}).catch(t=>{console.error(t),this.serverError=!0}),this.fetch(`${this.apiPath}/queue?apikey=${this.item.apikey}`).then(t=>{if(this.activity=0,this.item.legacyApi)for(var e=0;e<t.length;e++)t[e].series&&this.activity++;else this.activity=t.totalRecords}).catch(t=>{console.error(t),this.serverError=!0})}}},v={class:"notifs"},u={key:0,class:"notif activity",title:"Activity"},k={key:1,class:"notif warnings",title:"Warning"},w={key:2,class:"notif errors",title:"Error"},A={key:3,class:"notif errors",title:"Connection error to Sonarr API, check url and apikey in config.yml"};function C(t,e,n,E,$,P){const a=p("Generic");return r(),f(a,{item:n.item},{indicator:_(()=>[d("div",v,[t.activity>0?(r(),s("strong",u,o(t.activity),1)):i("",!0),t.warnings>0?(r(),s("strong",k,o(t.warnings),1)):i("",!0),t.errors>0?(r(),s("strong",w,o(t.errors),1)):i("",!0),t.serverError?(r(),s("strong",A," ? ")):i("",!0)])]),_:1},8,["item"])}const b=h(g,[["render",C],["__scopeId","data-v-6eb7a9ad"]]);export{b as default};
|