forked from cerc-io/laconic-console
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,
|
"useWorkspaces": true,
|
||||||
"npmClient": "yarn"
|
"npmClient": "yarn"
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@dxos/console",
|
"name": "@dxos/console",
|
||||||
"version": "1.2.7-alpha.0",
|
"version": "1.2.8-alpha.0",
|
||||||
"description": "Console",
|
"description": "Console",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"private": true,
|
"private": true,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@dxos/console-app",
|
"name": "@dxos/console-app",
|
||||||
"version": "1.2.7",
|
"version": "1.2.8-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",
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
import moment from 'moment';
|
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 { useQuery, useMutation } 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';
|
||||||
@ -12,7 +12,7 @@ import TableBody from '@material-ui/core/TableBody';
|
|||||||
import BOT_LIST from '../../../gql/bot_list.graphql';
|
import BOT_LIST from '../../../gql/bot_list.graphql';
|
||||||
import BOT_KILL from '../../../gql/bot_kill.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 BotControls from '../../../components/BotControls';
|
||||||
import Table from '../../../components/Table';
|
import Table from '../../../components/Table';
|
||||||
@ -22,8 +22,9 @@ const RunningBots = () => {
|
|||||||
const [sorter, sortBy] = useSorter('started', false);
|
const [sorter, sortBy] = useSorter('started', false);
|
||||||
const [botList, setBotList] = useState([]);
|
const [botList, setBotList] = useState([]);
|
||||||
const [, setStatus] = useStatusReducer();
|
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(() => {
|
useEffect(() => {
|
||||||
if (botListResponse) {
|
if (botListResponse) {
|
||||||
|
@ -47,7 +47,7 @@ const KubeRecords = () => {
|
|||||||
return (
|
return (
|
||||||
<TableRow key={id} size='small'>
|
<TableRow key={id} size='small'>
|
||||||
<TableCell monospace>
|
<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>
|
||||||
<TableCell monospace>
|
<TableCell monospace>
|
||||||
{version}
|
{version}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"build": {
|
"build": {
|
||||||
"name": "@dxos/console-app",
|
"name": "@dxos/console-app",
|
||||||
"buildDate": "2020-12-16T17:56:19.213Z",
|
"buildDate": "2020-12-16T09:52:39.755Z",
|
||||||
"version": "1.2.7"
|
"version": "1.2.8-alpha.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@dxos/console-server",
|
"name": "@dxos/console-server",
|
||||||
"version": "1.2.7",
|
"version": "1.2.8-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.7",
|
"@dxos/console-app": "^1.2.8-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",
|
||||||
|
@ -15,18 +15,19 @@ const SERVICE_CONFIG_FILENAME = 'service.yml';
|
|||||||
|
|
||||||
const log = debug('dxos:console:server:resolvers');
|
const log = debug('dxos:console:server:resolvers');
|
||||||
|
|
||||||
|
let topic;
|
||||||
const getBotFactoryTopic = (botFactoryCwd) => {
|
const getBotFactoryTopic = (botFactoryCwd) => {
|
||||||
// TODO(egorgripasov): Get topic from config or registry.
|
if (!topic) {
|
||||||
const serviceFilePath = path.join(os.homedir(), botFactoryCwd || DEFAULT_BOT_FACTORY_CWD, SERVICE_CONFIG_FILENAME);
|
// TODO(egorgripasov): Get topic from config or registry.
|
||||||
if (fs.existsSync(serviceFilePath)) {
|
const serviceFilePath = path.join(os.homedir(), botFactoryCwd || DEFAULT_BOT_FACTORY_CWD, SERVICE_CONFIG_FILENAME);
|
||||||
const { topic } = yaml.safeLoad(fs.readFileSync(serviceFilePath));
|
if (fs.existsSync(serviceFilePath)) {
|
||||||
return topic;
|
const botFactoryInfo = yaml.safeLoad(fs.readFileSync(serviceFilePath));
|
||||||
|
topic = botFactoryInfo.topic;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return undefined;
|
return topic;
|
||||||
};
|
};
|
||||||
|
|
||||||
const topic = getBotFactoryTopic();
|
|
||||||
|
|
||||||
const executeCommand = async (command, args, timeout = 10000) => {
|
const executeCommand = async (command, args, timeout = 10000) => {
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
const child = spawn(command, args, { encoding: 'utf8' });
|
const child = spawn(command, args, { encoding: 'utf8' });
|
||||||
@ -59,7 +60,7 @@ const executeCommand = async (command, args, timeout = 10000) => {
|
|||||||
|
|
||||||
const getRunningBots = async () => {
|
const getRunningBots = async () => {
|
||||||
const command = 'wire';
|
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);
|
const { code, stdout, stderr } = await executeCommand(command, args);
|
||||||
return {
|
return {
|
||||||
@ -71,7 +72,7 @@ const getRunningBots = async () => {
|
|||||||
|
|
||||||
const sendBotCommand = async (botId, botCommand) => {
|
const sendBotCommand = async (botId, botCommand) => {
|
||||||
const command = 'wire';
|
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);
|
const { code, stdout, stderr } = await executeCommand(command, args);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user