Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
bobimicroweber committed Apr 26, 2024
1 parent 21b3b20 commit 8d231bf
Show file tree
Hide file tree
Showing 10 changed files with 101 additions and 7 deletions.
1 change: 1 addition & 0 deletions web/Modules/Customer/module.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"description": "",
"keywords": [],
"priority": 0,
"hidden": true,
"providers": [
"Modules\\Customer\\App\\Providers\\CustomerServiceProvider"
],
Expand Down
2 changes: 2 additions & 0 deletions web/Modules/Docker/module.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
"description": "",
"keywords": [],
"priority": 0,
"logoIcon": "docker-logo",
"category": "DevOps",
"providers": [
"Modules\\Docker\\App\\Providers\\DockerServiceProvider"
],
Expand Down
4 changes: 3 additions & 1 deletion web/Modules/LetsEncrypt/module.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@
"description": "",
"keywords": [],
"priority": 0,
"logoIcon": "lets_encrypt-logo",
"category": "Security",
"providers": [
"Modules\\LetsEncrypt\\App\\Providers\\LetsEncryptServiceProvider",
"Modules\\LetsEncrypt\\Providers\\Filament\\AdminPanelProvider"
],
"files": []
}
}
4 changes: 3 additions & 1 deletion web/Modules/Microweber/module.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@
"description": "",
"keywords": [],
"priority": 0,
"logoIcon": "mw-mw_logo_small_white",
"category": "CMS",
"providers": [
"Modules\\Microweber\\App\\Providers\\MicroweberServiceProvider",
"Modules\\Microweber\\Providers\\Filament\\AdminPanelProvider"
],
"files": []
}
}
37 changes: 37 additions & 0 deletions web/app/Filament/Pages/Modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,43 @@ class Modules extends Page

protected function getViewData(): array
{

$scanModules = scandir(base_path('Modules'));
$scanModules = array_diff($scanModules, ['.', '..']);

$modules = [];
foreach ($scanModules as $key => $module) {
if (!is_dir(base_path('Modules/' . $module))) {
unset($modules[$key]);
}
$moduleJson = file_get_contents(base_path('Modules/' . $module . '/module.json'));
$moduleJson = json_decode($moduleJson, true);
if (isset($moduleJson['hidden']) && $moduleJson['hidden'] == true) {
continue;
}
$category = 'All';
$logoIcon = 'heroicon-o-puzzle-piece';
if (isset($moduleJson['logoIcon'])) {
$logoIcon = $moduleJson['logoIcon'];
}
if (isset($moduleJson['category'])) {
$category = $moduleJson['category'];
}
$modules[$category][] = [
'name' => $module,
'description' => 'A drag and drop website builder and a powerful next-generation CMS.',
'url' => url('admin/' . $module),
'iconUrl' => url('images/modules/' . $module . '.png'),
'logoIcon' => $logoIcon,
'category' => 'Content Management',
];
}

return [
'categories' => $modules,
];


return [
'categories' => [
'Security' => [
Expand Down
11 changes: 11 additions & 0 deletions web/app/Models/Module.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Module extends Model
{
use HasFactory;
}
6 changes: 3 additions & 3 deletions web/app/Providers/Filament/AdminPanelProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ public function panel(Panel $panel): Panel
->discoverResources(in: app_path('Filament/Resources'), for: 'App\\Filament\\Resources')
->discoverPages(in: app_path('Filament/Pages'), for: 'App\\Filament\\Pages')

->discoverClusters(in: module_path('Microweber', 'Filament/Clusters'), for: 'Modules\\Microweber\\Filament\\Clusters')
->discoverClusters(in: module_path('LetsEncrypt', 'Filament/Clusters'), for: 'Modules\\LetsEncrypt\\Filament\\Clusters')
->discoverClusters(in: module_path('Docker', 'Filament/Clusters'), for: 'Modules\\Docker\\Filament\\Clusters')
// ->discoverClusters(in: module_path('Microweber', 'Filament/Clusters'), for: 'Modules\\Microweber\\Filament\\Clusters')
// ->discoverClusters(in: module_path('LetsEncrypt', 'Filament/Clusters'), for: 'Modules\\LetsEncrypt\\Filament\\Clusters')
// ->discoverClusters(in: module_path('Docker', 'Filament/Clusters'), for: 'Modules\\Docker\\Filament\\Clusters')

->pages([
Pages\Dashboard::class,
Expand Down
38 changes: 38 additions & 0 deletions web/database/migrations/2024_04_26_183012_create_modules_table.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('modules', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('namespace')->nullable();
$table->tinyInteger('installed')->nullable();
$table->string('version')->nullable();
$table->string('author')->nullable();
$table->string('description')->nullable();
$table->string('icon')->nullable();
$table->string('developer_url')->nullable();
$table->string('screenshot')->nullable();
$table->string('license')->nullable();
$table->string('license_url')->nullable();
$table->timestamps();
});
}

/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('modules');
}
};
3 changes: 2 additions & 1 deletion web/resources/views/filament/pages/modules.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@

<div class="mb-2">
<div class="w-12">
<img src="{{$module['iconUrl']}}" />
<x-filament::icon :icon="$module['logoIcon']"
class="w-12 h-12 text-primary-500"/>
</div>
</div>

Expand Down
2 changes: 1 addition & 1 deletion web/tests/Unit/MicroweberHostingSubscriptionCreateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function test_create()
{
ini_set('memory_limit', '-1');
ini_set('max_execution_time', 0);

Artisan::call('phyre:install-module Microweber');

$random = rand(1000, 9999);
Expand Down

0 comments on commit 8d231bf

Please sign in to comment.