diff --git a/src/components/editor/loop.vue b/src/components/editor/loop.vue index 5e6808b03..189d9444c 100644 --- a/src/components/editor/loop.vue +++ b/src/components/editor/loop.vue @@ -27,6 +27,15 @@ class="mr-2 ml-1" /> {{ element.config.name || $t("Variable Name") }} + + + {{ $t('Copied')}} +
{{ element.config.name || $t("Variable Name") }} + + + {{ $t('Copied')}} +
diff --git a/src/components/editor/multi-column.vue b/src/components/editor/multi-column.vue index 4ba98470c..26a1ed263 100644 --- a/src/components/editor/multi-column.vue +++ b/src/components/editor/multi-column.vue @@ -42,6 +42,15 @@ class="mr-2 ml-1" /> {{ element.config.name || $t("Variable Name") }} + + + {{ $t('Copied')}} +
{{ element.config.name || $t("Variable Name") }} + + + {{ $t('Copied')}} +
diff --git a/src/components/renderer/file-upload.vue b/src/components/renderer/file-upload.vue index b76c9004e..db4bda736 100644 --- a/src/components/renderer/file-upload.vue +++ b/src/components/renderer/file-upload.vue @@ -158,6 +158,10 @@ export default { this.removeDefaultClasses(); }, mounted() { + if (this.value) { + this.fetchFiles(); + } + this.$root.$on('set-upload-data-name', (recordList, index, id) => this.listenRecordList(recordList, index, id)); @@ -703,7 +707,29 @@ export default { }, cfSkipFileUpload() { this.$emit('cf-skip-file-upload'); - } + }, + async fetchFiles() { + const fileIds = Array.isArray(this.value) ? this.value : [this.value]; + + const fetchPromises = fileIds.map(async (file) => { + const id = file?.file ?? file; + const endpoint = `files/${id}`; + try { + const response = await ProcessMaker.apiClient.get(endpoint); + if (response?.data) { + const fileExists = this.files.some(existingFile => existingFile.id === response.data.id); + // Check if the file already exists in the list before adding it. + if (!fileExists) { + this.files.push(response.data); + } + } + } catch (error) { + console.error(`Failed to fetch file ${id}`, error); + } + }); + + return await Promise.all(fetchPromises); + }, }, }; diff --git a/src/components/vue-form-builder.vue b/src/components/vue-form-builder.vue index f0b0c56c6..395fadf85 100644 --- a/src/components/vue-form-builder.vue +++ b/src/components/vue-form-builder.vue @@ -202,6 +202,15 @@ class="mr-2 ml-1" /> {{ element.config.name || element.label || $t("Field Name") }} + + + {{ $t('Copied')}} +
{{ element.config.name || $t("Variable Name") }} + + + {{ $t('Copied')}} +
{ // Step 4: Verify 'Remove from Clipboard' button is visible after adding to clipboard and then click it cy.get('[data-cy="removeFromClipboard"]').should("be.visible"); - cy.get('[data-cy="removeFromClipboard"]').click(); + cy.get('[data-cy="removeFromClipboard"]').click({force: true}); cy.get('[data-cy="removeFromClipboard"]').should("not.exist"); }); @@ -73,7 +73,7 @@ describe("Clipboard Button Actions", () => { // Step 5: Remove the form input from the clipboard cy.get('[data-cy="removeFromClipboard"]').should("be.visible"); - cy.get('[data-cy="removeFromClipboard"]').click(); + cy.get('[data-cy="removeFromClipboard"]').click({force: true}); cy.get('[data-cy="removeFromClipboard"]').should("not.exist"); }); @@ -102,7 +102,7 @@ describe("Clipboard Button Actions", () => { // Step 4: Remove the form input from the clipboard cy.get('[data-cy="removeFromClipboard"]').should("be.visible"); - cy.get('[data-cy="removeFromClipboard"]').click(); + cy.get('[data-cy="removeFromClipboard"]').click({force: true}); cy.get('[data-cy="removeFromClipboard"]').should("not.exist"); }); diff --git a/tests/e2e/specs/ClipboardTestCases.spec.js b/tests/e2e/specs/ClipboardTestCases.spec.js index 393d74dd3..acf27457c 100644 --- a/tests/e2e/specs/ClipboardTestCases.spec.js +++ b/tests/e2e/specs/ClipboardTestCases.spec.js @@ -61,31 +61,37 @@ describe("Clipboard Button Actions", () => { cy.get('[data-cy="addToClipboard"]').should("be.visible"); cy.get('[data-cy="addToClipboard"]').click(); cy.get('[data-cy="addToClipboard"]').should("not.exist"); + cy.get('[data-cy="copied-badge"]').should("exist"); cy.get(':nth-child(2) > [data-cy="screen-element-container"]').click({ force: true }); cy.get('[data-cy="addToClipboard"]').should("be.visible"); cy.get('[data-cy="addToClipboard"]').click(); cy.get('[data-cy="addToClipboard"]').should("not.exist"); + cy.get('[data-cy="copied-badge"]').should("exist"); cy.get(':nth-child(3) > [data-cy="screen-element-container"]').click({ force: true }); cy.get('[data-cy="addToClipboard"]').should("be.visible"); cy.get('[data-cy="addToClipboard"]').click(); cy.get('[data-cy="addToClipboard"]').should("not.exist"); + cy.get('[data-cy="copied-badge"]').should("exist"); cy.get(':nth-child(4) > [data-cy="screen-element-container"]').click({ force: true }); cy.get('[data-cy="addToClipboard"]').should("be.visible"); cy.get('[data-cy="addToClipboard"]').click(); cy.get('[data-cy="addToClipboard"]').should("not.exist"); + cy.get('[data-cy="copied-badge"]').should("exist"); cy.get(':nth-child(5) > [data-cy="screen-element-container"]').click({ force: true }); cy.get('[data-cy="addToClipboard"]').should("be.visible"); cy.get('[data-cy="addToClipboard"]').click(); cy.get('[data-cy="addToClipboard"]').should("not.exist"); + cy.get('[data-cy="copied-badge"]').should("exist"); cy.get(':nth-child(6) > [data-cy="screen-element-container"]').click({ force: true }); cy.get('[data-cy="addToClipboard"]').should("be.visible"); cy.get('[data-cy="addToClipboard"]').click(); cy.get('[data-cy="addToClipboard"]').should("not.exist"); + cy.get('[data-cy="copied-badge"]').should("exist"); cy.get("[data-test=page-dropdown").click(); cy.get("[data-test=clipboard]").should("exist").click({ force: true }); @@ -111,32 +117,37 @@ describe("Clipboard Button Actions", () => { cy.get('[data-cy="addToClipboard"]').should("be.visible"); cy.get('[data-cy="addToClipboard"]').click(); cy.get('[data-cy="addToClipboard"]').should("not.exist"); + cy.get('[data-cy="copied-badge"]').should("exist"); cy.get(':nth-child(2) > [data-cy="screen-element-container"]').click({ force: true }); cy.get('[data-cy="addToClipboard"]').should("be.visible"); cy.get('[data-cy="addToClipboard"]').click(); cy.get('[data-cy="addToClipboard"]').should("not.exist"); + cy.get('[data-cy="copied-badge"]').should("exist"); cy.get(':nth-child(3) > [data-cy="screen-element-container"]').click({ force: true }); cy.get('[data-cy="addToClipboard"]').should("be.visible"); cy.get('[data-cy="addToClipboard"]').click(); cy.get('[data-cy="addToClipboard"]').should("not.exist"); + cy.get('[data-cy="copied-badge"]').should("exist"); cy.get(':nth-child(4) > [data-cy="screen-element-container"]').click({ force: true }); cy.get('[data-cy="addToClipboard"]').should("be.visible"); cy.get('[data-cy="addToClipboard"]').click(); cy.get('[data-cy="addToClipboard"]').should("not.exist"); + cy.get('[data-cy="copied-badge"]').should("exist"); cy.get(':nth-child(5) > [data-cy="screen-element-container"]').click({ force: true }); cy.get('[data-cy="addToClipboard"]').should("be.visible"); cy.get('[data-cy="addToClipboard"]').click(); cy.get('[data-cy="addToClipboard"]').should("not.exist"); + cy.get('[data-cy="copied-badge"]').should("exist"); cy.get(':nth-child(6) > [data-cy="screen-element-container"]').click({ force: true }); cy.get('[data-cy="addToClipboard"]').should("be.visible"); cy.get('[data-cy="addToClipboard"]').click(); cy.get('[data-cy="addToClipboard"]').should("not.exist"); - + cy.get('[data-cy="copied-badge"]').should("exist"); cy.get("[data-test=page-dropdown").click(); cy.get("[data-test=clipboard]").should("exist").click({ force: true }); @@ -158,6 +169,7 @@ describe("Clipboard Button Actions", () => { cy.get('[data-cy="addToClipboard"]').should("be.visible"); cy.get('[data-cy="addToClipboard"]').click(); cy.get('[data-cy="addToClipboard"]').should("not.exist"); + cy.get('[data-cy="copied-badge"]').should("exist"); cy.get("[data-test=page-dropdown").click(); cy.get("[data-test=clipboard]").should("exist").click({ force: true }); @@ -178,11 +190,13 @@ describe("Clipboard Button Actions", () => { cy.get('[data-cy="addToClipboard"]').should("be.visible"); cy.get('[data-cy="addToClipboard"]').click(); cy.get('[data-cy="addToClipboard"]').should("not.exist"); + cy.get('[data-cy="copied-badge"]').should("exist"); cy.get(':nth-child(2) > [data-cy="screen-element-container"]').click(); cy.get('[data-cy="addToClipboard"]').should("be.visible"); cy.get('[data-cy="addToClipboard"]').click(); cy.get('[data-cy="addToClipboard"]').should("not.exist"); + cy.get('[data-cy="copied-badge"]').should("exist"); cy.get("[data-test=page-dropdown").click();