Format vainfo display

This commit is contained in:
Nick Mowen 2023-02-25 14:23:21 -07:00
parent 23602ff417
commit e2baca387a
2 changed files with 20 additions and 4 deletions

View File

@ -21,7 +21,7 @@ export default function Dialog({ children, portalRootID = 'dialogs' }) {
> >
<div <div
role="modal" role="modal"
className={`absolute rounded shadow-2xl bg-white dark:bg-gray-700 max-w-sm text-gray-900 dark:text-white transition-transform transition-opacity duration-75 transform scale-90 opacity-0 ${ className={`absolute rounded shadow-2xl bg-white dark:bg-gray-700 sm:max-w-sm md:max-w-md lg:max-w-lg text-gray-900 dark:text-white transition-transform transition-opacity duration-75 transform scale-90 opacity-0 ${
show ? 'scale-100 opacity-100' : '' show ? 'scale-100 opacity-100' : ''
}`} }`}
> >

View File

@ -68,7 +68,11 @@ export default function System() {
const response = await axios.get('vainfo'); const response = await axios.get('vainfo');
if (response.status === 200) { if (response.status === 200) {
setState({ ...state, showVainfo: true, vainfo: JSON.stringify(response.data, null, 2) }); setState({
...state,
showVainfo: true,
vainfo: response.data,
});
} else { } else {
setState({ ...state, showVainfo: true, vainfo: 'There was an error getting the vainfo output.' }); setState({ ...state, showVainfo: true, vainfo: 'There was an error getting the vainfo output.' });
} }
@ -128,10 +132,22 @@ export default function System() {
{state.showVainfo && ( {state.showVainfo && (
<Dialog> <Dialog>
<div className="p-4"> <div className="p-4 overflow-scroll whitespace-pre-line">
<Heading size="lg">Vainfo Output</Heading> <Heading size="lg">Vainfo Output</Heading>
{state.vainfo != '' ? ( {state.vainfo != '' ? (
<p className="mb-2 max-h-96 overflow-scroll">{state.vainfo}</p> <div className="mb-2 max-h-96 whitespace-pre-line">
<div className="">Return Code:</div>
<br />
<div>{state.vainfo.return_code}</div>
<br />
<div className="">Process Error:</div>
<br />
<div>{state.vainfo.stderr}</div>
<br />
<div className="">Process Output:</div>
<br />
{state.vainfo.stdout}
</div>
) : ( ) : (
<ActivityIndicator /> <ActivityIndicator />
)} )}