Skip to content

Commit

Permalink
Merge pull request #61 from Brandawg93/grafana
Browse files Browse the repository at this point in the history
Add support for Grafana & InfluxDB
  • Loading branch information
Brandawg93 authored Jul 14, 2024
2 parents 3e919a1 + 158ea4c commit 4de9847
Show file tree
Hide file tree
Showing 46 changed files with 2,693 additions and 1,134 deletions.
7 changes: 0 additions & 7 deletions .eslintignore

This file was deleted.

9 changes: 0 additions & 9 deletions .eslintrc.json

This file was deleted.

11 changes: 11 additions & 0 deletions .stylelintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"extends": ["stylelint-config-standard"],
"rules": {
"at-rule-no-unknown": [
true,
{
"ignoreAtRules": ["tailwind"]
}
]
}
}
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ docker run -p 8080:8080 --restart unless-stopped \
### docker-compose.yml

```yaml
version: '3'
services:
peanut:
image: brandawg93/peanut:latest
Expand Down
1 change: 1 addition & 0 deletions __tests__/unit/app/page.test.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import React from 'react'
import { render } from '@testing-library/react'
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
import Page from '@/app/page'
Expand Down
1 change: 1 addition & 0 deletions __tests__/unit/client/components/daynight/index.test.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import React from 'react'
import { fireEvent, render } from '@testing-library/react'
import DayNightSwitch from '@/client/components/daynight'

Expand Down
1 change: 1 addition & 0 deletions __tests__/unit/client/components/daynight/mobile.test.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import React from 'react'
import { fireEvent, render } from '@testing-library/react'
import DayNightSwitch from '@/client/components/daynight/mobile'

Expand Down
1 change: 1 addition & 0 deletions __tests__/unit/client/components/footer.test.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import React from 'react'
import { render } from '@testing-library/react'
import Footer from '@/client/components/footer'

Expand Down
1 change: 1 addition & 0 deletions __tests__/unit/client/components/gauge.test.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import React from 'react'
import { render } from '@testing-library/react'
import Gauge from '@/client/components/gauge'

Expand Down
1 change: 1 addition & 0 deletions __tests__/unit/client/components/grid.test.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import React from 'react'
import { render } from '@testing-library/react'
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
import NutGrid from '@/client/components/grid'
Expand Down
1 change: 1 addition & 0 deletions __tests__/unit/client/components/kpi.test.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import React from 'react'
import { render } from '@testing-library/react'
import Kpi from '@/client/components/kpi'

Expand Down
7 changes: 4 additions & 3 deletions __tests__/unit/client/components/line-chart.test.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import React from 'react'
import { render } from '@testing-library/react'
import LineChart from '@/client/components/line-chart'
import { DEVICE } from '@/common/types'
Expand Down Expand Up @@ -34,9 +35,9 @@ describe('Line', () => {
const { getByTestId } = render(
<LineChart
serial={vars['device.serial']?.value}
inputVoltage={parseFloat(vars['input.voltage'].value)}
inputVoltageNominal={parseFloat(vars['input.voltage.nominal']?.value)}
outputVoltage={parseFloat(vars['output.voltage']?.value)}
inputVoltage={parseFloat(vars['input.voltage'].value as string)}
inputVoltageNominal={parseFloat(vars['input.voltage.nominal']?.value as string)}
outputVoltage={parseFloat(vars['output.voltage']?.value as string)}
updated={new Date()}
/>
)
Expand Down
1 change: 1 addition & 0 deletions __tests__/unit/client/components/navbar.test.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import React from 'react'
import { render, screen } from '@testing-library/react'
import NavBar from '@/client/components/navbar'

Expand Down
1 change: 1 addition & 0 deletions __tests__/unit/client/components/runtime.test.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import React from 'react'
import { render } from '@testing-library/react'
import Runtime from '@/client/components/runtime'

Expand Down
5 changes: 3 additions & 2 deletions __tests__/unit/client/components/watts-chart.test.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import React from 'react'
import { render } from '@testing-library/react'
import WattsChart from '@/client/components/watts-chart'
import { DEVICE } from '@/common/types'
Expand Down Expand Up @@ -31,8 +32,8 @@ describe('Gauge', () => {
const { getByTestId } = render(
<WattsChart
serial={vars['device.serial']?.value}
realpower={parseFloat(vars['ups.realpower'].value)}
realpowerNominal={parseFloat(vars['ups.realpower.nominal']?.value)}
realpower={parseFloat(vars['ups.realpower'].value as string)}
realpowerNominal={parseFloat(vars['ups.realpower.nominal']?.value as string)}
updated={new Date()}
/>
)
Expand Down
1 change: 1 addition & 0 deletions __tests__/unit/client/components/wrapper.test.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import React from 'react'
import { render } from '@testing-library/react'
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'

Expand Down
1 change: 1 addition & 0 deletions __tests__/unit/server/nut.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ describe('Nut', () => {
jest.spyOn(PromiseSocket.prototype, 'readAll').mockResolvedValueOnce('OK\n')
jest.spyOn(PromiseSocket.prototype, 'readAll').mockResolvedValueOnce('OK\n')
jest.spyOn(PromiseSocket.prototype, 'readAll').mockResolvedValue(listVarUps)
jest.spyOn(Nut.prototype, 'getType').mockResolvedValue('STRING')
await nut.connect()
const data = await nut.getData('ups')
expect(data['battery.charge'].value).toEqual('100')
Expand Down
47 changes: 47 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import globals from 'globals'
import pluginJs from '@eslint/js'
import tseslint from 'typescript-eslint'
import pluginReactConfig from 'eslint-plugin-react/configs/recommended.js'
import { fixupConfigRules } from '@eslint/compat'
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended'
import reactPlugin from 'eslint-plugin-react'
import prettier from 'eslint-plugin-prettier'

export default [
{
files: ['**/*.{js,mjs,cjs,ts,jsx,tsx}'],
plugins: { reactPlugin, prettier },
},
{
ignores: [
'dist',
'.next',
'scripts',
'pnpm-lock.yml',
'config',
'*.png',
'.pnpm-store',
'.husky',
'.devcontainer',
'.gitignore',
],
},
{ languageOptions: { parserOptions: { ecmaFeatures: { jsx: true } } } },
{ languageOptions: { globals: { ...globals.browser, ...globals.node } } },
pluginJs.configs.recommended,
...tseslint.configs.recommended,
...fixupConfigRules(pluginReactConfig),
eslintPluginPrettierRecommended,
{
settings: {
react: {
version: 'detect',
},
},
},
{
rules: {
'@typescript-eslint/no-explicit-any': 'off',
},
},
]
Loading

0 comments on commit 4de9847

Please sign in to comment.