From b3b404e96d27cb71d21780a228be48797857eb27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustavo=20Bascop=C3=A9?= Date: Fri, 31 Jan 2025 12:12:32 -0400 Subject: [PATCH 1/7] Apply an update of an existing bundle (reinstall a bundle) --- .../Controllers/Api/DevLinkController.php | 4 +- ProcessMaker/Models/Bundle.php | 18 +- ProcessMaker/Models/BundleSetting.php | 15 +- ProcessMaker/Models/DevLink.php | 2 + devhub/pm-font/svg/add-outlined.svg | 3 + resources/fonts/pm-font/index.html | 4 +- resources/fonts/pm-font/processmaker-font.css | 103 +++++----- resources/fonts/pm-font/processmaker-font.eot | Bin 18412 -> 18772 bytes .../fonts/pm-font/processmaker-font.less | 103 +++++----- .../pm-font/processmaker-font.module.less | 103 +++++----- .../fonts/pm-font/processmaker-font.scss | 194 +++++++++--------- .../fonts/pm-font/processmaker-font.styl | 103 +++++----- resources/fonts/pm-font/processmaker-font.svg | 93 +++++---- .../pm-font/processmaker-font.symbol.svg | 2 +- resources/fonts/pm-font/processmaker-font.ttf | Bin 18208 -> 18568 bytes .../fonts/pm-font/processmaker-font.woff | Bin 11860 -> 11976 bytes .../fonts/pm-font/processmaker-font.woff2 | Bin 10484 -> 10552 bytes resources/fonts/pm-font/symbol.html | 9 +- resources/fonts/pm-font/unicode.html | 12 +- resources/img/add.svg | 3 + .../components/AuthClientsListing.vue | 2 +- .../components/BundleConfigurations.vue | 1 + .../admin/devlink/components/BundleDetail.vue | 3 +- .../admin/groups/components/GroupsListing.vue | 2 +- .../components/SettingsMenuCollapse.vue | 2 +- .../admin/users/components/UsersListing.vue | 2 +- .../processes/components/ProcessesListing.vue | 2 +- .../screens/components/ScreenListing.vue | 2 +- .../scripts/components/ScriptListing.vue | 2 +- 29 files changed, 409 insertions(+), 380 deletions(-) create mode 100644 devhub/pm-font/svg/add-outlined.svg create mode 100644 resources/img/add.svg diff --git a/ProcessMaker/Http/Controllers/Api/DevLinkController.php b/ProcessMaker/Http/Controllers/Api/DevLinkController.php index f4f24a7016..ae9ff04ac1 100644 --- a/ProcessMaker/Http/Controllers/Api/DevLinkController.php +++ b/ProcessMaker/Http/Controllers/Api/DevLinkController.php @@ -198,6 +198,8 @@ public function bundleUpdated($bundleId, $token) public function deleteBundle(Bundle $bundle) { + $bundle->assets()->delete(); + $bundle->settings()->delete(); $bundle->delete(); } @@ -255,7 +257,7 @@ public function exportLocalBundleSettings(Bundle $bundle) public function exportLocalBundleSettingPayloads(Bundle $bundle) { if ($bundle->settings->isEmpty()) { - return ['payloads' => [0 => []]]; + return ['payloads' => []]; } return ['payloads' => $bundle->exportSettingPayloads()]; diff --git a/ProcessMaker/Models/Bundle.php b/ProcessMaker/Models/Bundle.php index 1cdd68fc76..2748b9bd38 100644 --- a/ProcessMaker/Models/Bundle.php +++ b/ProcessMaker/Models/Bundle.php @@ -292,8 +292,14 @@ public function newestVersionFile() return $this->filesSortedByVersion()->first(); } - public function savePayloadsToFile(array $payloads) + public function savePayloadsToFile(array $payloads, array $payloadsSettings, $logger = null) { + if ($logger === null) { + $logger = new Logger(); + } + $logger->status('Saving the bundle locally'); + $payloads = array_merge($payloads, $payloadsSettings[0]); + $this->addMediaFromString( gzencode( json_encode($payloads) @@ -374,15 +380,12 @@ public function installSettingsPayloads(array $payloads, $mode, $logger = null) } } - public function install(array $payloads, $mode, $logger = null) + public function install(array $payloads, $mode, $logger = null, $reinstall = false) { if ($logger === null) { $logger = new Logger(); } - $logger->status('Saving the bundle locally'); - $this->savePayloadsToFile($payloads); - $logger->status('Installing bundle on the this instance'); $logger->setSteps($payloads); @@ -394,7 +397,7 @@ public function install(array $payloads, $mode, $logger = null) $assets[] = DevLink::import($payload, $options, $logger); } - if ($mode === 'update') { + if ($mode === 'update' && $reinstall === false) { $logger->status('Syncing bundle assets'); $this->syncAssets($assets); } @@ -406,8 +409,7 @@ public function reinstall(string $mode, Logger $logger = null) $content = file_get_contents($media->getPath()); $payloads = json_decode(gzdecode($content), true); - - $this->install($payloads, $mode, $logger); + $this->install($payloads, $mode, $logger, true); $logger?->setStatus('done'); } diff --git a/ProcessMaker/Models/BundleSetting.php b/ProcessMaker/Models/BundleSetting.php index 9a8afb14a4..6d61622d33 100644 --- a/ProcessMaker/Models/BundleSetting.php +++ b/ProcessMaker/Models/BundleSetting.php @@ -6,6 +6,7 @@ use ProcessMaker\Enums\ExporterMap; use ProcessMaker\ImportExport\Exporter; use ProcessMaker\ImportExport\Exporters\GroupExporter; +use ProcessMaker\ImportExport\Exporters\MediaExporter; use ProcessMaker\ImportExport\Exporters\ScriptExecutorExporter; use ProcessMaker\ImportExport\Exporters\UserExporter; use ProcessMaker\Models\ProcessMakerModel; @@ -91,15 +92,17 @@ public function export() return $uiMenus->map(function ($uiMenu) { return $this->exportHelper($uiMenu, MenuExporter::class); }); - case 'translations': + case 'public_files': if (empty($this->config)) { - $translations = Translatable::all(); + $publicFiles = Media::all()->filter(function ($media) { + return $media->isPublicFile(); + }); } else { - $translations = Translatable::whereIn('key', $ids)->get(); + $publicFiles = Media::whereIn('id', $ids)->get(); } - return $translations->map(function ($translation) { - return $this->exportHelper($translation, TranslatableExporter::class); + return $publicFiles->map(function ($publicFile) { + return $this->exportHelper($publicFile, MediaExporter::class); }); case 'auth_clients': if (empty($this->config)) { @@ -125,8 +128,6 @@ public function export() return $bundleSetting; }); } - - return []; } public function exportHelper($model, $exporterClass, $options = null, $ignoreExplicitExport = true) diff --git a/ProcessMaker/Models/DevLink.php b/ProcessMaker/Models/DevLink.php index a7d83f6cde..57c2879f46 100644 --- a/ProcessMaker/Models/DevLink.php +++ b/ProcessMaker/Models/DevLink.php @@ -172,6 +172,8 @@ public function installRemoteBundle($remoteBundleId, $updateType) ] ); + $bundle->savePayloadsToFile($bundleExport['payloads'], $bundleSettingsPayloads['payloads']); + $bundle->install($bundleExport['payloads'], $updateType, $this->logger); $bundle->installSettingsPayloads($bundleSettingsPayloads['payloads'], $updateType, $this->logger); $bundle->installSettings($bundleSettingsExport['settings']); diff --git a/devhub/pm-font/svg/add-outlined.svg b/devhub/pm-font/svg/add-outlined.svg new file mode 100644 index 0000000000..cd39c4f44c --- /dev/null +++ b/devhub/pm-font/svg/add-outlined.svg @@ -0,0 +1,3 @@ + + + diff --git a/resources/fonts/pm-font/index.html b/resources/fonts/pm-font/index.html index b5f9bc7fa0..10529f3013 100644 --- a/resources/fonts/pm-font/index.html +++ b/resources/fonts/pm-font/index.html @@ -103,7 +103,7 @@
-

ProcessMaker Icons4.12.0+beta-5

+

ProcessMaker Icons4.13.0-RC1

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

ProcessMaker Icons4.12.0+beta-5

ProcessMaker Icons4.12.0+beta-5

+

ProcessMaker Icons4.13.0-RC1

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

ProcessMaker Icons4.12.0+beta-5

    +
  • + +

    fp-add-outlined

    +
  • +
  • -

    ProcessMaker Icons4.12.0+beta-5

    +

    ProcessMaker Icons4.13.0-RC1

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

    ProcessMaker Icons4.12.0+beta-5

      -
    • 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

      
    • +
    • add-outlined

      
    • 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

      