Skip to content

Commit 1d94162

Browse files
committed
Return proper code when a starr instance is down
Handle an instance down in the UI instance management list
1 parent 0f4c1b8 commit 1d94162

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

root/app/www/public/api/index.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,10 @@
237237
echo $request['response'];
238238
exit();
239239
} else { //-- RETURN THE JSON API RESPONSE
240+
if (!$request['code']) {
241+
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')]);
242+
}
243+
240244
apiResponse($request['code'], $request['response'], $request['responseHeaders']);
241245
}
242246
}

root/app/www/public/pages/starr.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,16 @@
4747
$starrInstance['name'] = $test['response']['instanceName'];
4848
}
4949

50+
$instanceDown = !$version ? true : false;
5051
?>
5152
<tr>
5253
<td>
53-
<?= $starrInstance['name'] ?><br>
54-
<span class="text-small"><?= $branch ?> → v<?= $version ?></span>
54+
<?php if ($instanceDown) { ?>
55+
<div class="text-center text-danger">Unreachable</div>
56+
<?php } else { ?>
57+
<?= $starrInstance['name'] ?><br>
58+
<span class="text-small"><?= $branch ?> → v<?= $version ?></span>
59+
<?php } ?>
5560
</td>
5661
<td><input type="text" class="form-control" id="instance-url-<?= $starrInstance['id'] ?>" placeholder="http://localhost:1111" value="<?= $starrInstance['url'] ?>"></td>
5762
<td>

0 commit comments

Comments
 (0)