@splunk/visualizations 26.0.0 → 26.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Area.config.js +102 -18
- package/Area.config.js.map +1 -1
- package/Area.js +618 -221
- package/Area.js.map +1 -1
- package/Bar.config.js +104 -20
- package/Bar.config.js.map +1 -1
- package/Bar.js +624 -219
- package/Bar.js.map +1 -1
- package/Bubble.config.js +94 -20
- package/Bubble.config.js.map +1 -1
- package/Bubble.js +606 -211
- package/Bubble.js.map +1 -1
- package/ChoroplethSvg.config.js +65 -14
- package/ChoroplethSvg.config.js.map +1 -1
- package/ChoroplethSvg.js +550 -183
- package/ChoroplethSvg.js.map +1 -1
- package/Column.config.js +103 -18
- package/Column.config.js.map +1 -1
- package/Column.js +637 -221
- package/Column.js.map +1 -1
- package/Ellipse.config.js +82 -17
- package/Ellipse.config.js.map +1 -1
- package/Ellipse.js +425 -148
- package/Ellipse.js.map +1 -1
- package/Events.config.js +100 -18
- package/Events.config.js.map +1 -1
- package/Events.js +752 -293
- package/Events.js.map +1 -1
- package/FillerGauge.config.js +96 -27
- package/FillerGauge.config.js.map +1 -1
- package/FillerGauge.js +759 -374
- package/FillerGauge.js.map +1 -1
- package/Image.config.js +62 -18
- package/Image.config.js.map +1 -1
- package/Image.js +419 -154
- package/Image.js.map +1 -1
- package/Line.config.js +106 -22
- package/Line.config.js.map +1 -1
- package/Line.js +631 -223
- package/Line.js.map +1 -1
- package/LinkGraph.config.js +72 -22
- package/LinkGraph.config.js.map +1 -1
- package/LinkGraph.js +632 -219
- package/LinkGraph.js.map +1 -1
- package/MIGRATION.md +1082 -0
- package/Map.config.js +241 -97
- package/Map.config.js.map +1 -1
- package/Map.js +1195 -595
- package/Map.js.map +1 -1
- package/Markdown.config.js +70 -20
- package/Markdown.config.js.map +1 -1
- package/Markdown.js +460 -195
- package/Markdown.js.map +1 -1
- package/MarkerGauge.config.js +79 -21
- package/MarkerGauge.config.js.map +1 -1
- package/MarkerGauge.js +802 -411
- package/MarkerGauge.js.map +1 -1
- package/ParallelCoordinates.config.js +72 -18
- package/ParallelCoordinates.config.js.map +1 -1
- package/ParallelCoordinates.js +853 -484
- package/ParallelCoordinates.js.map +1 -1
- package/Pie.config.js +75 -22
- package/Pie.config.js.map +1 -1
- package/Pie.js +612 -212
- package/Pie.js.map +1 -1
- package/Punchcard.config.js +81 -29
- package/Punchcard.config.js.map +1 -1
- package/Punchcard.js +844 -379
- package/Punchcard.js.map +1 -1
- package/Rectangle.config.js +85 -19
- package/Rectangle.config.js.map +1 -1
- package/Rectangle.js +432 -152
- package/Rectangle.js.map +1 -1
- package/Sankey.config.js +84 -22
- package/Sankey.config.js.map +1 -1
- package/Sankey.js +878 -342
- package/Sankey.js.map +1 -1
- package/Scatter.config.js +96 -22
- package/Scatter.config.js.map +1 -1
- package/Scatter.js +607 -212
- package/Scatter.js.map +1 -1
- package/SingleValue.config.js +94 -24
- package/SingleValue.config.js.map +1 -1
- package/SingleValue.js +1182 -650
- package/SingleValue.js.map +1 -1
- package/SingleValueBasic.js +286 -225
- package/SingleValueBasic.js.map +1 -1
- package/SingleValueIcon.config.js +92 -22
- package/SingleValueIcon.config.js.map +1 -1
- package/SingleValueIcon.js +965 -506
- package/SingleValueIcon.js.map +1 -1
- package/SingleValueRadial.config.js +99 -26
- package/SingleValueRadial.config.js.map +1 -1
- package/SingleValueRadial.js +1167 -616
- package/SingleValueRadial.js.map +1 -1
- package/SparkLine.js +126 -67
- package/SparkLine.js.map +1 -1
- package/Table.config.js +73 -20
- package/Table.config.js.map +1 -1
- package/Table.js +810 -322
- package/Table.js.map +1 -1
- package/common/Charting.js +107 -35
- package/common/Charting.js.map +1 -1
- package/common/ChartingApi.js +18 -7
- package/common/ChartingApi.js.map +1 -1
- package/common/EventsDoc.js +76 -22
- package/common/EventsDoc.js.map +1 -1
- package/common/GaugeMajorTicks.js +68 -58
- package/common/GaugeMajorTicks.js.map +1 -1
- package/common/GaugeValueMarker.js +43 -34
- package/common/GaugeValueMarker.js.map +1 -1
- package/common/OptionsDoc.js +156 -65
- package/common/OptionsDoc.js.map +1 -1
- package/common/OverviewDoc.js +33 -5
- package/common/OverviewDoc.js.map +1 -1
- package/common/SplunkVisualization.js +31 -4
- package/common/SplunkVisualization.js.map +1 -1
- package/common/SplunkVisualizationApi.js +8 -2
- package/common/SplunkVisualizationApi.js.map +1 -1
- package/common/ThemesDoc.js +27 -14
- package/common/ThemesDoc.js.map +1 -1
- package/common/chartingUtils.js +44 -12
- package/common/chartingUtils.js.map +1 -1
- package/common/docUtils.js +11 -1
- package/common/docUtils.js.map +1 -1
- package/common/gaugeUtils.js +173 -90
- package/common/gaugeUtils.js.map +1 -1
- package/common/shapeUtils.js +14 -2
- package/common/shapeUtils.js.map +1 -1
- package/common/utils/configUtils.js +49 -14
- package/common/utils/configUtils.js.map +1 -1
- package/common/utils/dataUtils.js +7 -2
- package/common/utils/dataUtils.js.map +1 -1
- package/common/utils/hocUtils.js +3 -1
- package/common/utils/hocUtils.js.map +1 -1
- package/common/utils/layoutUtils.js +1 -0
- package/common/utils/layoutUtils.js.map +1 -1
- package/common/utils/mapUtils.js +287 -127
- package/common/utils/mapUtils.js.map +1 -1
- package/common/utils/singleValueUtils.js +241 -196
- package/common/utils/singleValueUtils.js.map +1 -1
- package/common/utils/testHelper.js +9 -0
- package/common/utils/testHelper.js.map +1 -1
- package/common/utils/trellisUtils.js +61 -0
- package/common/utils/trellisUtils.js.map +1 -1
- package/common/utils/urlUtils.js +2 -0
- package/common/utils/urlUtils.js.map +1 -1
- package/common/withDashboardViz.js +274 -95
- package/common/withDashboardViz.js.map +1 -1
- package/package.json +16 -18
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///external \"prop-types\"","webpack:///./src/common/SplunkVisualization.tsx","webpack:///./src/common/interfaces/VizActionHandler.ts","webpack:///external \"lodash\"","webpack:///external \"@babel/runtime/helpers/classCallCheck\"","webpack:///external \"@babel/runtime/helpers/createClass\""],"names":["T","require","lodash_1","VizActionHandler_1","exports","INITIAL_WIDTH","INITIAL_HEIGHT","SplunkVisualization","_classCallCheck","propTypes","mode","oneOf","isRequired","width","oneOfType","string","number","height","context","object","options","onOptionsChange","func","dataSources","objectOf","shape","requestParams","data","fields","array","columns","error","level","message","meta","onEventTrigger","hasEventHandlers","bool","onComputedProps","vizActionHandlerRef","loading","theme","onRequestParamsChange","defaultProps","DefaultVizActionHandler","noop","default","_createClass","key","value","focus","snapshot"],"mappings":";;;;;;;QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;;AClFA,uC;;;;;;;;;;;;;;;ACAA;AACA,IAAAA,CAAA,GAAAC,mBAAA;AACA,IAAAC,QAAA,GAAAD,mBAAA;AAEA,IAAAE,kBAAA,GAAAF,mBAAA;AAEA;AACaG,OAAA,CAAAC,aAAa,GAAG,GAAG;AACnBD,OAAA,CAAAE,cAAc,GAAG,GAAG;AAEjC;;;AAAA,IAGMC,mBAAmB,YAAAA,oBAAA;EAAAC,eAAA,OAAAD,mBAAA;AAAA;AACdA,mBAAA,CAAAE,SAAS,GAAsD;EAClE;;;EAGAC,IAAI,EAAEV,CAAC,CA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MAAM;EACf;;;EAGAuB,qBAAqB,EAAE1C,CAAC,CAACsB;CAC5B;AAED;;;AAGOf,mBAAA,CAAAoC,YAAY,GAAsB;EACrC;EACA9B,KAAK,EAAE,MAAM;EACbI,MAAM,EAAEb,OAAA,CAAAE,cAAc;EACtBiB,WAAW,EAAE,EAAE;EACfY,cAAc,EAAE,SAAAA,eAAA;IAAA,OAAgC,EAAE;EAAA,CAAC;EACnDzB,IAAI,EAAE,MAAM;EACZ0B,gBAAgB,EAAE,KAAK;EACvBhB,OAAO,EAAE,EAAE;EACXF,OAAO,EAAE,EAAE;EACXG,eAAe,EAAE,SAAAA,gBAAA;IAAA,OAAgC,EAAE;EAAA,CAAC;EACpDkB,mBAAmB,EAAE,SAAAA,oBAAA;IAAA,OAA+B,IAAIpC,kBAAA,CAAAyC,uBAAuB,EAAE;EAAA;EACjFN,eAAe,EAAE,SAAAA,gBAAA;IAAA,OAAgC,EAAE;EAAA,CAAC;EACpDE,OAAO,EAAE,KAAK;EACdE,qBAAqB,EAAExC,QAAA,CAAA2C;CAC1B;AAGLzC,OAAA,CAAA0C,OAAA,GAAevC,mBAAmB,C;;;;;;;;;;;;;;;;ICrGrBqC,uBAAuB;EAAA,SAAAA,wBAAA;IAAApC,eAAA,OAAAoC,uBAAA;EAAA;EAAAG,YAAA,CAAAH,uBAAA;IAAAI,GAAA;IAAAC,KAAA,EAChC,SAAAC,MAAA,EAAK;MACD;IAAA;EACH;IAAAF,GAAA;IAAAC,KAAA,EAED,SAAAE,SAAA,EAAQ;MACJ,OAAO,IAAI,CAAC,CAAC;IACjB;EAAC;EAAA,OAAAP,uBAAA;AAAA;AAPLxC,OAAA,CAAAwC,uBAAA,GAAAA,uBAAA,C;;;;;;;ACbA,mC;;;;;;;ACAA,kE;;;;;;;ACAA,+D","file":"SplunkVisualization.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 24);\n","module.exports = require(\"prop-types\");","/* eslint-disable react/no-unused-prop-types,react/prefer-stateless-function */\nimport * as T from 'prop-types';\nimport { noop } from 'lodash';\nimport { DashboardVizProps } from './interfaces/DashboardVizProps';\nimport { DefaultVizActionHandler } from './interfaces/VizActionHandler';\n\n// this is identical to the initial height and width we use in BaseVisualization in dashboard-visualizations\nexport const INITIAL_WIDTH = 250;\nexport const INITIAL_HEIGHT = 250;\n\n/**\n * A Splunk visualization\n */\nclass SplunkVisualization {\n static propTypes: Record<keyof DashboardVizProps, T.Validator<any>> = {\n /**\n * display mode\n */\n mode: T.oneOf(['view', 'edit', 'export']).isRequired,\n /**\n * width in pixel or string, defaults to 100%\n */\n width: T.oneOfType([T.string, T.number]).isRequired,\n /**\n * height in pixel or string\n */\n height: T.oneOfType([T.string, T.number]).isRequired,\n /**\n * visualization context used for dynamic option evaluation\n */\n context: T.object,\n /**\n * visualization formatting options\n */\n options: T.object,\n /**\n * A callback to update formatting options\n */\n onOptionsChange: T.func,\n /**\n * datasource state which include data and request params, object key indicate the datasource type.\n */\n dataSources: T.objectOf(\n T.shape({\n /**\n * current request params\n */\n requestParams: T.object,\n /**\n * current dataset\n */\n data: T.shape({\n fields: T.array,\n columns: T.array,\n }),\n /**\n * error\n */\n error: T.shape({\n level: T.string,\n message: T.string,\n }),\n /**\n * meta data that came with the dataset\n */\n meta: T.object,\n })\n ),\n /**\n * A callback to trigger event\n */\n onEventTrigger: T.func,\n /**\n * Inform viz if there are handlers listening to events\n */\n hasEventHandlers: T.bool,\n /**\n * A callback to communicate computed props to a consumer\n */\n onComputedProps: T.func,\n /**\n * A callback to obtain visualization api\n */\n vizActionHandlerRef: T.func,\n\n loading: T.bool,\n theme: T.object,\n /**\n * A callback to request new data with updated request params\n */\n onRequestParamsChange: T.func,\n };\n\n /**\n *\n */\n static defaultProps: DashboardVizProps = {\n // BaseVisualization in dashboard-visualizations uses 100% for width but 250 for height\n width: '100%',\n height: INITIAL_HEIGHT,\n dataSources: {},\n onEventTrigger: (): Record<string, unknown> => ({}),\n mode: 'view',\n hasEventHandlers: false,\n options: {},\n context: {},\n onOptionsChange: (): Record<string, unknown> => ({}),\n vizActionHandlerRef: (): DefaultVizActionHandler => new DefaultVizActionHandler(),\n onComputedProps: (): Record<string, unknown> => ({}),\n loading: false,\n onRequestParamsChange: noop,\n };\n}\n\nexport default SplunkVisualization;\n","/* eslint-disable class-methods-use-this */\nexport interface VizActionHandler {\n /**\n * put focus on the visualization\n */\n focus(): void;\n\n /**\n * compute snapshot of this visualization\n */\n snapshot(): Record<string, unknown>; // (This is for pdf export)\n}\n\nexport class DefaultVizActionHandler {\n focus(): void {\n // noop\n }\n\n snapshot(): Record<string, unknown> {\n return null; // noop\n }\n}\n","module.exports = require(\"lodash\");","module.exports = require(\"@babel/runtime/helpers/classCallCheck\");","module.exports = require(\"@babel/runtime/helpers/createClass\");"],"sourceRoot":""}
|
|
1
|
+
{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///external \"prop-types\"","webpack:///./src/common/SplunkVisualization.tsx","webpack:///./src/common/interfaces/VizActionHandler.ts","webpack:///external \"lodash\"","webpack:///external \"@babel/runtime/helpers/classCallCheck\"","webpack:///external \"@babel/runtime/helpers/createClass\""],"names":[],"mappings":";;;;;;;QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QAC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AACJ,aAAO,IAAP,CADI,CACS;AAChB;;;;;;AAPL,0D;;;;;;;ACbA,mC;;;;;;;ACAA,kE;;;;;;;ACAA,+D","file":"SplunkVisualization.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 24);\n","module.exports = require(\"prop-types\");","/* eslint-disable react/no-unused-prop-types,react/prefer-stateless-function */\nimport * as T from 'prop-types';\nimport { noop } from 'lodash';\nimport { DashboardVizProps } from './interfaces/DashboardVizProps';\nimport { DefaultVizActionHandler } from './interfaces/VizActionHandler';\n\n// this is identical to the initial height and width we use in BaseVisualization in dashboard-visualizations\nexport const INITIAL_WIDTH = 250;\nexport const INITIAL_HEIGHT = 250;\n\n/**\n * A Splunk visualization\n */\nclass SplunkVisualization {\n static propTypes: Record<keyof DashboardVizProps, T.Validator<any>> = {\n /**\n * display mode\n */\n mode: T.oneOf(['view', 'edit', 'export']).isRequired,\n /**\n * width in pixel or string, defaults to 100%\n */\n width: T.oneOfType([T.string, T.number]).isRequired,\n /**\n * height in pixel or string\n */\n height: T.oneOfType([T.string, T.number]).isRequired,\n /**\n * visualization context used for dynamic option evaluation\n */\n context: T.object,\n /**\n * visualization formatting options\n */\n options: T.object,\n /**\n * A callback to update formatting options\n */\n onOptionsChange: T.func,\n /**\n * datasource state which include data and request params, object key indicate the datasource type.\n */\n dataSources: T.objectOf(\n T.shape({\n /**\n * current request params\n */\n requestParams: T.object,\n /**\n * current dataset\n */\n data: T.shape({\n fields: T.array,\n columns: T.array,\n }),\n /**\n * error\n */\n error: T.shape({\n level: T.string,\n message: T.string,\n }),\n /**\n * meta data that came with the dataset\n */\n meta: T.object,\n })\n ),\n /**\n * A callback to trigger event\n */\n onEventTrigger: T.func,\n /**\n * Inform viz if there are handlers listening to events\n */\n hasEventHandlers: T.bool,\n /**\n * A callback to communicate computed props to a consumer\n */\n onComputedProps: T.func,\n /**\n * A callback to obtain visualization api\n */\n vizActionHandlerRef: T.func,\n\n loading: T.bool,\n theme: T.object,\n /**\n * A callback to request new data with updated request params\n */\n onRequestParamsChange: T.func,\n };\n\n /**\n *\n */\n static defaultProps: DashboardVizProps = {\n // BaseVisualization in dashboard-visualizations uses 100% for width but 250 for height\n width: '100%',\n height: INITIAL_HEIGHT,\n dataSources: {},\n onEventTrigger: (): Record<string, unknown> => ({}),\n mode: 'view',\n hasEventHandlers: false,\n options: {},\n context: {},\n onOptionsChange: (): Record<string, unknown> => ({}),\n vizActionHandlerRef: (): DefaultVizActionHandler => new DefaultVizActionHandler(),\n onComputedProps: (): Record<string, unknown> => ({}),\n loading: false,\n onRequestParamsChange: noop,\n };\n}\n\nexport default SplunkVisualization;\n","/* eslint-disable class-methods-use-this */\nexport interface VizActionHandler {\n /**\n * put focus on the visualization\n */\n focus(): void;\n\n /**\n * compute snapshot of this visualization\n */\n snapshot(): Record<string, unknown>; // (This is for pdf export)\n}\n\nexport class DefaultVizActionHandler {\n focus(): void {\n // noop\n }\n\n snapshot(): Record<string, unknown> {\n return null; // noop\n }\n}\n","module.exports = require(\"lodash\");","module.exports = require(\"@babel/runtime/helpers/classCallCheck\");","module.exports = require(\"@babel/runtime/helpers/createClass\");"],"sourceRoot":""}
|
|
@@ -113,37 +113,43 @@ module.exports = require("@babel/runtime/helpers/createClass");
|
|
|
113
113
|
|
|
114
114
|
|
|
115
115
|
var _classCallCheck = __webpack_require__(4);
|
|
116
|
+
|
|
116
117
|
var _createClass = __webpack_require__(6);
|
|
118
|
+
|
|
117
119
|
Object.defineProperty(exports, "__esModule", {
|
|
118
120
|
value: true
|
|
119
121
|
});
|
|
120
122
|
/**
|
|
121
123
|
*
|
|
122
124
|
*/
|
|
125
|
+
|
|
123
126
|
var DashboardVisualizationApi = /*#__PURE__*/function () {
|
|
124
127
|
function DashboardVisualizationApi() {
|
|
125
128
|
_classCallCheck(this, DashboardVisualizationApi);
|
|
126
129
|
}
|
|
130
|
+
|
|
127
131
|
_createClass(DashboardVisualizationApi, [{
|
|
128
132
|
key: "focus",
|
|
129
133
|
value:
|
|
130
134
|
/**
|
|
131
135
|
* put focus on the visualization
|
|
132
136
|
*/
|
|
133
|
-
function focus() {
|
|
134
|
-
// do nothing
|
|
137
|
+
function focus() {// do nothing
|
|
135
138
|
}
|
|
136
139
|
/**
|
|
137
140
|
* compute snapshot of this visualization
|
|
138
141
|
*/
|
|
142
|
+
|
|
139
143
|
}, {
|
|
140
144
|
key: "snapshot",
|
|
141
145
|
value: function snapshot() {
|
|
142
146
|
return {};
|
|
143
147
|
}
|
|
144
148
|
}]);
|
|
149
|
+
|
|
145
150
|
return DashboardVisualizationApi;
|
|
146
151
|
}();
|
|
152
|
+
|
|
147
153
|
exports.default = DashboardVisualizationApi;
|
|
148
154
|
|
|
149
155
|
/***/ })
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///external \"@babel/runtime/helpers/classCallCheck\"","webpack:///external \"@babel/runtime/helpers/createClass\"","webpack:///./src/common/SplunkVisualizationApi.ts"],"names":[
|
|
1
|
+
{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///external \"@babel/runtime/helpers/classCallCheck\"","webpack:///external \"@babel/runtime/helpers/createClass\"","webpack:///./src/common/SplunkVisualizationApi.ts"],"names":[],"mappings":";;;;;;;QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;;AClFA,kE;;;;;;;ACAA,+D;;;;;;;;;;;;;;;;;ACGA;;AAEG;;IACG,yB;;;;;;;;AACF;;AAEG;AACH,qBAAK,CACD;AACH;AAED;;AAEG;;;;WACH,oBAAQ;AACJ,aAAO,EAAP;AACH;;;;;;AAGL,kBAAe,yBAAf,C","file":"SplunkVisualizationApi.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 65);\n","module.exports = require(\"@babel/runtime/helpers/classCallCheck\");","module.exports = require(\"@babel/runtime/helpers/createClass\");","/* eslint-disable class-methods-use-this */\nimport { VizActionHandler } from './interfaces/VizActionHandler';\n\n/**\n *\n */\nclass DashboardVisualizationApi implements VizActionHandler {\n /**\n * put focus on the visualization\n */\n focus() {\n // do nothing\n }\n\n /**\n * compute snapshot of this visualization\n */\n snapshot() {\n return {};\n }\n}\n\nexport default DashboardVisualizationApi;\n"],"sourceRoot":""}
|
package/common/ThemesDoc.js
CHANGED
|
@@ -248,6 +248,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
248
248
|
|
|
249
249
|
|
|
250
250
|
|
|
251
|
+
|
|
251
252
|
var ThemeVar = styled_components__WEBPACK_IMPORTED_MODULE_5___default.a.div.withConfig({
|
|
252
253
|
displayName: "ThemesDoc__ThemeVar",
|
|
253
254
|
componentId: "ycgc2f-0"
|
|
@@ -272,13 +273,15 @@ var ColorPreview = styled_components__WEBPACK_IMPORTED_MODULE_5___default.a.div.
|
|
|
272
273
|
})(["width:20px;height:20px;background:", ";display:inline-block;vertical-align:bottom;margin-right:5px;border:1px solid rgba(0,0,0,0.3);border-radius:5px;"], function (props) {
|
|
273
274
|
return props.color;
|
|
274
275
|
});
|
|
276
|
+
|
|
275
277
|
var Pair = function Pair(_ref) {
|
|
276
278
|
var title = _ref.title,
|
|
277
|
-
|
|
279
|
+
text = _ref.text;
|
|
278
280
|
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default.a.createElement(PairContainer, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default.a.createElement(PairTitle, null, "".concat(title, ":")), Object(_splunk_visualizations_shared_colorUtils__WEBPACK_IMPORTED_MODULE_13__["isColor"])(text) && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default.a.createElement(ColorPreview, {
|
|
279
281
|
color: text
|
|
280
282
|
}), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default.a.createElement("samp", null, text));
|
|
281
283
|
};
|
|
284
|
+
|
|
282
285
|
Pair.propTypes = {
|
|
283
286
|
title: prop_types__WEBPACK_IMPORTED_MODULE_3___default.a.string,
|
|
284
287
|
text: prop_types__WEBPACK_IMPORTED_MODULE_3___default.a.string
|
|
@@ -347,25 +350,30 @@ var themeIdToVariant = {
|
|
|
347
350
|
label: 'Prisma Dark Compact'
|
|
348
351
|
}
|
|
349
352
|
};
|
|
353
|
+
|
|
350
354
|
var ThemesDoc = function ThemesDoc(props) {
|
|
351
355
|
var renderVisualization = props.renderVisualization,
|
|
352
|
-
|
|
356
|
+
themeVars = props.themes;
|
|
357
|
+
|
|
353
358
|
var _useState = Object(react__WEBPACK_IMPORTED_MODULE_2__["useState"])(''),
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
359
|
+
_useState2 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_1___default()(_useState, 2),
|
|
360
|
+
highlightedThemeVariable = _useState2[0],
|
|
361
|
+
setHighlightedThemeVariable = _useState2[1];
|
|
362
|
+
|
|
357
363
|
var _useState3 = Object(react__WEBPACK_IMPORTED_MODULE_2__["useState"])(themeIdToVariant.enterpriseLightComfortable),
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
// if the highlighted theme variable is a color, color it red
|
|
364
|
+
_useState4 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_1___default()(_useState3, 2),
|
|
365
|
+
selectedTheme = _useState4[0],
|
|
366
|
+
setSelectedTheme = _useState4[1];
|
|
367
|
+
|
|
368
|
+
var previewTheme = lodash_cloneDeep__WEBPACK_IMPORTED_MODULE_7___default()(themeVars); // if the highlighted theme variable is a color, color it red
|
|
363
369
|
// TODO(fkurniawan): fix red highlighting. this broke ~v20.7.0, and approach needs to be modified again owing to SUI upgrade
|
|
370
|
+
|
|
364
371
|
if (Object(_splunk_visualizations_shared_colorUtils__WEBPACK_IMPORTED_MODULE_13__["isColor"])(themeVars[highlightedThemeVariable])) {
|
|
365
372
|
previewTheme[highlightedThemeVariable] = function () {
|
|
366
373
|
return 'red';
|
|
367
374
|
};
|
|
368
375
|
}
|
|
376
|
+
|
|
369
377
|
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default.a.createElement(_splunk_react_ui_ColumnLayout__WEBPACK_IMPORTED_MODULE_8___default.a, {
|
|
370
378
|
style: {
|
|
371
379
|
marginTop: -20
|
|
@@ -408,19 +416,23 @@ var ThemesDoc = function ThemesDoc(props) {
|
|
|
408
416
|
level: 4
|
|
409
417
|
}, "Variables"), Object.keys(previewTheme).map(function (varKey) {
|
|
410
418
|
var _sharedThemeVariables, _themeFamilyMapping$s;
|
|
419
|
+
|
|
411
420
|
var themeValue = previewTheme[varKey]({
|
|
412
421
|
theme: {
|
|
413
422
|
splunkThemeV1: lodash_omit__WEBPACK_IMPORTED_MODULE_6___default()(selectedTheme, ['label'])
|
|
414
423
|
}
|
|
415
|
-
});
|
|
416
|
-
// if a theme variable is in @splunk/visualization-themes and it has the same value
|
|
424
|
+
}); // if a theme variable is in @splunk/visualization-themes and it has the same value
|
|
417
425
|
// we assume we used the shared variable.
|
|
418
|
-
|
|
419
|
-
// for now we only show simple theme values (nested theme objects shouldn't have been introduced in the first place)
|
|
426
|
+
|
|
427
|
+
var isFromSharedVariables = (_splunk_visualization_themes_variables__WEBPACK_IMPORTED_MODULE_14__ === null || _splunk_visualization_themes_variables__WEBPACK_IMPORTED_MODULE_14__ === void 0 ? void 0 : (_sharedThemeVariables = _splunk_visualization_themes_variables__WEBPACK_IMPORTED_MODULE_14__[themeFamilyMapping === null || themeFamilyMapping === void 0 ? void 0 : (_themeFamilyMapping$s = themeFamilyMapping[selectedTheme.family]) === null || _themeFamilyMapping$s === void 0 ? void 0 : _themeFamilyMapping$s[selectedTheme.colorScheme]]) === null || _sharedThemeVariables === void 0 ? void 0 : _sharedThemeVariables[varKey]) === themeValue; // for now we only show simple theme values (nested theme objects shouldn't have been introduced in the first place)
|
|
428
|
+
|
|
420
429
|
var isJSON;
|
|
430
|
+
|
|
421
431
|
try {
|
|
422
432
|
isJSON = _babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0___default()(JSON.parse(themeValue)) === 'object';
|
|
423
433
|
} catch (e) {} // eslint-disable-line no-empty
|
|
434
|
+
|
|
435
|
+
|
|
424
436
|
return !isJSON && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_2___default.a.createElement(ThemeVar, {
|
|
425
437
|
key: varKey,
|
|
426
438
|
onMouseOver: function onMouseOver() {
|
|
@@ -439,6 +451,7 @@ var ThemesDoc = function ThemesDoc(props) {
|
|
|
439
451
|
}));
|
|
440
452
|
}))));
|
|
441
453
|
};
|
|
454
|
+
|
|
442
455
|
ThemesDoc.propTypes = {
|
|
443
456
|
themes: prop_types__WEBPACK_IMPORTED_MODULE_3___default.a.object.isRequired,
|
|
444
457
|
// @TODO: replace with themes object from viz config when we add docs/descs to theme vars
|
package/common/ThemesDoc.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///external \"react\"","webpack:///external \"prop-types\"","webpack:///external \"@babel/runtime/helpers/slicedToArray\"","webpack:///external \"@splunk/react-ui/ColumnLayout\"","webpack:///external \"@babel/runtime/helpers/typeof\"","webpack:///external \"@splunk/visualizations-shared/colorUtils\"","webpack:///external \"@splunk/visualization-themes/variables\"","webpack:///external \"styled-components\"","webpack:///external \"@splunk/react-ui/Select\"","webpack:///external \"lodash/omit\"","webpack:///external \"lodash/cloneDeep\"","webpack:///external \"@splunk/react-ui/Message\"","webpack:///external \"@splunk/react-ui/Tooltip\"","webpack:///external \"@splunk/themes/SplunkThemeProvider\"","webpack:///external \"@splunk/react-ui/Heading\"","webpack:///./src/common/ThemesDoc.jsx"],"names":["ThemeVar","styled","div","withConfig","displayName","componentId","ThemeVarName","props","highlighted","PairContainer","PairTitle","span","ColorPreview","color","Pair","_ref","title","text","React","createElement","concat","isColor","propTypes","T","string","themeFamilyMapping","enterprise","colorScheme","dark","light","prisma","themeIdToVariant","enterpriseLightComfortable","density","family","label","enterpriseLightCompact","enterpriseDarkComfortable","enterpriseDarkCompact","prismaLightComfortable","prismaLightCompact","prismaDarkComfortable","prismaDarkCompact","ThemesDoc","renderVisualization","themeVars","themes","_useState","useState","_useState2","_slicedToArray","highlightedThemeVariable","setHighlightedThemeVariable","_useState3","_useState4","selectedTheme","setSelectedTheme","previewTheme","cloneDeep","ColumnLayout","style","marginTop","Row","Column","Heading","level","Select","value","onChange","e","_ref2","Object","keys","map","themeId","Option","key","colStyle","padding","SplunkThemeProvider","Message","type","varKey","_sharedThemeVariables","_themeFamilyMapping$s","themeValue","theme","splunkThemeV1","omit","isFromSharedVariables","sharedThemeVariables","isJSON","_typeof","JSON","parse","onMouseOver","onMouseOut","Tooltip","content","object","isRequired","func"],"mappings":";;;;;;;QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;;AClFA,kC;;;;;;;ACAA,uC;;;;;;;ACAA,iE;;;;;;;ACAA,0D;;;;;;;ACAA,0D;;;;;;;ACAA,qE;;;;;;;ACAA,mE;;;;;;;ACAA,8C;;;;;;;ACAA,oD;;;;;;;ACAA,wC;;;;;;;ACAA,6C;;;;;;;ACAA,qD;;;;;;;ACAA,qD;;;;;;;ACAA,+D;;;;;;;ACAA,qD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACAA;AACwC;AACb;AACoB;AACR;AACR;AACU;AACgB;AACZ;AACE;AACA;AACsB;AACF;AACY;AAE/E,IAAMA,QAAQ,GAAGC,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AC,CACgB,CACP,CACR;AAEvB,CAAC;AAED1C,SAAS,CAACrB,SAAS,GAAG;EAClBwB,MAAM,EAAEvB,iDAAC,CAAC4E,MAAM,CAACC,UAAU;EAAE;EAC7BxD,mBAAmB,EAAErB,iDAAC,CAAC8E,IAAI,CAACD;AAChC,CAAC;AAEczD,wEAAS,E","file":"ThemesDoc.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 66);\n","module.exports = require(\"react\");","module.exports = require(\"prop-types\");","module.exports = require(\"@babel/runtime/helpers/slicedToArray\");","module.exports = require(\"@splunk/react-ui/ColumnLayout\");","module.exports = require(\"@babel/runtime/helpers/typeof\");","module.exports = require(\"@splunk/visualizations-shared/colorUtils\");","module.exports = require(\"@splunk/visualization-themes/variables\");","module.exports = require(\"styled-components\");","module.exports = require(\"@splunk/react-ui/Select\");","module.exports = require(\"lodash/omit\");","module.exports = require(\"lodash/cloneDeep\");","module.exports = require(\"@splunk/react-ui/Message\");","module.exports = require(\"@splunk/react-ui/Tooltip\");","module.exports = require(\"@splunk/themes/SplunkThemeProvider\");","module.exports = require(\"@splunk/react-ui/Heading\");","/* eslint-disable react/no-multi-comp */\nimport React, { useState } from 'react';\nimport T from 'prop-types';\nimport Heading from '@splunk/react-ui/Heading';\nimport styled from 'styled-components';\nimport omit from 'lodash/omit';\nimport cloneDeep from 'lodash/cloneDeep';\nimport ColumnLayout from '@splunk/react-ui/ColumnLayout';\nimport Select from '@splunk/react-ui/Select';\nimport Message from '@splunk/react-ui/Message';\nimport Tooltip from '@splunk/react-ui/Tooltip';\nimport SplunkThemeProvider from '@splunk/themes/SplunkThemeProvider';\nimport { isColor } from '@splunk/visualizations-shared/colorUtils';\nimport * as sharedThemeVariables from '@splunk/visualization-themes/variables';\n\nconst ThemeVar = styled.div`\n margin-top: 20px;\n cursor: pointer;\n`;\nconst ThemeVarName = styled.div`\n color: #5ca300;\n padding-bottom: 5px;\n display: inline-block;\n padding-right: 5px;\n font-weight: ${props => (props.highlighted ? 'bold' : 'normal')};\n`;\nconst PairContainer = styled.div`\n margin-left: 40px;\n margin-top: 10px;\n`;\nconst PairTitle = styled.span`\n display: inline-block;\n color: #8293a7;\n width: 80px;\n`;\nconst ColorPreview = styled.div`\n width: 20px;\n height: 20px;\n background: ${props => props.color};\n display: inline-block;\n vertical-align: bottom;\n margin-right: 5px;\n border: 1px solid rgba(0, 0, 0, 0.3);\n border-radius: 5px;\n`;\n\nconst Pair = ({ title, text }) => (\n <PairContainer>\n <PairTitle>{`${title}:`}</PairTitle>\n {isColor(text) && <ColorPreview color={text} />}\n <samp>{text}</samp>\n </PairContainer>\n);\nPair.propTypes = {\n title: T.string,\n text: T.string,\n};\n\nconst themeFamilyMapping = {\n enterprise: {\n colorScheme: {\n dark: 'enterpriseDark',\n light: 'enterprise',\n },\n },\n prisma: {\n colorScheme: {\n dark: 'scp',\n light: 'enterprise',\n },\n },\n};\n\nconst themeIdToVariant = {\n enterpriseLightComfortable: {\n colorScheme: 'light',\n density: 'comfortable',\n family: 'enterprise',\n label: 'Enterprise Light Comfortable',\n },\n enterpriseLightCompact: {\n colorScheme: 'light',\n density: 'compact',\n family: 'enterprise',\n label: 'Enterprise Light Compact',\n },\n enterpriseDarkComfortable: {\n colorScheme: 'dark',\n density: 'comfortable',\n family: 'enterprise',\n label: 'Enterprise Dark Comfortable',\n },\n enterpriseDarkCompact: {\n colorScheme: 'dark',\n density: 'compact',\n family: 'enterprise',\n label: 'Enterprise Dark Compact',\n },\n prismaLightComfortable: {\n colorScheme: 'light',\n density: 'comfortable',\n family: 'prisma',\n label: 'Prisma Light Comfortable',\n },\n prismaLightCompact: {\n colorScheme: 'light',\n density: 'compact',\n family: 'prisma',\n label: 'Prisma Light Compact',\n },\n prismaDarkComfortable: {\n colorScheme: 'dark',\n density: 'comfortable',\n family: 'prisma',\n label: 'Prisma Dark Comfortable',\n },\n prismaDarkCompact: {\n colorScheme: 'dark',\n density: 'compact',\n family: 'prisma',\n label: 'Prisma Dark Compact',\n },\n};\n\nconst ThemesDoc = props => {\n const { renderVisualization, themes: themeVars } = props;\n const [highlightedThemeVariable, setHighlightedThemeVariable] = useState('');\n const [selectedTheme, setSelectedTheme] = useState(themeIdToVariant.enterpriseLightComfortable);\n const previewTheme = cloneDeep(themeVars);\n // if the highlighted theme variable is a color, color it red\n // TODO(fkurniawan): fix red highlighting. this broke ~v20.7.0, and approach needs to be modified again owing to SUI upgrade\n if (isColor(themeVars[highlightedThemeVariable])) {\n previewTheme[highlightedThemeVariable] = () => 'red';\n }\n return (\n <ColumnLayout style={{ marginTop: -20 }}>\n <ColumnLayout.Row>\n <ColumnLayout.Column span={12}>\n <Heading level={4}>Theme</Heading>\n <Select value={selectedTheme} onChange={(e, { value }) => setSelectedTheme(value)}>\n {Object.keys(themeIdToVariant).map(themeId => (\n <Select.Option\n key={themeId}\n label={themeIdToVariant[themeId].label}\n value={themeIdToVariant[themeId]}\n />\n ))}\n </Select>\n </ColumnLayout.Column>\n </ColumnLayout.Row>\n <ColumnLayout.Row>\n <ColumnLayout.Column colStyle={{ padding: 10 }} span={4}>\n <Heading level={4}>Preview</Heading>\n <SplunkThemeProvider\n family={selectedTheme.family}\n colorScheme={selectedTheme.colorScheme}\n density={selectedTheme.density}\n >\n {renderVisualization()}\n </SplunkThemeProvider>\n <Message type=\"info\">\n This preview may differ from the visualization's default look and feel. <br />\n It exists to show areas affected by theme variables.\n </Message>\n </ColumnLayout.Column>\n <ColumnLayout.Column colStyle={{ padding: 10 }} span={8}>\n <Heading level={4}>Variables</Heading>\n {Object.keys(previewTheme).map(varKey => {\n const themeValue = previewTheme[varKey]({\n theme: { splunkThemeV1: omit(selectedTheme, ['label']) },\n });\n // if a theme variable is in @splunk/visualization-themes and it has the same value\n // we assume we used the shared variable.\n const isFromSharedVariables =\n sharedThemeVariables?.[\n themeFamilyMapping?.[selectedTheme.family]?.[selectedTheme.colorScheme]\n ]?.[varKey] === themeValue;\n // for now we only show simple theme values (nested theme objects shouldn't have been introduced in the first place)\n let isJSON;\n try {\n isJSON = typeof JSON.parse(themeValue) === 'object';\n } catch (e) {} // eslint-disable-line no-empty\n return (\n !isJSON && (\n <ThemeVar\n key={varKey}\n onMouseOver={() => setHighlightedThemeVariable(varKey)}\n onMouseOut={() => setHighlightedThemeVariable('')}\n >\n <ThemeVarName\n highlighted={varKey === highlightedThemeVariable}\n >{`${varKey}`}</ThemeVarName>\n {isFromSharedVariables && (\n <Tooltip content=\"This is a shared theme variable from @splunk/visualization-themes\" />\n )}\n <Pair title=\"Value\" text={themeValue} />\n </ThemeVar>\n )\n );\n })}\n </ColumnLayout.Column>\n </ColumnLayout.Row>\n </ColumnLayout>\n );\n};\n\nThemesDoc.propTypes = {\n themes: T.object.isRequired, // @TODO: replace with themes object from viz config when we add docs/descs to theme vars\n renderVisualization: T.func.isRequired,\n};\n\nexport default ThemesDoc;\n"],"sourceRoot":""}
|
|
1
|
+
{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///external \"react\"","webpack:///external \"prop-types\"","webpack:///external \"@babel/runtime/helpers/slicedToArray\"","webpack:///external \"@splunk/react-ui/ColumnLayout\"","webpack:///external \"@babel/runtime/helpers/typeof\"","webpack:///external \"@splunk/visualizations-shared/colorUtils\"","webpack:///external \"@splunk/visualization-themes/variables\"","webpack:///external \"styled-components\"","webpack:///external \"@splunk/react-ui/Select\"","webpack:///external \"lodash/omit\"","webpack:///external \"lodash/cloneDeep\"","webpack:///external \"@splunk/react-ui/Message\"","webpack:///external \"@splunk/react-ui/Tooltip\"","webpack:///external \"@splunk/themes/SplunkThemeProvider\"","webpack:///external \"@splunk/react-ui/Heading\"","webpack:///./src/common/ThemesDoc.jsx"],"names":["ThemeVar","styled","ThemeVarName","props","PairContainer","PairTitle","ColorPreview","Pair","title","text","isColor","T","string","themeFamilyMapping","enterprise","colorScheme","dark","light","prisma","themeIdToVariant","enterpriseLightComfortable","density","family","label","enterpriseLightCompact","enterpriseDarkComfortable","enterpriseDarkCompact","prismaLightComfortable","prismaLightCompact","prismaDarkComfortable","prismaDarkCompact","ThemesDoc","renderVisualization","themeVars","useState","highlightedThemeVariable","setHighlightedThemeVariable","selectedTheme","setSelectedTheme","previewTheme","cloneDeep","marginTop","value","padding","themeValue","theme","splunkThemeV1","omit","isFromSharedVariables","isJSON","JSON","varKey","themes","isRequired"],"mappings":";;;;;;;QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;;AClFA,kC;;;;;;;ACAA,uC;;;;;;;ACAA,iE;;;;;;;ACAA,0D;;;;;;;ACAA,0D;;;;;;;ACAA,qE;;;;;;;ACAA,mE;;;;;;;ACAA,8C;;;;;;;ACAA,oD;;;;;;;ACAA,wC;;;;;;;ACAA,6C;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EJ;AAA1B,MAXJ,CAFR;AAhDpB,GAiCiB,CAFL,CAfJ,CAfJ,CADJ;AAVJ;;AAkFAb,SAAS,CAATA,YAAsB;AAClBqB,QAAM,EAAEzC,iDAAC,CAADA,OADU;AACW;AAC7BqB,qBAAmB,EAAErB,iDAAC,CAADA,KAAO0C;AAFV,CAAtBtB;AAKA,0E","file":"ThemesDoc.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 66);\n","module.exports = require(\"react\");","module.exports = require(\"prop-types\");","module.exports = require(\"@babel/runtime/helpers/slicedToArray\");","module.exports = require(\"@splunk/react-ui/ColumnLayout\");","module.exports = require(\"@babel/runtime/helpers/typeof\");","module.exports = require(\"@splunk/visualizations-shared/colorUtils\");","module.exports = require(\"@splunk/visualization-themes/variables\");","module.exports = require(\"styled-components\");","module.exports = require(\"@splunk/react-ui/Select\");","module.exports = require(\"lodash/omit\");","module.exports = require(\"lodash/cloneDeep\");","module.exports = require(\"@splunk/react-ui/Message\");","module.exports = require(\"@splunk/react-ui/Tooltip\");","module.exports = require(\"@splunk/themes/SplunkThemeProvider\");","module.exports = require(\"@splunk/react-ui/Heading\");","/* eslint-disable react/no-multi-comp */\nimport React, { useState } from 'react';\nimport T from 'prop-types';\nimport Heading from '@splunk/react-ui/Heading';\nimport styled from 'styled-components';\nimport omit from 'lodash/omit';\nimport cloneDeep from 'lodash/cloneDeep';\nimport ColumnLayout from '@splunk/react-ui/ColumnLayout';\nimport Select from '@splunk/react-ui/Select';\nimport Message from '@splunk/react-ui/Message';\nimport Tooltip from '@splunk/react-ui/Tooltip';\nimport SplunkThemeProvider from '@splunk/themes/SplunkThemeProvider';\nimport { isColor } from '@splunk/visualizations-shared/colorUtils';\nimport * as sharedThemeVariables from '@splunk/visualization-themes/variables';\n\nconst ThemeVar = styled.div`\n margin-top: 20px;\n cursor: pointer;\n`;\nconst ThemeVarName = styled.div`\n color: #5ca300;\n padding-bottom: 5px;\n display: inline-block;\n padding-right: 5px;\n font-weight: ${props => (props.highlighted ? 'bold' : 'normal')};\n`;\nconst PairContainer = styled.div`\n margin-left: 40px;\n margin-top: 10px;\n`;\nconst PairTitle = styled.span`\n display: inline-block;\n color: #8293a7;\n width: 80px;\n`;\nconst ColorPreview = styled.div`\n width: 20px;\n height: 20px;\n background: ${props => props.color};\n display: inline-block;\n vertical-align: bottom;\n margin-right: 5px;\n border: 1px solid rgba(0, 0, 0, 0.3);\n border-radius: 5px;\n`;\n\nconst Pair = ({ title, text }) => (\n <PairContainer>\n <PairTitle>{`${title}:`}</PairTitle>\n {isColor(text) && <ColorPreview color={text} />}\n <samp>{text}</samp>\n </PairContainer>\n);\nPair.propTypes = {\n title: T.string,\n text: T.string,\n};\n\nconst themeFamilyMapping = {\n enterprise: {\n colorScheme: {\n dark: 'enterpriseDark',\n light: 'enterprise',\n },\n },\n prisma: {\n colorScheme: {\n dark: 'scp',\n light: 'enterprise',\n },\n },\n};\n\nconst themeIdToVariant = {\n enterpriseLightComfortable: {\n colorScheme: 'light',\n density: 'comfortable',\n family: 'enterprise',\n label: 'Enterprise Light Comfortable',\n },\n enterpriseLightCompact: {\n colorScheme: 'light',\n density: 'compact',\n family: 'enterprise',\n label: 'Enterprise Light Compact',\n },\n enterpriseDarkComfortable: {\n colorScheme: 'dark',\n density: 'comfortable',\n family: 'enterprise',\n label: 'Enterprise Dark Comfortable',\n },\n enterpriseDarkCompact: {\n colorScheme: 'dark',\n density: 'compact',\n family: 'enterprise',\n label: 'Enterprise Dark Compact',\n },\n prismaLightComfortable: {\n colorScheme: 'light',\n density: 'comfortable',\n family: 'prisma',\n label: 'Prisma Light Comfortable',\n },\n prismaLightCompact: {\n colorScheme: 'light',\n density: 'compact',\n family: 'prisma',\n label: 'Prisma Light Compact',\n },\n prismaDarkComfortable: {\n colorScheme: 'dark',\n density: 'comfortable',\n family: 'prisma',\n label: 'Prisma Dark Comfortable',\n },\n prismaDarkCompact: {\n colorScheme: 'dark',\n density: 'compact',\n family: 'prisma',\n label: 'Prisma Dark Compact',\n },\n};\n\nconst ThemesDoc = props => {\n const { renderVisualization, themes: themeVars } = props;\n const [highlightedThemeVariable, setHighlightedThemeVariable] = useState('');\n const [selectedTheme, setSelectedTheme] = useState(themeIdToVariant.enterpriseLightComfortable);\n const previewTheme = cloneDeep(themeVars);\n // if the highlighted theme variable is a color, color it red\n // TODO(fkurniawan): fix red highlighting. this broke ~v20.7.0, and approach needs to be modified again owing to SUI upgrade\n if (isColor(themeVars[highlightedThemeVariable])) {\n previewTheme[highlightedThemeVariable] = () => 'red';\n }\n return (\n <ColumnLayout style={{ marginTop: -20 }}>\n <ColumnLayout.Row>\n <ColumnLayout.Column span={12}>\n <Heading level={4}>Theme</Heading>\n <Select value={selectedTheme} onChange={(e, { value }) => setSelectedTheme(value)}>\n {Object.keys(themeIdToVariant).map(themeId => (\n <Select.Option\n key={themeId}\n label={themeIdToVariant[themeId].label}\n value={themeIdToVariant[themeId]}\n />\n ))}\n </Select>\n </ColumnLayout.Column>\n </ColumnLayout.Row>\n <ColumnLayout.Row>\n <ColumnLayout.Column colStyle={{ padding: 10 }} span={4}>\n <Heading level={4}>Preview</Heading>\n <SplunkThemeProvider\n family={selectedTheme.family}\n colorScheme={selectedTheme.colorScheme}\n density={selectedTheme.density}\n >\n {renderVisualization()}\n </SplunkThemeProvider>\n <Message type=\"info\">\n This preview may differ from the visualization's default look and feel. <br />\n It exists to show areas affected by theme variables.\n </Message>\n </ColumnLayout.Column>\n <ColumnLayout.Column colStyle={{ padding: 10 }} span={8}>\n <Heading level={4}>Variables</Heading>\n {Object.keys(previewTheme).map(varKey => {\n const themeValue = previewTheme[varKey]({\n theme: { splunkThemeV1: omit(selectedTheme, ['label']) },\n });\n // if a theme variable is in @splunk/visualization-themes and it has the same value\n // we assume we used the shared variable.\n const isFromSharedVariables =\n sharedThemeVariables?.[\n themeFamilyMapping?.[selectedTheme.family]?.[selectedTheme.colorScheme]\n ]?.[varKey] === themeValue;\n // for now we only show simple theme values (nested theme objects shouldn't have been introduced in the first place)\n let isJSON;\n try {\n isJSON = typeof JSON.parse(themeValue) === 'object';\n } catch (e) {} // eslint-disable-line no-empty\n return (\n !isJSON && (\n <ThemeVar\n key={varKey}\n onMouseOver={() => setHighlightedThemeVariable(varKey)}\n onMouseOut={() => setHighlightedThemeVariable('')}\n >\n <ThemeVarName\n highlighted={varKey === highlightedThemeVariable}\n >{`${varKey}`}</ThemeVarName>\n {isFromSharedVariables && (\n <Tooltip content=\"This is a shared theme variable from @splunk/visualization-themes\" />\n )}\n <Pair title=\"Value\" text={themeValue} />\n </ThemeVar>\n )\n );\n })}\n </ColumnLayout.Column>\n </ColumnLayout.Row>\n </ColumnLayout>\n );\n};\n\nThemesDoc.propTypes = {\n themes: T.object.isRequired, // @TODO: replace with themes object from viz config when we add docs/descs to theme vars\n renderVisualization: T.func.isRequired,\n};\n\nexport default ThemesDoc;\n"],"sourceRoot":""}
|
package/common/chartingUtils.js
CHANGED
|
@@ -113,20 +113,25 @@ module.exports = require("lodash");
|
|
|
113
113
|
|
|
114
114
|
|
|
115
115
|
var _toConsumableArray = __webpack_require__(26);
|
|
116
|
+
|
|
116
117
|
var __rest = this && this.__rest || function (s, e) {
|
|
117
118
|
var t = {};
|
|
119
|
+
|
|
118
120
|
for (var p in s) {
|
|
119
121
|
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
120
122
|
}
|
|
123
|
+
|
|
121
124
|
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
122
125
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
123
126
|
}
|
|
124
127
|
return t;
|
|
125
128
|
};
|
|
129
|
+
|
|
126
130
|
Object.defineProperty(exports, "__esModule", {
|
|
127
131
|
value: true
|
|
128
132
|
});
|
|
129
133
|
exports.constructFieldsAndColumns = exports.toArrayForSeries = exports.isMultiSeriesData = exports.convertOverlayFields = exports.convertY2AxisOptions = exports.mapToValues = exports.truncateData = exports.getAnnotations = void 0;
|
|
134
|
+
|
|
130
135
|
var lodash_1 = __webpack_require__(3);
|
|
131
136
|
/**
|
|
132
137
|
* Get formatted annotations
|
|
@@ -137,10 +142,12 @@ var lodash_1 = __webpack_require__(3);
|
|
|
137
142
|
* @param {Array} options.annotationLabel
|
|
138
143
|
* @returns {Array}
|
|
139
144
|
*/
|
|
145
|
+
|
|
146
|
+
|
|
140
147
|
var getAnnotations = function getAnnotations(_ref) {
|
|
141
148
|
var annotationX = _ref.annotationX,
|
|
142
|
-
|
|
143
|
-
|
|
149
|
+
annotationColor = _ref.annotationColor,
|
|
150
|
+
annotationLabel = _ref.annotationLabel;
|
|
144
151
|
return annotationX && annotationX.length ? annotationX.map(function (timestamp, i) {
|
|
145
152
|
return {
|
|
146
153
|
color: annotationColor && annotationColor[i],
|
|
@@ -149,6 +156,7 @@ var getAnnotations = function getAnnotations(_ref) {
|
|
|
149
156
|
};
|
|
150
157
|
}) : [];
|
|
151
158
|
};
|
|
159
|
+
|
|
152
160
|
exports.getAnnotations = getAnnotations;
|
|
153
161
|
/**
|
|
154
162
|
* Truncate the result set to given limit
|
|
@@ -157,20 +165,25 @@ exports.getAnnotations = getAnnotations;
|
|
|
157
165
|
* @param {Number|String} truncationLimit - options['chart.resultTruncationLimit']
|
|
158
166
|
* @returns {Object}
|
|
159
167
|
*/
|
|
168
|
+
|
|
160
169
|
var truncateData = function truncateData(dataSet, truncationLimit) {
|
|
161
170
|
if (!dataSet) {
|
|
162
171
|
return null;
|
|
163
172
|
}
|
|
173
|
+
|
|
164
174
|
var limit = parseInt(truncationLimit, 10);
|
|
175
|
+
|
|
165
176
|
if (!limit || limit <= 0) {
|
|
166
177
|
return dataSet;
|
|
167
178
|
}
|
|
179
|
+
|
|
168
180
|
var truncatedData = Object.assign({}, dataSet);
|
|
169
181
|
truncatedData.columns = truncatedData.columns.map(function (columnData) {
|
|
170
182
|
return columnData && Array.isArray(columnData) ? columnData.slice(0, limit) : columnData;
|
|
171
183
|
});
|
|
172
184
|
return truncatedData;
|
|
173
185
|
};
|
|
186
|
+
|
|
174
187
|
exports.truncateData = truncateData;
|
|
175
188
|
/**
|
|
176
189
|
* Helper method to update the option values into the values that SC accepts
|
|
@@ -178,12 +191,14 @@ exports.truncateData = truncateData;
|
|
|
178
191
|
* @param {Object} options
|
|
179
192
|
* @returns {Object}
|
|
180
193
|
*/
|
|
194
|
+
|
|
181
195
|
var mapToValues = function mapToValues(optionValuesSCMapping) {
|
|
182
196
|
return function (options) {
|
|
183
197
|
var convertedOptions = Object.assign({}, options);
|
|
184
198
|
Object.keys(optionValuesSCMapping).forEach(function (key) {
|
|
185
199
|
if ((0, lodash_1.has)(options, key)) {
|
|
186
200
|
var updatedValue = optionValuesSCMapping[key][options[key]];
|
|
201
|
+
|
|
187
202
|
if (!(0, lodash_1.isUndefined)(updatedValue)) {
|
|
188
203
|
convertedOptions[key] = updatedValue;
|
|
189
204
|
}
|
|
@@ -192,6 +207,7 @@ var mapToValues = function mapToValues(optionValuesSCMapping) {
|
|
|
192
207
|
return convertedOptions;
|
|
193
208
|
};
|
|
194
209
|
};
|
|
210
|
+
|
|
195
211
|
exports.mapToValues = mapToValues;
|
|
196
212
|
/**
|
|
197
213
|
* Helper method to process options related to y2Fields
|
|
@@ -199,18 +215,23 @@ exports.mapToValues = mapToValues;
|
|
|
199
215
|
* @param {Object} originalOptions
|
|
200
216
|
* @returns {Object}
|
|
201
217
|
*/
|
|
218
|
+
|
|
202
219
|
var convertY2AxisOptions = function convertY2AxisOptions(_a) {
|
|
203
220
|
var y2Fields = _a.y2Fields,
|
|
204
|
-
|
|
221
|
+
originalOptions = __rest(_a, ["y2Fields"]);
|
|
222
|
+
|
|
205
223
|
var convertedOptions = Object.assign({}, originalOptions);
|
|
224
|
+
|
|
206
225
|
if (y2Fields) {
|
|
207
226
|
convertedOptions['axisY2.enabled'] = true;
|
|
208
227
|
convertedOptions['axisY2.fields'] = (0, lodash_1.isArray)(y2Fields) ? y2Fields.filter(function (name) {
|
|
209
228
|
return name;
|
|
210
229
|
}).join(',') : y2Fields;
|
|
211
230
|
}
|
|
231
|
+
|
|
212
232
|
return convertedOptions;
|
|
213
233
|
};
|
|
234
|
+
|
|
214
235
|
exports.convertY2AxisOptions = convertY2AxisOptions;
|
|
215
236
|
/**
|
|
216
237
|
* Helper method to format value for overlayFields
|
|
@@ -218,9 +239,11 @@ exports.convertY2AxisOptions = convertY2AxisOptions;
|
|
|
218
239
|
* @param {Object} originalOptions
|
|
219
240
|
* @returns {Object}
|
|
220
241
|
*/
|
|
242
|
+
|
|
221
243
|
var convertOverlayFields = function convertOverlayFields(originalOptions) {
|
|
222
244
|
var convertedOptions = Object.assign({}, originalOptions);
|
|
223
245
|
var overlayFields = originalOptions.overlayFields;
|
|
246
|
+
|
|
224
247
|
if (overlayFields) {
|
|
225
248
|
convertedOptions.overlayFields = Array.isArray(overlayFields) ? overlayFields.filter(function (field) {
|
|
226
249
|
return field;
|
|
@@ -228,17 +251,21 @@ var convertOverlayFields = function convertOverlayFields(originalOptions) {
|
|
|
228
251
|
return field.trim();
|
|
229
252
|
}).join(',') : overlayFields;
|
|
230
253
|
}
|
|
254
|
+
|
|
231
255
|
return convertedOptions;
|
|
232
256
|
};
|
|
257
|
+
|
|
233
258
|
exports.convertOverlayFields = convertOverlayFields;
|
|
234
259
|
/**
|
|
235
260
|
* checks whether data is multi series data
|
|
236
261
|
* @param {array} data array
|
|
237
262
|
* @return {Boolean}
|
|
238
263
|
*/
|
|
264
|
+
|
|
239
265
|
var isMultiSeriesData = function isMultiSeriesData(data) {
|
|
240
266
|
return Array.isArray(data) && Array.isArray(data[0]);
|
|
241
267
|
};
|
|
268
|
+
|
|
242
269
|
exports.isMultiSeriesData = isMultiSeriesData;
|
|
243
270
|
/**
|
|
244
271
|
* checks whether data is multi series data and returns value as array
|
|
@@ -246,19 +273,22 @@ exports.isMultiSeriesData = isMultiSeriesData;
|
|
|
246
273
|
* @param {*} value to return as array
|
|
247
274
|
* @return {array}
|
|
248
275
|
*/
|
|
276
|
+
|
|
249
277
|
var toArrayForSeries = function toArrayForSeries(data, value) {
|
|
250
278
|
return (0, exports.isMultiSeriesData)(data) ? value : [value];
|
|
251
279
|
};
|
|
280
|
+
|
|
252
281
|
exports.toArrayForSeries = toArrayForSeries;
|
|
282
|
+
|
|
253
283
|
var constructFieldsAndColumns = function constructFieldsAndColumns(_ref2) {
|
|
254
284
|
var _ref2$x = _ref2.x,
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
285
|
+
x = _ref2$x === void 0 ? [] : _ref2$x,
|
|
286
|
+
_ref2$y = _ref2.y,
|
|
287
|
+
y = _ref2$y === void 0 ? [] : _ref2$y,
|
|
288
|
+
xField = _ref2.xField,
|
|
289
|
+
yFields = _ref2.yFields,
|
|
290
|
+
y2 = _ref2.y2,
|
|
291
|
+
y2Fields = _ref2.y2Fields;
|
|
262
292
|
var columns = [x.map(String)].concat(_toConsumableArray((0, exports.toArrayForSeries)(y, y).map(function (series) {
|
|
263
293
|
return series.map(String);
|
|
264
294
|
})));
|
|
@@ -269,10 +299,10 @@ var constructFieldsAndColumns = function constructFieldsAndColumns(_ref2) {
|
|
|
269
299
|
return {
|
|
270
300
|
name: field
|
|
271
301
|
};
|
|
272
|
-
})));
|
|
273
|
-
// splunk-charting requires y2 to be part of columns
|
|
302
|
+
}))); // splunk-charting requires y2 to be part of columns
|
|
274
303
|
// when y & y2 options are configured with different (mutually exclusive) series
|
|
275
304
|
// y2 columns need to be added to columns
|
|
305
|
+
|
|
276
306
|
if (y2Fields) {
|
|
277
307
|
var y2FieldsArray = (0, exports.toArrayForSeries)(y2, y2Fields);
|
|
278
308
|
var y2AsArray = (0, exports.toArrayForSeries)(y2, y2).map(function (series) {
|
|
@@ -287,11 +317,13 @@ var constructFieldsAndColumns = function constructFieldsAndColumns(_ref2) {
|
|
|
287
317
|
}
|
|
288
318
|
});
|
|
289
319
|
}
|
|
320
|
+
|
|
290
321
|
return {
|
|
291
322
|
columns: columns,
|
|
292
323
|
fields: fields
|
|
293
324
|
};
|
|
294
325
|
};
|
|
326
|
+
|
|
295
327
|
exports.constructFieldsAndColumns = constructFieldsAndColumns;
|
|
296
328
|
|
|
297
329
|
/***/ })
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///external \"@babel/runtime/helpers/toConsumableArray\"","webpack:///external \"lodash\"","webpack:///./src/common/chartingUtils.ts"],"names":["lodash_1","require","getAnnotations","_ref","annotationX","annotationColor","annotationLabel","length","map","timestamp","i","color","label","time","exports","truncateData","dataSet","truncationLimit","limit","parseInt","truncatedData","Object","assign","columns","columnData","Array","isArray","slice","mapToValues","optionValuesSCMapping","options","convertedOptions","keys","forEach","key","has","updatedValue","isUndefined","convertY2AxisOptions","_a","y2Fields","originalOptions","__rest","filter","name","join","convertOverlayFields","overlayFields","field","trim","isMultiSeriesData","data","toArrayForSeries","value","constructFieldsAndColumns","_ref2","_ref2$x","x","_ref2$y","y","xField","yFields","y2","String","concat","_toConsumableArray","series","yFieldsArray","fields","y2FieldsArray","y2AsArray","y2Field","index","indexOf","push"],"mappings":";;;;;;;QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QA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C,KAAK;IAAA,OAAK;MAAEJ,IAAI,EAAEI;IAAK,CAAE;EAAA,CAAC,CAAC,EAAC;EAClF;EACA;EACA;EACA,IAAIR,QAAQ,EAAE;IACV,IAAM6B,aAAa,GAAG,IAAAvD,OAAA,CAAAsC,gBAAgB,EAACU,EAAE,EAAEtB,QAAQ,CAAC;IACpD,IAAM8B,SAAS,GAAG,IAAAxD,OAAA,CAAAsC,gBAAgB,EAACU,EAAE,EAAEA,EAAE,CAAC,CAACtD,GAAG,CAAC,UAAA0D,MAAM;MAAA,OAAIA,MAAM,aAANA,MAAM,uBAANA,MAAM,CAAE1D,GAAG,CAACuD,MAAM,CAAC;IAAA,EAAC;IAC7EM,aAAa,CAACpC,OAAO,CAAC,UAACsC,OAAO,EAAEC,KAAK,EAAI;MACrC,IAAIL,YAAY,CAACM,OAAO,CAACF,OAAO,CAAC,KAAK,CAAC,CAAC,IAAID,SAAS,CAACE,KAAK,CAAC,EAAE;QAC1DJ,MAAM,CAACM,IAAI,CAAC;UACR9B,IAAI,EAAE2B;SACT,CAAC;QACFhD,OAAO,CAACmD,IAAI,CAACJ,SAAS,CAACE,KAAK,CAAC,CAAC;;IAEtC,CAAC,CAAC;;EAEN,OAAO;IACHjD,OAAO,EAAPA,OAAO;IACP6C,MAAM,EAANA;GACH;AACL,CAAC;AA9BYtD,OAAA,CAAAwC,yBAAyB,GAAAA,yBAAA,C","file":"chartingUtils.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 67);\n","module.exports = require(\"@babel/runtime/helpers/toConsumableArray\");","module.exports = require(\"lodash\");","import { has, isArray, isUndefined } from 'lodash';\nimport type { JsonColumnData } from './interfaces/DataSource';\n\ninterface ChartOptions {\n [key: string]: any;\n}\n\n/**\n * Get formatted annotations\n * @method getAnnotations\n * @param {Object} options\n * @param {Array} options.annotationX\n * @param {Array} options.annotationColor\n * @param {Array} options.annotationLabel\n * @returns {Array}\n */\nexport const getAnnotations = ({ annotationX, annotationColor, annotationLabel }) =>\n annotationX && annotationX.length\n ? annotationX.map((timestamp, i) => ({\n color: annotationColor && annotationColor[i],\n label: annotationLabel && annotationLabel[i],\n time: timestamp,\n }))\n : [];\n\n/**\n * Truncate the result set to given limit\n * @method truncateData\n * @param {Object} dataSet - dataSources.primary.data\n * @param {Number|String} truncationLimit - options['chart.resultTruncationLimit']\n * @returns {Object}\n */\nexport const truncateData = (dataSet, truncationLimit): Record<string, any[]> => {\n if (!dataSet) {\n return null;\n }\n\n const limit = parseInt(truncationLimit, 10);\n if (!limit || limit <= 0) {\n return dataSet;\n }\n\n const truncatedData: Record<string, Array<string[] | number[]>> = { ...dataSet };\n truncatedData.columns = truncatedData.columns.map(columnData =>\n columnData && Array.isArray(columnData) ? columnData.slice(0, limit) : columnData\n );\n return truncatedData;\n};\n\n/**\n * Helper method to update the option values into the values that SC accepts\n * @method mapToValues\n * @param {Object} options\n * @returns {Object}\n */\nexport const mapToValues = (optionValuesSCMapping: Record<string, any>) => options => {\n const convertedOptions: Record<string, any> = { ...options };\n Object.keys(optionValuesSCMapping).forEach(key => {\n if (has(options, key)) {\n const updatedValue = optionValuesSCMapping[key][options[key]];\n if (!isUndefined(updatedValue)) {\n convertedOptions[key] = updatedValue;\n }\n }\n });\n return convertedOptions;\n};\n\ninterface y2AxisOptions extends ChartOptions {\n y2Fields?: string | string[];\n}\n\n/**\n * Helper method to process options related to y2Fields\n * @method convertY2AxisOptions\n * @param {Object} originalOptions\n * @returns {Object}\n */\nexport const convertY2AxisOptions = ({\n y2Fields,\n ...originalOptions\n}: y2AxisOptions): Record<string, any> => {\n const convertedOptions: Record<string, any> = {\n ...originalOptions,\n };\n if (y2Fields) {\n convertedOptions['axisY2.enabled'] = true;\n convertedOptions['axisY2.fields'] = isArray(y2Fields)\n ? y2Fields.filter(name => name).join(',')\n : y2Fields;\n }\n return convertedOptions;\n};\n\n/**\n * Helper method to format value for overlayFields\n * @method convertOverlayFields\n * @param {Object} originalOptions\n * @returns {Object}\n */\nexport const convertOverlayFields = (originalOptions: ChartOptions): ChartOptions => {\n const convertedOptions: ChartOptions = {\n ...originalOptions,\n };\n const { overlayFields } = originalOptions;\n if (overlayFields) {\n convertedOptions.overlayFields = Array.isArray(overlayFields)\n ? overlayFields\n .filter(field => field)\n .map(field => field.trim())\n .join(',')\n : overlayFields;\n }\n return convertedOptions;\n};\n\n/**\n * checks whether data is multi series data\n * @param {array} data array\n * @return {Boolean}\n */\nexport const isMultiSeriesData = (data: string[] | string[][]): boolean =>\n Array.isArray(data) && Array.isArray(data[0]);\n/**\n * checks whether data is multi series data and returns value as array\n * @param {array} data array\n * @param {*} value to return as array\n * @return {array}\n */\nexport const toArrayForSeries = (data, value): any[] => (isMultiSeriesData(data) ? value : [value]);\n\ninterface ConstructFieldsAndColumnsParams {\n x: string[];\n y: string[] | string[][];\n xField: string;\n yFields: string | string[];\n y2?: string[] | string[][];\n y2Fields?: string | string[];\n}\nexport const constructFieldsAndColumns = ({\n x = [],\n y = [],\n xField,\n yFields,\n y2,\n y2Fields,\n}: ConstructFieldsAndColumnsParams): JsonColumnData => {\n const columns = [x.map(String), ...toArrayForSeries(y, y).map(series => series.map(String))];\n const yFieldsArray = toArrayForSeries(y, yFields);\n const fields = [{ name: xField }, ...yFieldsArray.map(field => ({ name: field }))];\n // splunk-charting requires y2 to be part of columns\n // when y & y2 options are configured with different (mutually exclusive) series\n // y2 columns need to be added to columns\n if (y2Fields) {\n const y2FieldsArray = toArrayForSeries(y2, y2Fields);\n const y2AsArray = toArrayForSeries(y2, y2).map(series => series?.map(String));\n y2FieldsArray.forEach((y2Field, index) => {\n if (yFieldsArray.indexOf(y2Field) === -1 && y2AsArray[index]) {\n fields.push({\n name: y2Field,\n });\n columns.push(y2AsArray[index]);\n }\n });\n }\n return {\n columns,\n fields,\n };\n};\n"],"sourceRoot":""}
|
|
1
|
+
{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///external \"@babel/runtime/helpers/toConsumableArray\"","webpack:///external \"lodash\"","webpack:///./src/common/chartingUtils.ts"],"names":[],"mappings":";;;;;;;QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;;AClFA,qE;;;;;;;ACAA,mC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACAA;AAOA;;;;;;;;AAQG;;;AACI,IAAM,cAAc,GAAG,SAAjB,cAAiB;AAAA,MAAG,WAAH,QAAG,WAAH;AAAA,MAAgB,eAAhB,QAAgB,eAAhB;AAAA,MAAiC,eAAjC,QAAiC,eAAjC;AAAA,SAC1B,WAAW,IAAI,WAAW,CAAC,MAA3B,GACM,WAAW,CAAC,GAAZ,CAAgB,UAAC,SAAD,EAAY,CAAZ;AAAA,WAAmB;AAC/B,WA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MAAN,SAAM,CAAE,GAAR,CAAY,MAAZ,CAAJ;AAAA,KAAnC,CAAlB;AACA,iBAAa,CAAC,OAAd,CAAsB,UAAC,OAAD,EAAU,KAAV,EAAmB;AACrC,UAAI,YAAY,CAAC,OAAb,CAAqB,OAArB,MAAkC,CAAC,CAAnC,IAAwC,SAAS,CAAC,KAAD,CAArD,EAA8D;AAC1D,cAAM,CAAC,IAAP,CAAY;AACR,cAAI,EAAE;AADE,SAAZ;AAGA,eAAO,CAAC,IAAR,CAAa,SAAS,CAAC,KAAD,CAAtB;AACH;AACJ,KAPD;AAQH;;AACD,SAAO;AACH,WAAO,EAAP,OADG;AAEH,UAAM,EAAN;AAFG,GAAP;AAIH,CA9BM;;AAAM,oCAAyB,yBAAzB,C","file":"chartingUtils.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 67);\n","module.exports = require(\"@babel/runtime/helpers/toConsumableArray\");","module.exports = require(\"lodash\");","import { has, isArray, isUndefined } from 'lodash';\nimport type { JsonColumnData } from './interfaces/DataSource';\n\ninterface ChartOptions {\n [key: string]: any;\n}\n\n/**\n * Get formatted annotations\n * @method getAnnotations\n * @param {Object} options\n * @param {Array} options.annotationX\n * @param {Array} options.annotationColor\n * @param {Array} options.annotationLabel\n * @returns {Array}\n */\nexport const getAnnotations = ({ annotationX, annotationColor, annotationLabel }) =>\n annotationX && annotationX.length\n ? annotationX.map((timestamp, i) => ({\n color: annotationColor && annotationColor[i],\n label: annotationLabel && annotationLabel[i],\n time: timestamp,\n }))\n : [];\n\n/**\n * Truncate the result set to given limit\n * @method truncateData\n * @param {Object} dataSet - dataSources.primary.data\n * @param {Number|String} truncationLimit - options['chart.resultTruncationLimit']\n * @returns {Object}\n */\nexport const truncateData = (dataSet, truncationLimit): Record<string, any[]> => {\n if (!dataSet) {\n return null;\n }\n\n const limit = parseInt(truncationLimit, 10);\n if (!limit || limit <= 0) {\n return dataSet;\n }\n\n const truncatedData: Record<string, Array<string[] | number[]>> = { ...dataSet };\n truncatedData.columns = truncatedData.columns.map(columnData =>\n columnData && Array.isArray(columnData) ? columnData.slice(0, limit) : columnData\n );\n return truncatedData;\n};\n\n/**\n * Helper method to update the option values into the values that SC accepts\n * @method mapToValues\n * @param {Object} options\n * @returns {Object}\n */\nexport const mapToValues = (optionValuesSCMapping: Record<string, any>) => options => {\n const convertedOptions: Record<string, any> = { ...options };\n Object.keys(optionValuesSCMapping).forEach(key => {\n if (has(options, key)) {\n const updatedValue = optionValuesSCMapping[key][options[key]];\n if (!isUndefined(updatedValue)) {\n convertedOptions[key] = updatedValue;\n }\n }\n });\n return convertedOptions;\n};\n\ninterface y2AxisOptions extends ChartOptions {\n y2Fields?: string | string[];\n}\n\n/**\n * Helper method to process options related to y2Fields\n * @method convertY2AxisOptions\n * @param {Object} originalOptions\n * @returns {Object}\n */\nexport const convertY2AxisOptions = ({\n y2Fields,\n ...originalOptions\n}: y2AxisOptions): Record<string, any> => {\n const convertedOptions: Record<string, any> = {\n ...originalOptions,\n };\n if (y2Fields) {\n convertedOptions['axisY2.enabled'] = true;\n convertedOptions['axisY2.fields'] = isArray(y2Fields)\n ? y2Fields.filter(name => name).join(',')\n : y2Fields;\n }\n return convertedOptions;\n};\n\n/**\n * Helper method to format value for overlayFields\n * @method convertOverlayFields\n * @param {Object} originalOptions\n * @returns {Object}\n */\nexport const convertOverlayFields = (originalOptions: ChartOptions): ChartOptions => {\n const convertedOptions: ChartOptions = {\n ...originalOptions,\n };\n const { overlayFields } = originalOptions;\n if (overlayFields) {\n convertedOptions.overlayFields = Array.isArray(overlayFields)\n ? overlayFields\n .filter(field => field)\n .map(field => field.trim())\n .join(',')\n : overlayFields;\n }\n return convertedOptions;\n};\n\n/**\n * checks whether data is multi series data\n * @param {array} data array\n * @return {Boolean}\n */\nexport const isMultiSeriesData = (data: string[] | string[][]): boolean =>\n Array.isArray(data) && Array.isArray(data[0]);\n/**\n * checks whether data is multi series data and returns value as array\n * @param {array} data array\n * @param {*} value to return as array\n * @return {array}\n */\nexport const toArrayForSeries = (data, value): any[] => (isMultiSeriesData(data) ? value : [value]);\n\ninterface ConstructFieldsAndColumnsParams {\n x: string[];\n y: string[] | string[][];\n xField: string;\n yFields: string | string[];\n y2?: string[] | string[][];\n y2Fields?: string | string[];\n}\nexport const constructFieldsAndColumns = ({\n x = [],\n y = [],\n xField,\n yFields,\n y2,\n y2Fields,\n}: ConstructFieldsAndColumnsParams): JsonColumnData => {\n const columns = [x.map(String), ...toArrayForSeries(y, y).map(series => series.map(String))];\n const yFieldsArray = toArrayForSeries(y, yFields);\n const fields = [{ name: xField }, ...yFieldsArray.map(field => ({ name: field }))];\n // splunk-charting requires y2 to be part of columns\n // when y & y2 options are configured with different (mutually exclusive) series\n // y2 columns need to be added to columns\n if (y2Fields) {\n const y2FieldsArray = toArrayForSeries(y2, y2Fields);\n const y2AsArray = toArrayForSeries(y2, y2).map(series => series?.map(String));\n y2FieldsArray.forEach((y2Field, index) => {\n if (yFieldsArray.indexOf(y2Field) === -1 && y2AsArray[index]) {\n fields.push({\n name: y2Field,\n });\n columns.push(y2AsArray[index]);\n }\n });\n }\n return {\n columns,\n fields,\n };\n};\n"],"sourceRoot":""}
|