@netdata/charts
Version:
Netdata frontend SDK and chart utilities
50 lines • 1.57 kB
JavaScript
import React from "react";
import { Flex, Text } from "@netdata/netdata-ui";
import Controls from "./controls";
import Table from "./table";
import useData from "./useData";
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
var Correlate = function Correlate() {
var _useData = useData(),
loading = _useData.loading,
error = _useData.error,
data = _useData.data;
return /*#__PURE__*/_jsxs(Flex, {
flex: true,
column: true,
gap: 2,
height: {
min: "0px",
base: "100%"
},
overflow: "hidden",
children: [/*#__PURE__*/_jsx(Flex, {
flex: false,
children: /*#__PURE__*/_jsx(Controls, {})
}), error && /*#__PURE__*/_jsx(Flex, {
justifyContent: "center",
padding: [2, 0],
children: /*#__PURE__*/_jsxs(Text, {
color: "error",
children: ["Error: ", error]
})
}), loading && !(data !== null && data !== void 0 && data.length) && /*#__PURE__*/_jsx(Flex, {
justifyContent: "center",
padding: [2, 0],
children: /*#__PURE__*/_jsx(Text, {
color: "textLite",
children: "Loading correlations..."
})
}), !loading && !error && (data === null || data === void 0 ? void 0 : data.length) === 0 && /*#__PURE__*/_jsx(Flex, {
justifyContent: "center",
padding: [4, 0],
children: /*#__PURE__*/_jsx(Text, {
color: "textLite",
children: "No correlations found"
})
}), data && data.length > 0 && /*#__PURE__*/_jsx(Table, {
data: data
})]
});
};
export default Correlate;