From 76a0b4740d1f97172fad8e6642b00569fcfaf78e Mon Sep 17 00:00:00 2001 From: guzhongren Date: Mon, 11 Nov 2024 23:16:39 +0800 Subject: [PATCH] [frontend] change the config name of downloading --- .../containers/MetricsStepper/MetricsStepper.test.tsx | 10 +++++----- frontend/src/containers/MetricsStepper/index.tsx | 3 ++- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/frontend/__tests__/containers/MetricsStepper/MetricsStepper.test.tsx b/frontend/__tests__/containers/MetricsStepper/MetricsStepper.test.tsx index 8c7a4e02d..f7fc6a09b 100644 --- a/frontend/__tests__/containers/MetricsStepper/MetricsStepper.test.tsx +++ b/frontend/__tests__/containers/MetricsStepper/MetricsStepper.test.tsx @@ -321,7 +321,7 @@ describe('MetricsStepper', () => { }); it('should export json when click save button', async () => { - const expectedFileName = 'config'; + const expectedFileName = `-Heartbeat`; const expectedJson = { board: undefined, calendarType: Calendar.Regular, @@ -345,7 +345,7 @@ describe('MetricsStepper', () => { }); it('should export json when click save button when pipelineTool, sourceControl, and board is not empty', async () => { - const expectedFileName = 'config'; + const expectedFileName = `-Heartbeat`; const expectedJson = { board: { boardId: '', email: '', site: '', token: '', type: 'Jira' }, calendarType: Calendar.Regular, @@ -363,7 +363,7 @@ describe('MetricsStepper', () => { }; setup(); - await fillMetricsData(); + fillMetricsData(); await userEvent.click(screen.getByText(SAVE)); @@ -371,7 +371,7 @@ describe('MetricsStepper', () => { }); it('should export json file when click save button in metrics page given all content is empty', async () => { - const expectedFileName = 'config'; + const expectedFileName = 'test-project-Name-Heartbeat'; const expectedJson = { advancedSettings: null, assigneeFilter: ASSIGNEE_FILTER_TYPES.LAST_ASSIGNEE, @@ -423,7 +423,7 @@ describe('MetricsStepper', () => { }, 50000); it('should export json file when click save button in report page given all content is empty', async () => { - const expectedFileName = 'config'; + const expectedFileName = 'test-project-Name-Heartbeat'; const expectedJson = { advancedSettings: null, assigneeFilter: ASSIGNEE_FILTER_TYPES.LAST_ASSIGNEE, diff --git a/frontend/src/containers/MetricsStepper/index.tsx b/frontend/src/containers/MetricsStepper/index.tsx index 1bad2f7dd..68e2b7519 100644 --- a/frontend/src/containers/MetricsStepper/index.tsx +++ b/frontend/src/containers/MetricsStepper/index.tsx @@ -388,7 +388,8 @@ const MetricsStepper = () => { reworkTimesSettings: importedData.reworkTimesSettings, }; const jsonData = activeStep === METRICS_STEPS.CONFIG ? configData : { ...configData, ...metricsData }; - exportToJsonFile('config', jsonData); + // exportToJsonFile('config', jsonData); + exportToJsonFile(`${config.basic.projectName.split(' ').join('-')}-Heartbeat`, jsonData) }; const handleNext = () => {