Skip to content

Commit

Permalink
Return proper code when a starr instance is down
Browse files Browse the repository at this point in the history
Handle an instance down in the UI instance management list
  • Loading branch information
austinwbest committed Dec 16, 2024
1 parent 0f4c1b8 commit 1d94162
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
4 changes: 4 additions & 0 deletions root/app/www/public/api/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,10 @@
echo $request['response'];
exit();
} else { //-- RETURN THE JSON API RESPONSE
if (!$request['code']) {
apiResponse(502, ['error' => sprintf(APP_API_ERROR, 'could not access the requested starr app, it appears to be down and returning an HTTP 0 code')]);
}

apiResponse($request['code'], $request['response'], $request['responseHeaders']);
}
}
Expand Down
9 changes: 7 additions & 2 deletions root/app/www/public/pages/starr.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,16 @@
$starrInstance['name'] = $test['response']['instanceName'];
}

$instanceDown = !$version ? true : false;
?>
<tr>
<td>
<?= $starrInstance['name'] ?><br>
<span class="text-small"><?= $branch ?> → v<?= $version ?></span>
<?php if ($instanceDown) { ?>
<div class="text-center text-danger">Unreachable</div>
<?php } else { ?>
<?= $starrInstance['name'] ?><br>
<span class="text-small"><?= $branch ?> → v<?= $version ?></span>
<?php } ?>
</td>
<td><input type="text" class="form-control" id="instance-url-<?= $starrInstance['id'] ?>" placeholder="http://localhost:1111" value="<?= $starrInstance['url'] ?>"></td>
<td>
Expand Down

0 comments on commit 1d94162

Please sign in to comment.