文件操作 - testDataDSPlugin.2427a858f877b88b2243.js
返回文件管理
返回主菜单
删除本文件
文件: /usr/share/grafana/public/build/testDataDSPlugin.2427a858f877b88b2243.js
编辑文件内容
(window.webpackJsonp=window.webpackJsonp||[]).push([[67],{RQDA:function(e,t,r){"use strict";r.r(t);var n=r("Obii"),a=r("D1y2"),o=r.n(a),i=r("t8hP");function u(e){return 0===e.indexOf("value")?[{name:e,children:[]}]:function e(t,r,n){if(n>=r.length)return t;if("*"===r[n])return t;var a=r[n],o=[],i=[a];a.startsWith("{")&&(i=a.replace(/\{|\}/g,"").split(","));var u=!0,s=!1,c=void 0;try{for(var l,f=t[Symbol.iterator]();!(u=(l=f.next()).done);u=!0){var d=l.value,p=!0,y=!1,m=void 0;try{for(var b,h=i[Symbol.iterator]();!(p=(b=h.next()).done);p=!0){var v=b.value;if(-1!==v.indexOf("*")){var g=v.replace("*","");new RegExp("^".concat(g,".*"),"gi").test(d.name)&&(o=o.concat(e([d],r,n+1)))}else d.name===v&&(o=o.concat(e(d.children,r,n+1)))}}catch(e){y=!0,m=e}finally{try{p||null==h.return||h.return()}finally{if(y)throw m}}}}catch(e){s=!0,c=e}finally{try{u||null==f.return||f.return()}finally{if(s)throw c}}return o}(function e(t,r){var n=[];if(r>5)return[];for(var a=0,o=["A","B","C"];a<o.length;a++){var i=o[a],u="".concat(t).concat(i);n.push({name:u,children:e(u,r+1)})}return n}("",0),e.split("."),0)}var s=r("0/uQ"),c=r("p0ib"),l=r("F/XL"),f=r("LvDl"),d=r.n(f),p=r("6blF"),y=0;function m(){return y=(y+Math.floor(5*Math.random()))%b.length,b[y]}var b=["At","vero","eos","et","accusamus","et","iusto","odio","dignissimos","ducimus","qui","blanditiis","praesentium","voluptatum","deleniti","atque","corrupti","quos","dolores","et","quas","molestias","excepturi","sint","occaecati","cupiditate","non","provident","similique","sunt","in","culpa","qui","officia","deserunt","mollitia","animi","id","est","laborum","et","dolorum","fuga","Et","harum","quidem","rerum","facilis","est","et","expedita","distinctio","Nam","libero","tempore","cum","soluta","nobis","est","eligendi","optio","cumque","nihil","impedit","quo","minus","id","quod","maxime","placeat","facere","possimus","omnis","voluptas","assumenda","est","omnis","dolor","repellendus","Temporibus","autem","quibusdam","et","aut","officiis","debitis","aut","rerum","necessitatibus","saepe","eveniet","ut","et","voluptates","repudiandae","sint","et","molestiae","non","recusandae","Itaque","earum","rerum","hic","tenetur","a","sapiente","delectus","ut","aut","reiciendis","voluptatibus","maiores","alias","consequatur","aut","perferendis","doloribus","asperiores","repellat"],h={type:"signal",speed:250,spread:3.5,noise:2.2,bands:1};function v(e,t){var r=Object(f.defaults)(e.stream,h);if("signal"===r.type)return function(e,t,r){return new p.a((function(a){var o="signal-".concat(r.panelId,"-").concat(e.refId),i=r.maxDataPoints||1e3,u=new n.CircularDataFrame({append:"tail",capacity:i});u.refId=e.refId,u.name=e.alias||"Signal "+e.refId,u.addField({name:"time",type:n.FieldType.time}),u.addField({name:"value",type:n.FieldType.number});for(var s=t.spread,c=t.speed,l=t.bands,f=void 0===l?0:l,d=t.noise,p=0;p<f;p++){var y=f>1?" ".concat(p+1):"";u.addField({name:"Min"+y,type:n.FieldType.number}),u.addField({name:"Max"+y,type:n.FieldType.number})}for(var m=100*Math.random(),b=null,h=function(e){m+=(Math.random()-.5)*s;var t=0;u.fields[t++].values.add(e),u.fields[t++].values.add(m);for(var r=m,n=m,a=0;a<f;a++)r-=Math.random()*d,n+=Math.random()*d,u.fields[t++].values.add(r),u.fields[t++].values.add(n)},v=Date.now()-i*c,g=0;g<i;g++)h(v),v+=c;return setTimeout((function e(){h(Date.now()),a.next({data:[u],key:o}),b=setTimeout(e,c)}),5),function(){console.log("unsubscribing to stream "+o),clearTimeout(b)}}))}(e,r,t);if("logs"===r.type)return function(e,t,r){return new p.a((function(a){var o="logs-".concat(r.panelId,"-").concat(e.refId),i=r.maxDataPoints||1e3,u=new n.CircularDataFrame({append:"tail",capacity:i});u.refId=e.refId,u.name=e.alias||"Logs "+e.refId,u.addField({name:"line",type:n.FieldType.string}),u.addField({name:"time",type:n.FieldType.time}),u.meta={preferredVisualisationType:"logs"};var s=t.speed,c=null;return setTimeout((function e(){u.values.time.add(Date.now()),u.values.line.add(function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:60,t=m();t.length<e;)t+=" "+m();return t}()),a.next({data:[u],key:o}),c=setTimeout(e,s)}),5),function(){console.log("unsubscribing to stream "+o),clearTimeout(c)}}))}(e,r,t);if("fetch"===r.type)return function(e,t,r){return new p.a((function(a){var o,i="fetch-".concat(r.panelId,"-").concat(e.refId),u=r.maxDataPoints||1e3,s=new n.CircularDataFrame({append:"tail",capacity:u});s.refId=e.refId,s.name=e.alias||"Fetch "+e.refId;var c=new n.CSVReader({callback:{onHeader:function(t){s.fields.length&&((s=new n.CircularDataFrame({append:"tail",capacity:u})).refId=e.refId,s.name="Fetch "+e.refId);var r=!0,a=!1,o=void 0;try{for(var i,c=t[Symbol.iterator]();!(r=(i=c.next()).done);r=!0){var l=i.value;s.addField(l)}}catch(e){a=!0,o=e}finally{try{r||null==c.return||c.return()}finally{if(a)throw o}}},onRow:function(e){s.add(e)}}}),l=function e(t){if(t.value){var r=(new TextDecoder).decode(t.value);c.readCSV(r)}return a.next({data:[s],key:i,state:t.done?n.LoadingState.Done:n.LoadingState.Streaming}),t.done?(console.log("Finished stream"),void a.complete()):o.read().then(e)};if(!t.url)throw new Error("query.url is not defined");return fetch(new Request(t.url)).then((function(e){e.body&&(o=e.body.getReader()).read().then(l)})),function(){console.log("unsubscribing to stream "+i)}}))}(e,r,t);throw new Error("Unknown Stream Type: ".concat(r.type))}var g=r("5kRJ"),w=r("+JjO");function O(e){return(O="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function S(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function j(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?S(Object(r),!0).forEach((function(t){I(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):S(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function I(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function P(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function _(e,t){return!t||"object"!==O(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function T(e){return(T=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function k(e,t){return(k=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var x=function(e){function t(e){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),_(this,T(t).call(this,e))}var r,n,a;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&k(e,t)}(t,e),r=t,(n=[{key:"query",value:function(e){var t=this,r=[],n=[],a=!0,o=!1,u=void 0;try{for(var l,f=e.targets[Symbol.iterator]();!(a=(l=f.next()).done);a=!0){var d=l.value;d.hide||("streaming_client"===d.scenarioId?n.push(v(d,e)):"grafana_api"===d.scenarioId?n.push(E(d,e)):"arrow"===d.scenarioId?n.push(D(d,e)):r.push(j({},d,{intervalMs:e.intervalMs,maxDataPoints:e.maxDataPoints,datasourceId:this.id,alias:g.b.replace(d.alias||"")})))}}catch(e){o=!0,u=e}finally{try{a||null==f.return||f.return()}finally{if(o)throw u}}if(r.length){var p=Object(i.getBackendSrv)().datasourceRequest({method:"POST",url:"/api/tsdb/query",data:{from:e.range.from.valueOf().toString(),to:e.range.to.valueOf().toString(),queries:r},requestId:e.requestId}).then((function(e){return t.processQueryResult(r,e)}));n.push(Object(s.a)(p))}return c.a.apply(void 0,n)}},{key:"processQueryResult",value:function(e,t){var r=[],n=void 0,a=!0,i=!1,u=void 0;try{for(var s,c=e[Symbol.iterator]();!(a=(s=c.next()).done);a=!0){var l=s.value,f=t.data.results[l.refId],d=!0,p=!1,y=void 0;try{for(var m,b=(f.tables||[])[Symbol.iterator]();!(d=(m=b.next()).done);d=!0){var h=m.value;h.refId=l.refId,h.name=l.alias,"logs"===l.scenarioId&&o()(h,"meta.preferredVisualisationType","logs"),r.push(h)}}catch(e){p=!0,y=e}finally{try{d||null==b.return||b.return()}finally{if(p)throw y}}var v=!0,g=!1,w=void 0;try{for(var O,S=(f.series||[])[Symbol.iterator]();!(v=(O=S.next()).done);v=!0){var j=O.value;r.push({target:j.name,datapoints:j.points,refId:l.refId,tags:j.tags})}}catch(e){g=!0,w=e}finally{try{v||null==S.return||S.return()}finally{if(g)throw w}}f.error&&(n={message:f.error})}}catch(e){i=!0,u=e}finally{try{a||null==c.return||c.return()}finally{if(i)throw u}}return{data:r,error:n}}},{key:"annotationQuery",value:function(e){for(var t=e.range.from.valueOf(),r=[],n=(e.range.to.valueOf()-t)/10,a=0;a<10;a++)r.push({annotation:e.annotation,time:t,text:'This is the text, <a href="https://grafana.com">Grafana.com</a>',tags:["text","server"]}),t+=n;return Promise.resolve(r)}},{key:"getQueryDisplayText",value:function(e){return e.alias?e.scenarioId+" as "+e.alias:e.scenarioId}},{key:"testDatasource",value:function(){return Promise.resolve({status:"success",message:"Data source is working"})}},{key:"getScenarios",value:function(){return Object(i.getBackendSrv)().get("/api/tsdb/testdata/scenarios")}},{key:"metricFindQuery",value:function(e,t){return new Promise((function(r,n){setTimeout((function(){var n=u(g.b.replace(e,Object(w.c)({query:e,wildcardChar:"*",options:t}))).map((function(e){return{value:e.name,text:e.name}}));r(n)}),100)}))}}])&&P(r.prototype,n),a&&P(r,a),t}(n.DataSourceApi);function D(e,t){var r=[];if(e.stringInput&&e.stringInput.length>10)try{var a=Object(n.base64StringToArrowTable)(e.stringInput);r=[Object(n.arrowTableToDataFrame)(a)]}catch(t){console.warn("Error reading saved arrow",t);var o=Object(i.toDataQueryError)(t);return o.refId=e.refId,Object(l.a)({state:n.LoadingState.Error,error:o,data:r})}return Object(l.a)({state:n.LoadingState.Done,data:r})}function E(e,t){var r="/api/".concat(e.stringInput);return Object(s.a)(Object(i.getBackendSrv)().get(r).then((function(e){var t=new n.ArrayDataFrame(e);return{state:n.LoadingState.Done,data:[t]}})))}var C=r("Csm0"),q=r("LzXI"),F=r("2KQq");function L(e){return(L="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function M(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function R(e,t){return!t||"object"!==L(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function Q(e){return(Q=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function A(e,t){return(A=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var V={timeStep:60,onCount:3,onValue:2,offCount:3,offValue:1},W={timeStep:60,valuesCSV:"0,0,2,2,1,1"},B=["random_walk","predictable_pulse","predictable_csv_wave"],$=function(e){function t(e,r){var a;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(a=R(this,Q(t).call(this,e,r))).showLabels=!1,a.target.scenarioId=a.target.scenarioId||"random_walk",a.scenarioList=[],a.newPointTime=Object(n.dateTime)(),a.selectedPoint={text:"Select point",value:null},a.showLabels=B.includes(a.target.scenarioId),a.selectors=C.selectors.components.DataSource.TestData.QueryTab,a}var r,a,o;return t.$inject=["$scope","$injector"],function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&A(e,t)}(t,e),r=t,(a=[{key:"getPoints",value:function(){return d.a.map(this.target.points,(function(e,t){return{text:Object(n.dateTime)(e[1]).format("MMMM Do YYYY, H:mm:ss")+" : "+e[0],value:t}}))}},{key:"pointSelected",value:function(e){this.selectedPoint=e}},{key:"deletePoint",value:function(){this.target.points.splice(this.selectedPoint.value,1),this.selectedPoint={text:"Select point",value:null},this.refresh()}},{key:"addPoint",value:function(){this.target.points=this.target.points||[],this.newPointTime=n.dateMath.parse(this.newPointTime),this.target.points.push([this.newPointValue,this.newPointTime.valueOf()]),this.target.points=d.a.sortBy(this.target.points,(function(e){return e[1]})),this.refresh()}},{key:"$onInit",value:function(){var e=this;return Object(F.a)(this.$scope)(Object(i.getBackendSrv)().get("/api/tsdb/testdata/scenarios").then((function(t){e.scenarioList=t,e.scenario=d.a.find(e.scenarioList,{id:e.target.scenarioId})})))}},{key:"scenarioChanged",value:function(){var e;this.scenario=d.a.find(this.scenarioList,{id:this.target.scenarioId}),"manual_entry"===this.target.scenarioId?this.target.points=this.target.points||[]:delete this.target.points,"streaming_client"===this.target.scenarioId?this.target.stream=d.a.defaults(this.target.stream||{},h):delete this.target.stream,"predictable_pulse"===this.target.scenarioId?this.target.pulseWave=d.a.defaults(this.target.pulseWave||{},V):delete this.target.pulseWave,"predictable_csv_wave"===this.target.scenarioId?this.target.csvWave=d.a.defaults(this.target.csvWave||{},W):delete this.target.csvWave,"grafana_api"===this.target.scenarioId?this.target.stringInput="datasources":delete this.target.stringInput,this.target.stringInput=null!==(e=this.scenario.stringInput)&&void 0!==e?e:void 0,this.showLabels=B.includes(this.target.scenarioId),this.refresh()}},{key:"streamChanged",value:function(){this.refresh()}}])&&M(r.prototype,a),o&&M(r,o),t}(q.QueryCtrl);$.templateUrl="partials/query.editor.html";var J=r("q1tI"),Y=r.n(J);function G(e){return(G="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function H(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function N(e,t){return!t||"object"!==G(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function U(e){return(U=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function X(e,t){return(X=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var z=function(e){function t(e){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),N(this,U(t).call(this,e))}var r,n,a;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&X(e,t)}(t,e),r=t,(n=[{key:"render",value:function(){return Y.a.createElement("div",null,"See github for more information about setting up a reproducable test environment.",Y.a.createElement("br",null),Y.a.createElement("br",null),Y.a.createElement("a",{className:"btn btn-inverse",href:"https://github.com/grafana/grafana/tree/master/devenv",target:"_blank",rel:"noopener"},"Github"),Y.a.createElement("br",null))}}])&&H(r.prototype,n),a&&H(r,a),t}(J.PureComponent);function K(e){return(K="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Z(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ee(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function te(e,t){return!t||"object"!==K(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function re(e){return(re=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ne(e,t){return(ne=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var ae=function(e){function t(){return Z(this,t),te(this,re(t).apply(this,arguments))}var r,n,a;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ne(e,t)}(t,e),r=t,(n=[{key:"render",value:function(){return Y.a.createElement("div",null)}}])&&ee(r.prototype,n),a&&ee(r,a),t}(J.PureComponent);r.d(t,"plugin",(function(){return ie}));var oe=function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)};oe.template="<h2>Annotation scenario</h2>";var ie=new n.DataSourcePlugin(x).setConfigEditor(ae).setQueryCtrl($).setAnnotationQueryCtrl(oe).addConfigPage({title:"Setup",icon:"list-ul",body:z,id:"setup"})}}]); //# sourceMappingURL=testDataDSPlugin.2427a858f877b88b2243.js.map
修改文件时间
将文件时间修改为当前时间的前一年
删除文件