UNPKG

@netdata/charts

Version:

Netdata frontend SDK and chart utilities

45 lines 2.33 kB
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; } function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } import React, { useMemo } from "react"; import { Flex } from "@netdata/netdata-ui"; import { useAttributeValue } from "../provider"; import Header from "./header"; import Dimensions from "./dimensions"; import DrillDown from "./drillDown"; import Compare from "./compare"; // import Correlate from "./correlate" import { actions } from "./constants"; import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; var componentsByAction = _defineProperty(_defineProperty(_defineProperty({}, actions.values, Dimensions), actions.drillDown, DrillDown), actions.compare, Compare); var Drawer = function Drawer() { var expandedHeight = useAttributeValue("expandedHeight"); var action = useAttributeValue("drawer.action"); var Component = useMemo(function () { return componentsByAction[action] || componentsByAction.values; }, [action]); return /*#__PURE__*/_jsxs(Flex, { height: "".concat(expandedHeight, "px"), flex: false, column: true, "data-testid": "drawer", background: "mainChartBg", border: { side: "top", color: "borderSecondary" }, children: [/*#__PURE__*/_jsx(Header, { padding: [3, 2, 2, 2] }), /*#__PURE__*/_jsx(Flex, { flex: true, column: true, padding: [0, 2, 3, 2], overflow: { vertical: "scroll" }, children: /*#__PURE__*/_jsx(Component, {}) })] }); }; export default Drawer;