This commit is contained in:
richburdon 2020-05-26 08:58:11 -04:00
parent e71d51eb7f
commit 24e59cec11
9 changed files with 42 additions and 32 deletions

View File

@ -40,6 +40,14 @@ const useStyles = makeStyles((theme) => ({
flex: 1,
textAlign: 'center'
},
info: {
display: 'flex',
fontFamily: 'monospace',
fontSize: 'large',
'& div': {
margin: 4
}
},
icon: {
margin: '0 2px'
},
@ -54,12 +62,6 @@ const useStyles = makeStyles((theme) => ({
},
loading: {
color: theme.palette.primary.dark
},
info: {
display: 'flex',
'& div': {
margin: 4
}
}
}));

View File

@ -45,9 +45,7 @@ const VersionCheck = () => {
}
});
if (latest !== current) {
setUpgrade({ current, latest });
}
setUpgrade({ current, latest: latest !== current ? latest : undefined });
}
}, [status, data]);

View File

@ -18,10 +18,11 @@ import { getServiceUrl } from '../../../util/config';
import Table from '../../../components/Table';
import TableCell from '../../../components/TableCell';
import moment from 'moment';
const AppRecords = () => {
const { config } = useContext(ConsoleContext);
const [sorter, sortBy] = useSorter('id');
const [sorter, sortBy] = useSorter('createTime', false);
const data = useQueryStatusReducer(useQuery(WNS_RECORDS, {
pollInterval: config.api.pollInterval,
variables: { type: 'wrn:app' }
@ -54,20 +55,22 @@ const AppRecords = () => {
<Table>
<TableHead>
<TableRow>
<TableCell onClick={sortBy('name')}>ID</TableCell>
<TableCell onClick={sortBy('name')}>Identifier</TableCell>
<TableCell onClick={sortBy('version')} size="small">Version</TableCell>
<TableCell onClick={sortBy('createTime')} size="small">Created</TableCell>
<TableCell onClick={sortBy('attributes.displayName')}>Name</TableCell>
<TableCell>Link</TableCell>
</TableRow>
</TableHead>
<TableBody>
{records.sort(sorter).map(({ id, name, version, attributes: { displayName, publicUrl } }) => {
{records.sort(sorter).map(({ id, name, version, createTime, attributes: { displayName, publicUrl } }) => {
const link = getAppUrl({ id, name, version, publicUrl });
return (
<TableRow key={id} size="small">
<TableCell monospace>{name}</TableCell>
<TableCell monospace>{version}</TableCell>
<TableCell>{moment.utc(createTime).fromNow()}</TableCell>
<TableCell>{displayName}</TableCell>
<TableCell monospace>
{link && (

View File

@ -15,10 +15,11 @@ import TableBody from '@material-ui/core/TableBody';
import Table from '../../../components/Table';
import TableCell from '../../../components/TableCell';
import moment from 'moment';
const AppRecords = () => {
const { config } = useContext(ConsoleContext);
const [sorter, sortBy] = useSorter('id');
const [sorter, sortBy] = useSorter('createTime', false);
const data = useQueryStatusReducer(useQuery(WNS_RECORDS, {
pollInterval: config.api.pollInterval,
variables: { type: 'wrn:bot' }
@ -34,19 +35,22 @@ const AppRecords = () => {
<Table>
<TableHead>
<TableRow>
<TableCell onClick={sortBy('name')}>ID</TableCell>
<TableCell onClick={sortBy('name')}>Identifier</TableCell>
<TableCell onClick={sortBy('version')} size="small">Version</TableCell>
<TableCell onClick={sortBy('createTime')} size="small">Created</TableCell>
<TableCell onClick={sortBy('attributes.displayName')}>Name</TableCell>
<TableCell />
</TableRow>
</TableHead>
<TableBody>
{records.sort(sorter).map(({ id, name, version, attributes: { displayName } }) => {
{records.sort(sorter).map(({ id, name, version, createTime, attributes: { displayName } }) => {
return (
<TableRow key={id} size="small">
<TableCell monospace>{name}</TableCell>
<TableCell monospace>{version}</TableCell>
<TableCell>{moment.utc(createTime).fromNow()}</TableCell>
<TableCell>{displayName}</TableCell>
<TableCell />
</TableRow>
);
})}

View File

@ -64,7 +64,7 @@ export const WNSRecordType = ({ type = types[0].key, onChanged }) => {
const WNSRecords = ({ type }) => {
const { config } = useContext(ConsoleContext);
const [sorter, sortBy] = useSorter('id');
const [sorter, sortBy] = useSorter('createTime', false);
const data = useQueryStatusReducer(useQuery(WNS_RECORDS, {
pollInterval: config.api.pollInterval,
variables: { type }
@ -81,11 +81,11 @@ const WNSRecords = ({ type }) => {
<TableHead>
<TableRow>
<TableCell onClick={sortBy('type')} size="small">Type</TableCell>
<TableCell onClick={sortBy('name')}>ID</TableCell>
<TableCell onClick={sortBy('name')}>Identifier</TableCell>
<TableCell onClick={sortBy('version')} size="small">Version</TableCell>
<TableCell onClick={sortBy('createTime')} size="small">Created</TableCell>
<TableCell onClick={sortBy('attributes.displayName')}>Name</TableCell>
<TableCell onClick={sortBy('attributes.package')}>Package Hash</TableCell>
<TableCell onClick={sortBy('createTime')} size="small">Created</TableCell>
</TableRow>
</TableHead>
<TableBody>
@ -95,13 +95,13 @@ const WNSRecords = ({ type }) => {
<TableCell monospace>{type}</TableCell>
<TableCell monospace>{name}</TableCell>
<TableCell monospace>{version}</TableCell>
<TableCell>{moment.utc(createTime).fromNow()}</TableCell>
<TableCell>{displayName}</TableCell>
<TableCell title={JSON.stringify(pkg)} monospace>
{pkg && (
<PackageLink config={config} type={type} pkg={pkg} />
)}
</TableCell>
<TableCell>{moment.utc(createTime).fromNow()}</TableCell>
</TableRow>
))}
</TableBody>

View File

@ -6,8 +6,8 @@ import get from 'lodash.get';
import { useState } from 'react';
// TODO(burdon): Enable multiple sort order (e.g., id, version).
export const useSorter = (initial) => {
const [{ sort, ascend }, setSort] = useState({ sort: initial, ascend: true });
export const useSorter = (initSort, initAscend) => {
const [{ sort, ascend }, setSort] = useState({ sort: initSort, ascend: initAscend });
const sorter = (item1, item2) => {
const a = get(item1, sort);

View File

@ -34,8 +34,8 @@ export default {
icon: BotsIcon
},
{
path: '/signal',
title: 'Signal Server',
path: '/signaling',
title: 'Signaling',
icon: SignalIcon
},
{

View File

@ -1,7 +1,7 @@
{
"build": {
"name": "@dxos/console-client",
"buildDate": "2020-05-26T01:16:30.514Z",
"buildDate": "2020-05-26T12:54:32.629Z",
"version": "1.0.0-beta.0"
}
}

View File

@ -35,14 +35,17 @@ export const createResolvers = config => ({
// System
//
system_status: () => ({
// TODO(burdon): System calls.
system_status: () => {
return {
timestamp: timestamp(),
json: JSON.stringify({
dxos: {
image: '0.0.1'
}
})
}),
};
},
//
// IPFS