From 3cd61bdbb0db3c209a64f985f468af3ebd4f84d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Agust=C3=ADn=20Busso?= <90727999+agustinbusso@users.noreply.github.com> Date: Thu, 7 Nov 2024 09:34:39 -0300 Subject: [PATCH 1/2] Validate if packages are installed when showing packageassets buttons --- resources/js/processes/designer/Assets.vue | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/resources/js/processes/designer/Assets.vue b/resources/js/processes/designer/Assets.vue index 9e236122fa..6563f6f293 100644 --- a/resources/js/processes/designer/Assets.vue +++ b/resources/js/processes/designer/Assets.vue @@ -43,6 +43,7 @@ Date: Thu, 7 Nov 2024 10:25:56 -0300 Subject: [PATCH 2/2] Validate if package is installed for options of recent assets --- resources/js/processes/designer/RecentAssets.vue | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/resources/js/processes/designer/RecentAssets.vue b/resources/js/processes/designer/RecentAssets.vue index 9e22b804da..ba270a97b0 100644 --- a/resources/js/processes/designer/RecentAssets.vue +++ b/resources/js/processes/designer/RecentAssets.vue @@ -104,12 +104,26 @@ export default { this.getOptionsType(); }, methods: { + isPackageInstalled(packageName) { + if (packageName) { + return window.ProcessMaker?.packages?.includes(packageName); + } + return true; + }, getOptionsType() { if (this.project) { window.ProcessMaker.apiClient .get("projects/assets/type") .then((response) => { this.optionsType = response.data.data; + // Filter optionsType based on package installation + this.optionsType = Object.keys(this.optionsType).reduce((accumulator, type) => { + if (this.isPackageInstalled(this.optionsType[type].package)) { + accumulator[type] = this.optionsType[type]; + } + return accumulator; + }, {}); + // Add all asset types to selectedTypes Object.keys(this.optionsType).forEach((type) => { this.selectedTypes.push(this.optionsType[type].asset_type); });