Merge branch 'main' into release

This commit is contained in:
Thomas E Lackey 2020-12-10 13:24:27 -06:00
commit c0a8303c8f
13 changed files with 53 additions and 32 deletions

View File

@ -1,5 +1,5 @@
{ {
"version": "1.2.6", "version": "1.2.7-alpha.0",
"useWorkspaces": true, "useWorkspaces": true,
"npmClient": "yarn" "npmClient": "yarn"
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "@dxos/console", "name": "@dxos/console",
"version": "1.2.6-alpha.0", "version": "1.2.7-alpha.0",
"description": "Console", "description": "Console",
"main": "index.js", "main": "index.js",
"private": true, "private": true,

View File

@ -1,6 +1,6 @@
{ {
"name": "@dxos/console-app", "name": "@dxos/console-app",
"version": "1.2.6", "version": "1.2.7-alpha.0",
"description": "Kubenet Console Client", "description": "Kubenet Console Client",
"repository": "https://github.com/dxos/console", "repository": "https://github.com/dxos/console",
"main": "dist/es/index.js", "main": "dist/es/index.js",

View File

@ -13,8 +13,9 @@ import ListItem from '@material-ui/core/ListItem';
import ListItemIcon from '@material-ui/core/ListItemIcon'; import ListItemIcon from '@material-ui/core/ListItemIcon';
import LinkIcon from '@material-ui/icons/ExitToApp'; import LinkIcon from '@material-ui/icons/ExitToApp';
import ListItemText from '@material-ui/core/ListItemText'; import ListItemText from '@material-ui/core/ListItemText';
import EXTENSIONS from '../gql/extensions.graphql';
import { useQueryStatusReducer } from '../hooks'; import { useQueryStatusReducer } from '../hooks';
import ADDON_LIST from '../gql/addon_list.graphql';
const useStyles = makeStyles(theme => ({ const useStyles = makeStyles(theme => ({
root: { root: {
@ -35,6 +36,10 @@ const useStyles = makeStyles(theme => ({
selected: { selected: {
color: theme.palette.primary.main color: theme.palette.primary.main
},
expand: {
flex: 1
} }
})); }));
@ -43,12 +48,8 @@ const Sidebar = ({ modules: { services, settings } }) => {
const history = useHistory(); const history = useHistory();
const { module } = useParams(); const { module } = useParams();
const { data: addonResponse } = useQueryStatusReducer(useQuery(ADDON_LIST)); const { data: extensionsData } = useQueryStatusReducer(useQuery(EXTENSIONS));
console.log(addonResponse); const extensions = extensionsData ? JSON.parse(extensionsData.extensions.json) : [];
if (!addonResponse) {
return null;
}
const addons = JSON.parse(addonResponse.addon_list.json);
const isSelected = path => path === `/${module}`; const isSelected = path => path === `/${module}`;
@ -65,9 +66,9 @@ const Sidebar = ({ modules: { services, settings } }) => {
</List> </List>
); );
const Addons = ({ addons }) => ( const Extensions = ({ extensions }) => (
<List aria-label='items' className={classes.list}> <List aria-label='items' className={classes.list}>
{addons.map(({ url, title }) => ( {extensions.map(({ url, title }) => (
<ListItem button key={url} onClick={() => { window.location = url; return true; }}> <ListItem button key={url} onClick={() => { window.location = url; return true; }}>
<ListItemIcon classes={{ root: classes.icon }}> <ListItemIcon classes={{ root: classes.icon }}>
<LinkIcon className={clsx(classes.icon)} /> <LinkIcon className={clsx(classes.icon)} />
@ -81,7 +82,8 @@ const Sidebar = ({ modules: { services, settings } }) => {
return ( return (
<div className={classes.root}> <div className={classes.root}>
<Modules modules={services} /> <Modules modules={services} />
<Addons addons={addons} /> <Extensions extensions={extensions} />
<div className={classes.expand} />
<Modules modules={settings} /> <Modules modules={settings} />
</div> </div>
); );

View File

@ -12,6 +12,7 @@ import { ConsoleContext, useQueryStatusReducer, useSorter } from '../../../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 Table from '../../../components/Table'; import Table from '../../../components/Table';
import TableCell from '../../../components/TableCell'; import TableCell from '../../../components/TableCell';
@ -38,17 +39,32 @@ const BotRecords = () => {
<TableCell onClick={sortBy('names[0]')}>Identifier</TableCell> <TableCell onClick={sortBy('names[0]')}>Identifier</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>
{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 ( return (
<TableRow key={id} size='small'> <TableRow key={id} size='small'>
<TableCell monospace>{names.map(name => <div key={name}>{name}</div>)}</TableCell> <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>{displayName}</TableCell>
<TableCell>
{url &&
<Link href={url} target={url}>{url}</Link>}
</TableCell>
<TableCell>{moment.utc(createTime).fromNow()}</TableCell> <TableCell>{moment.utc(createTime).fromNow()}</TableCell>
<TableCell /> <TableCell />
</TableRow> </TableRow>

View File

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

View File

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

View File

@ -3,7 +3,7 @@
# #
query { query {
addon_list { extensions {
json json
} }
} }

View File

@ -1,7 +1,7 @@
{ {
"build": { "build": {
"name": "@dxos/console-app", "name": "@dxos/console-app",
"buildDate": "2020-12-10T03:59:58.111Z", "buildDate": "2020-12-10T18:33:21.012Z",
"version": "1.2.6-alpha.0" "version": "1.2.7-alpha.0"
} }
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "@dxos/console-server", "name": "@dxos/console-server",
"version": "1.2.6", "version": "1.2.7-alpha.0",
"description": "Kubenet Console Server", "description": "Kubenet Console Server",
"main": "dist/es/index.js", "main": "dist/es/index.js",
"bin": { "bin": {
@ -31,7 +31,7 @@
"dependencies": { "dependencies": {
"@babel/polyfill": "^7.8.7", "@babel/polyfill": "^7.8.7",
"@babel/runtime": "^7.8.7", "@babel/runtime": "^7.8.7",
"@dxos/console-app": "^1.2.6", "@dxos/console-app": "^1.2.7-alpha.0",
"@wirelineio/wns-schema": "^0.1.1", "@wirelineio/wns-schema": "^0.1.1",
"apollo-boost": "^0.4.9", "apollo-boost": "^0.4.9",
"apollo-server-express": "^2.13.1", "apollo-server-express": "^2.13.1",

View File

@ -22,7 +22,7 @@ type Query {
system_status: JSONResult! system_status: JSONResult!
wns_status: JSONResult! wns_status: JSONResult!
bot_list: JSONResult! bot_list: JSONResult!
addon_list: JSONResult! extensions: JSONResult!
} }
type Mutation { type Mutation {

View File

@ -9,7 +9,10 @@ const ifRadicle = () => {
try { try {
const result = childProcess.execSync('docker ps -f "ancestor=dxos/radicle-seed-node" -q'); const result = childProcess.execSync('docker ps -f "ancestor=dxos/radicle-seed-node" -q');
if (result && result.toString()) { if (result && result.toString()) {
return { title: 'Radicle', url: '/radicle/' }; return {
title: 'Radicle',
url: '/radicle/'
};
} }
} catch (e) {} } catch (e) {}
}; };
@ -22,9 +25,9 @@ const ifSentry = () => {
}; };
}; };
export const addonResolvers = { export const extensionResolvers = {
Query: { Query: {
addon_list: async (_, __, { config }) => { extensions: async (_, __, { config }) => {
return { return {
timestamp: new Date().toUTCString(), timestamp: new Date().toUTCString(),
json: JSON.stringify([ json: JSON.stringify([

View File

@ -5,7 +5,7 @@
import debug from 'debug'; import debug from 'debug';
import defaultsDeep from 'lodash.defaultsdeep'; import defaultsDeep from 'lodash.defaultsdeep';
import { addonResolvers } from './addons'; import { extensionResolvers } from './extensions';
import { ipfsResolvers } from './ipfs'; import { ipfsResolvers } from './ipfs';
import { systemResolvers } from './system'; import { systemResolvers } from './system';
import { logResolvers } from './log'; import { logResolvers } from './log';
@ -23,4 +23,4 @@ export const resolvers = defaultsDeep({
// TODO(burdon): Auth. // TODO(burdon): Auth.
// https://www.apollographql.com/docs/apollo-server/data/errors/#codes // https://www.apollographql.com/docs/apollo-server/data/errors/#codes
}, ipfsResolvers, systemResolvers, logResolvers, botsResolvers, addonResolvers); }, ipfsResolvers, systemResolvers, logResolvers, botsResolvers, extensionResolvers);