mirror of
https://github.com/timberjoegithub/grafana-statusmap.git
synced 2026-07-22 15:53:09 +00:00
fix: remove messages 'Using strings as events are deprecated'
This commit is contained in:
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
1. @grafana/data is not supported in grafana 5.x and 6.2. The workaround is
|
||||
the module `./libs/grafana/events` that include copy-pasted events
|
||||
from @grafana/data and app/core from grafana sources.
|
||||
|
||||
2. Newly Grafana versions flood Console with
|
||||
"Usage strings as events is deprecated ..." messages.
|
||||
This module has a function to detect if Grafana’s Emitter support AppEvent style event ids.
|
||||
|
||||
Vendored
+38
@@ -0,0 +1,38 @@
|
||||
"use strict";
|
||||
|
||||
System.register([], function (_export, _context) {
|
||||
"use strict";
|
||||
|
||||
// Old Grafana releases use strings as event ids and
|
||||
// new event ids in form of object {name: "event-id"} are not
|
||||
// supported properly: first defined listener will receive
|
||||
// all emitted events despite of the value in 'name' field.
|
||||
//
|
||||
// This method detects this behaviour and return true
|
||||
// only for new Grafana versions.
|
||||
function hasAppEventCompatibleEmitter(emitter) {
|
||||
var receiveEvents = 0;
|
||||
var eventId = {
|
||||
name: "non-existed-event-id"
|
||||
};
|
||||
var eventId2 = {
|
||||
name: "non-existed-event-id-2"
|
||||
};
|
||||
emitter.on(eventId, function () {
|
||||
receiveEvents++;
|
||||
});
|
||||
emitter.emit(eventId);
|
||||
emitter.emit(eventId2);
|
||||
emitter.removeAllListeners(eventId); // New Grafana versions should receive one event.
|
||||
|
||||
return receiveEvents == 1;
|
||||
}
|
||||
|
||||
_export("hasAppEventCompatibleEmitter", hasAppEventCompatibleEmitter);
|
||||
|
||||
return {
|
||||
setters: [],
|
||||
execute: function () {}
|
||||
};
|
||||
});
|
||||
//# sourceMappingURL=funcs.js.map
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../src/libs/polygrafill/funcs.ts"],"names":["hasAppEventCompatibleEmitter","emitter","receiveEvents","eventId","name","eventId2","on","emit","removeAllListeners"],"mappings":";;;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,WAASA,4BAAT,CAAsCC,OAAtC,EAAgE;AACnE,QAAIC,aAAa,GAAG,CAApB;AACA,QAAIC,OAAY,GAAG;AAACC,MAAAA,IAAI,EAAE;AAAP,KAAnB;AACA,QAAIC,QAAa,GAAG;AAACD,MAAAA,IAAI,EAAE;AAAP,KAApB;AACAH,IAAAA,OAAO,CAACK,EAAR,CAAWH,OAAX,EAAoB,YAAU;AAC1BD,MAAAA,aAAa;AAChB,KAFD;AAGAD,IAAAA,OAAO,CAACM,IAAR,CAAaJ,OAAb;AACAF,IAAAA,OAAO,CAACM,IAAR,CAAaF,QAAb;AACAJ,IAAAA,OAAO,CAACO,kBAAR,CAA2BL,OAA3B,EATmE,CAWnE;;AACA,WAAOD,aAAa,IAAI,CAAxB;AACH;;0CAbeF,4B","sourcesContent":["import { Emitter } from 'app/core/utils/emitter';\n\n// Old Grafana releases use strings as event ids and\n// new event ids in form of object {name: \"event-id\"} are not\n// supported properly: first defined listener will receive\n// all emitted events despite of the value in 'name' field.\n//\n// This method detects this behaviour and return true\n// only for new Grafana versions.\nexport function hasAppEventCompatibleEmitter(emitter: Emitter):boolean {\n let receiveEvents = 0;\n let eventId: any = {name: \"non-existed-event-id\"};\n let eventId2: any = {name: \"non-existed-event-id-2\"};\n emitter.on(eventId, function(){\n receiveEvents++;\n });\n emitter.emit(eventId);\n emitter.emit(eventId2);\n emitter.removeAllListeners(eventId);\n\n // New Grafana versions should receive one event.\n return receiveEvents == 1;\n}\n"],"file":"funcs.js"}
|
||||
Vendored
+16
@@ -0,0 +1,16 @@
|
||||
"use strict";
|
||||
|
||||
System.register(["./funcs"], function (_export, _context) {
|
||||
"use strict";
|
||||
|
||||
var Polygrafill;
|
||||
return {
|
||||
setters: [function (_funcs) {
|
||||
Polygrafill = _funcs;
|
||||
}],
|
||||
execute: function () {
|
||||
_export("Polygrafill", Polygrafill);
|
||||
}
|
||||
};
|
||||
});
|
||||
//# sourceMappingURL=index.js.map
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../src/libs/polygrafill/index.ts"],"names":["Polygrafill"],"mappings":";;;;;;;;AAAYA,MAAAA,W;;;6BACHA,W","sourcesContent":["import * as Polygrafill from './funcs';\nexport { Polygrafill };"],"file":"index.js"}
|
||||
Reference in New Issue
Block a user