Skip to content

Commit f330f3b

Browse files
committed
✨ Show dashboard widget lock state
1 parent af720a7 commit f330f3b

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/Action/Modules/Dashboard/DashboardAction.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
use App\Services\Module\Issues\MyIssuesService;
1313
use App\Services\Module\ModulesService;
1414
use App\Services\Module\Todo\MyTodoService;
15+
use App\Services\Settings\SettingsLockModuleService;
1516
use App\Services\System\LockedResourceService;
1617
use Doctrine\DBAL\Driver\Exception;
1718
use Doctrine\ORM\EntityManagerInterface;
@@ -29,6 +30,7 @@ public function __construct(
2930
private readonly EntityManagerInterface $em,
3031
private readonly LockedResourceService $lockedResourceService,
3132
private readonly DashboardService $dashboardService,
33+
private readonly SettingsLockModuleService $settingsLockModuleService
3234
) {
3335
}
3436

@@ -74,6 +76,11 @@ public function getAll(): JsonResponse
7476
}
7577
}
7678

79+
foreach ($entriesData as $widgetName => $widgetData) {
80+
$associatedModule = DashboardService::getModuleForWidgetName($widgetName);
81+
$entriesData[Setting::DASHBOARD_WIDGETS_LOCK_STATE][$widgetName] = $this->settingsLockModuleService->isModuleLocked($associatedModule);
82+
}
83+
7784
$response = BaseResponse::buildOkResponse();
7885
$response->setAllRecordsData($entriesData);
7986

src/Entity/Setting.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ class Setting implements EntityInterface
1414
public const string DASHBOARD_WIDGET_GOAL_PAYMENTS = "goalPayments";
1515
public const string DASHBOARD_WIDGET_ISSUES = "issues";
1616
public const string DASHBOARD_WIDGET_SCHEDULES = "schedules";
17+
public const string DASHBOARD_WIDGETS_LOCK_STATE = "lockState";
1718

1819
public const array ALL_DASHBOARD_WIDGETS = [
1920
self::DASHBOARD_WIDGET_GOAL_PROGRESS,

0 commit comments

Comments
 (0)