Skip to content

Commit

Permalink
Merge branch 'release-2024-fall' into bugfix/FOUR-19806
Browse files Browse the repository at this point in the history
  • Loading branch information
nolanpro committed Oct 29, 2024
2 parents 9d4c105 + 83aaa2e commit 18d73cb
Show file tree
Hide file tree
Showing 6 changed files with 123 additions and 5 deletions.
26 changes: 26 additions & 0 deletions src/components/editor/loop.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,15 @@
class="mr-2 ml-1"
/>
{{ element.config.name || $t("Variable Name") }}
<b-badge
v-if="isInClipboard(items[index])"
data-cy="copied-badge"
class="m-2 custom-badge"
pill
>
<i class="far fa-check-circle"></i>
<span class="pl-2">{{ $t('Copied')}}</span>
</b-badge>
<div class="ml-auto">
<clipboard-button
:index="index"
Expand Down Expand Up @@ -91,6 +100,15 @@
class="mr-2 ml-1"
/>
{{ element.config.name || $t("Variable Name") }}
<b-badge
v-if="isInClipboard(items[index])"
data-cy="copied-badge"
class="m-2 custom-badge"
pill
>
<i class="far fa-check-circle"></i>
<span class="pl-2">{{ $t('Copied')}}</span>
</b-badge>
<div class="ml-auto">
<clipboard-button
:index="index"
Expand Down Expand Up @@ -334,4 +352,12 @@ export default {
box-shadow: 0 0 0 13px rgba(0, 0, 0, 0);
}
}
.custom-badge {
background-color: #D1F4D7 !important;
color: #06723A !important;
padding: 0.5rem 0.75rem;
border-radius: 8px;
font-weight: 500;
font-size: 14px;
}
</style>
26 changes: 26 additions & 0 deletions src/components/editor/multi-column.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,15 @@
class="mr-2 ml-1"
/>
{{ element.config.name || $t("Variable Name") }}
<b-badge
v-if="isInClipboard(element)"
data-cy="copied-badge"
class="m-2 custom-badge"
pill
>
<i class="far fa-check-circle"></i>
<span class="pl-2">{{ $t('Copied')}}</span>
</b-badge>
<div class="ml-auto">
<clipboard-button
:index="index"
Expand Down Expand Up @@ -108,6 +117,15 @@
class="mr-2 ml-1"
/>
{{ element.config.name || $t("Variable Name") }}
<b-badge
v-if="isInClipboard(element)"
data-cy="copied-badge"
class="m-2 custom-badge"
pill
>
<i class="far fa-check-circle"></i>
<span class="pl-2">{{ $t('Copied')}}</span>
</b-badge>
<div class="ml-auto">
<clipboard-button
:index="index"
Expand Down Expand Up @@ -375,4 +393,12 @@ export default {
box-shadow: 0 0 0 13px rgba(0, 0, 0, 0);
}
}
.custom-badge {
background-color: #D1F4D7 !important;
color: #06723A !important;
padding: 0.5rem 0.75rem;
border-radius: 8px;
font-weight: 500;
font-size: 14px;
}
</style>
28 changes: 27 additions & 1 deletion src/components/renderer/file-upload.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down Expand Up @@ -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);
},
},
};
</script>
Expand Down
26 changes: 26 additions & 0 deletions src/components/vue-form-builder.vue
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,15 @@
class="mr-2 ml-1"
/>
{{ element.config.name || element.label || $t("Field Name") }}
<b-badge
v-if="!isClipboardPage(tabPage) && isInClipboard(extendedPages[tabPage].items[index])"
data-cy="copied-badge"
class="m-2 custom-badge"
pill
>
<i class="far fa-check-circle"></i>
<span class="pl-2">{{ $t('Copied')}}</span>
</b-badge>
<div class="ml-auto">
<clipboard-button
v-if="!isClipboardPage(tabPage)"
Expand Down Expand Up @@ -267,6 +276,15 @@
class="mr-2 ml-1"
/>
{{ element.config.name || $t("Variable Name") }}
<b-badge
v-if="!isClipboardPage(tabPage) && isInClipboard(extendedPages[tabPage].items[index])"
data-cy="copied-badge"
class="m-2 custom-badge"
pill
>
<i class="far fa-check-circle"></i>
<span class="pl-2">{{ $t('Copied')}}</span>
</b-badge>
<div class="ml-auto">
<clipboard-button
v-if="!isClipboardPage(tabPage)"
Expand Down Expand Up @@ -1746,6 +1764,14 @@ $side-bar-font-size: 0.875rem;
cursor: not-allowed; /* Cambia el cursor cuando se pasa por encima */
pointer-events: all; /* Permite que el pseudo-elemento reciba eventos del ratón */
}
.custom-badge {
background-color: #D1F4D7 !important;
color: #06723A !important;
padding: 0.5rem 0.75rem;
border-radius: 8px;
font-weight: 500;
font-size: 14px;
}
.no-text-transform {
text-transform: none;
}
Expand Down
6 changes: 3 additions & 3 deletions tests/e2e/specs/Clipboard.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ describe("Clipboard Button Actions", () => {

// 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");
});

Expand Down Expand Up @@ -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");
});

Expand Down Expand Up @@ -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");
});

Expand Down
16 changes: 15 additions & 1 deletion tests/e2e/specs/ClipboardTestCases.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
Expand All @@ -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 });
Expand All @@ -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 });
Expand All @@ -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();
Expand Down

0 comments on commit 18d73cb

Please sign in to comment.