Skip to content

Commit 0008804

Browse files
authored
Merge pull request #7967 from ProcessMaker/task/FOUR-21696
Add script microservice status to about page
2 parents f63ceac + 92298a1 commit 0008804

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

ProcessMaker/Http/Controllers/AboutController.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use Exception;
66
use Illuminate\Foundation\PackageManifest;
7+
use Illuminate\Http\Client\RequestException;
78
use Illuminate\Support\Facades\Cache;
89
use Illuminate\Support\Facades\Http;
910
use Illuminate\Support\Facades\Log;
@@ -74,6 +75,8 @@ public function index()
7475
$microServices = [$aiMicroService];
7576
}
7677

78+
$microServices[] = $this->getScriptMicroService();
79+
7780
$nayraMicroService = $this->getNayraMicroServiceAbout();
7881
if ($nayraMicroService) {
7982
$microServices[] = $nayraMicroService;
@@ -98,6 +101,29 @@ public function index()
98101
);
99102
}
100103

104+
private function getScriptMicroService()
105+
{
106+
$info = [
107+
'name' => 'Script Microservice',
108+
'description' => 'Execute scripts in ProcessMaker',
109+
'status' => 'Disabled',
110+
];
111+
112+
if (config('script-runner-microservice.enabled')) {
113+
$baseUrl = config('script-runner-microservice.base_url');
114+
try {
115+
$response = Http::timeout(3)
116+
->get($baseUrl . '/accept-traffic')
117+
->throw();
118+
$info['status'] = $response->json()['message'] . ". Microservice is running at $baseUrl";
119+
} catch (Exception $e) {
120+
$info['status'] = "Error connecting to $baseUrl: " . $e->getMessage();
121+
}
122+
}
123+
124+
return $info;
125+
}
126+
101127
private function getAiMicroService()
102128
{
103129
if (hasPackage('package-ai')) {

resources/views/about/microservices.blade.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
@if (isset($microService['version']))
1111
<div><strong>Version:</strong> {{ $microService['version'] }}</div>
1212
@endif
13+
@if (isset($microService['status']))
14+
<div><strong>Status:</strong> {{ $microService['status'] }}</div>
15+
@endif
1316
</small>
1417
@if (!empty($microService['waiting']))
1518
<i class="fas fa-sync fa-spin text-secondary waiting"></i>

0 commit comments

Comments
 (0)