Skip to content

Commit cb79854

Browse files
committed
send reset from client
Signed-off-by: shmck <[email protected]>
1 parent 613bce8 commit cb79854

File tree

4 files changed

+13
-13
lines changed

4 files changed

+13
-13
lines changed

Diff for: src/channel/index.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -320,17 +320,17 @@ class Channel implements Channel {
320320
case 'EDITOR_RUN_TEST':
321321
vscode.commands.executeCommand(COMMANDS.RUN_TEST, action?.payload)
322322
return
323-
case 'EDITOR_RUN_RESET_SCRIPT':
324-
const tutorial: TT.Tutorial | null = this.context.tutorial.get()
323+
case 'EDITOR_RUN_RESET':
324+
// reset to timeline
325+
// 1. get last pass commit
326+
// 2. load timeline until last pass commit
327+
325328
// if tutorial.config.reset.command, run it
329+
const tutorial: TT.Tutorial | null = this.context.tutorial.get()
326330
if (tutorial?.config?.reset?.command) {
327331
await exec({ command: tutorial.config.reset.command })
328332
}
329333
return
330-
case 'EDITOR_RUN_RESET_TO_LAST_PASS':
331-
return
332-
case 'EDITOR_RUN_RESET_TO_TIMELINE':
333-
return
334334
default:
335335
logger(`No match for action type: ${actionType}`)
336336
return

Diff for: web-app/src/containers/Tutorial/index.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import StepProgress from './components/StepProgress'
1212
import { DISPLAY_RUN_TEST_BUTTON } from '../../environment'
1313
import formatLevels from './formatLevels'
1414
// import SettingsPage from './containers/Settings'
15-
// import Reset from './components/Reset'
15+
import Reset from './components/Reset'
1616

1717
const styles = {
1818
header: {
@@ -95,7 +95,7 @@ const TutorialPage = (props: PageProps) => {
9595
}
9696

9797
const onReset = (): void => {
98-
// TODO
98+
props.send({ type: 'RUN_RESET' })
9999
}
100100

101101
const [menuVisible, setMenuVisible] = React.useState(false)
@@ -148,7 +148,7 @@ const TutorialPage = (props: PageProps) => {
148148

149149
{/* Center */}
150150
<div css={{ flex: 1, display: 'flex', justifyContent: 'center' }}>
151-
{/* <Reset onReset={onReset} disabled={processes.length > 0} /> */}
151+
<Reset onReset={onReset} disabled={processes.length > 0} />
152152
</div>
153153

154154
{/* Right */}

Diff for: web-app/src/services/state/actions/editor.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,9 @@ export default (editorSend: any) => ({
117117
payload: { position: context.position },
118118
})
119119
},
120-
runResetScript() {
120+
runReset() {
121121
editorSend({
122-
type: 'EDITOR_RUN_RESET_SCRIPT',
122+
type: 'EDITOR_RUN_RESET',
123123
})
124124
},
125125
})

Diff for: web-app/src/services/state/machine.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,8 @@ export const createMachine = (options: any) => {
168168
RUN_TEST: {
169169
actions: ['runTest'],
170170
},
171-
RESET_SCRIPT: {
172-
actions: ['runResetScript'],
171+
RUN_RESET: {
172+
actions: ['runReset'],
173173
},
174174
},
175175
},

0 commit comments

Comments
 (0)