Merge branch 'main' into release
This commit is contained in:
commit
487f70dd6b
@ -1,5 +1,5 @@
|
||||
{
|
||||
"version": "1.2.7",
|
||||
"version": "1.2.8-alpha.0",
|
||||
"useWorkspaces": true,
|
||||
"npmClient": "yarn"
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@dxos/console",
|
||||
"version": "1.2.7-alpha.0",
|
||||
"version": "1.2.8-alpha.0",
|
||||
"description": "Console",
|
||||
"main": "index.js",
|
||||
"private": true,
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@dxos/console-app",
|
||||
"version": "1.2.7",
|
||||
"version": "1.2.8-alpha.0",
|
||||
"description": "Kubenet Console Client",
|
||||
"repository": "https://github.com/dxos/console",
|
||||
"main": "dist/es/index.js",
|
||||
|
@ -3,7 +3,7 @@
|
||||
//
|
||||
|
||||
import moment from 'moment';
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import React, { useState, useEffect, useContext } from 'react';
|
||||
import { useQuery, useMutation } from '@apollo/react-hooks';
|
||||
import TableHead from '@material-ui/core/TableHead';
|
||||
import TableRow from '@material-ui/core/TableRow';
|
||||
@ -12,7 +12,7 @@ import TableBody from '@material-ui/core/TableBody';
|
||||
import BOT_LIST from '../../../gql/bot_list.graphql';
|
||||
import BOT_KILL from '../../../gql/bot_kill.graphql';
|
||||
|
||||
import { useQueryStatusReducer, useStatusReducer, useSorter } from '../../../hooks';
|
||||
import { ConsoleContext, useQueryStatusReducer, useStatusReducer, useSorter } from '../../../hooks';
|
||||
|
||||
import BotControls from '../../../components/BotControls';
|
||||
import Table from '../../../components/Table';
|
||||
@ -22,8 +22,9 @@ const RunningBots = () => {
|
||||
const [sorter, sortBy] = useSorter('started', false);
|
||||
const [botList, setBotList] = useState([]);
|
||||
const [, setStatus] = useStatusReducer();
|
||||
const { config } = useContext(ConsoleContext);
|
||||
|
||||
const { data: botListResponse, refetch } = useQueryStatusReducer(useQuery(BOT_LIST));
|
||||
const { data: botListResponse, refetch } = useQueryStatusReducer(useQuery(BOT_LIST, { pollInterval: config.api.pollInterval }));
|
||||
|
||||
useEffect(() => {
|
||||
if (botListResponse) {
|
||||
|
@ -47,7 +47,7 @@ const KubeRecords = () => {
|
||||
return (
|
||||
<TableRow key={id} size='small'>
|
||||
<TableCell monospace>
|
||||
{names.map(wrn => <div key={wrn}>{url ? <Link href={url}>{wrn}</Link> : {wrn}}</div>)}
|
||||
{names.map(wrn => <div key={wrn}>{url ? <Link href={url}>{wrn}</Link> : { wrn }}</div>)}
|
||||
</TableCell>
|
||||
<TableCell monospace>
|
||||
{version}
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"build": {
|
||||
"name": "@dxos/console-app",
|
||||
"buildDate": "2020-12-16T17:56:19.213Z",
|
||||
"version": "1.2.7"
|
||||
"buildDate": "2020-12-16T09:52:39.755Z",
|
||||
"version": "1.2.8-alpha.0"
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@dxos/console-server",
|
||||
"version": "1.2.7",
|
||||
"version": "1.2.8-alpha.0",
|
||||
"description": "Kubenet Console Server",
|
||||
"main": "dist/es/index.js",
|
||||
"bin": {
|
||||
@ -31,7 +31,7 @@
|
||||
"dependencies": {
|
||||
"@babel/polyfill": "^7.8.7",
|
||||
"@babel/runtime": "^7.8.7",
|
||||
"@dxos/console-app": "^1.2.7",
|
||||
"@dxos/console-app": "^1.2.8-alpha.0",
|
||||
"@wirelineio/wns-schema": "^0.1.1",
|
||||
"apollo-boost": "^0.4.9",
|
||||
"apollo-server-express": "^2.13.1",
|
||||
|
@ -15,18 +15,19 @@ const SERVICE_CONFIG_FILENAME = 'service.yml';
|
||||
|
||||
const log = debug('dxos:console:server:resolvers');
|
||||
|
||||
let topic;
|
||||
const getBotFactoryTopic = (botFactoryCwd) => {
|
||||
// TODO(egorgripasov): Get topic from config or registry.
|
||||
const serviceFilePath = path.join(os.homedir(), botFactoryCwd || DEFAULT_BOT_FACTORY_CWD, SERVICE_CONFIG_FILENAME);
|
||||
if (fs.existsSync(serviceFilePath)) {
|
||||
const { topic } = yaml.safeLoad(fs.readFileSync(serviceFilePath));
|
||||
return topic;
|
||||
if (!topic) {
|
||||
// TODO(egorgripasov): Get topic from config or registry.
|
||||
const serviceFilePath = path.join(os.homedir(), botFactoryCwd || DEFAULT_BOT_FACTORY_CWD, SERVICE_CONFIG_FILENAME);
|
||||
if (fs.existsSync(serviceFilePath)) {
|
||||
const botFactoryInfo = yaml.safeLoad(fs.readFileSync(serviceFilePath));
|
||||
topic = botFactoryInfo.topic;
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
return topic;
|
||||
};
|
||||
|
||||
const topic = getBotFactoryTopic();
|
||||
|
||||
const executeCommand = async (command, args, timeout = 10000) => {
|
||||
return new Promise((resolve) => {
|
||||
const child = spawn(command, args, { encoding: 'utf8' });
|
||||
@ -59,7 +60,7 @@ const executeCommand = async (command, args, timeout = 10000) => {
|
||||
|
||||
const getRunningBots = async () => {
|
||||
const command = 'wire';
|
||||
const args = ['bot', 'factory', 'status', '--topic', topic];
|
||||
const args = ['bot', 'factory', 'status', '--topic', getBotFactoryTopic()];
|
||||
|
||||
const { code, stdout, stderr } = await executeCommand(command, args);
|
||||
return {
|
||||
@ -71,7 +72,7 @@ const getRunningBots = async () => {
|
||||
|
||||
const sendBotCommand = async (botId, botCommand) => {
|
||||
const command = 'wire';
|
||||
const args = ['bot', botCommand, '--topic', topic, '--bot-id', botId];
|
||||
const args = ['bot', botCommand, '--topic', getBotFactoryTopic(), '--bot-id', botId];
|
||||
|
||||
const { code, stdout, stderr } = await executeCommand(command, args);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user