1344.b3f7a66d84fa430cc2a2.js 11 KB

12
  1. "use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[1344],{63773:(t,e,a)=>{a.d(e,{O:()=>n});var i=a(43215),s=a(90923);const r={http:80,https:443,ftp:21};class n{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,i.deprecationWarning)("$location",t.name,e||"locationService"),t.apply(a,arguments)}}absUrl(){return`${window.location.origin}${this.url()}`}hash(t){if((0,s.navigationLogger)("AngularLocationWrapper",!1,"Angular compat layer: hash"),t)throw new Error("AngularLocationWrapper method not implemented.");return s.locationService.getLocation().hash.slice(1)}host(){return new URL(window.location.href).hostname}path(t){(0,s.navigationLogger)("AngularLocationWrapper",!1,"Angular compat layer: path");const e=s.locationService.getLocation();if(null!=t){let a=String(t);a=a.startsWith("/")?a:`/${a}`;const i=new URL(`${window.location.origin}${a}`);return s.locationService.push({pathname:i.pathname,search:i.search.length>0?i.search:e.search,hash:i.hash.length>0?i.hash:e.hash}),this}return null===t?(s.locationService.push("/"),this):e.pathname}port(){const t=new URL(window.location.href);return parseInt(t.port,10)||r[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,s.navigationLogger)("AngularLocationWrapper",!1,"Angular compat layer: search"),!t)return s.locationService.getSearchObject();if(t&&arguments.length>1)return s.locationService.partial({[t]:e}),this;if(t){let e;e="object"==typeof t?Object.assign({},t):(0,s.locationSearchToObject)(t);for(const t of Object.keys(e))null!==e[t]&&void 0!==e[t]||delete e[t];const a=i.urlUtil.renderUrl(s.locationService.getLocation().pathname,e);s.locationService.push(a)}return this}state(t){throw(0,s.navigationLogger)("AngularLocationWrapper",!1,"Angular compat layer: state"),new Error("AngularLocationWrapper method not implemented.")}url(t){if((0,s.navigationLogger)("AngularLocationWrapper",!1,"Angular compat layer: url"),void 0!==t)return t.startsWith("#")?s.locationService.push(Object.assign({},s.locationService.getLocation(),{hash:t})):t.startsWith("?")?s.locationService.push(Object.assign({},s.locationService.getLocation(),{search:t})):0===t.trim().length?s.locationService.push("/"):s.locationService.push(t),s.locationService;const e=s.locationService.getLocation();return`${e.pathname}${e.search}${e.hash}`}}},79281:(t,e,a)=>{a.d(e,{H:()=>n,m:()=>r});var i=a(82897);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}class r{constructor(t){s(this,"type",void 0),s(this,"style",void 0),s(this,"label",void 0),s(this,"params",void 0),s(this,"defaultParams",void 0),s(this,"wrapOpen",void 0),s(this,"wrapClose",void 0),s(this,"separator",void 0),this.type=t.type,t.label?this.label=t.label:this.label=this.type[0].toUpperCase()+this.type.substring(1)+":",this.style=t.style,"function"===this.style?(this.wrapOpen="(",this.wrapClose=")",this.separator=", "):(this.wrapOpen=" ",this.wrapClose=" ",this.separator=" "),this.params=t.params,this.defaultParams=t.defaultParams}}class n{constructor(t,e){if(s(this,"part",void 0),s(this,"def",void 0),s(this,"params",void 0),s(this,"label",void 0),s(this,"name",void 0),s(this,"datatype",void 0),this.part=t,this.def=e,!this.def)throw{message:"Could not find sql part "+t.type};this.datatype=t.datatype,t.name?(this.name=t.name,this.label=e.label+" "+t.name):(this.name="",this.label=e.label),t.params=t.params||(0,i.clone)(this.def.defaultParams),this.params=t.params}updateParam(t,e){""===t&&this.def.params[e].optional?this.params.splice(e,1):this.params[e]=t,this.part.params=this.params}}},15866:(t,e,a)=>{a.d(e,{k:()=>h});var i=a(82897),s=a(43215),r=a(91082),n=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 h extends r.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===s.LoadingState.Error&&(this.loading=!1,this.processDataError(t.error)),t.state===s.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,s.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(s.PanelEvents.refresh,this.onMetricsPanelRefresh.bind(this)),this.events.on(s.PanelEvents.panelTeardown,this.onPanelTearDown.bind(this)),this.events.on(s.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,i.isArray)(t)||(t=t.data),this.panelData={state:s.LoadingState.Done,series:t,timeRange:this.range},this.$timeout((()=>{this.events.emit(s.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,n.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,s.toDataFrameDTO)(t))));try{this.events.emit(s.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(s.PanelEvents.dataReceived,t.data)}catch(t){this.processDataError(t)}}}},91082:(t,e,a)=>{a.d(e,{q:()=>l});var i=a(82897),s=a(43215),r=a(63773),n=a(78837),o=a(98163);function h(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{constructor(t,e){var a,i;h(this,"panel",void 0),h(this,"error",void 0),h(this,"pluginName",""),h(this,"pluginId",""),h(this,"editorTabs",void 0),h(this,"$scope",void 0),h(this,"$injector",void 0),h(this,"$timeout",void 0),h(this,"editModeInitiated",!1),h(this,"containerHeight",void 0),h(this,"events",void 0),h(this,"loading",!1),h(this,"timing",void 0),h(this,"$location",void 0),h(this,"onPluginTypeChange",(t=>{})),this.panel=null!==(a=this.panel)&&void 0!==a?a:t.$parent.panel,this.dashboard=null!==(i=this.dashboard)&&void 0!==i?i:t.$parent.dashboard,this.$injector=e,this.$scope=t,this.$timeout=e.get("$timeout"),this.editorTabs=[],this.$location=new r.O,this.events=new s.EventBusSrv,this.timing={};const o=n.ZP.panels[this.panel.type];o&&(this.pluginId=o.id,this.pluginName=o.name),t.$on(s.PanelEvents.componentDidMount.name,(()=>this.panelDidMount()))}panelDidMount(){this.events.emit(s.PanelEvents.componentDidMount),this.events.emit(s.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(s.PanelEvents.editModeInitialized))}addEditorTab(t,e,a,s){const r={title:t,directiveFn:e,icon:s};(0,i.isString)(e)&&(r.directiveFn=()=>({templateUrl:e})),a?this.editorTabs.splice(a,0,r):this.editorTabs.push(r)}getExtendedMenu(){const t=[];return this.events.emit(s.PanelEvents.initPanelActions,t),t}async getAdditionalMenuItems(){return[]}otherPanelInFullscreenMode(){return this.dashboard.otherPanelInFullscreen(this.panel)}render(t){this.events.emit(s.PanelEvents.render,t)}}},88643:(t,e,a)=>{a.d(e,{G:()=>r});var i=a(82897);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}class r{constructor(t,e){var a,r,n,o,h;s(this,"target",void 0),s(this,"datasource",void 0),s(this,"panelCtrl",void 0),s(this,"panel",void 0),s(this,"hasRawMode",void 0),s(this,"error",void 0),s(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!==(r=this.target)&&void 0!==r?r:t.ctrl.target,this.datasource=null!==(n=this.datasource)&&void 0!==n?n:t.ctrl.datasource,this.panel=null!==(o=null===(h=this.panelCtrl)||void 0===h?void 0:h.panel)&&void 0!==o?o:t.ctrl.panelCtrl.panel,this.isLastQuery=(0,i.indexOf)(this.panel.targets,this.target)===this.panel.targets.length-1}refresh(){this.panelCtrl.refresh()}}},4344:(t,e,a)=>{let i;a.d(e,{HX:()=>i,Xr:()=>s,wP:()=>r}),function(t){t.Password="password",t.BasicAuthPassword="basicAuthPassword"}(i||(i={}));const s=(t,e)=>a=>{a.preventDefault(),t.current[e]=void 0,t.current.secureJsonFields[e]=!1,t.current.secureJsonData=t.current.secureJsonData||{},t.current.secureJsonData[e]=""},r=(t,e)=>a=>{t.current.secureJsonData=t.current.secureJsonData||{},t.current.secureJsonData[e]=a.currentTarget.value}},60974:(t,e,a)=>{a.r(e),a.d(e,{MetricsPanelCtrl:()=>l,PanelCtrl:()=>h,QueryCtrl:()=>c,loadPluginCss:()=>s.loadPluginCss});var i=a(43215),s=a(90923),r=a(15866),n=a(91082),o=a(88643);const h=(0,i.makeClassES5Compatible)(n.q),l=(0,i.makeClassES5Compatible)(r.k),c=(0,i.makeClassES5Compatible)(o.G)}}]);
  2. //# sourceMappingURL=1344.b3f7a66d84fa430cc2a2.js.map