Skip to content

Commit 0afda95

Browse files
committed
Added timezone to admin jobs query parameters
1 parent 92ad696 commit 0afda95

File tree

7 files changed

+20
-18
lines changed

7 files changed

+20
-18
lines changed

__tests__/JobsList.test.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,27 +89,27 @@ describe('JobsList', () => {
8989
// Verify default sorting
9090
table = result.getByRole('table');
9191
expect(table.querySelectorAll('tbody tr:nth-child(1) td')[2].textContent).eq(
92-
'10/30/2023, 9:30:38 AM'
92+
'10/30/2023, 10:30:38 AM'
9393
);
9494
expect(table.querySelectorAll('tbody tr:nth-child(2) td')[2].textContent).eq(
95-
'10/30/2023, 9:15:38 AM'
95+
'10/30/2023, 10:15:38 AM'
9696
);
9797
expect(table.querySelectorAll('tbody tr:nth-child(3) td')[2].textContent).eq(
98-
'10/30/2023, 9:00:38 AM'
98+
'10/30/2023, 10:00:38 AM'
9999
);
100100

101101
// Sort by start date
102102
const startDateSorter = table.querySelector('thead th:nth-child(3)');
103103
await fireEvent.click(startDateSorter);
104104
table = result.getByRole('table');
105105
expect(table.querySelectorAll('tbody tr:nth-child(1) td')[2].textContent).eq(
106-
'10/30/2023, 9:00:38 AM'
106+
'10/30/2023, 10:00:38 AM'
107107
);
108108
expect(table.querySelectorAll('tbody tr:nth-child(2) td')[2].textContent).eq(
109-
'10/30/2023, 9:15:38 AM'
109+
'10/30/2023, 10:15:38 AM'
110110
);
111111
expect(table.querySelectorAll('tbody tr:nth-child(3) td')[2].textContent).eq(
112-
'10/30/2023, 9:30:38 AM'
112+
'10/30/2023, 10:30:38 AM'
113113
);
114114
});
115115

__tests__/component_utilities.test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ it('removes duplicated datasets and sort by name', () => {
6767

6868
it('sort projects by timestamp_created DESC', () => {
6969
const projects = [
70-
{ name: 'p1', read_only: false, id: 2, timestamp_created: '2024-01-29T09:34:40.687256' },
71-
{ name: 'p3', read_only: false, id: 5, timestamp_created: '2024-01-29T09:36:40.380260' },
72-
{ name: 'p2', read_only: false, id: 4, timestamp_created: '2024-01-29T09:35:20.571999' }
70+
{ name: 'p1', read_only: false, id: 2, timestamp_created: '2024-01-29T09:34:40.687256+00:00' },
71+
{ name: 'p3', read_only: false, id: 5, timestamp_created: '2024-01-29T09:36:40.380260+00:00' },
72+
{ name: 'p2', read_only: false, id: 4, timestamp_created: '2024-01-29T09:35:20.571999+00:00' }
7373
];
7474

7575
sortProjectsByTimestampCreatedDesc(projects);

__tests__/mock/jobs-list.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ export const data = {
3939
workflow_id: 1,
4040
input_dataset_id: 1,
4141
output_dataset_id: 2,
42-
start_timestamp: '2023-10-30T09:00:38.442196',
43-
end_timestamp: '2023-10-30T09:10:38.442196',
42+
start_timestamp: '2023-10-30T09:00:38.442196+00:00',
43+
end_timestamp: '2023-10-30T09:10:38.442196+00:00',
4444
workflow_dump: { id: 1, name: 'workflow 1' },
4545
input_dataset_dump: { id: 1, name: 'input1' },
4646
output_dataset_dump: { id: 2, name: 'output1' },
@@ -53,8 +53,8 @@ export const data = {
5353
workflow_id: 2,
5454
input_dataset_id: 3,
5555
output_dataset_id: 4,
56-
start_timestamp: '2023-10-30T09:15:38.442196',
57-
end_timestamp: '2023-10-30T09:20:38.442196',
56+
start_timestamp: '2023-10-30T09:15:38.442196+00:00',
57+
end_timestamp: '2023-10-30T09:20:38.442196+00:00',
5858
workflow_dump: { id: 2, name: 'workflow 2' },
5959
input_dataset_dump: { id: 3, name: 'input2' },
6060
output_dataset_dump: { id: 4, name: 'output2' },
@@ -67,7 +67,7 @@ export const data = {
6767
workflow_id: 2,
6868
input_dataset_id: 5,
6969
output_dataset_id: 6,
70-
start_timestamp: '2023-10-30T09:30:38.442196',
70+
start_timestamp: '2023-10-30T09:30:38.442196+00:00',
7171
input_dataset_dump: { id: 5, name: 'input3' },
7272
output_dataset_dump: { id: 6, name: 'output3' },
7373
end_timestamp: null,

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"lint": "prettier --check . && eslint .",
1212
"format": "prettier --write .",
1313
"pre-commit": "lint-staged",
14-
"test": "vitest"
14+
"test": "TZ=Europe/Rome vitest"
1515
},
1616
"devDependencies": {
1717
"@playwright/test": "^1.40.0",

playwright.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export default defineConfig({
3939

4040
webServer: [
4141
{
42-
command: './tests/start-test-server.sh 1.4.3a1',
42+
command: './tests/start-test-server.sh 1.4.3a2',
4343
port: 8000,
4444
waitForPort: true,
4545
stdout: 'pipe',

src/lib/types.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ export type Workflow = {
2929
project_id: number
3030
project: Project
3131
task_list: Array<WorkflowTask>
32+
timestamp_created: string
3233
}
3334

3435
export type WorkflowTask = {
@@ -63,6 +64,7 @@ export type Dataset = {
6364
resource_list: Array<Resource>
6465
project_id: number
6566
project: Project
67+
timestamp_created: string
6668
}
6769

6870
export type JobStatus = 'submitted' | 'running' | 'done' | 'failed'

src/routes/admin/jobs/+page.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,9 @@
124124
return undefined;
125125
}
126126
if (time === undefined || time === '') {
127-
return `${date}T00:00:00`;
127+
return new Date(`${date}T00:00:00`).toISOString();
128128
}
129-
return `${date}T${time}:00`;
129+
return new Date(`${date}T${time}:00`).toISOString();
130130
}
131131
132132
function resetSearchFields() {

0 commit comments

Comments
 (0)