fix: Bot updates. (#58)

* fix: update running bot tab.

* fix: add version link to bots records.
This commit is contained in:
Egor Gripasov 2020-12-10 14:01:19 +03:00 committed by GitHub
parent 4056042078
commit 1fed8f4de2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 26 additions and 10 deletions

View File

@ -12,6 +12,7 @@ import { ConsoleContext, useQueryStatusReducer, useSorter } from '../../../hooks
import TableHead from '@material-ui/core/TableHead';
import TableRow from '@material-ui/core/TableRow';
import TableBody from '@material-ui/core/TableBody';
import Link from '@material-ui/core/Link';
import Table from '../../../components/Table';
import TableCell from '../../../components/TableCell';
@ -38,17 +39,32 @@ const BotRecords = () => {
<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('attributes.repository')}>Repository</TableCell>
<TableCell onClick={sortBy('createTime')} size='small'>Created</TableCell>
<TableCell size='icon' />
</TableRow>
</TableHead>
<TableBody>
{records.sort(sorter).map(({ id, names, createTime, attributes: { name: displayName, version } }) => {
{records.sort(sorter).map(({
id, names, createTime, attributes: { name: displayName, version, versionUrl, repositoryVersion, repository, homepage }
}) => {
const url = repository || homepage;
if (!versionUrl && repository && repositoryVersion && repository.includes('github')) {
versionUrl = `${repository}/tree/${repositoryVersion}`.replace('-dirty', '');
}
return (
<TableRow key={id} size='small'>
<TableCell monospace>{names.map(name => <div key={name}>{name}</div>)}</TableCell>
<TableCell monospace>{version}</TableCell>
<TableCell monospace>
{versionUrl
? <Link href={versionUrl}>{version}</Link>
: version}
</TableCell>
<TableCell>{displayName}</TableCell>
<TableCell>
{url &&
<Link href={url} target={url}>{url}</Link>}
</TableCell>
<TableCell>{moment.utc(createTime).fromNow()}</TableCell>
<TableCell />
</TableRow>

View File

@ -33,8 +33,8 @@ const Bots = () => {
<Toolbar>
<Tabs value={tab} onChange={(_, value) => setTab(value)}>
<Tab value={TAB_RECORDS} label='Records' />
<Tab value={TAB_LOG} label='Log' />
<Tab value={TAB_DATA} label='Running Bots' />
<Tab value={TAB_LOG} label='Log' />
</Tabs>
</Toolbar>
}

View File

@ -53,22 +53,22 @@ const RunningBots = () => {
<Table>
<TableHead>
<TableRow>
<TableCell onClick={sortBy('id')}>Identifier</TableCell>
<TableCell onClick={sortBy('recordName')}>Identifier</TableCell>
<TableCell onClick={sortBy('botId')} size='small'>Bot Id</TableCell>
<TableCell onClick={sortBy('started')}>Started</TableCell>
<TableCell onClick={sortBy('stopped')}>Stopped</TableCell>
<TableCell onClick={sortBy('stopped')}>Running</TableCell>
<TableCell onClick={sortBy('parties')} size='small'>Parties</TableCell>
<TableCell size='icon' />
</TableRow>
</TableHead>
<TableBody>
{botList.sort(sorter).map(({ id, botId, started, stopped, parties }) => {
{botList.sort(sorter).map(({ recordName, botId, started, stopped, parties }) => {
return (
<TableRow key={botId} size='small'>
<TableCell monospace>{id}</TableCell>
<TableCell monospace>{recordName}</TableCell>
<TableCell monospace>{botId}</TableCell>
<TableCell>{moment.utc(started).fromNow()}</TableCell>
<TableCell monospace>{String(stopped)}</TableCell>
<TableCell monospace>{String(!stopped)}</TableCell>
<TableCell monospace>{parties && parties.map(partyId => <div key={partyId}>{partyId}</div>)}</TableCell>
<TableCell monospace>
<BotControls onStop={() => onKillBot(botId)} />

View File

@ -1,7 +1,7 @@
{
"build": {
"name": "@dxos/console-app",
"buildDate": "2020-12-09T23:25:12.047Z",
"version": "1.2.6-alpha.0"
"buildDate": "2020-12-10T09:59:41.380Z",
"version": "1.2.6-alpha.1"
}
}