We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see ourdocumentation.
There was an error while loading.Please reload this page.
1 parent8dc00aa commitfc5d41cCopy full SHA for fc5d41c
src/editor/commands.ts
@@ -60,8 +60,8 @@ export const createCommands = ({ extensionPath, workspaceState, workspaceRoot }:
60
webview.send({type:'TEST_PASS', payload})
61
},
62
onFail:(payload:Payload,message:string)=>{
63
-// send test fail message back to client
64
-webview.send({type:'TEST_FAIL', payload})
+// send test fail message back to client with failure message
+webview.send({type:'TEST_FAIL',payload:{ ...payload, message}})
65
66
onError:(payload:Payload)=>{
67
// send test error message back to client
web-app/src/components/Message/index.tsx
@@ -3,10 +3,11 @@ import * as React from 'react'
3
4
interfaceProps{
5
type?:'success'|'warning'|'error'|'notice'|'help'|'loading'
6
-title:string
7
shape?:'inline'|'addon'|'toast'
8
size?:'medium'|'large'
9
-children?:string
+title:string
+content?:string
10
+closed?:boolean
11
closeable?:boolean
12
onClose?:()=>void
13
handleClose?:()=>void
@@ -23,13 +24,13 @@ const Message = (props: Props) => {
23
24
return(
25
<AlifdMessage
26
type={props.type}
-visible={visible}
27
+visible={props.closed ?!props.closed :visible}
28
title={props.title}
29
closeable={props.closeable}
30
onClose={onClose}
31
shape={props.shape}
32
>
-{props.children}
33
+{props.content}
34
</AlifdMessage>
35
)
36
}
web-app/src/components/ProcessMessages/TestMessage.tsx
@@ -0,0 +1,43 @@
1
+importMessagefrom'../Message'
2
+import*asReactfrom'react'
+import*asTfrom'typings'
+import{css,jsx}from'@emotion/core'
+
+constdurations={
+success:1000,
+warning:4500,
+error:4500,
+loading:Infinity,
+}
+constuseTimeout=({ duration, key}:{duration:number;key:string})=>{
14
+const[timeoutClose,setTimeoutClose]=React.useState(false)
15
+React.useEffect(()=>{
16
+setTimeoutClose(false)
17
+consttimeout=setTimeout(()=>{
18
+setTimeoutClose(true)
19
+},duration)
20
+return()=>{
21
+clearTimeout(timeout)
22
+},[key])
+returntimeoutClose
+constTestMessage=(props:T.TestStatus)=>{
+constduration=durations[props.type]
+consttimeoutClose=useTimeout({ duration,key:props.title})
+return(
+<Message
+key={props.title}
+type={props.type}
+title={props.title}
+closed={timeoutClose}
+size="medium"
37
+closeable={props.type!=='loading'}
38
+content={props.content}
39
+/>
40
+)
41
42
43
+exportdefaultTestMessage
web-app/src/components/ProcessMessages/index.tsx
@@ -2,6 +2,7 @@ import Message from '../Message'
import*asReactfrom'react'
import*asTfrom'typings'
import{css,jsx}from'@emotion/core'
+importTestMessagefrom'./TestMessage'
testStatus:T.TestStatus|null
@@ -18,21 +19,15 @@ const styles = {
// display a list of active processes
constProcessMessages=({ processes, testStatus}:Props)=>{
if(testStatus){
-return(
-<Messagekey={testStatus.title}type={testStatus.type}title={testStatus.title}size="medium">
-{testStatus.content}
-</Message>
-)
+return<TestMessage{...testStatus}/>
if(!processes.length){
returnnull
<divcss={styles.container}>
{processes.map(process=>(
-<Messagekey={process.title}type="loading"size="medium"title={process.title}>
-{process.description}
+<Messagekey={process.title}type="loading"size="medium"title={process.title}content={process.description}/>
))}
</div>
web-app/src/containers/LoadingPage.tsx
@@ -25,9 +25,7 @@ const LoadingPage = ({ text, context }: Props) => {
if(error){
<divcss={styles.page}>
-<Messagetype="error"title={error.title}>
-{error.description}
+<Messagetype="error"title={error.title}content={error.description}/>
web-app/src/containers/Tutorial/LevelPage/Level.tsx
@@ -108,7 +108,7 @@ const Level = ({ level, onContinue, onLoadSolution, processes, testStatus }: Pro
108
109
110
111
-{processes.length>0&&(
+{(testStatus||processes.length>0)&&(
112
<divcss={styles.processes}>
113
<ProcessMessagesprocesses={processes}testStatus={testStatus}/>
114
web-app/src/services/state/actions/test.ts
@@ -18,10 +18,10 @@ const testActions: ActionFunctionMap<CR.MachineContext, CR.MachineEvent> = {
}),
//@ts-ignore
testFail:assign({
-testStatus:()=>({
+testStatus:(context,event)=>({
type:'warning',
title:'Fail!',
-content:'Test failed for some reason',
+content:event.payload.message,