-
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 13 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 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,84 @@ | ||
| import Chart from 'react-apexcharts'; | ||
| import React, { useEffect } from 'react'; | ||
| import ApexCharts from 'apexcharts'; | ||
|
|
||
| const graph_height = 400; | ||
|
|
||
| export default function LoadChartWidget(props) { | ||
| const options = { | ||
| chart: { | ||
| height: graph_height, | ||
| type: 'line', | ||
| zoom: { | ||
| enabled: true, | ||
| }, | ||
| id: 'load_chart', | ||
| }, | ||
| dataLabels: { | ||
| enabled: false, | ||
| }, | ||
| title: { | ||
| text: props.title, | ||
| }, | ||
| stroke: { | ||
| width: 2, | ||
| curve: 'smooth', | ||
| }, | ||
| colors: ['#2E93fA', '#66DA26', '#546E7A'], | ||
| fill: { | ||
| type: 'gradient', | ||
| gradient: { | ||
| shadeIntensity: 1, | ||
| inverseColors: true, | ||
| gradientToColors: ['#ff0fd7', '#b7ff00', '#0841ff'], | ||
| opacityFrom: 1, | ||
| opacityTo: 1, | ||
| type: 'vertical', | ||
| stops: [0, 30], | ||
| }, | ||
| }, | ||
| }; | ||
|
|
||
| const series = [ | ||
| { | ||
| name: '1 minute', | ||
| data: [], | ||
| }, | ||
| { | ||
| name: '5 minute', | ||
| data: [], | ||
| }, | ||
| { | ||
| name: '15 mintue', | ||
| data: [], | ||
| }, | ||
| ]; | ||
|
|
||
| useEffect(() => { | ||
| ApexCharts.exec('load_chart', 'updateOptions', { | ||
| xaxis: { | ||
| labels: { | ||
| show: false, | ||
| }, | ||
| }, | ||
| }); | ||
|
|
||
| ApexCharts.exec('load_chart', 'appendData', [ | ||
| { | ||
| data: props.data[0], | ||
| }, | ||
| { | ||
| data: props.data[1], | ||
| }, | ||
| { | ||
| data: props.data[2], | ||
| }, | ||
| ]); | ||
| }); | ||
|
|
||
| return ( | ||
| <div id="chart"> | ||
| <Chart options={options} series={series} type="line" height={graph_height} /> | ||
| </div> | ||
| ); | ||
| } | ||
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,71 @@ | ||
| import { Box } from '@material-ui/core'; | ||
|
rroohhh marked this conversation as resolved.
Outdated
|
||
| import React, { useEffect, useState } from 'react'; | ||
| import { Command } from './CommandWidgets'; | ||
| import LoadChartWidget from './LoadChartWidget'; | ||
|
|
||
| const uptime_cmd = 'uptime'; | ||
|
|
||
| const graph_title = 'Load average'; | ||
|
|
||
| export default function RunCommand(props) { | ||
| const [state, setstate] = useState({ | ||
|
rroohhh marked this conversation as resolved.
Outdated
|
||
| labels: [], | ||
| data: [[], [], []], | ||
| output: '', | ||
| }); | ||
|
|
||
| function extractLoadFromString(str = '') { | ||
| let list = str.split(',').map(ele => { | ||
| return ele.trim(); | ||
| }); | ||
|
|
||
| let one_min = parseFloat(list[2].split(':')[1]); | ||
| let five_min = parseFloat(list[3]); | ||
| let fifteen_min = parseFloat(list[4]); | ||
|
|
||
| return { | ||
| y_value: [one_min, five_min, fifteen_min], | ||
| original_str: str, | ||
| }; | ||
| } | ||
|
|
||
| function updateData(new_data) { | ||
| setstate({ | ||
| data: [[new_data.y_value[0]], [new_data.y_value[1]], [new_data.y_value[2]]], | ||
| output: new_data.original_str, | ||
| }); | ||
| } | ||
|
|
||
| useEffect(() => { | ||
| const callback = () => | ||
| exec(props.command) | ||
| .then(result => { | ||
| if (props.showGraph) updateData(extractLoadFromString(result[0])); | ||
| else | ||
| setstate(prevState => ({ | ||
| ...prevState, | ||
| output: result[0], | ||
| })); | ||
| }) | ||
| .catch(err => console.log(err[1])); | ||
| const interval_handle = setInterval(callback, props.interval); | ||
| callback(); | ||
| return () => clearInterval(interval_handle); | ||
| }, [props.command]); | ||
|
rroohhh marked this conversation as resolved.
Outdated
|
||
|
|
||
| return ( | ||
| <div> | ||
| {props.showGraph !== undefined && props.command === uptime_cmd ? ( | ||
| <Box | ||
| style={{ | ||
| padding: '1.5rem', | ||
| }} | ||
| > | ||
| <LoadChartWidget data={state.data} title={graph_title} /> | ||
| </Box> | ||
| ) : null} | ||
|
|
||
| <Command command={props.command} output={state.output} children={props.children} /> | ||
| </div> | ||
| ); | ||
| } | ||
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 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 |
|---|---|---|
| @@ -1,20 +1,20 @@ | ||
| import * as React from 'react'; | ||
| import { Command } from '../components/CommandWidgets'; | ||
| import RunCommand from '../components/RunCommand'; | ||
|
|
||
| export const title = 'System Information'; | ||
| export const route = '/system_information'; | ||
| export const explanation = `Get an overview of whats going on in the linux side of your camera. | ||
| Ip address, system load, etc can be found here`; | ||
|
|
||
| export function Component(props) { | ||
| export function Component() { | ||
| return ( | ||
| <div> | ||
| <Command command="date" interval={1000} /> | ||
| <Command command="uptime" interval={1000} /> | ||
| <Command command="free -h" interval={1000} /> | ||
| <Command command="ip a" interval={1000} /> | ||
| <Command command="uname -a" interval={10000} /> | ||
| <Command command="ps -aef --forest" interval={10000} /> | ||
| <RunCommand command="uptime" interval={1000} showGraph={true} /> | ||
| <RunCommand command="date" interval={1000} /> | ||
| <RunCommand command="free -h" interval={1000} /> | ||
| <RunCommand command="ip a" interval={1000} /> | ||
| <RunCommand command="uname -a" interval={10000} /> | ||
| <RunCommand command="ps -aef --forest" interval={10000} /> | ||
| </div> | ||
| ); | ||
| } |
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.
Uh oh!
There was an error while loading. Please reload this page.