Add blinking cursor to show user that more output is to be expected.

Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
DL6ER
2019-12-03 14:58:22 +00:00
parent 4cf2705711
commit 271b13414c
+26 -1
View File
@@ -30,6 +30,30 @@ interface LiveLogState {
}>;
}
const refreshingInverval = 500;
class BlinkingCursor extends Component<any, any> {
constructor(props: any) {
super(props);
this.state = { showText: true };
// Change the state every second
setInterval(
() => {
this.setState((previousState: any) => {
return { showText: !previousState.showText };
});
},
// Define blinking time.
refreshingInverval
);
}
render() {
let display = this.state.showText ? "_" : " ";
return <div style={{ marginBottom: 10 }}>{display}</div>;
}
}
let nextId = 0;
let newdata = false;
class LiveLog extends Component<LiveLogProps & WithTranslation, LiveLogState> {
@@ -95,6 +119,7 @@ class LiveLog extends Component<LiveLogProps & WithTranslation, LiveLogState> {
{getTimeFromTimestamp(item.timestamp) + " : " + item.message}
</div>
))}
<BlinkingCursor />
</pre>
</Col>
</Row>
@@ -123,7 +148,7 @@ export default (props: any) => (
return response;
});
}}
repeatOptions={{ interval: 500, ignoreCancel: true }}
repeatOptions={{ interval: refreshingInverval, ignoreCancel: true }}
renderInitial={() => null}
renderOk={data => <TranslatedLiveLog log={data.log} {...props} />}
renderErr={() => null}