Fixed results of commands

This commit is contained in:
bourquecharles
2021-05-30 09:21:28 -04:00
parent 85fa46394e
commit 8b13f2a918
2 changed files with 5 additions and 6 deletions

View File

@@ -152,16 +152,15 @@ const DeviceCommands = ({ selectedDeviceId }) => {
setEnd(new Date());
};
const getDetails = (command, commandDetails, index) => {
const getDetails = (command, index) => {
if (!details.includes(index)) {
return <pre className="ignore" />;
}
if (command === 'reboot' || command === 'leds') {
const result = commandDetails.results;
if (command.results) {
const result = command.results;
if (result) return <pre className="ignore">{JSON.stringify(result, null, 4)}</pre>;
}
return <pre className="ignore">{JSON.stringify(commandDetails, null, 4)}</pre>;
return <pre className="ignore">{JSON.stringify(command, null, 4)}</pre>;
};
const getResponse = (commandDetails, index) => {

View File

@@ -7,7 +7,7 @@ const DeviceCommandsCollapse = ({ details, responses, index, item, getDetails, g
<CCollapse show={details.includes(index)}>
<CCardBody>
<h5>Result</h5>
<div>{getDetails(item.command, item, index)}</div>
<div>{getDetails(item, index)}</div>
</CCardBody>
</CCollapse>
<CCollapse show={responses.includes(index)}>