"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[6784],{63773:(t,e,a)=>{a.d(e,{O:()=>r});var s=a(43215),n=a(90923);const i={http:80,https:443,ftp:21};class r{constructor(){this.absUrl=this.wrapInDeprecationWarning(this.absUrl),this.hash=this.wrapInDeprecationWarning(this.hash),this.host=this.wrapInDeprecationWarning(this.host),this.path=this.wrapInDeprecationWarning(this.path),this.port=this.wrapInDeprecationWarning(this.port,"window.location"),this.protocol=this.wrapInDeprecationWarning(this.protocol,"window.location"),this.replace=this.wrapInDeprecationWarning(this.replace),this.search=this.wrapInDeprecationWarning(this.search),this.state=this.wrapInDeprecationWarning(this.state),this.url=this.wrapInDeprecationWarning(this.url)}wrapInDeprecationWarning(t,e){let a=this;return function(){return(0,s.deprecationWarning)("$location",t.name,e||"locationService"),t.apply(a,arguments)}}absUrl(){return`${window.location.origin}${this.url()}`}hash(t){if((0,n.navigationLogger)("AngularLocationWrapper",!1,"Angular compat layer: hash"),t)throw new Error("AngularLocationWrapper method not implemented.");return n.locationService.getLocation().hash.slice(1)}host(){return new URL(window.location.href).hostname}path(t){(0,n.navigationLogger)("AngularLocationWrapper",!1,"Angular compat layer: path");const e=n.locationService.getLocation();if(null!=t){let a=String(t);a=a.startsWith("/")?a:`/${a}`;const s=new URL(`${window.location.origin}${a}`);return n.locationService.push({pathname:s.pathname,search:s.search.length>0?s.search:e.search,hash:s.hash.length>0?s.hash:e.hash}),this}return null===t?(n.locationService.push("/"),this):e.pathname}port(){const t=new URL(window.location.href);return parseInt(t.port,10)||i[t.protocol]||null}protocol(){return new URL(window.location.href).protocol.slice(0,-1)}replace(){throw new Error("AngularLocationWrapper method not implemented.")}search(t,e){if((0,n.navigationLogger)("AngularLocationWrapper",!1,"Angular compat layer: search"),!t)return n.locationService.getSearchObject();if(t&&arguments.length>1)return n.locationService.partial({[t]:e}),this;if(t){let e;e="object"==typeof t?Object.assign({},t):(0,n.locationSearchToObject)(t);for(const t of Object.keys(e))null!==e[t]&&void 0!==e[t]||delete e[t];const a=s.urlUtil.renderUrl(n.locationService.getLocation().pathname,e);n.locationService.push(a)}return this}state(t){throw(0,n.navigationLogger)("AngularLocationWrapper",!1,"Angular compat layer: state"),new Error("AngularLocationWrapper method not implemented.")}url(t){if((0,n.navigationLogger)("AngularLocationWrapper",!1,"Angular compat layer: url"),void 0!==t)return t.startsWith("#")?n.locationService.push(Object.assign({},n.locationService.getLocation(),{hash:t})):t.startsWith("?")?n.locationService.push(Object.assign({},n.locationService.getLocation(),{search:t})):0===t.trim().length?n.locationService.push("/"):n.locationService.push(t),n.locationService;const e=n.locationService.getLocation();return`${e.pathname}${e.search}${e.hash}`}}},15866:(t,e,a)=>{a.d(e,{k:()=>l});var s=a(82897),n=a(43215),i=a(91082),r=a(60301);function o(t,e,a){return e in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}class l extends i.q{constructor(t,e){super(t,e),o(this,"contextSrv",void 0),o(this,"datasourceSrv",void 0),o(this,"timeSrv",void 0),o(this,"templateSrv",void 0),o(this,"interval",void 0),o(this,"intervalMs",void 0),o(this,"resolution",void 0),o(this,"timeInfo",void 0),o(this,"skipDataOnInit",!1),o(this,"dataList",[]),o(this,"querySubscription",void 0),o(this,"useDataFrames",!1),o(this,"panelData",void 0),o(this,"panelDataObserver",{next:t=>{if(this.panelData=t,t.state===n.LoadingState.Error&&(this.loading=!1,this.processDataError(t.error)),t.state===n.LoadingState.Loading)return this.loading=!0,void this.angularDirtyCheck();if(t.request){const{timeInfo:e}=t.request;e&&(this.timeInfo=e)}if(t.timeRange&&(this.range=t.timeRange),this.useDataFrames)this.handleDataFrames(t.series);else{const e=t.series.map((t=>(0,n.toLegacyResponseData)(t)));this.handleQueryResult({data:e})}this.angularDirtyCheck()}}),this.contextSrv=e.get("contextSrv"),this.datasourceSrv=e.get("datasourceSrv"),this.timeSrv=e.get("timeSrv"),this.templateSrv=e.get("templateSrv"),this.panel.datasource=this.panel.datasource||null,this.events.on(n.PanelEvents.refresh,this.onMetricsPanelRefresh.bind(this)),this.events.on(n.PanelEvents.panelTeardown,this.onPanelTearDown.bind(this)),this.events.on(n.PanelEvents.componentDidMount,this.onMetricsPanelMounted.bind(this))}onMetricsPanelMounted(){const t=this.panel.getQueryRunner();this.querySubscription=t.getData({withTransforms:!0,withFieldConfig:!0}).subscribe(this.panelDataObserver)}onPanelTearDown(){this.querySubscription&&(this.querySubscription.unsubscribe(),this.querySubscription=null)}onMetricsPanelRefresh(){if(!this.otherPanelInFullscreenMode()){if(this.panel.snapshotData){this.updateTimeRange();let t=this.panel.snapshotData;return(0,s.isArray)(t)||(t=t.data),this.panelData={state:n.LoadingState.Done,series:t,timeRange:this.range},this.$timeout((()=>{this.events.emit(n.PanelEvents.dataSnapshotLoad,t)}))}return delete this.error,this.loading=!0,this.datasourceSrv.get(this.panel.datasource,this.panel.scopedVars).then(this.issueQueries.bind(this)).catch((t=>{this.processDataError(t)}))}}processDataError(t){t.cancelled?console.log("Panel request cancelled",t):(this.error=t.message||"Request Error",t.data&&(t.data.message?this.error=t.data.message:t.data.error&&(this.error=t.data.error)),this.angularDirtyCheck())}angularDirtyCheck(){this.$scope.$root.$$phase||this.$scope.$digest()}updateTimeRange(t){this.datasource=t||this.datasource,this.range=this.timeSrv.timeRange();const e=(0,r.W1)(this.panel,this.range);this.timeInfo=e.timeInfo,this.range=e.timeRange}issueQueries(t){this.updateTimeRange(t),this.datasource=t;const e=this.panel;return e.getQueryRunner().run({datasource:e.datasource,queries:e.targets,panelId:e.id,dashboardId:this.dashboard.id,timezone:this.dashboard.getTimezone(),timeInfo:this.timeInfo,timeRange:this.range,maxDataPoints:e.maxDataPoints||this.width,minInterval:e.interval,scopedVars:e.scopedVars,cacheTimeout:e.cacheTimeout,transformations:e.transformations})}handleDataFrames(t){this.loading=!1,this.dashboard&&this.dashboard.snapshot&&(this.panel.snapshotData=t.map((t=>(0,n.toDataFrameDTO)(t))));try{this.events.emit(n.PanelEvents.dataFramesReceived,t)}catch(t){this.processDataError(t)}}handleQueryResult(t){this.loading=!1,this.dashboard.snapshot&&(this.panel.snapshotData=t.data),t&&t.data||(console.log("Data source query result invalid, missing data field:",t),t={data:[]});try{this.events.emit(n.PanelEvents.dataReceived,t.data)}catch(t){this.processDataError(t)}}}},91082:(t,e,a)=>{a.d(e,{q:()=>h});var s=a(82897),n=a(43215),i=a(63773),r=a(78837),o=a(98163);function l(t,e,a){return e in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}class h{constructor(t,e){var a,s;l(this,"panel",void 0),l(this,"error",void 0),l(this,"pluginName",""),l(this,"pluginId",""),l(this,"editorTabs",void 0),l(this,"$scope",void 0),l(this,"$injector",void 0),l(this,"$timeout",void 0),l(this,"editModeInitiated",!1),l(this,"containerHeight",void 0),l(this,"events",void 0),l(this,"loading",!1),l(this,"timing",void 0),l(this,"$location",void 0),l(this,"onPluginTypeChange",(t=>{})),this.panel=null!==(a=this.panel)&&void 0!==a?a:t.$parent.panel,this.dashboard=null!==(s=this.dashboard)&&void 0!==s?s:t.$parent.dashboard,this.$injector=e,this.$scope=t,this.$timeout=e.get("$timeout"),this.editorTabs=[],this.$location=new i.O,this.events=new n.EventBusSrv,this.timing={};const o=r.ZP.panels[this.panel.type];o&&(this.pluginId=o.id,this.pluginName=o.name),t.$on(n.PanelEvents.componentDidMount.name,(()=>this.panelDidMount()))}panelDidMount(){this.events.emit(n.PanelEvents.componentDidMount),this.events.emit(n.PanelEvents.initialized),this.dashboard.panelInitialized(this.panel)}renderingCompleted(){o.rv.renderingCompleted()}refresh(){this.panel.refresh()}publishAppEvent(t,e){this.$scope.$root.appEvent(t,e)}initEditMode(){this.editModeInitiated||(this.editModeInitiated=!0,this.events.emit(n.PanelEvents.editModeInitialized))}addEditorTab(t,e,a,n){const i={title:t,directiveFn:e,icon:n};(0,s.isString)(e)&&(i.directiveFn=()=>({templateUrl:e})),a?this.editorTabs.splice(a,0,i):this.editorTabs.push(i)}getExtendedMenu(){const t=[];return this.events.emit(n.PanelEvents.initPanelActions,t),t}async getAdditionalMenuItems(){return[]}otherPanelInFullscreenMode(){return this.dashboard.otherPanelInFullscreen(this.panel)}render(t){this.events.emit(n.PanelEvents.render,t)}}},88643:(t,e,a)=>{a.d(e,{G:()=>i});var s=a(82897);function n(t,e,a){return e in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}class i{constructor(t,e){var a,i,r,o,l;n(this,"target",void 0),n(this,"datasource",void 0),n(this,"panelCtrl",void 0),n(this,"panel",void 0),n(this,"hasRawMode",void 0),n(this,"error",void 0),n(this,"isLastQuery",void 0),this.$scope=t,this.$injector=e,this.panelCtrl=null!==(a=this.panelCtrl)&&void 0!==a?a:t.ctrl.panelCtrl,this.target=null!==(i=this.target)&&void 0!==i?i:t.ctrl.target,this.datasource=null!==(r=this.datasource)&&void 0!==r?r:t.ctrl.datasource,this.panel=null!==(o=null===(l=this.panelCtrl)||void 0===l?void 0:l.panel)&&void 0!==o?o:t.ctrl.panelCtrl.panel,this.isLastQuery=(0,s.indexOf)(this.panel.targets,this.target)===this.panel.targets.length-1}refresh(){this.panelCtrl.refresh()}}},75983:(t,e,a)=>{a.r(e),a.d(e,{TablePanelCtrl:()=>P,plugin:()=>$});var s=a(98572),n=a.n(s),i=a(82897),r=a(43215),o=a(78837),l=a(28380),h=a(60974),u=a(56340);function c(t,e,a){return e in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}class d{constructor(t){c(this,"panel",void 0),c(this,"panelCtrl",void 0),c(this,"colorModes",void 0),c(this,"columnStyles",void 0),c(this,"columnTypes",void 0),c(this,"fontSizes",void 0),c(this,"dateFormats",void 0),c(this,"addColumnSegment",void 0),c(this,"unitFormats",void 0),c(this,"getColumnNames",void 0),c(this,"activeStyleIndex",void 0),c(this,"mappingTypes",void 0),c(this,"alignTypes",void 0),t.editor=this,this.activeStyleIndex=0,this.panelCtrl=t.ctrl,this.panel=this.panelCtrl.panel,this.unitFormats=(0,r.getValueFormats)(),this.colorModes=[{text:"Disabled",value:null},{text:"Cell",value:"cell"},{text:"Value",value:"value"},{text:"Row",value:"row"}],this.columnTypes=[{text:"Number",value:"number"},{text:"String",value:"string"},{text:"Date",value:"date"},{text:"Hidden",value:"hidden"}],this.fontSizes=["80%","90%","100%","110%","120%","130%","150%","160%","180%","200%","220%","250%"],this.dateFormats=[{text:"YYYY-MM-DD HH:mm:ss",value:"YYYY-MM-DD HH:mm:ss"},{text:"YYYY-MM-DD HH:mm:ss.SSS",value:"YYYY-MM-DD HH:mm:ss.SSS"},{text:"MM/DD/YY h:mm:ss a",value:"MM/DD/YY h:mm:ss a"},{text:"MMMM D, YYYY LT",value:"MMMM D, YYYY LT"},{text:"YYYY-MM-DD",value:"YYYY-MM-DD"}],this.mappingTypes=[{text:"Value to text",value:1},{text:"Range to text",value:2}],this.alignTypes=d.alignTypesEnum,this.getColumnNames=()=>this.panelCtrl.table?(0,i.map)(this.panelCtrl.table.columns,(t=>t.text)):[],this.onColorChange=this.onColorChange.bind(this)}render(){this.panelCtrl.render()}setUnitFormat(t){return e=>{t.unit=e,this.panelCtrl.render()}}addColumnStyle(){const t=this.panel.styles,e=t.length;let a=e;if(e>0){"/.*/"===t[e-1].pattern&&(a=e-1)}t.splice(a,0,{unit:"short",type:"number",alias:"",decimals:2,colors:["rgba(245, 54, 54, 0.9)","rgba(237, 129, 40, 0.89)","rgba(50, 172, 45, 0.97)"],colorMode:null,pattern:"",dateFormat:"YYYY-MM-DD HH:mm:ss",thresholds:[],mappingType:1,align:"auto"}),this.activeStyleIndex=a}removeColumnStyle(t){this.panel.styles=(0,i.without)(this.panel.styles,t)}invertColorOrder(t){const e=this.panel.styles[t].colors,a=e[0];e[0]=e[2],e[2]=a,this.panelCtrl.render()}onColorChange(t,e){return a=>{t.colors[e]=a,this.render()}}addValueMap(t){t.valueMaps||(t.valueMaps=[]),t.valueMaps.push({value:"",text:""}),this.panelCtrl.render()}removeValueMap(t,e){t.valueMaps.splice(e,1),this.panelCtrl.render()}addRangeMap(t){t.rangeMaps||(t.rangeMaps=[]),t.rangeMaps.push({from:"",to:"",text:""}),this.panelCtrl.render()}removeRangeMap(t,e){t.rangeMaps.splice(e,1),this.panelCtrl.render()}}function p(){return{restrict:"E",scope:!0,templateUrl:"public/app/plugins/panel/table-old/column_options.html",controller:d}}d.$inject=["$scope"],c(d,"alignTypesEnum",[{text:"auto",value:""},{text:"left",value:"left"},{text:"center",value:"center"},{text:"right",value:"right"}]);var m=a(65660),g=a(9166),v=a(90845);const f={},b=t=>Array.isArray(t)?t.reduce(((t,e)=>e.datapoints?t.concat(e):t),[]):t.datapoints?[t]:[],y=t=>Array.isArray(t)?t.reduce(((t,e)=>e.columns?t.concat(e):t),[]):t.columns?[t]:[];function S(t,e,a){return e in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}f.timeseries_to_rows={description:"Time series to rows",getColumns:()=>[],transform:(t,e,a)=>{a.columns=[{text:"Time",type:"date"},{text:"Metric"},{text:"Value"}];const s=b(t);for(let t=0;t[],transform:(t,e,a)=>{a.columns.push({text:"Time",type:"date"});const s={},n=b(t);for(let t=0;t[{text:"Avg",value:"avg"},{text:"Min",value:"min"},{text:"Max",value:"max"},{text:"Total",value:"total"},{text:"Current",value:"current"},{text:"Count",value:"count"}],transform:(t,e,a)=>{let s,n;for(a.columns.push({text:"Metric"}),s=0;s[],transform:(t,e,a)=>{if(a.columns.push({text:"Time",type:"date"}),a.columns.push({text:"Title"}),a.columns.push({text:"Text"}),a.columns.push({text:"Tags"}),t&&t.annotations&&0!==t.annotations.length)for(let e=0;e{if(!t||0===t.length)return[];if(1===t.length)return[...t[0].columns];const e=y(t),a={};return e.reduce(((t,e)=>(e.columns.forEach((e=>{const{text:s}=e;void 0===a[s]&&(a[s]=t.length,t.push(e))})),t)),[])},transform:(t,e,a)=>{if(!t||0===t.length)return;const s=y(t),n=(0,i.findIndex)(s,(t=>"columns"in t&&"rows"in t));if(n<0)throw{message:`Result of query #${String.fromCharCode(65+n)} is not in table format, try using another transform.`};(0,m.M)(a,...s)}},f.json={description:"JSON Data",getColumns:t=>{if(!t||0===t.length)return[];const e={};for(let a=0;a({text:e,value:e})))},transform:(t,e,a)=>{let s,n,r;for(const s of e.columns){const e={text:s.text};t.length>0&&t[0].filterable&&(e.filterable=!0),a.columns.push(e)}for(0===a.columns.length&&a.columns.push({text:"JSON"}),s=0;s0){const a=(0,v.default)(t);for(r=0;rthis.uiSegmentSrv.newSegment({value:t.text})));return Promise.resolve(e)}addColumn(){const t=f[this.panel.transform].getColumns(this.panelCtrl.dataRaw),e=(0,i.find)(t,{text:this.addColumnSegment.value});e&&(this.panel.columns.push(e),this.render());const a=this.uiSegmentSrv.newPlusButton();this.addColumnSegment.html=a.html,this.addColumnSegment.value=a.value}transformChanged(){this.panel.columns=[],"annotations"===this.panel.transform?this.panelCtrl.refresh():("timeseries_aggregations"===this.panel.transform&&this.panel.columns.push({text:"Avg",value:"avg"}),this.updateTransformHints(),this.render())}render(){this.panelCtrl.render()}removeColumn(t){this.panel.columns=(0,i.without)(this.panel.columns,t),this.panelCtrl.render()}}function w(t){return{restrict:"E",scope:!0,templateUrl:"public/app/plugins/panel/table-old/editor.html",controller:C}}C.$inject=["$scope","uiSegmentSrv"];var x=a(90923);function M(t,e,a){return e in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}class D{constructor(t,e,a,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:(0,x.getTemplateSrv)(),i=arguments.length>5?arguments[5]:void 0;M(this,"formatters",[]),M(this,"colorState",void 0),this.panel=t,this.table=e,this.timeZone=a,this.sanitize=s,this.templateSrv=n,this.theme=i,this.initColumns()}setTable(t){this.table=t,this.initColumns()}initColumns(){this.formatters=[],this.colorState={};for(let t=0;t0;a--)if(t>=e.thresholds[a-1])return this.theme.visualization.getColorByName(e.colors[a]);return this.theme.visualization.getColorByName((0,i.first)(e.colors))}defaultCellFormatter(t,e){return null==t||void 0===t?"":((0,i.isArray)(t)&&(t=t.join(", ")),e&&e.sanitize?this.sanitize(t):(0,i.escape)(t))}createColumnFormatter(t){if(!t.style)return this.defaultCellFormatter;if("hidden"===t.style.type)return t=>{};if("date"===t.style.type)return e=>null==e?"-":((0,i.isArray)(e)&&(e=e[0]),(0,i.isString)(e)&&!isNaN(e)&&e.length>12&&(e=parseInt(e,10)),t.style.dateFormat?(0,r.dateTimeFormat)(e,{format:t.style.dateFormat,timeZone:this.timeZone}):(0,r.dateTimeFormatISO)(e,{timeZone:this.timeZone}));if("string"===t.style.type)return e=>{(0,i.isArray)(e)&&(e=e.join(", "));const a=t.style.mappingType||0;if(1===a&&t.style.valueMaps)for(let a=0;a=Number(e))return this.setColorState(e,t.style),this.defaultCellFormatter(s.text,t.style)}else if("null"===s.from&&"null"===s.to)return s.text}return null==e?"-":(this.setColorState(e,t.style),this.defaultCellFormatter(e,t.style))};if("number"===t.style.type){const e=(0,r.getValueFormat)(t.unit||t.style.unit);return a=>null==a?"-":isNaN(a)||(0,i.isArray)(a)?this.defaultCellFormatter(a,t.style):(this.setColorState(a,t.style),(0,r.formattedValueToString)(e(a,t.style.decimals,null)))}return e=>this.defaultCellFormatter(e,t.style)}setColorState(t,e){if(!e.colorMode)return;if(null==t||(0,i.isArray)(t))return;const a=Number(t);isNaN(a)||(this.colorState[e.colorMode]=this.getColorForValue(a,e))}renderRowVariables(t){const e={};let a;const s=this.table.rows[t];for(let t=0;t3&&void 0!==arguments[3]&&arguments[3];a=this.formatColumnValue(t,a);const n=this.table.columns[t],o=[];let l="";const h=[];let u="";this.colorState.cell?(o.push("background-color:"+this.colorState.cell),h.push("table-panel-color-cell"),this.colorState.cell=null):this.colorState.value&&(o.push("color:"+this.colorState.value),this.colorState.value=null);let c="";if(s&&(c='
'+this.table.columns[t].title+"
"),void 0===a?(o.push("display:none"),n.hidden=!0):n.hidden=!1,!0===n.hidden)return"";if(n.style&&n.style.preserveFormat&&h.push("table-panel-cell-pre"),n.style&&n.style.align){const t=(0,i.find)(d.alignTypesEnum,["text",n.style.align]);t&&t.value&&o.push(`text-align:${t.value}`)}if(o.length&&(l=' style="'+o.join(";")+'"'),n.style&&n.style.link){const t=this.renderRowVariables(e);t.__cell={value:a,text:a?a.toString():""};const s=this.templateSrv.replace(n.style.linkUrl,t,encodeURIComponent),i=r.textUtil.sanitizeUrl(s),o=r.textUtil.escapeHtml(this.templateSrv.replace(n.style.linkTooltip,t)),u=n.style.linkTargetBlank?"_blank":"";h.push("table-panel-cell-link"),c+=``,c+=`${a}`,c+=""}else c+=a;return n.filterable&&(h.push("table-panel-cell-filterable"),c+=``,c+='',c+="",c+=``,c+='',c+=""),h.length&&(u=' class="'+h.join(" ")+'"'),c=""+c+"",c}render(t){const e=this.panel.pageSize||100,a=t*e,s=Math.min(a+e,this.table.rows.length);let n="";for(let t=a;t"+s+""}return n}render_values(){const t=[],e=this.table.columns.filter((t=>!t.hidden));for(let e=0;e"row"===t.colorMode))),this.panelHasLinks=Boolean(this.panel.styles.find((t=>t.link))),this.events.on(r.PanelEvents.dataReceived,this.onDataReceived.bind(this)),this.events.on(r.PanelEvents.dataSnapshotLoad,this.onDataReceived.bind(this)),this.events.on(r.PanelEvents.editModeInitialized,this.onInitEditMode.bind(this))}onInitEditMode(){this.addEditorTab("Options",w,2),this.addEditorTab("Column Styles",p,3)}migrateToPanel(t){this.onPluginTypeChange(o.ZP.panels[t])}issueQueries(t){return this.pageIndex=0,"annotations"===this.panel.transform?this.annotationsSrv.getAnnotations({dashboard:this.dashboard,panel:this.panel,range:this.range}).then((t=>(this.loading=!1,this.dataRaw=t,this.pageIndex=0,this.render(),{data:this.dataRaw}))):super.issueQueries(t)}onDataReceived(t){this.dataRaw=t,this.pageIndex=0,this.dataRaw&&this.dataRaw.length&&((0,r.isTableData)(this.dataRaw[0])?this.panel.transform="table":"docs"===this.dataRaw[0].type?this.panel.transform="json":"table"!==this.panel.transform&&"json"!==this.panel.transform||(this.panel.transform="timeseries_to_rows")),this.render()}render(){return this.table=function(t,e){const a=new m.Z;if(!t||0===t.length)return a;const s=f[e.transform];if(!s)throw{message:"Transformer "+e.transform+" not found"};return s.transform(t,e,a),a}(this.dataRaw,this.panel),this.table.sort(this.panel.sort),this.renderer=new D(this.panel,this.table,this.dashboard.getTimezone(),this.$sanitize,this.templateSrv,o.ZP.theme),super.render(this.table)}toggleColumnSort(t,e){this.table.columns[this.panel.sort.col]&&(this.table.columns[this.panel.sort.col].sort=!1),this.panel.sort.col===e?this.panel.sort.desc?this.panel.sort.desc=!1:this.panel.sort.col=null:(this.panel.sort.col=e,this.panel.sort.desc=!0),this.render()}link(t,e,a,s){let i;const o=s.panel;let h=0;function c(){let t=s.height;return h>1&&(t-=26),t-31+"px"}function d(){const t=e.parents(".panel-content"),a=e.find(".table-panel-scroll"),r=e.find("tbody"),l=e.find(".table-panel-footer");e.css({"font-size":o.fontSize}),t.addClass("table-panel-content"),function(t){s.renderer.setTable(i),t.empty(),t.html(s.renderer.render(s.pageIndex))}(r),function(t){t.empty();const e=o.pageSize||100;if(h=Math.ceil(i.rows.length/e),1===h)return;const a=Math.max(s.pageIndex-3,0),r=Math.min(h,a+9),l=n()("
    ");for(let t=a;t'+(t+1)+"");l.append(a)}t.append(l)}(l),a.css({"max-height":c()})}e.tooltip({selector:"[data-link-tooltip]"}),e.on("click",".table-panel-page-link",(function(t){const e=n()(t.currentTarget);s.pageIndex=parseInt(e.text(),10)-1,d()})),e.on("click",".table-panel-filter-link",(function(t){const e=n()(t.currentTarget).data(),a={datasource:o.datasource,key:i.columns[e.column].text,value:i.rows[e.row][e.column],operator:e.operator};(0,u.WI)((0,l.m2)(a))}));const p=t.$on("$destroy",(()=>{e.off("click",".table-panel-page-link"),e.off("click",".table-panel-filter-link"),p()}));s.events.on(r.PanelEvents.render,(t=>{i=t||i,i&&d(),s.renderingCompleted()}))}}P.$inject=["$scope","$injector","annotationsSrv","$sanitize"],T(P,"templateUrl","module.html");const $=new r.PanelPlugin(null);$.angularPanelCtrl=P,$.setNoPadding()},60974:(t,e,a)=>{a.r(e),a.d(e,{MetricsPanelCtrl:()=>h,PanelCtrl:()=>l,QueryCtrl:()=>u,loadPluginCss:()=>n.loadPluginCss});var s=a(43215),n=a(90923),i=a(15866),r=a(91082),o=a(88643);const l=(0,s.makeClassES5Compatible)(r.q),h=(0,s.makeClassES5Compatible)(i.k),u=(0,s.makeClassES5Compatible)(o.G)}}]); //# sourceMappingURL=tableOldPlugin.8cc901e4b2a126e67fa7.js.map