diff --git a/frontend/package.json b/frontend/package.json index aba06dd..d8e8d7f 100755 --- a/frontend/package.json +++ b/frontend/package.json @@ -4,7 +4,7 @@ "private": true, "homepage": ".", "dependencies": { - "@code-ready/crc-react-components": "https://github.com/code-ready/crc-react-components/releases/download/0.9.8/crc-react-components-0.9.8.tgz", + "@code-ready/crc-react-components": "https://github.com/code-ready/crc-react-components/releases/download/0.9.9/crc-react-components-0.9.9.tgz", "@patternfly/react-core": "^4.175.4", "react": "^17.0.2", "react-dom": "^17.0.2", diff --git a/frontend/src/components/MiniStatusWindow.jsx b/frontend/src/components/MiniStatusWindow.jsx index 24e06bf..3f40fab 100644 --- a/frontend/src/components/MiniStatusWindow.jsx +++ b/frontend/src/components/MiniStatusWindow.jsx @@ -10,24 +10,35 @@ export default class MiniStatusWindow extends React.Component { super(props); this.state = { preset: "unknown", + vmstatus: "unknown" }; this.control = React.createRef(); + this.onPlayPause = this.onPlayPause.bind(this); } componentDidMount() { window.api.onStatusChanged(async (event, status) => { this.setState({preset: status.Preset}) + + // Toggle states of the button + if(status.CrcStatus === "Stopping") { + this.setState({vmstatus: "Starting"}) + } else { + this.setState({vmstatus: status.CrcStatus}) + } + this.control.current.updateStatus(status); }) } - onStart() { - window.api.startInstance({}) - } - - onStop() { - window.api.stopInstance({}) + onPlayPause() { + if(this.state.vmstatus === "Stopped") { + window.api.startInstance({}) + } + if(this.state.vmstatus === "Running") { + window.api.stopInstance({}) + } } onDelete() { @@ -38,8 +49,8 @@ export default class MiniStatusWindow extends React.Component { return ( ); }