Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change DLS datafile create time to datafileCreateTime #1664 #1668

Merged
merged 13 commits into from
Oct 1, 2024
6 changes: 3 additions & 3 deletions .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ jobs:
with:
repository: ral-facilities/datagateway-api
path: datagateway-api
ref: v9.0.2
ref: v9.0.3

# DataGateway API file setup
- name: Create search_api_mapping.json
Expand Down Expand Up @@ -301,7 +301,7 @@ jobs:
with:
repository: ral-facilities/datagateway-api
path: datagateway-api
ref: v9.0.2
ref: v9.0.3

# DataGateway API file setup
- name: Create search_api_mapping.json
Expand Down Expand Up @@ -436,7 +436,7 @@ jobs:
with:
repository: ral-facilities/datagateway-api
path: datagateway-api
ref: v9.0.2
ref: v9.0.3

# DataGateway API file setup
- name: Create search_api_mapping.json
Expand Down
2 changes: 2 additions & 0 deletions packages/datagateway-common/src/app.types.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ export interface Datafile {
name: string;
modTime: string;
createTime: string;
datafileModTime?: string;
datafileCreateTime?: string;
fileSize?: number;
location?: string;
description?: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ describe('Datafile preview', () => {
cy.contains('159.93 MB').should('exist');
cy.contains('/wish/although/eat.txt').should('exist');
cy.contains('2019-09-05 14:03:35+01:00').should('exist');
cy.contains('2019-09-05 14:03:35+01:00').should('exist');
cy.contains('2011-03-25 13:11:50+00:00').should('exist');

// should be at 100% zoom
cy.contains('100%').should('exist');
Expand Down Expand Up @@ -162,7 +162,7 @@ describe('Datafile preview', () => {
cy.contains('159.93 MB').should('not.exist');
cy.contains('/wish/although/eat.txt').should('not.exist');
cy.contains('2019-09-05 14:03:35+01:00').should('not.exist');
cy.contains('2019-09-05 14:03:35+01:00').should('not.exist');
cy.contains('2011-03-25 13:11:50+00:00').should('not.exist');

// see above for the HTML structure of the checkbox
cy.get('label')
Expand All @@ -181,7 +181,7 @@ describe('Datafile preview', () => {
cy.contains('159.93 MB').should('exist');
cy.contains('/wish/although/eat.txt').should('exist');
cy.contains('2019-09-05 14:03:35+01:00').should('exist');
cy.contains('2019-09-05 14:03:35+01:00').should('exist');
cy.contains('2011-03-25 13:11:50+00:00').should('exist');

// see above for the HTML structure of the checkbox
cy.get('label')
Expand Down
4 changes: 2 additions & 2 deletions packages/datagateway-dataview/cypress/fixtures/datafile.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[
{
"datafileModTime": "2019-09-05 14:03:35+01:00",
"modTime": "2019-09-05 14:03:35+01:00",
"modTime": "2019-09-06 14:03:35+01:00",
"checksum": "ca0b59c00703c61a077e099c3d4f4d5f",
"datafileCreateTime": "2011-03-25 13:11:50+00:00",
"fileSize": 159934493,
"name": "Datafile 3484.txt",
"createTime": "2011-03-25 13:11:50+00:00",
"createTime": "2011-03-26 13:11:50+00:00",
"createId": "user",
"description": "Effort plan social history carry this summer stuff. Fear source yard small.\nTogether discover new account parent. Learn wall industry red suffer. Black concern building behavior able long.",
"location": "/wish/although/eat.txt",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,8 @@ describe('DatafilePreviewer', () => {
expect(screen.getByText(mockDatafile.location)).toBeInTheDocument();
// formatted size of the datafile
expect(screen.getByText('100 B')).toBeInTheDocument();
expect(screen.getByText(mockDatafile.modTime)).toBeInTheDocument();
expect(screen.getByText(mockDatafile.createTime)).toBeInTheDocument();
expect(screen.getByText(mockDatafile.datafileModTime)).toBeInTheDocument();
expect(screen.getByText(mockDatafile.datafileCreateTime)).toBeInTheDocument();
});

it('should show the current progress of downloading datafile content', async () => {
Expand Down Expand Up @@ -229,8 +229,8 @@ describe('DatafilePreviewer', () => {
expect(screen.getByText(mockDatafile.location)).toBeInTheDocument();
// formatted size of the datafile
expect(screen.getByText('100 B')).toBeInTheDocument();
expect(screen.getByText(mockDatafile.modTime)).toBeInTheDocument();
expect(screen.getByText(mockDatafile.createTime)).toBeInTheDocument();
expect(screen.getByText(mockDatafile.datafileModTime)).toBeInTheDocument();
expect(screen.getByText(mockDatafile.datafileCreateTime)).toBeInTheDocument();
});

it('should show a message saying the datafile cannot be previewed if the datafile extension is not supported', async () => {
Expand Down Expand Up @@ -262,9 +262,9 @@ describe('DatafilePreviewer', () => {
expect(screen.getByText(unsupportedDatafile.location)).toBeInTheDocument();
// formatted size of the datafile
expect(screen.getByText('100 B')).toBeInTheDocument();
expect(screen.getByText(unsupportedDatafile.modTime)).toBeInTheDocument();
expect(screen.getByText(unsupportedDatafile.datafileModTime)).toBeInTheDocument();
expect(
screen.getByText(unsupportedDatafile.createTime)
screen.getByText(unsupportedDatafile.datafileCreateTime)
).toBeInTheDocument();
});

Expand Down Expand Up @@ -297,9 +297,9 @@ describe('DatafilePreviewer', () => {
expect(screen.getByText(unsupportedDatafile.location)).toBeInTheDocument();
// formatted size of the datafile
expect(screen.getByText('100 B')).toBeInTheDocument();
expect(screen.getByText(unsupportedDatafile.modTime)).toBeInTheDocument();
expect(screen.getByText(unsupportedDatafile.datafileModTime)).toBeInTheDocument();
expect(
screen.getByText(unsupportedDatafile.createTime)
screen.getByText(unsupportedDatafile.datafileCreateTime)
).toBeInTheDocument();
});

Expand Down Expand Up @@ -330,8 +330,8 @@ describe('DatafilePreviewer', () => {
expect(screen.getByText(mockDatafile.location)).toBeInTheDocument();
// formatted size of the datafile
expect(screen.getByText('100 B')).toBeInTheDocument();
expect(screen.getByText(mockDatafile.modTime)).toBeInTheDocument();
expect(screen.getByText(mockDatafile.createTime)).toBeInTheDocument();
expect(screen.getByText(mockDatafile.datafileModTime)).toBeInTheDocument();
expect(screen.getByText(mockDatafile.datafileCreateTime)).toBeInTheDocument();
});

it('hides the details pane when it is switched off', async () => {
Expand All @@ -355,8 +355,8 @@ describe('DatafilePreviewer', () => {
expect(screen.queryByText(mockDatafile.location)).toBeNull();
// formatted size of the datafile
expect(screen.queryByText('100 B')).toBeNull();
expect(screen.queryByText(mockDatafile.modTime)).toBeNull();
expect(screen.queryByText(mockDatafile.createTime)).toBeNull();
expect(screen.queryByText(mockDatafile.datafileModTime)).toBeNull();
expect(screen.queryByText(mockDatafile.datafileCreateTime)).toBeNull();
});
});

Expand Down Expand Up @@ -387,8 +387,8 @@ describe('DatafilePreviewer', () => {
expect(screen.getByText(mockDatafile.location)).toBeInTheDocument();
// formatted size of the datafile
expect(screen.getByText('100 B')).toBeInTheDocument();
expect(screen.getByText(mockDatafile.modTime)).toBeInTheDocument();
expect(screen.getByText(mockDatafile.createTime)).toBeInTheDocument();
expect(screen.getByText(mockDatafile.datafileModTime)).toBeInTheDocument();
expect(screen.getByText(mockDatafile.datafileCreateTime)).toBeInTheDocument();
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,16 @@ describe('DetailsPane', () => {
expect(
await screen.findByText('datafiles.details.mod_time')
).toBeInTheDocument();
expect(screen.getByText(mockDatafile.modTime)).toBeInTheDocument();
expect(
screen.getByText(mockDatafile.datafileModTime)
).toBeInTheDocument();
});

it('with an unknown message if the last modified time is unknown', async () => {
renderComponent({
datafile: {
...mockDatafile,
modTime: '',
datafileModTime: undefined,
},
});

Expand All @@ -121,14 +123,16 @@ describe('DetailsPane', () => {
expect(
await screen.findByText('datafiles.details.create_time')
).toBeInTheDocument();
expect(screen.getByText(mockDatafile.createTime)).toBeInTheDocument();
expect(
screen.getByText(mockDatafile.datafileCreateTime)
).toBeInTheDocument();
});

it('with an unknown message if the creation date is unknown', async () => {
renderComponent({
datafile: {
...mockDatafile,
createTime: '',
datafileCreateTime: undefined,
},
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ function DetailsPane(): JSX.Element {
/>
<DetailsField
name={t('datafiles.details.mod_time')}
value={datafile.modTime || t('datafiles.details.unknown')}
value={datafile.datafileModTime || t('datafiles.details.unknown')}
/>
<DetailsField
name={t('datafiles.details.create_time')}
value={datafile.createTime || t('datafiles.details.unknown')}
value={datafile.datafileCreateTime || t('datafiles.details.unknown')}
/>
</Stack>
</Paper>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ import type { Datafile } from 'datagateway-common';

const mockDatafile = {
createTime: '2020-01-01',
datafileCreateTime: '2019-01-01',
dataset: undefined,
description: 'test description',
fileSize: 100,
id: 123,
location: 'test location',
modTime: '2020-01-02',
datafileModTime: '2019-01-02',
name: 'Datafile.txt',
parameters: [],
} satisfies Datafile;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ describe('Datafile table component', () => {
fileSize: 1,
modTime: '2019-07-23',
createTime: '2019-07-23',
datafileModTime: '2019-01-02',
datafileCreateTime: '2019-01-01',
},
];
history = createMemoryHistory();
Expand Down Expand Up @@ -200,7 +202,7 @@ describe('Datafile table component', () => {
findCellInRow(row, {
columnIndex: await findColumnIndexByName('datafiles.modified_time'),
})
).getByText('2019-07-23')
).getByText('2019-01-02')
).toBeInTheDocument();
});

Expand Down Expand Up @@ -243,7 +245,9 @@ describe('Datafile table component', () => {

expect(history.length).toBe(2);
expect(history.location.search).toBe(
`?filters=${encodeURIComponent('{"modTime":{"endDate":"2019-08-06"}}')}`
`?filters=${encodeURIComponent(
'{"datafileModTime":{"endDate":"2019-08-06"}}'
)}`
);

// await user.clear(filterInput);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ const DatafileTable = (props: DatafileTableProps): React.ReactElement => {
{
icon: CalendarToday,
label: t('datafiles.modified_time'),
dataKey: 'modTime',
dataKey: 'datafileModTime',
filterComponent: dateFilter,
},
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ describe('DLS datafiles table component', () => {
fileSize: 1,
modTime: '2019-07-23',
createTime: '2019-07-23',
datafileModTime: '2019-01-02',
datafileCreateTime: '2019-01-01',
},
];
history = createMemoryHistory();
Expand Down Expand Up @@ -165,7 +167,7 @@ describe('DLS datafiles table component', () => {
findCellInRow(row, {
columnIndex: await findColumnIndexByName('datafiles.create_time'),
})
).getByText('2019-07-23')
).getByText('2019-01-01')
).toBeInTheDocument();
});

Expand Down Expand Up @@ -209,7 +211,7 @@ describe('DLS datafiles table component', () => {
expect(history.length).toBe(2);
expect(history.location.search).toBe(
`?filters=${encodeURIComponent(
'{"createTime":{"endDate":"2019-08-06"}}'
'{"datafileCreateTime":{"endDate":"2019-08-06"}}'
)}`
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ const DLSDatafilesTable = (
{
icon: CalendarToday,
label: t('datafiles.create_time'),
dataKey: 'createTime',
dataKey: 'datafileCreateTime',
filterComponent: dateFilter,
},
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ describe('ISIS datafiles table component', () => {
fileSize: 1,
modTime: '2019-07-23',
createTime: '2019-07-23',
datafileModTime: '2019-01-02',
datafileCreateTime: '2019-01-01',
},
];
cartItems = [];
Expand Down Expand Up @@ -201,7 +203,7 @@ describe('ISIS datafiles table component', () => {
findCellInRow(row, {
columnIndex: await findColumnIndexByName('datafiles.modified_time'),
})
).getByText('2019-07-23')
).getByText('2019-01-02')
).toBeInTheDocument();
});

Expand Down Expand Up @@ -244,7 +246,9 @@ describe('ISIS datafiles table component', () => {

expect(history.length).toBe(2);
expect(history.location.search).toBe(
`?filters=${encodeURIComponent('{"modTime":{"endDate":"2019-08-06"}}')}`
`?filters=${encodeURIComponent(
'{"datafileModTime":{"endDate":"2019-08-06"}}'
)}`
);

// await user.clear(filterInput);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ const ISISDatafilesTable = (
{
icon: CalendarTodayIcon,
label: t('datafiles.modified_time'),
dataKey: 'modTime',
dataKey: 'datafileModTime',
filterComponent: dateFilter,
},
],
Expand Down
Loading