var __awaiter=this&&this.__awaiter||function(t,e,i,n){function r(t){return t instanceof i?t:new i((function(e){e(t)}))}return new(i||(i=Promise))((function(i,a){function s(t){try{c(n.next(t))}catch(t){a(t)}}function o(t){try{c(n["throw"](t))}catch(t){a(t)}}function c(t){t.done?i(t.value):r(t.value).then(s,o)}c((n=n.apply(t,e||[])).next())}))};var __generator=this&&this.__generator||function(t,e){var i={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},n,r,a,s;return s={next:o(0),throw:o(1),return:o(2)},typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function o(t){return function(e){return c([t,e])}}function c(s){if(n)throw new TypeError("Generator is already executing.");while(i)try{if(n=1,r&&(a=s[0]&2?r["return"]:s[0]?r["throw"]||((a=r["return"])&&a.call(r),0):r.next)&&!(a=a.call(r,s[1])).done)return a;if(r=0,a)s=[s[0]&2,a.value];switch(s[0]){case 0:case 1:a=s;break;case 4:i.label++;return{value:s[1],done:false};case 5:i.label++;r=s[1];s=[0];continue;case 7:s=i.ops.pop();i.trys.pop();continue;default:if(!(a=i.trys,a=a.length>0&&a[a.length-1])&&(s[0]===6||s[0]===2)){i=0;continue}if(s[0]===3&&(!a||s[1]>a[0]&&s[1]<a[3])){i.label=s[1];break}if(s[0]===6&&i.label<a[1]){i.label=a[1];a=s;break}if(a&&i.label<a[2]){i.label=a[2];i.ops.push(s);break}if(a[2])i.ops.pop();i.trys.pop();continue}s=e.call(t,i)}catch(t){s=[6,t];r=0}finally{n=a=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};import{r as registerInstance,h,H as Host}from"./index-ecdfb761.js";import{L as ListFetchState}from"./list-fetch-state-e772aa74.js";import{T as TextField}from"./index-150b6a59.js";import"./data-model-88af49fc.js";import"./FieldGenerator-3ae403b2.js";import"./BaseField-0b01dc2c.js";var damgaDomainLogsCss="";var DamgaDashboard=function(){function t(t){registerInstance(this,t);this.domains=ListFetchState.init();this.logs=ListFetchState.init();this.relativeTime=30;this.startDate=undefined;this.endDate=undefined}t.prototype.componentWillLoad=function(){this.endDate=new Date;this.startDate=new Date((new Date).getTime()-this.relativeTime*60*1e3);this.fetchList()};t.prototype.fetchList=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){this.selectedDomain="api.mentornity.com";this.fetchLogs();return[2]}))}))};t.prototype.fetchLogs=function(){return __awaiter(this,void 0,void 0,(function(){var t,e,i,n,r;var a=this;return __generator(this,(function(s){switch(s.label){case 0:t=this,e=t.logs,i=t.endDate,n=t.startDate;this.logs=this.logs.beforeFetch();return[4,this.apiServicesDamga.getLogs(this.selectedDomain,n,i).catch((function(t){a.logs=e.afterFetchError(t)}))];case 1:r=s.sent();if(!r)return[2];this.logs=e.afterFetch(r);return[2]}}))}))};t.prototype.render=function(){var t=this;var e=this.logs;var i=e.data||[];return h(Host,{class:"-container d-flex flex-grow-1 flex-column"},h("dvn-list-view-table",{config:{fields:[{fieldId:"msg"},{fieldId:"target-response-time"},{fieldId:"method"},{fieldId:"path"},{fieldId:"status-code"},{fieldId:"time"}],columns:{msg:{width:200},"target-response-time":{width:100},method:{width:100},path:{weight:1},"status-code":{width:100},time:{width:200}}},fields:[new TextField("msg","Message"),new TextField("target-response-time","Duration"),new TextField("method","Method"),new TextField("path","Path"),new TextField("status-code","Status Code"),new TextField("time","Time")],items:i,isEndReached:e.isEndReached(),isProgressing:e.isPending,error:e.error?"Fetching list failed":undefined,onRetry:function(){return t.fetchLogs()},scrollToFit:true}))};return t}();DamgaDashboard.style=damgaDomainLogsCss;export{DamgaDashboard as damga_domain_logs};