- Notifications
You must be signed in to change notification settings - Fork39
Feature/show command running#58
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Merged
Uh oh!
There was an error while loading.Please reload this page.
Merged
Changes fromall commits
Commits
Show all changes
15 commits Select commitHold shift + click to select a range
12962fa
update linter
ShMcK121d5cb
create indeterminate loading checkbox
ShMcK3888e8b
add relative positioning to pages for storybook
ShMcKd0b8ee6
setup processes component
ShMcK70119ed
refactor level & step file structure
ShMcK0ee8b05
style without absolute positioning
ShMcK5133dad
fix level index
ShMcK3599137
setup tutorial level process events viewer
ShMcKaa978af
define processes
ShMcK6113648
setup command actions
ShMcK9999668
setup git actions to send command feedback
ShMcK7f8789c
fix typo bug
ShMcKb35f6b1
update debugger
ShMcK8e8fa50
working command tracker
ShMcKb148fa5
fix ui issue
ShMcKFile filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
25 changes: 9 additions & 16 deletionssrc/actions/setupActions.ts
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
9 changes: 7 additions & 2 deletionssrc/actions/solutionActions.ts
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,11 +1,16 @@ | ||
import * as T from 'typings' | ||
import * as G from 'typings/graphql' | ||
import * as vscode from 'vscode' | ||
import * as git from '../services/git' | ||
import setupActions from './setupActions' | ||
const solutionActions = async ( | ||
workspaceRoot: vscode.WorkspaceFolder, | ||
stepActions: G.StepActions, | ||
send: (action: T.Action) => void, | ||
): Promise<void> => { | ||
await git.clear() | ||
return setupActions(workspaceRoot, stepActions, send) | ||
} | ||
export default solutionActions |
27 changes: 27 additions & 0 deletionssrc/actions/utils/runCommands.ts
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,27 @@ | ||
import * as T from 'typings' | ||
import node from '../../services/node' | ||
const runCommands = async (commands: string[], send: (action: T.Action) => void) => { | ||
if (!commands.length) { | ||
return | ||
} | ||
for (const command of commands) { | ||
const process = { | ||
title: command, | ||
description: 'Running process...', | ||
} | ||
send({ type: 'COMMAND_START', payload: { process: { ...process, status: 'RUNNING' } } }) | ||
let result: { stdout: string; stderr: string } | ||
try { | ||
result = await node.exec(command) | ||
} catch (error) { | ||
console.log(error) | ||
send({ type: 'COMMAND_FAIL', payload: { process: { ...process, status: 'FAIL' } } }) | ||
return | ||
} | ||
console.log(result.stdout) | ||
send({ type: 'COMMAND_SUCCESS', payload: { process: { ...process, status: 'SUCCESS' } } }) | ||
} | ||
} | ||
export default runCommands |
6 changes: 3 additions & 3 deletionssrc/channel/index.ts
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
7 changes: 7 additions & 0 deletionstypings/index.d.ts
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
6 changes: 3 additions & 3 deletionsweb-app/package-lock.json
Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
2 changes: 1 addition & 1 deletionweb-app/package.json
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
47 changes: 25 additions & 22 deletionsweb-app/src/components/Checkbox/index.tsx
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,34 +1,37 @@ | ||
import*asReactfrom'react' | ||
conststyles={ | ||
box:{ | ||
display:'flex', | ||
alignItems:'center', | ||
justifyContent:'center', | ||
}, | ||
input:{ | ||
border:'1px solid black', | ||
}, | ||
loading:{ | ||
backgroundColor:'red', | ||
}, | ||
} | ||
interfaceProps{ | ||
status:'COMPLETE'|'INCOMPLETE'|'ACTIVE' | ||
} | ||
constCheckbox=(props:Props)=>{ | ||
constonChange=()=>{ | ||
/* read only */ | ||
} | ||
constchecked=props.status==='COMPLETE' | ||
return( | ||
<divstyle={styles.box}> | ||
<label> | ||
<inputstyle={styles.input}type="checkbox"checked={checked}onChange={onChange}/> | ||
</label> | ||
</div> | ||
) | ||
} | ||
exportdefaultCheckbox |
34 changes: 15 additions & 19 deletionsweb-app/src/components/Debugger/index.tsx
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,26 +1,22 @@ | ||
import * as React from 'react' | ||
import * as T from 'typings' | ||
interface Props extends T.MachineContext { | ||
state: string | ||
children: React.ReactElement | ||
} | ||
const Debugger = ({ state, children, env, position, progress, processes, tutorial }: Props) => ( | ||
<div style={{ backgroundColor: '#FFFF99', color: 'black', padding: '.5rem' }}> | ||
<h4>state: {state}</h4> | ||
<p>MachineId: {env.machineId}</p> | ||
<p>SessionId: {env.sessionId}</p> | ||
<p>tutorial: {tutorial ? tutorial.id : 'none'}</p> | ||
<p style={{ backgroundColor: 'khaki', padding: '.5rem' }}>position: {JSON.stringify(position)}</p> | ||
<p style={{ backgroundColor: 'moccasin', padding: '.5rem' }}>progress: {JSON.stringify(progress)}</p> | ||
<p style={{ backgroundColor: 'beige', padding: '.5rem' }}>processes: {JSON.stringify(processes)}</p> | ||
{children} | ||
</div> | ||
) | ||
export default Debugger |
32 changes: 32 additions & 0 deletionsweb-app/src/components/ProcessEvents/index.tsx
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,32 @@ | ||
import * as React from 'react' | ||
import { Message as AlifdMessage } from '@alifd/next' | ||
import * as T from 'typings' | ||
interface Props { | ||
processes: T.ProcessEvent[] | ||
} | ||
const styles = { | ||
container: { | ||
display: 'flex', | ||
flexDirection: 'column' as 'column', | ||
}, | ||
} | ||
// display a list of active processes | ||
const ProcessEvents = ({ processes }: Props) => { | ||
if (!processes.length) { | ||
return null | ||
} | ||
return ( | ||
<div style={styles.container}> | ||
{processes.map(process => ( | ||
<AlifdMessage key={process.title} type="loading" size="medium" title={process.title}> | ||
{process.description} | ||
</AlifdMessage> | ||
))} | ||
</div> | ||
) | ||
} | ||
export default ProcessEvents |
32 changes: 16 additions & 16 deletionsweb-app/src/components/Workspace/index.tsx
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,31 +1,31 @@ | ||
import * as React from 'react' | ||
interface Props { | ||
children: React.ReactElement | ||
} | ||
const resize = () => ({ | ||
width: window.innerWidth - 20, | ||
height: window.innerHeight - 20, | ||
}) | ||
const Workspace = ({ children }: Props) => { | ||
const [dimensions, setDimensions] = React.useState(resize()) | ||
// solution for windows getting off size | ||
React.useEffect(() => { | ||
setDimensions(resize()) | ||
}, [window.innerHeight, window.innerWidth]) | ||
const styles = { | ||
page: { | ||
display: 'flex' as 'flex', | ||
margin: 0, | ||
backgroundColor: 'white', | ||
}, | ||
} | ||
return <div style={{ ...styles.page, ...dimensions }}>{children}</div> | ||
} | ||
export default Workspace |
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
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.