fix: Display repo links

This commit is contained in:
Thomas E Lackey 2020-11-13 18:23:14 -06:00
parent d1a7fabd40
commit dc0651a1dd
2 changed files with 23 additions and 5 deletions

View File

@ -9,6 +9,7 @@ import { useQuery } from '@apollo/react-hooks';
import TableHead from '@material-ui/core/TableHead'; import TableHead from '@material-ui/core/TableHead';
import TableRow from '@material-ui/core/TableRow'; import TableRow from '@material-ui/core/TableRow';
import TableBody from '@material-ui/core/TableBody'; import TableBody from '@material-ui/core/TableBody';
import Link from '@material-ui/core/Link';
import IPFS_STATUS from '../../../gql/ipfs_status.graphql'; import IPFS_STATUS from '../../../gql/ipfs_status.graphql';
import WNS_RECORDS from '../../../gql/wns_records.graphql'; import WNS_RECORDS from '../../../gql/wns_records.graphql';
@ -45,22 +46,39 @@ const AppRecords = () => {
<TableCell onClick={sortBy('names[0]')}>Registered Names</TableCell> <TableCell onClick={sortBy('names[0]')}>Registered Names</TableCell>
<TableCell onClick={sortBy('attributes.version')} size='small'>Version</TableCell> <TableCell onClick={sortBy('attributes.version')} size='small'>Version</TableCell>
<TableCell onClick={sortBy('attributes.name')}>Name</TableCell> <TableCell onClick={sortBy('attributes.name')}>Name</TableCell>
<TableCell onClick={sortBy('attributes.repository')}>Repository</TableCell>
<TableCell onClick={sortBy('createTime')} size='small'>Created</TableCell> <TableCell onClick={sortBy('createTime')} size='small'>Created</TableCell>
<TableCell size='icon' /> <TableCell size='icon' />
</TableRow> </TableRow>
</TableHead> </TableHead>
<TableBody> <TableBody>
{appData.sort(sorter).map(({ id, names, createTime, attributes: { name: displayName, version, package: packageLink } }) => { {appData.sort(sorter).map(({ id, names, createTime, attributes: { name: displayName, description, version,
versionUrl, repositoryVersion, repository, homepage, package: packageLink } }) => {
const url = repository || homepage;
// If this is a GitHub repo, it is trivial to construct the URL from the base repository and version.
if (!versionUrl && repository && repositoryVersion && repository.includes('github')) {
versionUrl = `${repository}/tree/${repositoryVersion}`.replace('-dirty', '');
}
return ( return (
<TableRow key={id} size='small'> <TableRow key={id} size='small'>
<TableCell monospace> <TableCell monospace>
{names.map(wrn => <div key={wrn}> <AppLink config={config} wrn={wrn} /> </div>)} {names.map(wrn => <div key={wrn}> <AppLink config={config} wrn={wrn} /> </div>)}
</TableCell> </TableCell>
<TableCell monospace> <TableCell monospace>
{version} {versionUrl
? <Link href={versionUrl}>{version}</Link>
: version
}
</TableCell> </TableCell>
<TableCell> <TableCell>
{displayName} {displayName || description}
</TableCell>
<TableCell>
{url &&
<Link href={url} target={url}>{url}</Link>
}
</TableCell> </TableCell>
<TableCell>{moment.utc(createTime).fromNow()}</TableCell> <TableCell>{moment.utc(createTime).fromNow()}</TableCell>
<TableCell> <TableCell>

View File

@ -1,7 +1,7 @@
{ {
"build": { "build": {
"name": "@dxos/console-app", "name": "@dxos/console-app",
"buildDate": "2020-10-30T22:38:24.913Z", "buildDate": "2020-11-14T00:20:27.039Z",
"version": "1.1.0-beta.12" "version": "1.1.0-beta.15"
} }
} }