UNPKG

@netdata/charts

Version:

Netdata frontend SDK and chart utilities

301 lines (297 loc) 9.55 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = void 0; var _fullscreen = _interopRequireDefault(require("../components/toolbox/fullscreen")); var _settings = _interopRequireDefault(require("../components/toolbox/settings")); var _tabs = require("../components/toolbox/settings/tabs"); var _status = _interopRequireDefault(require("../components/status")); function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; } function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); } function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } } function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; } function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } } function _arrayWithHoles(r) { if (Array.isArray(r)) return r; } var _default = exports["default"] = { id: "", name: "", chartLibrary: "", theme: "default", host: "", description: null, before: 0, after: 0, title: null, min: 0, max: 0, autofetchOnHovering: false, pristineStaticValueRange: undefined, valueRange: null, staticValueRange: null, getValueRange: function getValueRange(chart) { var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, _ref$dygraph = _ref.dygraph, dygraph = _ref$dygraph === void 0 ? false : _ref$dygraph; if (!chart) return [null, null]; var _chart$getAttributes = chart.getAttributes(), _chart$getAttributes$ = _chart$getAttributes.min, min = _chart$getAttributes$ === void 0 ? null : _chart$getAttributes$, _chart$getAttributes$2 = _chart$getAttributes.max, max = _chart$getAttributes$2 === void 0 ? null : _chart$getAttributes$2, _chart$getAttributes$3 = _chart$getAttributes.valueRange, valueRange = _chart$getAttributes$3 === void 0 ? [null, null] : _chart$getAttributes$3, staticValueRange = _chart$getAttributes.staticValueRange; if (staticValueRange) return staticValueRange; if (!valueRange || valueRange[0] === null && valueRange[1] === null) { if (dygraph) return [null, null]; return [min, max]; } var _valueRange = _slicedToArray(valueRange, 2), rangeMin = _valueRange[0], rangeMax = _valueRange[1]; if (dygraph) { var _chart$getAttributes2 = chart.getAttributes(), groupBy = _chart$getAttributes2.groupBy, aggregationMethod = _chart$getAttributes2.aggregationMethod; if (groupBy.length > 1 || groupBy[0] !== "dimension" || aggregationMethod !== "avg") return [null, null]; } var newValueRange = [rangeMin === null || rangeMin > min ? min : rangeMin, rangeMax === null || rangeMax < max ? max : rangeMax]; return newValueRange; }, loaded: false, loading: false, processing: false, updatedAt: 0, fetchStartedAt: 0, focused: false, active: false, sparkline: false, chartType: "", stepPlot: false, selectedLegendDimensions: [], contextItems: [], contextScope: [], nodesScope: [], selectedContexts: [], selectedDimensions: [], selectedLabels: [], selectedNodes: [], selectedInstances: [], dimensionIds: [], versions: {}, enabledHover: true, syncHover: true, hoverX: null, navigation: "", enabledNavigation: true, enabledResetRange: true, syncPanning: true, panning: false, hovering: false, syncHighlight: true, highlighting: false, desiredUnits: ["auto"], staticFractionDigits: null, abs: true, unitsConversionMethod: [""], unitsConversionDivider: [-1], unitsConversionFractionDigits: [0], unitsConversionPrefix: [""], unitsConversionBase: [""], dbUnitsConversionMethod: [""], dbUnitsConversionDivider: [-1], dbUnitsConversionFractionDigits: [0], dbUnitsConversionPrefix: [""], dbUnitsConversionBase: [""], temperature: "celsius", secondsAsTime: true, timezone: undefined, locale: undefined, syncTimezone: true, dimensionsSort: "default", // default | nameAsc | nameDesc | valueAsc | valueDesc autofetch: false, autofetchOnWindowBlur: false, paused: false, pixelsPerPoint: 3, points: null, legend: true, groupingMethod: "average", groupingTime: 0, urlOptions: [], eliminateZeroDimensions: true, fullscreen: false, overlays: {}, showingInfo: false, colors: [], height: "", enabledYAxis: true, width: "", enabledXAxis: true, hasToolbox: true, hideTitle: false, hideName: false, hideUnits: false, hasHoverPopover: true, expandable: true, showAnnotations: true, hasYlabel: true, yAxisLabelWidth: 68, axisLabelFontSize: 10, outOfLimits: false, aggregationMethod: "sum", postAggregationMethod: "avg", groupBy: ["dimension"], groupByLabel: [], postGroupBy: ["selected"], postGroupByLabel: [], dimensionsSortBy: [{ id: "contribution", desc: true }], instancesSortBy: [{ id: "contribution", desc: true }], nodesSortBy: [{ id: "contribution", desc: true }], groupBySortBy: [], labelsSortBy: [{ id: "contribution", desc: true }], nodesExpanded: {}, groupByExpanded: {}, labelsExpanded: {}, drilldown: { groupBy: ["node", "instance", "dimension"], groupByLabel: [], data: null, loading: false, error: null, sortBy: [], expanded: {}, search: "", groupBySortBy: [], groupByExpanded: {} }, correlate: { data: null, loading: false, error: null, method: "volume", aggregation: "average", dataType: "", threshold: 0.01, expanded: {}, search: "" }, pristine: {}, themeGridColor: ["#E4E8E8", "#212727"], themeCrosshair: ["#536775", "#536775"], themeTrackColor: ["#DBE1E1", "#353F3F"], themeScaleColor: ["#F7F8F8", "#2B3136"], themeEasyPieTrackColor: ["#DBE1E1", "#353F3F"], themeEasyPieScaleColor: ["#B7C2C2", "#424E4E"], themeGaugePointer: ["#8F9EAA", "#536775"], themeGaugeStroke: ["#DBE1E1", "#353F3F"], gaugeLineWidth: 0.1, gaugeGradient: true, themeD3pieSmallColor: ["#536775", "#CFD5DA"], themeD3pieStroke: ["#DBE1E1", "#353F3F"], themeInnerLabelColor: ["#F7F8F8", "#282827"], themeLabelColor: ["#35414a", "#ffffff"], themeBackground: ["#ffffff", "#282C34"], themeNeutralBackground: ["#DBE1E1", "#353F3F"], themeWarningBackground: ["#FFCC26", "#FFCC26"], themeErrorBackground: ["#F95251", "#F95251"], themeAnomalyScaleColor: ["#9F75F9", "#9F75F9"], themeGroupBoxesMin: ["#E4F1FF", "#000C18"], themeGroupBoxesMax: ["#0075F2", "#0075F2"], themeLoadingStart: ["#BFE5C6", "#2f5446"], themeNetdata: ["#00AB44", "#00AB44"], themeShadow: ["rgba(9, 30, 66, 0.15)", "rgba(0, 0, 0, 0.4)"], designFlavour: "default", legendScroll: 0, initializedFilters: false, error: null, agent: true, toolboxElements: [_settings["default"], _fullscreen["default"]], toolboxProps: {}, settingsTabs: [_tabs.DisplayTab, _tabs.DataTab, _tabs.InfoTab, _tabs.DownloadTab], nulls2zero: false, filterToolboxMode: "fixed", leftHeaderElements: [_status["default"]], expanded: false, expandedHeight: 300, viewDimensions: { ids: [], names: [], count: 0, priorities: [], grouped: [], algorithm: "absolute" // absolute|incremental }, // view units: [""], unitsStsByContext: {}, unitsByContext: {}, unitsByDimension: {}, viewUpdateEvery: 0, // view.update_every // db dbUnits: [""], dbUnitsStsByContext: {}, dbUnitsByContext: {}, dbUnitsByDimension: {}, updateEvery: 0, firstEntry: 0, lastEntry: 0, // summary dimensions: {}, labels: {}, nodes: {}, instances: {}, alerts: {}, drawer: { action: "compare", tab: "window", showAdvancedStats: false, valuesSearch: "" }, renderedAt: null, fetchAt: null, liveAnchor: null, dimensionsOnNonDimensionGrouping: null, en: { instance: { one: "instance", other: "instances" } }, tableColumns: ["context", "dimension"], bearer: null, xNetdataBearer: null, showPostAggregations: false, showAnomalies: true, draftAnnotation: null, // { timestamp, createdAt, status: "draft"|"editing"|"saving" } compareData: {}, comparePeriods: [], compareLoading: false, compareError: null, customPeriods: [{ id: "24h", label: "24 hours before", offsetSeconds: 86400 }, { id: "7d", label: "7 days before", offsetSeconds: 604800 }], selectedNodeLabelsFilter: [] };