Handle undefined attributes in records resolver #61
@ -11,8 +11,8 @@ import Button from '@material-ui/core/Button';
|
||||
import TableHead from '@material-ui/core/TableHead';
|
||||
import TableRow from '@material-ui/core/TableRow';
|
||||
import TableBody from '@material-ui/core/TableBody';
|
||||
import TableFooter from '@material-ui/core/TableFooter';
|
||||
import TablePagination from '@material-ui/core/TablePagination';
|
||||
import { Paper, TableContainer, } from '@material-ui/core';
|
||||
|
||||
import WNS_RECORDS from '../../../gql/wns_records.graphql';
|
||||
|
||||
@ -108,6 +108,10 @@ const RegistryRecords = ({ type }) => {
|
||||
};
|
||||
|
||||
return (
|
||||
<Paper style={{
|
||||
width: '100%',
|
||||
}}>
|
||||
<TableContainer>
|
||||
<Table>
|
||||
<TableHead>
|
||||
<TableRow>
|
||||
@ -121,8 +125,7 @@ const RegistryRecords = ({ type }) => {
|
||||
</TableRow>
|
||||
</TableHead>
|
||||
<TableBody>
|
||||
{records.sort(sorter)
|
||||
.map((record) => {
|
||||
{records.sort(sorter).map((record) => {
|
||||
const { id, names, createTime, attributes: { type, name: displayName, fileName, version, description, service, package: pkg } } = record;
|
||||
|
||||
let pkgLink;
|
||||
@ -150,28 +153,19 @@ const RegistryRecords = ({ type }) => {
|
||||
<TableCell monospace>
|
||||
{appLinks || (names || []).map(name => <div key={name}>{name}</div>)}
|
||||
</TableCell>
|
||||
<TableCell monospace>
|
||||
{version}
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
{displayName || service || fileName || description}
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
{moment.utc(createTime).fromNow()}
|
||||
</TableCell>
|
||||
<TableCell monospace>
|
||||
{pkgLink}
|
||||
</TableCell>
|
||||
<TableCell monospace>{version}</TableCell>
|
||||
<TableCell>{displayName || service || fileName || description}</TableCell>
|
||||
<TableCell>{moment.utc(createTime).fromNow()}</TableCell>
|
||||
<TableCell monospace>{pkgLink}</TableCell>
|
||||
<TableCell>
|
||||
<QueryLink config={config} id={id} icon />
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
);
|
||||
}
|
||||
)}
|
||||
})}
|
||||
</TableBody>
|
||||
<TableFooter>
|
||||
<TableRow>
|
||||
</Table>
|
||||
</TableContainer>
|
||||
<TablePagination
|
||||
component="td"
|
||||
rowsPerPageOptions={[5, 10, 25]}
|
||||
@ -185,9 +179,7 @@ const RegistryRecords = ({ type }) => {
|
||||
disabled: records.length < rowsPerPage,
|
||||
}}
|
||||
/>
|
||||
</TableRow>
|
||||
</TableFooter>
|
||||
</Table>
|
||||
</Paper>
|
||||
);
|
||||
};
|
||||
|
||||
|
@ -46,7 +46,7 @@ export const createResolvers = config => {
|
||||
wns_records: async (_, { attributes }) => {
|
||||
log('WNS records...');
|
||||
|
||||
const {limit, offset, ...queryAttributes } = attributes;
|
||||
const {limit, offset, ...queryAttributes } = attributes || {};
|
||||
const data = await registry.queryRecords(queryAttributes, false, false, limit, offset);
|
||||
|
||||
return {
|
||||
|
Loading…
Reference in New Issue
Block a user