diff --git a/ProcessMaker/Http/Controllers/Api/DevLinkController.php b/ProcessMaker/Http/Controllers/Api/DevLinkController.php index 634ddac124..8cc056dc4f 100644 --- a/ProcessMaker/Http/Controllers/Api/DevLinkController.php +++ b/ProcessMaker/Http/Controllers/Api/DevLinkController.php @@ -4,12 +4,13 @@ use Illuminate\Http\Request; use Illuminate\Validation\Rule; +use ProcessMaker\Exception\ValidationException; use ProcessMaker\Http\Controllers\Controller; use ProcessMaker\Http\Resources\ApiCollection; use ProcessMaker\Jobs\DevLinkInstall; -use ProcessMaker\Exception\ValidationException; use ProcessMaker\Models\Bundle; use ProcessMaker\Models\BundleAsset; +use ProcessMaker\Models\BundleSetting; use ProcessMaker\Models\DevLink; use ProcessMaker\Models\Setting; @@ -119,7 +120,7 @@ public function localBundles(Request $request) public function showBundle(Bundle $bundle) { - return $bundle->load('assets'); + return $bundle->load('assets')->load('settings'); } public function remoteBundles(Request $request, DevLink $devLink) @@ -131,6 +132,7 @@ public function createBundle(Request $request) { $bundle = new Bundle(); $bundle->name = $request->input('name'); + $bundle->description = $request->input('description'); $bundle->published = (bool) $request->input('published', false); $bundle->version = 1; $bundle->saveOrFail(); @@ -143,6 +145,7 @@ public function updateBundle(Request $request, Bundle $bundle) $bundle->validateEditable(); $bundle->name = $request->input('name'); + $bundle->description = $request->input('description'); $bundle->published = (bool) $request->input('published', false); $bundle->saveOrFail(); @@ -212,7 +215,12 @@ public function addAsset(Request $request, Bundle $bundle) $asset = $request->input('type')::findOrFail($request->input('id')); $bundle->addAsset($asset); } - + + public function addSettings(Request $request, Bundle $bundle) + { + $bundle->addSettings($request->input('setting'), $request->input('config')); + } + public function addAssetToBundles(Request $request) { $bundles = $request->input('bundles'); @@ -290,4 +298,11 @@ public function deleteBundleAsset(BundleAsset $bundleAsset) return response()->json(['message' => 'Bundle asset association deleted.'], 200); } + + public function deleteBundleSetting(BundleSetting $bundleSetting) + { + $bundleSetting->delete(); + + return response()->json(['message' => 'Bundle setting deleted.'], 200); + } } diff --git a/ProcessMaker/Models/Bundle.php b/ProcessMaker/Models/Bundle.php index a53fa3ceef..76b6f666e4 100644 --- a/ProcessMaker/Models/Bundle.php +++ b/ProcessMaker/Models/Bundle.php @@ -45,6 +45,11 @@ public function assets() return $this->hasMany(BundleAsset::class); } + public function settings() + { + return $this->hasMany(BundleSetting::class); + } + public function devLink() { return $this->belongsTo(DevLink::class, 'dev_link_id'); @@ -125,7 +130,21 @@ public function addAsset(ProcessMakerModel $asset) 'asset_id' => $asset->id, ]); } - + + public function addSettings($setting, $config) + { + $exists = $this->settings()->where('setting', $setting)->exists(); + if ($exists) { + throw ValidationException::withMessages(['*' => 'Setting already exists in bundle']); + } + + BundleSetting::create([ + 'bundle_id' => $this->id, + 'setting' => $setting, + 'config' => $config, + ]); + } + public function addAssetToBundles(ProcessMakerModel $asset) { $message = null; @@ -134,6 +153,7 @@ public function addAssetToBundles(ProcessMakerModel $asset) } catch (ValidationException $ve) { $message = $ve->getMessage(); } + return $message; } diff --git a/ProcessMaker/Models/BundleAsset.php b/ProcessMaker/Models/BundleAsset.php index 3cb95de6b5..7789d1c544 100644 --- a/ProcessMaker/Models/BundleAsset.php +++ b/ProcessMaker/Models/BundleAsset.php @@ -11,7 +11,7 @@ class BundleAsset extends ProcessMakerModel protected $guarded = ['id']; - protected $appends = ['name', 'url', 'type']; + protected $appends = ['name', 'url', 'type', 'owner_name', 'categories']; protected static function boot() { @@ -86,4 +86,22 @@ public function getTypeAttribute() return null; } } + + public function getOwnerNameAttribute() + { + if ($this->asset && method_exists($this->asset, 'user')) { + return $this->asset->user->firstname . ' ' . $this->asset->user->lastname; + } + + return null; + } + + public function getCategoriesAttribute() + { + if ($this->asset && method_exists($this->asset, 'categories')) { + return $this->asset->categories->pluck('name')->toArray(); + } + + return []; + } } diff --git a/ProcessMaker/Models/BundleSetting.php b/ProcessMaker/Models/BundleSetting.php new file mode 100644 index 0000000000..c6e8272863 --- /dev/null +++ b/ProcessMaker/Models/BundleSetting.php @@ -0,0 +1,26 @@ + 'array', + ]; + + public function bundle() + { + return $this->belongsTo(Bundle::class); + } +} diff --git a/database/migrations/2024_11_26_145144_add_description_to_bundles_table.php b/database/migrations/2024_11_26_145144_add_description_to_bundles_table.php new file mode 100644 index 0000000000..26f93cef62 --- /dev/null +++ b/database/migrations/2024_11_26_145144_add_description_to_bundles_table.php @@ -0,0 +1,27 @@ +text('description')->after('name')->nullable(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('bundles', function (Blueprint $table) { + $table->dropColumn('description'); + }); + } +}; diff --git a/database/migrations/2024_12_03_140610_create_bundle_settings_table.php b/database/migrations/2024_12_03_140610_create_bundle_settings_table.php new file mode 100644 index 0000000000..7da3fae505 --- /dev/null +++ b/database/migrations/2024_12_03_140610_create_bundle_settings_table.php @@ -0,0 +1,31 @@ +id(); + $table->unsignedBigInteger('bundle_id'); + $table->string('setting'); + $table->json('config')->nullable(); + $table->timestamps(); + + $table->index(['bundle_id', 'setting']); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('bundle_settings'); + } +}; diff --git a/devhub/pm-font/svg/edit-outline.svg b/devhub/pm-font/svg/edit-outline.svg new file mode 100644 index 0000000000..5f6721106e --- /dev/null +++ b/devhub/pm-font/svg/edit-outline.svg @@ -0,0 +1,3 @@ + + + diff --git a/devhub/pm-font/svg/link-icon.svg b/devhub/pm-font/svg/link-icon.svg new file mode 100644 index 0000000000..1608f95ec0 --- /dev/null +++ b/devhub/pm-font/svg/link-icon.svg @@ -0,0 +1,3 @@ + + + diff --git a/devhub/pm-font/svg/plus-thin.svg b/devhub/pm-font/svg/plus-thin.svg new file mode 100644 index 0000000000..ef88e8a85a --- /dev/null +++ b/devhub/pm-font/svg/plus-thin.svg @@ -0,0 +1,3 @@ + + + diff --git a/devhub/pm-font/svg/remove-outlined.svg b/devhub/pm-font/svg/remove-outlined.svg new file mode 100644 index 0000000000..dcb2c5838d --- /dev/null +++ b/devhub/pm-font/svg/remove-outlined.svg @@ -0,0 +1,3 @@ + + + diff --git a/resources/fonts/pm-font/index.html b/resources/fonts/pm-font/index.html index 281a2aa4c4..b5f9bc7fa0 100644 --- a/resources/fonts/pm-font/index.html +++ b/resources/fonts/pm-font/index.html @@ -103,7 +103,7 @@
-

ProcessMaker Icons4.12.0+alpha-3

+

ProcessMaker Icons4.12.0+beta-5

Icons generated with svgtofont. For add new icons, please check the README file
@@ -115,7 +115,7 @@

ProcessMaker Icons4.12.0+alpha-3

-

ProcessMaker Icons4.12.0+alpha-3

+

ProcessMaker Icons4.12.0+beta-5

Icons generated with svgtofont. For add new icons, please check the README file
@@ -261,6 +261,13 @@

fp-copy

fp-desktop

+
  • + +

    fp-edit-outline

    +
  • +
  • fp-github

    fp-layout-icon

  • +
  • + +

    fp-link-icon

    +
  • +
  • fp-pdf

    fp-play-outline

  • +
  • + +

    fp-plus-thin

    +
  • +
  • fp-play-outline

    fp-plus

  • +
  • + +

    fp-remove-outlined

    +
  • +
  • -

    ProcessMaker Icons4.12.0+alpha-3

    +

    ProcessMaker Icons4.12.0+beta-5

    Icons generated with svgtofont. For add new icons, please check the README file
    @@ -134,7 +134,7 @@

    ProcessMaker Icons4.12.0+alpha-3

      -
    • bpmn-action-by-email

      
    • bpmn-data-connector

      
    • bpmn-data-object

      
    • bpmn-data-store

      
    • bpmn-docusign

      
    • bpmn-end-event

      
    • bpmn-flowgenie

      
    • bpmn-gateway

      
    • bpmn-generic-gateway

      
    • bpmn-idp

      
    • bpmn-intermediate-event

      
    • bpmn-pool

      
    • bpmn-send-email

      
    • bpmn-start-event

      
    • bpmn-task

      
    • bpmn-text-annotation

      
    • brush-icon

      
    • close

      
    • cloud-download-outline

      
    • copy

      
    • desktop

      
    • eye

      
    • fields-icon

      
    • flowgenie-outline

      
    • folder-outline

      
    • fullscreen

      
    • github

      
    • layout-icon

      
    • map

      
    • mobile

      
    • pdf

      
    • play-outline

      
    • plus

      
    • screen-outline

      
    • script-outline

      
    • slack-notification

      
    • slack

      
    • slideshow

      
    • table

      
    • trash

      
    • unlink

      
    • +
    • bpmn-action-by-email

      
    • bpmn-data-connector

      
    • bpmn-data-object

      
    • bpmn-data-store

      
    • bpmn-docusign

      
    • bpmn-end-event

      
    • bpmn-flowgenie

      
    • bpmn-gateway

      
    • bpmn-generic-gateway

      
    • bpmn-idp

      
    • bpmn-intermediate-event

      
    • bpmn-pool

      
    • bpmn-send-email

      
    • bpmn-start-event

      
    • bpmn-task

      
    • bpmn-text-annotation

      
    • brush-icon

      
    • close

      
    • cloud-download-outline

      
    • copy

      
    • desktop

      
    • edit-outline

      
    • eye

      
    • fields-icon

      
    • flowgenie-outline

      
    • folder-outline

      
    • fullscreen

      
    • github

      
    • layout-icon

      
    • link-icon

      
    • map

      
    • mobile

      
    • pdf

      
    • play-outline

      
    • plus-thin

      
    • plus

      
    • remove-outlined

      
    • screen-outline

      
    • script-outline

      
    • slack-notification

      
    • slack

      
    • slideshow

      
    • table

      
    • trash

      
    • unlink

      