-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
placeholder table instead of spinner
- Loading branch information
Showing
3 changed files
with
158 additions
and
163 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,65 +1,103 @@ | ||
import React, { useContext } from 'react'; | ||
|
||
import { Box, DataTable } from 'grommet'; | ||
import { Text, Box, DataTable } from 'grommet'; | ||
|
||
// Import Context | ||
import { AppContext } from '../../App'; | ||
import { usePromiseTracker } from 'react-promise-tracker'; | ||
|
||
export const ListEOL = () => { | ||
const eoxdata = useContext(AppContext); | ||
// items to display | ||
const step = 10 | ||
const eoxdata = useContext(AppContext); | ||
const { promiseInProgress } = usePromiseTracker(); | ||
|
||
// define datatable columns | ||
const columns = [ | ||
{ | ||
property: 'key', | ||
header: 'Num', | ||
primary: true, | ||
size: "xxsmall" | ||
}, | ||
{ | ||
property: 'EOLProductID', | ||
header: "Device Product Number", | ||
size: "medium" | ||
}, | ||
{ | ||
property: 'EOXExternalAnnouncementDate', | ||
header: 'End Of Life', | ||
size: "xsmall" | ||
}, | ||
{ | ||
property: 'EndOfSaleDate', | ||
header: 'End Of Sale', | ||
size: "xsmall" | ||
}, | ||
{ | ||
property: 'LastDateOfSupport', | ||
header: 'End Of Support', | ||
size: "xsmall" | ||
}, | ||
{ | ||
property: 'MigrationProductName', | ||
header: 'Recommended Replacement' | ||
} | ||
// items to display | ||
const step = 10 | ||
|
||
] | ||
return ( | ||
<Box align="center" fill="horizontal" pad="medium" flex> | ||
<DataTable | ||
//columns={columns} | ||
columns={columns.map(c => ({ | ||
...c, | ||
search: c.property === 'EOLProductID', | ||
}))} | ||
data={eoxdata.eoxdata} | ||
step={step} | ||
size="medium" | ||
//resizeable | ||
sortable | ||
onMore={() => { console.log(`InfiniteScroll fires onMore after loading ${step} items`) }} /> | ||
</Box> | ||
); | ||
// define datatable columns | ||
const columns = [ | ||
{ | ||
property: 'key', | ||
header: 'Num', | ||
primary: true, | ||
size: "xxsmall" | ||
}, | ||
{ | ||
property: 'EOLProductID', | ||
header: "Device Product Number", | ||
size: "medium" | ||
}, | ||
{ | ||
property: 'EOXExternalAnnouncementDate', | ||
header: 'End Of Life', | ||
size: "xsmall" | ||
}, | ||
{ | ||
property: 'EndOfSaleDate', | ||
header: 'End Of Sale', | ||
size: "xsmall" | ||
}, | ||
{ | ||
property: 'LastDateOfSupport', | ||
header: 'End Of Support', | ||
size: "xsmall" | ||
}, | ||
{ | ||
property: 'MigrationProductName', | ||
header: 'Recommended Replacement' | ||
} | ||
|
||
] | ||
return ( | ||
<Box align="center" fill="horizontal" pad="medium" flex> | ||
{ promiseInProgress ? ( | ||
<DataTable | ||
columns={columns.map(c => ({ | ||
...c, | ||
search: c.property === 'EOLProductID', | ||
}))} | ||
data={eoxdata.eoxdata} | ||
step={step} | ||
size="medium" | ||
sortable | ||
placeholder={ | ||
<Box | ||
fill | ||
align="center" | ||
justify="center" | ||
direction="row" | ||
pad="large" | ||
gap="small" | ||
background={{ color: 'background-front', opacity: 'strong' }} | ||
> | ||
<Box | ||
direction="row" | ||
border={[ | ||
{ side: 'all', color: 'transparent', size: 'medium' }, | ||
{ side: 'horizontal', color: 'brand', size: 'medium' }, | ||
]} | ||
pad="small" | ||
round="full" | ||
animation={{ type: 'rotateRight', duration: 1500 }} | ||
/> | ||
<Text weight="bold">Loading ...</Text> | ||
</Box> | ||
} | ||
onMore={() => { console.log(`InfiniteScroll fires onMore after loading ${step} items`) }} /> | ||
) : ( | ||
<DataTable | ||
columns={columns.map(c => ({ | ||
...c, | ||
search: c.property === 'EOLProductID', | ||
}))} | ||
data={eoxdata.eoxdata} | ||
step={step} | ||
size="medium" | ||
sortable | ||
onMore={() => { console.log(`InfiniteScroll fires onMore after loading ${step} items`) }} /> | ||
) | ||
} | ||
</Box> | ||
); | ||
} | ||
|
||
export default ListEOL; |
This file was deleted.
Oops, something went wrong.