feat: remove ansi color from log
This commit is contained in:
parent
e7988fc295
commit
7b60d76b77
2 changed files with 14 additions and 10 deletions
|
|
@ -1438,8 +1438,6 @@ public function application_by_uuid(Request $request)
|
||||||
)]
|
)]
|
||||||
public function logs_by_uuid(Request $request)
|
public function logs_by_uuid(Request $request)
|
||||||
{
|
{
|
||||||
// TODO: Implement logs_by_uuid() method.
|
|
||||||
|
|
||||||
$teamId = getTeamIdFromToken();
|
$teamId = getTeamIdFromToken();
|
||||||
if (is_null($teamId)) {
|
if (is_null($teamId)) {
|
||||||
return invalidTokenResponse();
|
return invalidTokenResponse();
|
||||||
|
|
@ -1453,23 +1451,27 @@ public function logs_by_uuid(Request $request)
|
||||||
return response()->json(['message' => 'Application not found.'], 404);
|
return response()->json(['message' => 'Application not found.'], 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
$container = getCurrentApplicationContainerStatus($application->destination->server, $application->id)->firstOrFail();
|
$containers = getCurrentApplicationContainerStatus($application->destination->server, $application->id);
|
||||||
// TODO: fix error when getting status
|
|
||||||
$status = getContainerStatus($application->destination->server, $container['name']);
|
|
||||||
// return response()->json([
|
|
||||||
// 'logs' => $status,
|
|
||||||
// ]);
|
|
||||||
|
|
||||||
|
if ($containers->count() == 0) {
|
||||||
|
return response()->json([
|
||||||
|
'message' => 'Application is not running.',
|
||||||
|
], 400);
|
||||||
|
}
|
||||||
|
|
||||||
|
$container = $containers->first();
|
||||||
|
|
||||||
|
$status = getContainerStatus($application->destination->server, $container['Names']);
|
||||||
if ($status !== 'running') {
|
if ($status !== 'running') {
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'message' => 'Application is not running.',
|
'message' => 'Application is not running.',
|
||||||
], 400);
|
], 400);
|
||||||
}
|
}
|
||||||
|
|
||||||
$logs = getContainerLogs($application->destination->server, $container['Id']);
|
$logs = getContainerLogs($application->destination->server, $container['ID']);
|
||||||
|
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'logs' => 'yey',
|
'logs' => $logs,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -864,6 +864,8 @@ function getContainerLogs(Server $server, string $container_id, int $lines = 100
|
||||||
], $server);
|
], $server);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$output .= removeAnsiColors($output);
|
||||||
|
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue