Update app/bot pages, fix sorting.

This commit is contained in:
Ashwin Phatak 2020-07-28 15:51:35 +05:30
parent c760a55ae6
commit a3df29c729
4 changed files with 24 additions and 20 deletions

View File

@ -11,7 +11,7 @@ import { getServiceUrl } from '../util/config';
const QUERY = `
query {
getRecordsByIds([ "%ID%" ]) {
getRecordsByIds(ids: [ "%ID%" ]) {
id
names
bondId

View File

@ -25,7 +25,7 @@ const AppRecords = () => {
const [sorter, sortBy] = useSorter('createTime', false);
const appResponse = useQueryStatusReducer(useQuery(WNS_RECORDS, {
pollInterval: config.api.intervalQuery,
variables: { attributes: { type: 'wrn:app' } }
variables: { attributes: { type: 'app' } }
}));
// TODO(telackey): Does this also need an interval?
@ -42,22 +42,26 @@ const AppRecords = () => {
<Table>
<TableHead>
<TableRow>
<TableCell onClick={sortBy('name')}>Identifier</TableCell>
<TableCell onClick={sortBy('version')} size='small'>Version</TableCell>
<TableCell onClick={sortBy('attributes.displayName')}>Name</TableCell>
<TableCell onClick={sortBy('names[0]')}>Identifier</TableCell>
<TableCell onClick={sortBy('attributes.version')} size='small'>Version</TableCell>
<TableCell onClick={sortBy('attributes.name')}>Name</TableCell>
<TableCell onClick={sortBy('createTime')} size='small'>Created</TableCell>
<TableCell size='icon' />
</TableRow>
</TableHead>
<TableBody>
{appData.sort(sorter).map(({ id, name, version, createTime, attributes: { displayName, package: hash } }) => {
{appData.sort(sorter).map(({ id, names, createTime, attributes: { name: displayName, version, package: hash } }) => {
return (
<TableRow key={id} size='small'>
<TableCell monospace>
<AppLink config={config} name={name} />
{names.map(name => <>
<AppLink config={config} name={name} />
<br />
</>
)}
</TableCell>
<TableCell monospace>
<AppLink config={config} name={name} version={version} text={version} />
{version}
</TableCell>
<TableCell>
{displayName}

View File

@ -22,7 +22,7 @@ const BotRecords = () => {
const [sorter, sortBy] = useSorter('createTime', false);
const data = useQueryStatusReducer(useQuery(WNS_RECORDS, {
pollInterval: config.api.intervalQuery,
variables: { attributes: { type: 'wrn:bot' } }
variables: { attributes: { type: 'bot' } }
}));
if (!data) {
@ -35,18 +35,18 @@ const BotRecords = () => {
<Table>
<TableHead>
<TableRow>
<TableCell onClick={sortBy('name')}>Identifier</TableCell>
<TableCell onClick={sortBy('version')} size='small'>Version</TableCell>
<TableCell onClick={sortBy('attributes.displayName')}>Name</TableCell>
<TableCell onClick={sortBy('names[0]')}>Identifier</TableCell>
<TableCell onClick={sortBy('attributes.version')} size='small'>Version</TableCell>
<TableCell onClick={sortBy('attributes.name')}>Name</TableCell>
<TableCell onClick={sortBy('createTime')} size='small'>Created</TableCell>
<TableCell size='icon' />
</TableRow>
</TableHead>
<TableBody>
{records.sort(sorter).map(({ id, name, version, createTime, attributes: { displayName } }) => {
{records.sort(sorter).map(({ id, names, createTime, attributes: { name: displayName, version } }) => {
return (
<TableRow key={id} size='small'>
<TableCell monospace>{name}</TableCell>
<TableCell monospace>{names}</TableCell>
<TableCell monospace>{version}</TableCell>
<TableCell>{displayName}</TableCell>
<TableCell>{moment.utc(createTime).fromNow()}</TableCell>

View File

@ -83,12 +83,12 @@ const WNSRecords = ({ type }) => {
<Table>
<TableHead>
<TableRow>
<TableCell onClick={sortBy('type')} size='medium'>Type</TableCell>
<TableCell onClick={sortBy('name')}>Identifier</TableCell>
<TableCell onClick={sortBy('version')} size='small'>Version</TableCell>
<TableCell onClick={sortBy('attributes.displayName')}>Name</TableCell>
<TableCell onClick={sortBy('attributes.type')} size='medium'>Type</TableCell>
<TableCell onClick={sortBy('names[0]')}>Identifier</TableCell>
<TableCell onClick={sortBy('attributes.version')} size='small'>Version</TableCell>
<TableCell onClick={sortBy('attributes.name')}>Name</TableCell>
<TableCell onClick={sortBy('createTime')} size='small'>Created</TableCell>
<TableCell onClick={sortBy('package')}>Package</TableCell>
<TableCell onClick={sortBy('attributes.package')}>Package</TableCell>
<TableCell size='icon' />
</TableRow>
</TableHead>
@ -135,7 +135,7 @@ const WNSRecords = ({ type }) => {
{pkgLink}
</TableCell>
<TableCell>
<QueryLink config={config} name={name} icon />
<QueryLink config={config} id={id} icon />
</TableCell>
</TableRow>
);