Skip to content

Commit

Permalink
Sidebar and MenuItems clean up (#298)
Browse files Browse the repository at this point in the history
* Remove Sidebar fetching from `frontend`

* Remove leftover Sidebar code from packages

* Remove Sidebar from core

* Fix rename `filesystem`

* Add migration file

* Fix lint
  • Loading branch information
dmohns authored Sep 30, 2024
1 parent a3c801a commit 46aa423
Show file tree
Hide file tree
Showing 59 changed files with 157 additions and 1,624 deletions.
60 changes: 0 additions & 60 deletions src/backend/app/Console/Commands/AddEBikesItemToNavbar.php

This file was deleted.

25 changes: 0 additions & 25 deletions src/backend/app/Console/Commands/MenuItemsGenerator.php

This file was deleted.

This file was deleted.

3 changes: 0 additions & 3 deletions src/backend/app/Http/Controllers/CompanyController.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use App\Services\CompanyDatabaseService;
use App\Services\CompanyService;
use App\Services\MainSettingsService;
use App\Services\MenuItemsService;
use App\Services\MpmPluginService;
use App\Services\PluginsService;
use App\Services\RegistrationTailService;
Expand All @@ -23,7 +22,6 @@ public function __construct(
private CompanyService $companyService,
private CompanyDatabaseService $companyDatabaseService,
private PluginsService $pluginsService,
private MenuItemsService $menuItemsService,
private UserService $userService,
private DatabaseProxyManagerService $databaseProxyManagerService,
private MpmPluginService $mpmPluginService,
Expand Down Expand Up @@ -110,7 +108,6 @@ function () use ($company, $plugins) {
return response()->json([
'message' => 'Congratulations! you have registered to MicroPowerManager successfully. You will be redirected to dashboard in seconds..',
'company' => $company,
'sidebarData' => $this->menuItemsService->getAll(),
], 201);
}
);
Expand Down
8 changes: 0 additions & 8 deletions src/backend/app/Http/Controllers/PluginController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use App\Http\Resources\ApiResource;
use App\Services\CompanyDatabaseService;
use App\Services\MenuItemsService;
use App\Services\MpmPluginService;
use App\Services\PluginsService;
use App\Services\RegistrationTailService;
Expand All @@ -17,7 +16,6 @@ public function __construct(
private PluginsService $pluginsService,
private MpmPluginService $mpmPluginService,
private CompanyDatabaseService $companyDatabaseService,
private MenuItemsService $menuItemsService,
private RegistrationTailService $registrationTailService,
) {
}
Expand Down Expand Up @@ -53,16 +51,10 @@ public function update(Request $request, $mpmPluginId): ApiResource
}

$updatedPlugin = $this->pluginsService->update($plugin, $pluginData);
$ExistingMenuItem = $this->menuItemsService->checkMenuItemIsExistsForTag($mpmPlugin);

if (!$ExistingMenuItem) {
$this->companyDatabaseService->addPluginSpecificMenuItemsToCompanyDatabase($mpmPlugin);
}

$this->registrationTailService->addMpmPluginToRegistrationTail($registrationTail, $mpmPlugin);
} else {
$updatedPlugin = $this->pluginsService->update($plugin, $pluginData);
$this->menuItemsService->removeMenuItemAndSubmenuItemForMenuItemName($mpmPlugin);

$this->registrationTailService->removeMpmPluginFromRegistrationTail($registrationTail, $mpmPlugin);
}
Expand Down
18 changes: 0 additions & 18 deletions src/backend/app/Http/Controllers/SidebarController.php

This file was deleted.

14 changes: 0 additions & 14 deletions src/backend/app/Models/MenuItems.php

This file was deleted.

14 changes: 0 additions & 14 deletions src/backend/app/Models/SubMenuItems.php

This file was deleted.

7 changes: 0 additions & 7 deletions src/backend/app/Services/CompanyDatabaseService.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,6 @@ public function getAll(?int $limit = null): Collection
public function addPluginSpecificMenuItemsToCompanyDatabase($plugin, ?int $companyId = null): void
{
$rootClass = $plugin['root_class'];
try {
$menuItemService = app()->make(sprintf('Inensus\%s\Services\MenuItemService', $rootClass));
} catch (\Exception $exception) {
// we return here if company chooses a plugin which does not have UI components
return;
}
$menuItems = $menuItemService->createMenuItems();

if ($companyId !== null) {
/** @var DatabaseProxyManagerService $databaseProxyManagerService */
Expand Down
Loading

0 comments on commit 46aa423

Please sign in to comment.