diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e8e1e6145a700b511f1b264e86f6f461628c8b63..f0d535dcb8432ac50ffadcdd29f2292360ff5e55 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -24,9 +24,10 @@ build: rules: # Always run the stage for the 'dev' branch - if: '$CI_COMMIT_REF_NAME == "dev"' - # For Merge Requests, make the stage manual + # For Merge Requests, make the stage manual (and optional) - if: '$CI_PIPELINE_SOURCE == "merge_request_event"' when: manual + allow_failure: true # Otherwise, skip the stage - when: never script: @@ -155,9 +156,10 @@ deploy-10-dev: rules: # Always run the stage for the 'dev' branch - if: '$CI_COMMIT_REF_NAME == "dev"' - # For Merge Requests, make the stage manual + # For Merge Requests, make the stage manual (and optional) - if: '$CI_PIPELINE_SOURCE == "merge_request_event"' when: manual + allow_failure: true # Otherwise, skip the stage - when: never diff --git a/src/app/utils/utils.ts b/src/app/utils/utils.ts index b414dc9e82c1e6b084bfcf06775b16ec054f6bbf..e65f9c8b0bdf89acb42f77681a6313e69dc04c89 100644 --- a/src/app/utils/utils.ts +++ b/src/app/utils/utils.ts @@ -199,7 +199,7 @@ export class Utils { } private convertToCSV(data: any[]): string { - const headers = Object.keys(data[0]).join(','); // CSV headers + const headers = Object.keys(data[0]).join(';'); // CSV headers const rows = data.map((row) => { return Object.values(row) @@ -213,20 +213,23 @@ export class Utils { } // If the value contains commas, newlines, or apostrophes, enclose it in double quotes - if (strValue.includes(',') || strValue.includes('\n') || strValue.includes("'")) { + if (strValue.includes(';') || strValue.includes('\n') || strValue.includes("'")) { strValue = `"${strValue}"`; } return strValue; }) - .join(','); // Join fields with commas + .join(';'); // Join fields with commas }); return [headers, ...rows].join('\n'); // Return the headers and data rows } private downloadCSV(csv: string, filename: string): void { - const blob = new Blob([csv], { type: 'text/csv' }); + const BOM = '\uFEFF'; // Special character at the beginning of the file for Excel encoding + csv = BOM + csv; + csv = csv.replace(/\n/g, '\r\n'); // Ensure proper line breaks in CSV + const blob = new Blob([csv], { type: 'text/csv;charset=utf-8' }); const url = window.URL.createObjectURL(blob); const a = document.createElement('a'); a.setAttribute('href', url);