Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade all #192

Merged
merged 10 commits into from
Apr 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 0 additions & 24 deletions .eslintrc.js

This file was deleted.

4 changes: 1 addition & 3 deletions babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@ const isTest = process.env.NODE_ENV === "test"

module.exports = {
presets: [
["@babel/env", { loose: true, modules: isES6 ? false : "commonjs" }],
["@babel/env", { loose: false, modules: isES6 ? false : "commonjs" }],
"@babel/preset-react",
],
plugins: [
["styled-components", { ssr: !isTest, displayName: !isTest }],
"@babel/plugin-transform-spread",
"@babel/plugin-proposal-object-rest-spread",
[
"module-resolver",
{
Expand Down
38 changes: 38 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
const globals = require("globals")
const pluginJs = require("@eslint/js")
const pluginReact = require("eslint-plugin-react")
const storybook = require("eslint-plugin-storybook")

module.exports = [
{ files: ["**/*.{js,mjs,cjs,jsx}"] },
{
languageOptions: {
globals: {
...globals.browser,
...globals.commonjs,
...globals.es6,
...globals.jest,
...globals.node,
},
},
},
pluginJs.configs.recommended,
pluginReact.configs.flat.recommended,
...storybook.configs["flat/recommended"],
{
rules: {
"react/jsx-filename-extension": [1, { extensions: [".js", ".jsx"] }],
"react/prop-types": "off",
"react/display-name": "off",
},
},
{
ignores: [
// Ignore dotfiles
".*.js",
"node_modules/",
"dist/",
"!.storybook",
],
},
]
80 changes: 37 additions & 43 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@netdata/charts",
"version": "5.6.6",
"version": "6.0.5",
"description": "Netdata frontend SDK and chart utilities",
"main": "dist/index.js",
"module": "dist/es6/index.js",
Expand All @@ -15,8 +15,7 @@
"scripts": {
"build:cjs": "babel src --out-dir dist --copy-files --ignore **/*.stories.js",
"build:es6": "BABEL_ENV=es6 babel src --out-dir dist/es6 --copy-files --ignore **/*.stories.js",
"build:umd": "NODE_ENV=production webpack",
"build": "yarn build:umd && yarn build:cjs && yarn build:es6",
"build": "yarn build:cjs && yarn build:es6",
"test": "jest --config ./jest/config.js",
"lint": "eslint './src/**/*.js'",
"clean": "rimraf lib dist es coverage",
Expand All @@ -33,64 +32,59 @@
"charts"
],
"peerDependencies": {
"@netdata/netdata-ui": "^4.3.2",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"styled-components": "^5.3.9"
"@netdata/netdata-ui": ">=5.0.1",
"react": ">=18.2.0",
"react-dom": ">=18.2.0",
"styled-components": ">=5.3.9"
},
"devDependencies": {
"@babel/cli": "^7.24.7",
"@babel/core": "^7.24.7",
"@babel/eslint-parser": "^7.24.7",
"@babel/plugin-proposal-object-rest-spread": "^7.20.7",
"@babel/plugin-transform-modules-umd": "^7.24.7",
"@babel/plugin-transform-runtime": "^7.24.7",
"@babel/preset-env": "^7.24.7",
"@babel/preset-react": "^7.24.7",
"@netdata/netdata-ui": "^4.8.15",
"@storybook/addon-essentials": "^8.1.11",
"@storybook/addon-interactions": "^8.1.11",
"@storybook/addon-links": "^8.1.11",
"@storybook/addon-onboarding": "^8.1.11",
"@storybook/addon-webpack5-compiler-babel": "^3.0.3",
"@storybook/blocks": "^8.1.11",
"@storybook/react": "^8.1.11",
"@storybook/react-webpack5": "^8.1.11",
"babel-loader": "^9.1.3",
"@babel/cli": "^7.27.0",
"@babel/core": "^7.26.10",
"@babel/eslint-parser": "^7.27.0",
"@babel/plugin-transform-runtime": "^7.26.10",
"@babel/preset-env": "^7.26.9",
"@babel/preset-react": "^7.26.3",
"@netdata/netdata-ui": "^5.0.3",
"@storybook/addon-essentials": "^8.6.11",
"@storybook/addon-interactions": "^8.6.11",
"@storybook/addon-links": "^8.6.11",
"@storybook/addon-onboarding": "^8.6.11",
"@storybook/addon-webpack5-compiler-babel": "^3.0.6",
"@storybook/blocks": "^8.6.11",
"@storybook/react": "^8.6.11",
"@storybook/react-webpack5": "^8.6.11",
"babel-loader": "^10.0.0",
"babel-plugin-module-resolver": "^5.0.2",
"babel-plugin-styled-components": "^2.1.4",
"clean-webpack-plugin": "^4.0.0",
"eslint": "^8.57.0",
"eslint-plugin-react": "^7.34.3",
"eslint-plugin-react-hooks": "^4.6.2",
"eslint-plugin-storybook": "^0.8.0",
"eslint": "^9.23.0",
"eslint-plugin-react": "^7.37.4",
"eslint-plugin-react-hooks": "^5.2.0",
"eslint-plugin-storybook": "^0.12.0",
"globals": "^16.0.0",
"identity-obj-proxy": "^3.0.0",
"jest": "^29.7.0",
"jest-canvas-mock": "^2.5.2",
"jest-environment-jsdom": "^29.7.0",
"prettier": "^3.3.2",
"prettier": "^3.5.3",
"raw-loader": "^4.0.2",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"rimraf": "^5.0.7",
"sass-loader": "^14.2.1",
"storybook": "^8.1.11",
"styled-components": "^5.3.9",
"react": "^19.1.0",
"react-dom": "^19.1.0",
"rimraf": "^6.0.1",
"sass-loader": "^16.0.5",
"storybook": "^8.6.11",
"styled-components": "^6.1.16",
"svg-sprite-loader": "^6.0.11",
"svgo-loader": "^4.0.0",
"webpack": "^5.92.1",
"webpack-cli": "^5.1.4",
"webpack-plugin": "^1.0.5"
"svgo-loader": "^4.0.0"
},
"dependencies": {
"@storybook/test": "^8.1.11",
"@storybook/test": "^8.6.11",
"babel-eslint": "^10.1.0",
"d3": "^7.9.0",
"d3-scale": "^4.0.2",
"dygraphs": "^2.2.1",
"easy-pie-chart": "^2.1.7",
"md5": "^2.3.0",
"throttle-debounce": "^5.0.2",
"uuid": "^10.0.0"
"uuid": "^11.1.0"
}
}
24 changes: 0 additions & 24 deletions src/chartLibraries/dygraph/style.css

This file was deleted.

6 changes: 3 additions & 3 deletions src/components/bars/index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React, { forwardRef } from "react"
import React from "react"
import ChartContainer from "@/components/chartContainer"
import { useOnResize } from "@/components/provider"
import withChart from "@/components/hocs/withChart"
import { ChartWrapper } from "@/components/hocs/withTile"
import Dimensions from "./dimensions"

export const BarsChart = forwardRef(({ uiName, ...rest }, ref) => {
export const BarsChart = ({ uiName, ref, ...rest }) => {
const { width, height } = useOnResize(uiName)

return (
Expand All @@ -15,6 +15,6 @@ export const BarsChart = forwardRef(({ uiName, ...rest }, ref) => {
</ChartContainer>
</ChartWrapper>
)
})
}

export default withChart(BarsChart, { tile: true })
6 changes: 3 additions & 3 deletions src/components/d3pie/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { forwardRef } from "react"
import React from "react"
import styled, { keyframes } from "styled-components"
import { Flex } from "@netdata/netdata-ui"
import ChartContainer from "@/components/chartContainer"
Expand All @@ -25,7 +25,7 @@ export const Skeleton = styled(Flex).attrs(props => ({
animation: ${frames} 1.6s ease-in infinite;
`

export const D3pie = forwardRef(({ uiName, ...rest }, ref) => {
export const D3pie = ({ uiName, ref, ...rest }) => {
const loaded = useAttributeValue("loaded")
const { width, height } = useOnResize(uiName)
const size = width < height ? width : height
Expand All @@ -41,6 +41,6 @@ export const D3pie = forwardRef(({ uiName, ...rest }, ref) => {
)}
</ChartWrapper>
)
})
}

export default withChart(D3pie, { tile: true })
6 changes: 3 additions & 3 deletions src/components/easyPie/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { forwardRef } from "react"
import React from "react"
import styled, { keyframes } from "styled-components"
import { Flex, Text } from "@netdata/netdata-ui"
import ChartContainer from "@/components/chartContainer"
Expand Down Expand Up @@ -73,7 +73,7 @@ export const Skeleton = styled(Flex).attrs(props => ({
animation: ${frames} 1.6s ease-in infinite;
`

export const EasyPie = forwardRef(({ uiName, ...rest }, ref) => {
export const EasyPie = ({ uiName, ref, ...rest }) => {
const loaded = useAttributeValue("loaded")

const { width, height } = useOnResize(uiName)
Expand All @@ -96,6 +96,6 @@ export const EasyPie = forwardRef(({ uiName, ...rest }, ref) => {
)}
</ChartWrapper>
)
})
}

export default withChart(EasyPie, { tile: true })
59 changes: 32 additions & 27 deletions src/components/filterToolbox/label.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { forwardRef } from "react"
import React from "react"
import styled from "styled-components"
import { Flex, TextSmall, getColor } from "@netdata/netdata-ui"
import chevronDown from "@netdata/netdata-ui/dist/components/icon/assets/chevron_down.svg"
Expand Down Expand Up @@ -27,32 +27,37 @@ const StyledLabel = styled(TextSmall).attrs({
flex: 1;
`

const Label = forwardRef(
(
{ icon, secondaryLabel, tertiaryLabel, label, chevron = true, iconRotate, textProps, ...rest },
ref
) =>
icon ? (
<Container ref={ref} {...rest}>
{icon}
</Container>
) : (
<Container ref={ref} {...rest}>
{secondaryLabel && (
<TextSmall color="textLite" whiteSpace="nowrap" truncate>
{secondaryLabel}
</TextSmall>
)}
<StyledLabel {...textProps}>{label}</StyledLabel>
{tertiaryLabel && (
<TextSmall color="textLite" whiteSpace="nowrap" truncate>
{tertiaryLabel}
</TextSmall>
)}
{chevron && <Icon svg={chevronDown} size="12px" color="textNoFocus" rotate={iconRotate} />}
</Container>
)
)
const Label = ({
icon,
secondaryLabel,
tertiaryLabel,
label,
chevron = true,
iconRotate,
textProps,
ref,
...rest
}) =>
icon ? (
<Container ref={ref} {...rest}>
{icon}
</Container>
) : (
<Container ref={ref} {...rest}>
{secondaryLabel && (
<TextSmall color="textLite" whiteSpace="nowrap" truncate>
{secondaryLabel}
</TextSmall>
)}
<StyledLabel {...textProps}>{label}</StyledLabel>
{tertiaryLabel && (
<TextSmall color="textLite" whiteSpace="nowrap" truncate>
{tertiaryLabel}
</TextSmall>
)}
{chevron && <Icon svg={chevronDown} size="12px" color="textNoFocus" rotate={iconRotate} />}
</Container>
)

const TooltipContent = ({ heading, body }) => (
<Flex column gap={1} {...tooltipStyleProps}>
Expand Down
6 changes: 3 additions & 3 deletions src/components/gauge/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { forwardRef } from "react"
import React from "react"
import styled, { keyframes } from "styled-components"
import { Flex, Text, getColor } from "@netdata/netdata-ui"
import ChartContainer from "@/components/chartContainer"
Expand Down Expand Up @@ -121,7 +121,7 @@ export const Skeleton = styled(Flex).attrs(props => ({
animation: ${frames} 1.6s ease-in infinite;
`

export const Gauge = forwardRef(({ uiName, ...rest }, ref) => {
export const Gauge = ({ uiName, ref, ...rest }) => {
const loaded = useAttributeValue("loaded")

return (
Expand All @@ -145,6 +145,6 @@ export const Gauge = forwardRef(({ uiName, ...rest }, ref) => {
)}
</ChartWrapper>
)
})
}

export default withChart(Gauge, { tile: true })
8 changes: 4 additions & 4 deletions src/components/groupBoxes/container.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React, { forwardRef } from "react"
import React from "react"
import { Flex } from "@netdata/netdata-ui"
import GroupBoxes from "./groupBoxes"

const Container = forwardRef((props, ref) => (
<Flex column width="100%" height="100%" gap={4} padding={[4, 2]} ref={ref} {...props}>
const Container = props => (
<Flex column width="100%" height="100%" gap={4} padding={[4, 2]} {...props}>
<GroupBoxes />
</Flex>
))
)

export default Container
Loading