From aeac6bae3ef5a69f88240734d11d40a2e1f1fa92 Mon Sep 17 00:00:00 2001 From: Nolan Ehrstrom Date: Tue, 8 Aug 2023 11:39:17 -0700 Subject: [PATCH 1/2] Fix warning messages causing console errors --- config/pm-blocks.php | 25 +++++++++++++++++++ .../export/components/ExportSuccessModal.vue | 2 -- .../export/components/MainAssetView.vue | 2 ++ .../import/components/ImportManagerView.vue | 4 +-- .../import/components/ImportProcessModal.vue | 24 +++++++++--------- resources/lang/en.json | 8 +++--- 6 files changed, 45 insertions(+), 20 deletions(-) create mode 100644 config/pm-blocks.php diff --git a/config/pm-blocks.php b/config/pm-blocks.php new file mode 100644 index 0000000000..19c96cf146 --- /dev/null +++ b/config/pm-blocks.php @@ -0,0 +1,25 @@ + [ + 'base_url' => 'https://raw.githubusercontent.com/processmaker/', + 'pm_block_repo' => env('DEFAULT_PM_BLOCKS_REPO', 'pm-blocks'), + 'pm_block_branch' => env('DEFAULT_PM_BLOCKS_BRANCH', 'main'), + 'pm_block_categories' => env( + 'DEFAULT_PM_BLOCKS_CATEGORIES', + 'finance,math' + ), + ], +]; diff --git a/resources/js/processes/export/components/ExportSuccessModal.vue b/resources/js/processes/export/components/ExportSuccessModal.vue index d7c4758d3d..c530b1295a 100644 --- a/resources/js/processes/export/components/ExportSuccessModal.vue +++ b/resources/js/processes/export/components/ExportSuccessModal.vue @@ -61,8 +61,6 @@ export default { }).map(([uuid, setting]) => { return this.$root.manifest[uuid]; }).reduce((groups, asset) => { - console.log(asset); - if(!(asset.type in groups)) { groups[asset.type] = { firstAsset: asset, diff --git a/resources/js/processes/export/components/MainAssetView.vue b/resources/js/processes/export/components/MainAssetView.vue index befa7727cc..57316bb421 100644 --- a/resources/js/processes/export/components/MainAssetView.vue +++ b/resources/js/processes/export/components/MainAssetView.vue @@ -152,6 +152,8 @@ export default { importingName: asset.name, existingId: asset.existing_id, matchedBy: asset.matched_by, + existingUpdatedAt: asset.existing_attributes?.updated_at, + importingUpdatedAt: asset.attributes?.updated_at, }; }); } diff --git a/resources/js/processes/import/components/ImportManagerView.vue b/resources/js/processes/import/components/ImportManagerView.vue index f2594e8055..50fdb8e5fa 100644 --- a/resources/js/processes/import/components/ImportManagerView.vue +++ b/resources/js/processes/import/components/ImportManagerView.vue @@ -155,8 +155,8 @@ export default { importingName: asset.name, existingId: asset.existing_id, matchedBy: asset.matched_by, - existingUpdatedAt: asset.existing_attributes.updated_at, - importingUpdatedAt: asset.attributes.updated_at, + existingUpdatedAt: asset.existing_attributes?.updated_at, + importingUpdatedAt: asset.attributes?.updated_at, }; }); } diff --git a/resources/js/processes/import/components/ImportProcessModal.vue b/resources/js/processes/import/components/ImportProcessModal.vue index c13b9435e8..f562b6d8dc 100644 --- a/resources/js/processes/import/components/ImportProcessModal.vue +++ b/resources/js/processes/import/components/ImportProcessModal.vue @@ -104,21 +104,21 @@ return this.$t('Caution: {{type}} Already Exists', {type: asset.typeHuman}); }, helperText(asset) { - let assetTiming = this.$t("This environment already contains "); + let text = "This environment already contains the {{ item }} named '{{ name }}.'"; + if (asset.existingUpdatedAt && asset.importingUpdatedAt) { + const existingUpdatedAt = new Date(asset.existingUpdatedAt); + const importingUpdatedAt = new Date(`${asset.importingUpdatedAt.replace(" ", "T")}.000000Z`); - const existingUpdatedAt = new Date(asset.existingUpdatedAt); - const importingUpdatedAt = new Date(`${asset.importingUpdatedAt.replace(" ", "T")}.000000Z`); - - if (existingUpdatedAt > importingUpdatedAt) { - assetTiming += this.$t("a newer"); - } else if (existingUpdatedAt < importingUpdatedAt) { - assetTiming += this.$t("an older"); - } else { - assetTiming += this.$t("the same"); + if (existingUpdatedAt > importingUpdatedAt) { + text = "This environment already contains a newer version of the {{ item }} named '{{ name }}.'"; + } else if (existingUpdatedAt < importingUpdatedAt) { + text = "This environment already contains an older version of the {{ item }} named '{{ name }}.'"; + } else { + text = "This environment already contains the same version of the {{ item }} named '{{ name }}.'"; + } } - const text = this.$t('{{ assetTiming }} version of the {{ item }} named "{{ name }}."', { - assetTiming, + text = this.$t(text, { item: asset.typeHuman.toLowerCase(), name: asset.importingName, }); diff --git a/resources/lang/en.json b/resources/lang/en.json index 70d5077d14..66452fa34f 100644 --- a/resources/lang/en.json +++ b/resources/lang/en.json @@ -1748,10 +1748,10 @@ "Import all assets from the uploaded package.":"Import all assets from the uploaded package.", "Custom":"Custom", "Select which assets from the uploaded package should be imported to this environment.":"Select which assets from the uploaded package should be imported to this environment.", - "This environment already contains ": "This environment already contains ", - "a newer": "a newer", - "an older": "an older", - "the same": "the same", + "This environment already contains the {{ item }} named '{{ name }}.'": "This environment already contains the {{ item }} named '{{ name }}.'", + "This environment already contains a newer version of the {{ item }} named '{{ name }}.'":"This environment already contains a newer version of the {{ item }} named '{{ name }}.'", + "This environment already contains an older version of the {{ item }} named '{{ name }}.'":"This environment already contains an older version of the {{ item }} named '{{ name }}.'", + "This environment already contains the same version of the {{ item }} named '{{ name }}.'":"This environment already contains the same version of the {{ item }} named '{{ name }}.'", "You are about to import":"You are about to import", "Process was successfully imported":"Process was successfully imported", "Select Import Type":"Select Import Type", From 9aa616adad7a8801ccb04c9165f356758127a8d6 Mon Sep 17 00:00:00 2001 From: Nolan Ehrstrom Date: Tue, 8 Aug 2023 12:12:34 -0700 Subject: [PATCH 2/2] Remove config file --- config/pm-blocks.php | 25 ------------------------- 1 file changed, 25 deletions(-) delete mode 100644 config/pm-blocks.php diff --git a/config/pm-blocks.php b/config/pm-blocks.php deleted file mode 100644 index 19c96cf146..0000000000 --- a/config/pm-blocks.php +++ /dev/null @@ -1,25 +0,0 @@ - [ - 'base_url' => 'https://raw.githubusercontent.com/processmaker/', - 'pm_block_repo' => env('DEFAULT_PM_BLOCKS_REPO', 'pm-blocks'), - 'pm_block_branch' => env('DEFAULT_PM_BLOCKS_BRANCH', 'main'), - 'pm_block_categories' => env( - 'DEFAULT_PM_BLOCKS_CATEGORIES', - 'finance,math' - ), - ], -];