@splunk/dashboard-event-handlers
Advanced tools
Comparing version 22.3.0 to 22.4.0
64
index.js
@@ -90,3 +90,3 @@ /*! | ||
/******/ // Load entry module and return exports | ||
/******/ return __webpack_require__(__webpack_require__.s = 1); | ||
/******/ return __webpack_require__(__webpack_require__.s = 2); | ||
/******/ }) | ||
@@ -154,2 +154,60 @@ /************************************************************************/ | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var SetToken = /** @class */ (function () { | ||
/** | ||
* A configuration object is passed to the handler | ||
* @constructor | ||
* @param {Object} options | ||
*/ | ||
function SetToken(options) { | ||
this.options = options; | ||
this.events = Array.isArray(options.events) ? options.events : ['any']; | ||
} | ||
/** | ||
* Determines if the custom event handler is designed to convert the event | ||
* @method canHandle | ||
* @param {VisualizationEvent} event | ||
* @returns {Boolean} true if the event handler will convert the event | ||
*/ | ||
SetToken.prototype.canHandle = function (event) { | ||
var _a, _b; | ||
return (event.type !== 'range.select' && | ||
!!((_a = this.options) === null || _a === void 0 ? void 0 : _a.token) && | ||
!!((_b = this.options) === null || _b === void 0 ? void 0 : _b.key) && | ||
(this.events.includes('any') || this.events.includes(event.type)) && | ||
// TODO: unset token if undefined? | ||
event.payload[this.options.key] !== undefined); | ||
}; | ||
/** | ||
* Convert the event payload into a list of actionable tasks | ||
* @method handle | ||
* @param {VisualizationEvent} event | ||
* @returns {EventAction[]} List of action(s) | ||
*/ | ||
SetToken.prototype.handle = function (event) { | ||
var _a; | ||
return Promise.resolve([ | ||
{ | ||
type: 'setToken', | ||
payload: { | ||
namespace: this.options.tokenNamespace || 'default', | ||
tokens: (_a = {}, | ||
_a[this.options.token] = "" + event.payload[this.options.key], | ||
_a), | ||
submit: true, | ||
}, | ||
}, | ||
]); | ||
}; | ||
return SetToken; | ||
}()); | ||
exports.default = SetToken; | ||
/***/ }), | ||
/* 2 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
@@ -159,5 +217,7 @@ return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.CustomUrlDrilldown = void 0; | ||
exports.SetToken = exports.CustomUrlDrilldown = void 0; | ||
var CustomUrlDrilldown_1 = __webpack_require__(0); | ||
Object.defineProperty(exports, "CustomUrlDrilldown", { enumerable: true, get: function () { return __importDefault(CustomUrlDrilldown_1).default; } }); | ||
var SetToken_1 = __webpack_require__(1); | ||
Object.defineProperty(exports, "SetToken", { enumerable: true, get: function () { return __importDefault(SetToken_1).default; } }); | ||
@@ -164,0 +224,0 @@ |
@@ -5,3 +5,3 @@ { | ||
"author": "Splunk", | ||
"version": "22.3.0", | ||
"version": "22.4.0", | ||
"scripts": { | ||
@@ -24,3 +24,3 @@ "build": "NODE_ENV=production webpack --config ./webpack.config.js --bail", | ||
"@babel/core": "^7.12.3", | ||
"@splunk/dashboard-build-tools": "22.3.0", | ||
"@splunk/dashboard-build-tools": "22.4.0", | ||
"jest": "^26.0.0", | ||
@@ -27,0 +27,0 @@ "raw-loader": "^4.0.0", |
export { default as CustomUrlDrilldown } from './CustomUrlDrilldown'; | ||
export { default as SetToken } from './SetToken'; | ||
//# sourceMappingURL=index.d.ts.map |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
53131
17
601