This repository was archived by the owner on Apr 9, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Dashboard #17
Open
czystyl
wants to merge
7
commits into
master
Choose a base branch
from
feat/dashboard
base: master
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
Dashboard #17
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
38737cf
Init work on dashboard
czystyl 98f9163
Add watch scripts to all packages
czystyl d0408f8
Add multiple examples
czystyl c7b2e30
Clean up
czystyl e7aedff
Update readme
czystyl e1ce900
Add screens from dashboard
czystyl fda4196
Add TS suport
czystyl 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
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,53 @@ | ||
| import React from "react"; | ||
| import blessed from "blessed"; | ||
| import { render } from "react-blessed"; | ||
|
|
||
| import Process from "./Process"; | ||
|
|
||
| const Core = () => { | ||
| return ( | ||
| <blessed-element> | ||
| <Process label="Nars - TS" arg="build-nars-ts" height="50%" width="50%" /> | ||
|
|
||
| <Process | ||
| label="Nars - RE" | ||
| arg="build-nars-re" | ||
| top="50%" | ||
| height="50%" | ||
| width="50%" | ||
| /> | ||
|
|
||
| <Process | ||
| label="Nars Client" | ||
| arg="build-nars-client" | ||
| right="0" | ||
| height="50%" | ||
| width="50%" | ||
| /> | ||
|
|
||
| <Process | ||
| label="Nars Common" | ||
| arg="build-nars-common" | ||
| top="50%" | ||
| right="0" | ||
| height="50%" | ||
| width="50%" | ||
| /> | ||
| </blessed-element> | ||
| ); | ||
| }; | ||
|
|
||
| /** | ||
| * Rendering the screen. | ||
| */ | ||
| const screen = blessed.screen({ | ||
| autoPadding: true, | ||
| smartCSR: true, | ||
| title: "Nars core dashboard", | ||
| }); | ||
|
|
||
| screen.key(["escape", "q", "C-c"], function() { | ||
| return process.exit(0); | ||
| }); | ||
|
|
||
| render(<Core />, screen); |
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,45 @@ | ||
| import React from "react"; | ||
| import blessed from "blessed"; | ||
| import { render } from "react-blessed"; | ||
|
|
||
| import Process from "./Process"; | ||
|
|
||
| const Example = () => { | ||
| return ( | ||
| <blessed-element> | ||
| <Process label="Client" arg="build-client" height="50%" width="100%" /> | ||
|
|
||
| <Process | ||
| label="Server" | ||
| arg="build-server" | ||
| top="50%" | ||
| height="50%" | ||
| width="70%" | ||
| /> | ||
|
|
||
| <Process | ||
| label="Common" | ||
| arg="build-common" | ||
| top="50%" | ||
| height="50%" | ||
| width="30%" | ||
| right="0" | ||
| /> | ||
| </blessed-element> | ||
| ); | ||
| }; | ||
|
|
||
| /** | ||
| * Rendering the screen. | ||
| */ | ||
| const screen = blessed.screen({ | ||
| autoPadding: true, | ||
| smartCSR: true, | ||
| title: "Nars example dashboard", | ||
| }); | ||
|
|
||
| screen.key(["escape", "q", "C-c"], function() { | ||
| return process.exit(0); | ||
| }); | ||
|
|
||
| render(<Example />, screen); |
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,76 @@ | ||
| import React from "react"; | ||
| import blessed from "blessed"; | ||
| import { render } from "react-blessed"; | ||
|
|
||
| import Process from "./Process"; | ||
|
|
||
| const Full = () => { | ||
| return ( | ||
| <blessed-element> | ||
| <Process label="Client" arg="build-client" height="33%" width="50%" /> | ||
|
|
||
| <Process | ||
| label="Server" | ||
| arg="build-server" | ||
| top="33%" | ||
| height="33%" | ||
| width="50%" | ||
| /> | ||
|
|
||
| <Process | ||
| label="Common" | ||
| arg="build-common" | ||
| top="66%" | ||
| height="33%" | ||
| width="50%" | ||
| /> | ||
|
|
||
| <Process | ||
| label="Nars - TS" | ||
| arg="build-nars-ts" | ||
| right="0" | ||
| height="25%" | ||
| width="50%" | ||
| /> | ||
|
|
||
| <Process | ||
| label="Nars - RE" | ||
| arg="build-nars-re" | ||
| top="25%" | ||
| right="0" | ||
| height="25%" | ||
| width="50%" | ||
| /> | ||
|
|
||
| <Process | ||
| label="Nars Client" | ||
| arg="build-nars-client" | ||
| top="50%" | ||
| right="0" | ||
| height="25%" | ||
| width="50%" | ||
| /> | ||
|
|
||
| <Process | ||
| label="Nars Common" | ||
| arg="build-nars-common" | ||
| top="75%" | ||
| right="0" | ||
| height="25%" | ||
| width="50%" | ||
| /> | ||
| </blessed-element> | ||
| ); | ||
| }; | ||
|
|
||
| const screen = blessed.screen({ | ||
| autoPadding: true, | ||
| smartCSR: true, | ||
| title: "Nars dashboard", | ||
| }); | ||
|
|
||
| screen.key(["escape", "q", "C-c"], function() { | ||
| return process.exit(0); | ||
| }); | ||
|
|
||
| render(<Full />, screen); |
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,47 @@ | ||
| import * as React from "react"; | ||
| import { spawn } from "child_process"; | ||
|
|
||
| import stylesheet from "./stylesheet"; | ||
|
|
||
| type Props = { | ||
| label: string; | ||
| arg: string; | ||
| width: string; | ||
| height: string; | ||
| top?: string; | ||
| right?: string; | ||
| left?: string; | ||
| }; | ||
|
|
||
| const Process = ({ width, height, top, right, left, label, arg }: Props) => { | ||
| const [logs, setLogs] = React.useState<string[]>([]); | ||
|
|
||
| React.useEffect(() => { | ||
| const subprocess = spawn("yarn", [arg], { | ||
| stdio: ["pipe", "pipe", "pipe"], | ||
| }); | ||
|
|
||
| subprocess.stdout.on("data", data => { | ||
| setLogs(state => [data.toString("utf-8"), ...state]); | ||
| }); | ||
|
|
||
| return () => subprocess.kill(); | ||
| }, []); | ||
|
|
||
| return ( | ||
| <blessed-box | ||
| label={label} | ||
| class={stylesheet.bordered} | ||
| top={top} | ||
| right={right} | ||
| left={left} | ||
| width={width} | ||
| height={height} | ||
| draggable={true} | ||
| > | ||
| <blessed-list items={logs} /> | ||
| </blessed-box> | ||
| ); | ||
| }; | ||
|
|
||
| export default Process; |
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,31 @@ | ||
| { | ||
| "name": "dashboard", | ||
| "version": "0.1.0", | ||
| "main": "index.js", | ||
| "license": "MIT", | ||
| "scripts": { | ||
| "build-client": "cd ../../examples/client && yarn start", | ||
| "build-server": "cd ../../examples/server && yarn start", | ||
| "build-common": "cd ../../examples/common && yarn build", | ||
| "build-nars-re": "cd ../nars && yarn re:watch", | ||
| "build-nars-ts": "cd ../nars && yarn watch", | ||
| "build-nars-client": "cd ../nars-client && yarn watch", | ||
| "build-nars-common": "cd ../nars-common && yarn watch" | ||
| }, | ||
| "dependencies": { | ||
| "@babel/core": "^7.6.0", | ||
| "@babel/preset-env": "^7.6.0", | ||
| "@babel/preset-react": "^7.0.0", | ||
| "@babel/register": "^7.6.0", | ||
| "blessed": "^0.1.81", | ||
| "react": "^16.9.0", | ||
| "react-blessed": "^0.6.1", | ||
| "react-devtools-core": "^3.6.3", | ||
| "ws": "^7.1.2" | ||
| }, | ||
| "devDependencies": { | ||
| "@babel/preset-typescript": "^7.6.0", | ||
| "@types/blessed": "^0.1.12", | ||
| "@types/react-blessed": "^0.3.1" | ||
| } | ||
| } |
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,25 @@ | ||
| require("@babel/register")({ | ||
| presets: [ | ||
| ["@babel/preset-env"], | ||
| ["@babel/preset-react"], | ||
| "@babel/typescript", | ||
| ], | ||
| extensions: [".js", ".ts", ".tsx"], | ||
| }); | ||
|
|
||
| const argv = process.argv.slice(2); | ||
|
|
||
| const version = argv[0]; | ||
| const versions = ["full", "example", "core"]; | ||
|
|
||
| if (versions.indexOf(version) === -1) { | ||
| console.warn( | ||
| "Invalid dashboard type %s selected. Must be one of:\n *", | ||
| version, | ||
| versions.join("\n * ") | ||
| ); | ||
|
|
||
| process.exit(0); | ||
| } | ||
|
|
||
| require("./" + version[0].toUpperCase() + version.slice(1) + ".tsx"); |
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.
That's why you was not able to run the dashboard. Sorry.