EVOLUTION-MANAGER
Edit File: module.js
define(["lodash"],(function(t){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var a=e[n]={i:n,l:!1,exports:{}};return t[n].call(a.exports,a,a.exports,r),a.l=!0,a.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var a in t)r.d(n,a,function(e){return t[e]}.bind(null,a));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="/",r(r.s=1)}([function(e,r){e.exports=t},function(t,e,r){"use strict";r.r(e);var n=function(){return(n=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var a in e=arguments[r])Object.prototype.hasOwnProperty.call(e,a)&&(t[a]=e[a]);return t}).apply(this,arguments)};var a=r(0),i=function(){function t(t,e,r){this.backendSrv=e,this.templateSrv=r,this.name=t.name,this.url=void 0===t.url?"":t.url,this.backendSrv=e,this.templateSrv=r,this.withCredentials=void 0!==t.withCredentials,this.headers={"Content-Type":"application/json"},"string"==typeof t.basicAuth&&t.basicAuth.length>0&&(this.headers.Authorization=t.basicAuth)}return t.$inject=["instanceSettings","backendSrv","templateSrv"],t.prototype.query=function(t){var e=this.buildQueryParameters(t);return e.targets.length<=0?Promise.resolve({data:[]}):(this.templateSrv.getAdhocFilters?e.adhocFilters=this.templateSrv.getAdhocFilters(this.name):e.adhocFilters=[],t.scopedVars=n(n({},this.getVariables()),t.scopedVars),this.doRequest({url:this.url+"/query",data:e,method:"POST"}))},t.prototype.testDatasource=function(){return this.doRequest({url:this.url+"/",method:"GET"}).then((function(t){return 200===t.status?{status:"success",message:"Data source is working",title:"Success"}:{status:"error",message:"Data source is not working: "+t.message,title:"Error"}}))},t.prototype.annotationQuery=function(t){var e={annotation:{query:this.templateSrv.replace(t.annotation.query,{},"glob"),name:t.annotation.name,datasource:t.annotation.datasource,enable:t.annotation.enable,iconColor:t.annotation.iconColor},range:t.range,rangeRaw:t.rangeRaw,variables:this.getVariables()};return this.doRequest({url:this.url+"/annotations",method:"POST",data:e}).then((function(t){return t.data}))},t.prototype.metricFindQuery=function(t,e,r){var n={type:r,target:this.templateSrv.replace(t,null,"regex")};return this.doRequest({url:this.url+"/search",data:n,method:"POST"}).then(this.mapToTextValue)},t.prototype.mapToTextValue=function(t){return t.data.map((function(t,e){return t&&t.text&&t.value?{text:t.text,value:t.value}:Object(a.isObject)(t)?{text:t,value:e}:{text:t,value:t}}))},t.prototype.doRequest=function(t){return t.withCredentials=this.withCredentials,t.headers=this.headers,this.backendSrv.datasourceRequest(t)},t.prototype.buildQueryParameters=function(t){var e=this;return t.targets=t.targets.filter((function(t){return"select metric"!==t.target})).map((function(r){var n=null;void 0!==r.data&&""!==r.data.trim()&&(n=JSON.parse(r.data,(function(r,n){return"string"==typeof n?n.replace(e.templateSrv.regex,(function(r){return e.cleanMatch(r,t)})):n})));var a=r.target;return"string"==typeof a&&(a=e.templateSrv.replace(r.target.toString(),t.scopedVars,"regex")),{data:n,target:a,refId:r.refId,hide:r.hide,type:r.type}})),t},t.prototype.cleanMatch=function(t,e){var r=this.templateSrv.replace(t,e.scopedVars,"json");return"string"==typeof r&&'"'===r[0]&&'"'===r[r.length-1]?JSON.parse(r):r},t.prototype.getVariables=function(){var t=Object(a.isUndefined)(this.templateSrv.index)?{}:this.templateSrv.index,e={};return Object.keys(t).forEach((function(r){var n=t[r],i=n.current.value;("$__all"===i||Object(a.isEqual)(i,["$__all"]))&&(i=null===n.allValue?n.options.slice(1).map((function(t){return t.value})):n.allValue),e[r]={text:n.current.text,value:i}})),e},t.prototype.getTagKeys=function(t){var e=this;return new Promise((function(r){e.doRequest({url:e.url+"/tag-keys",method:"POST",data:t}).then((function(t){return r(t.data)}))}))},t.prototype.getTagValues=function(t){var e=this;return new Promise((function(r){e.doRequest({url:e.url+"/tag-values",method:"POST",data:t}).then((function(t){return r(t.data)}))}))},t}(),o=function(){function t(){this.target.hide=!1,this.target.target=this.target.target||"select metric",this.target.type||(this.target.type="table"===this.panelCtrl.panel.type?"table":"timeseries"),this.target.data=this.target.data||"",this.types=[{text:"Time series",value:"timeseries"},{text:"Table",value:"table"}],this.showJSON=!1}return t.prototype.findMetrics=function(t){return this.datasource.metricFindQuery(t,void 0,this.target.type)},t.prototype.toggleEditorMode=function(){this.target.rawQuery=!this.target.rawQuery},t.prototype.onChangeInternal=function(){this.panelCtrl.refresh()},t.templateUrl="partials/query.editor.html",t}();r.d(e,"ConfigCtrl",(function(){return u})),r.d(e,"QueryOptionsCtrl",(function(){return s})),r.d(e,"AnnotationsQueryCtrl",(function(){return l})),r.d(e,"Datasource",(function(){return i})),r.d(e,"QueryCtrl",(function(){return o}));var u=function(){function t(){}return t.templateUrl="partials/config.html",t}(),s=function(){function t(){}return t.templateUrl="partials/query.options.html",t}(),l=function(){function t(){}return t.templateUrl="partials/annotations.editor.html",t}()}])}));