From 013b226c825ec8e6c9f4007de710882d64b5ea4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustavo=20Bascop=C3=A9?= Date: Mon, 8 Sep 2025 16:38:16 -0400 Subject: [PATCH 1/2] Added the option to chose update or copy for devlink installing asset --- .../Controllers/Api/DevLinkController.php | 4 +- ProcessMaker/Jobs/DevLinkInstall.php | 2 +- ProcessMaker/Models/DevLink.php | 4 +- .../admin/devlink/components/AssetListing.vue | 131 +++++++++++++----- 4 files changed, 100 insertions(+), 41 deletions(-) diff --git a/ProcessMaker/Http/Controllers/Api/DevLinkController.php b/ProcessMaker/Http/Controllers/Api/DevLinkController.php index 399323ea0c..8994184d1a 100644 --- a/ProcessMaker/Http/Controllers/Api/DevLinkController.php +++ b/ProcessMaker/Http/Controllers/Api/DevLinkController.php @@ -355,12 +355,14 @@ public function removeSharedAsset($id) public function installRemoteAsset(Request $request, DevLink $devLink) { + $updateType = $request->input('updateType', DevLinkInstall::MODE_UPDATE); + DevLinkInstall::dispatch( $request->user()->id, $devLink->id, $request->input('class'), $request->input('id'), - DevLinkInstall::MODE_UPDATE, + $updateType, DevLinkInstall::TYPE_IMPORT_ASSET ); diff --git a/ProcessMaker/Jobs/DevLinkInstall.php b/ProcessMaker/Jobs/DevLinkInstall.php index 25c347fbf3..c30519e201 100644 --- a/ProcessMaker/Jobs/DevLinkInstall.php +++ b/ProcessMaker/Jobs/DevLinkInstall.php @@ -67,7 +67,7 @@ public function handle(): void $bundle->reinstall($this->importMode, $logger); break; case self::TYPE_IMPORT_ASSET: - $devLink->installRemoteAsset($this->class, $this->id, $logger); + $devLink->installRemoteAsset($this->class, $this->id, $this->importMode, $logger); break; default: break; diff --git a/ProcessMaker/Models/DevLink.php b/ProcessMaker/Models/DevLink.php index a157d7f8fd..e7ad53939d 100644 --- a/ProcessMaker/Models/DevLink.php +++ b/ProcessMaker/Models/DevLink.php @@ -191,14 +191,14 @@ public function installRemoteBundle($remoteBundleId, $updateType) $this->logger->setStatus('done'); } - public function installRemoteAsset(string $class, int $id, Logger $logger) : ProcessMakerModel + public function installRemoteAsset(string $class, int $id, string $updateType, Logger $logger) : ProcessMakerModel { $payload = $this->client()->get( route('api.devlink.export-local-asset', ['class' => $class, 'id' => $id], false) )->json(); $options = new Options([ - 'mode' => 'update', + 'mode' => $updateType, ]); $logger->setSteps([$payload]); diff --git a/resources/js/admin/devlink/components/AssetListing.vue b/resources/js/admin/devlink/components/AssetListing.vue index af9d61781c..a5716181d3 100644 --- a/resources/js/admin/devlink/components/AssetListing.vue +++ b/resources/js/admin/devlink/components/AssetListing.vue @@ -1,6 +1,6 @@