-
Notifications
You must be signed in to change notification settings - Fork 8
Fancy wifi Table and Camera Load widget (Challenge) #11
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
Open
hanupratap
wants to merge
33
commits into
apertus-open-source-cinema:main
Choose a base branch
from
hanupratap:master
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 4 commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
f376756
Added sort by key feature in WiFi tab and Improved UI in WiFi tab
hanupratap d1ee1ca
Highlighted row and added active dot for connected network. Removed u…
hanupratap 433147f
Added Chips for WPA, Updated dependecies, cleaned code
hanupratap 4b06a8e
Added camer load graph
hanupratap e128d87
Minor UI Changes and code improvement
hanupratap 2bd325f
Minor function name changes
hanupratap d17e912
Changed graph library to ApexCharts
hanupratap 59d1f6e
graph update
hanupratap 9ad8da4
Added bars icon
hanupratap 8a7d92b
formatted code
hanupratap 317f1e6
Refactored command and graph widget
hanupratap 5b94db9
Fixed graph reset on re-render
hanupratap f8fe2be
Formatted Code
hanupratap 463328d
Removed ticks and added loading text for no data
hanupratap 7512d10
Changed case for setstate
hanupratap 9afde1a
added showGraph in rebuild list
hanupratap e359728
Added CanvasJs Charts
hanupratap eb839ff
Changed lib to chartjs, removed unnecessary libs and files, formatted…
hanupratap 7124ed4
minor improvements
hanupratap 9c4fe9f
minor performance improvement
hanupratap 2ff76b7
Fixed color in tooltip
hanupratap dd257e0
chartjs replaced with Dygraph charts
hanupratap 04b462d
Graph autoscale x-direction
hanupratap a0b7b3e
Added open source animation
hanupratap 13308ee
code format
hanupratap c435618
Added apertus animation
hanupratap 3777914
changed tooltip position, removed hardcoded theme
hanupratap dfa8512
format code
hanupratap ddbf771
added accordion on sys-info, improved performanec
hanupratap 8c9ecc8
format code
hanupratap 0685002
small change in accordion
hanupratap 8cc9a8c
added dark mode
hanupratap efb28fb
color highlight fix
hanupratap File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,144 @@ | ||
| import Chart from 'chart.js'; | ||
| import React, { createRef, useEffect } from 'react'; | ||
| import 'chartjs-plugin-zoom'; | ||
| import { Button } from '@material-ui/core'; | ||
| import RotateLeftIcon from '@material-ui/icons/RotateLeft'; | ||
| import { blue, green, orange } from '@material-ui/core/colors'; | ||
|
|
||
| var chart = null; | ||
| const update_interval = 1000; | ||
| const command = 'uptime'; | ||
| const chart_title = 'Load Averages'; | ||
|
|
||
| const chart_config = { | ||
| type: 'line', | ||
| data: { | ||
| labels: [], | ||
| datasets: [ | ||
| { | ||
| label: '1 minute', | ||
| data: [], | ||
| backgroundColor: 'rgba(255, 100, 100, 0.1)', | ||
| borderColor: orange.A100, | ||
| borderWidth: 1.5, | ||
| }, | ||
| { | ||
| label: '5 minute', | ||
| data: [], | ||
| backgroundColor: 'rgba(50, 255, 50, 0.1)', | ||
| borderColor: green.A200, | ||
| borderWidth: 1.5, | ||
| }, | ||
| { | ||
| label: '15 minute', | ||
| data: [], | ||
| backgroundColor: 'rgba(100, 100, 255, 0.1)', | ||
| borderColor: blue.A100, | ||
| borderWidth: 1.5, | ||
| }, | ||
| ], | ||
| }, | ||
| options: { | ||
| title: { | ||
| display: true, | ||
| text: chart_title, | ||
| fontSize: 16, | ||
| }, | ||
| hover: { | ||
| animationDuration: 0, | ||
| }, | ||
| responsiveAnimationDuration: 0, | ||
| scales: { | ||
| y: { | ||
| beginAtZero: true, | ||
| }, | ||
| }, | ||
| elements: { | ||
| line: { | ||
| tension: 0, | ||
| }, | ||
| }, | ||
| tooltips: { | ||
| mode: 'x', | ||
| }, | ||
| plugins: { | ||
| zoom: { | ||
| zoom: { | ||
| enabled: true, | ||
| mode: 'x', | ||
| }, | ||
| pan: { | ||
| enabled: true, | ||
| mode: 'x', | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| }; | ||
|
|
||
| export default function LoadGraph() { | ||
| const chartRef = createRef(); | ||
|
|
||
| function updateData(obj) { | ||
| if (chart == null) return; | ||
| chart.data.labels.push(obj.x_value); | ||
| chart.data.datasets.forEach((dataset, idx) => { | ||
| dataset.data.push(obj.y_value[idx]); | ||
| }); | ||
| chart.update(); | ||
| } | ||
|
|
||
| function extractLoadFromString(str = '') { | ||
| const list = str.split(','); | ||
| const time_stamp = list[0].trim(); | ||
| const one_min = parseFloat(list[2].split(':')[1]); | ||
| const five_min = parseFloat(list[3]); | ||
| const fifteen_min = parseFloat(list[4]); | ||
|
|
||
| return { | ||
| x_value: time_stamp, | ||
| y_value: [one_min, five_min, fifteen_min], | ||
| original_str: str, | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. unused |
||
| }; | ||
| } | ||
|
|
||
| useEffect(() => { | ||
| chart = new Chart(chartRef.current, chart_config); | ||
|
|
||
| const callback = () => | ||
| exec(command) | ||
| .then(result => { | ||
| updateData(extractLoadFromString(result[0])); | ||
| }) | ||
| .catch(err => console.log(err[1])); | ||
| const interval_handle = setInterval(callback, update_interval); | ||
| callback(); | ||
| return () => clearInterval(interval_handle); | ||
| }, []); | ||
|
|
||
| function resetZoom() { | ||
| if (chart == null) { | ||
| console.log('Chart is not defined/initialized'); | ||
| return; | ||
| } | ||
| chart.resetZoom(); | ||
| } | ||
|
|
||
| return ( | ||
| <div> | ||
| <Button | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The left edge of this button is cut-off for me. |
||
| variant="outlined" | ||
| color="primary" | ||
| size="small" | ||
| onClick={resetZoom} | ||
| style={{ | ||
| margin: '0.5rem', | ||
| }} | ||
| endIcon={<RotateLeftIcon />} | ||
| > | ||
| Reset Zoom | ||
| </Button> | ||
| <canvas ref={chartRef} id="myChart" width="400" height="200"></canvas> | ||
| </div> | ||
| ); | ||
| } | ||
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does not really work (atleast on my system). I get something like
xx:xx:xx up for x days x:xxinstead of just thexx:xx:xxpart.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
got it