Setting health status color for global indicators & fixing max value key

This commit is contained in:
Nikhil Kadam
2025-05-16 11:30:06 +05:30
parent ce1203b5bb
commit 0852bcc680
2 changed files with 15 additions and 7 deletions

View File

@@ -257,7 +257,7 @@ class UsersController extends Controller
'default_dashboard_fullscreen' => $request->default_dashboard_fullscreen ?? false,
'home_dashboard_id' => $request->home_dashboard_id ?? null,
'home_dashboard_hide_toolbar' => $request->home_dashboard_hide_toolbar ?? false,
'user_credentials_enabled' => $request->user_credentials_enabled ?? false,
'user_credentials_enabled' => 0,
'failed_login_attempts' => $request->failed_login_attempts ?? 0,
'last_login_ts' => $request->last_login_ts,
'version' => $request->version ?? 0,
@@ -335,6 +335,7 @@ class UsersController extends Controller
if (!empty($users)) {
return response()->json([
'message' => 'Users fetched successfully',
'count' => $users->count(),
'users' => $users
], 200);
}
@@ -506,6 +507,7 @@ class UsersController extends Controller
// Update password in Laravel
$user->password = Hash::make('password');
$user->user_credentials_enabled = 1;
$user->save();
Log::info("Password updated for User ID: {$id} in Laravel.");

View File

@@ -89,22 +89,22 @@ class TelemetryService
{
return [
'ChannelSpeed' => [
['min' => 0, 'color' => 50000]
['min' => 0, 'max' => 50000]
],
'PowerLoss_value' => [
['min' => 0, 'color' => 10]
['min' => 0, 'max' => 10]
],
'GlobalLevel_value' => [
['min' => 0, 'color' => 10]
['min' => 0, 'max' => 10]
],
'StaticTorque_value' => [
['min' => 0, 'color' => 50000]
['min' => 0, 'max' => 50000]
],
'StaticPower_value' => [
['min' => 0, 'color' => 500000]
['min' => 0, 'max' => 500000]
],
'default' => [
['min' => 0, 'color' => 100]
['min' => 0, 'max' => 100]
]
];
}
@@ -139,11 +139,17 @@ class TelemetryService
$thresholdLimits = $this->getThresholdLimit()[$key] ?? $this->getThresholdLimit()['default'];
$status = $this->getHealthStatus($value, $thresholds);
$statusColor = match($status) {
'Alert' => 'red',
'Attention' => 'orange',
'Stable' => 'green'
};
$transformedTelemetry[] = [
'display_name' => $displayNameMap[$key] ?? $key,
'value' => number_format((float)$value, 2),
'health_status' => $status,
'status_color' => $statusColor,
'thresholds' => $thresholds,
'limit' => $thresholdLimits
];