Merge branch 'main' into release
This commit is contained in:
commit
8ee45f5b0b
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"version": "1.2.4",
|
"version": "1.2.5-alpha.1",
|
||||||
"useWorkspaces": true,
|
"useWorkspaces": true,
|
||||||
"npmClient": "yarn"
|
"npmClient": "yarn"
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@dxos/console",
|
"name": "@dxos/console",
|
||||||
"version": "1.2.4-alpha.0",
|
"version": "1.2.5-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.4",
|
"version": "1.2.5-alpha.1",
|
||||||
"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",
|
||||||
|
@ -4,13 +4,17 @@
|
|||||||
|
|
||||||
import clsx from 'clsx';
|
import clsx from 'clsx';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import { useQuery } from '@apollo/react-hooks';
|
||||||
import { useHistory, useParams } from 'react-router';
|
import { useHistory, useParams } from 'react-router';
|
||||||
|
|
||||||
import { makeStyles } from '@material-ui/core';
|
import { makeStyles } from '@material-ui/core';
|
||||||
import List from '@material-ui/core/List';
|
import List from '@material-ui/core/List';
|
||||||
import ListItem from '@material-ui/core/ListItem';
|
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 ListItemText from '@material-ui/core/ListItemText';
|
import ListItemText from '@material-ui/core/ListItemText';
|
||||||
|
import { useQueryStatusReducer } from '../hooks';
|
||||||
|
import ADDON_LIST from '../gql/addon_list.graphql';
|
||||||
|
|
||||||
const useStyles = makeStyles(theme => ({
|
const useStyles = makeStyles(theme => ({
|
||||||
root: {
|
root: {
|
||||||
@ -39,6 +43,13 @@ const Sidebar = ({ modules: { services, settings } }) => {
|
|||||||
const history = useHistory();
|
const history = useHistory();
|
||||||
const { module } = useParams();
|
const { module } = useParams();
|
||||||
|
|
||||||
|
const { data: addonResponse } = useQueryStatusReducer(useQuery(ADDON_LIST));
|
||||||
|
console.log(addonResponse);
|
||||||
|
if (!addonResponse) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
const addons = JSON.parse(addonResponse.addon_list.json);
|
||||||
|
|
||||||
const isSelected = path => path === `/${module}`;
|
const isSelected = path => path === `/${module}`;
|
||||||
|
|
||||||
const Modules = ({ modules }) => (
|
const Modules = ({ modules }) => (
|
||||||
@ -54,9 +65,23 @@ const Sidebar = ({ modules: { services, settings } }) => {
|
|||||||
</List>
|
</List>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const Addons = ({ addons }) => (
|
||||||
|
<List aria-label='items' className={classes.list}>
|
||||||
|
{addons.map(({ url, title }) => (
|
||||||
|
<ListItem button key={url} onClick={() => { window.location = url; return true; }}>
|
||||||
|
<ListItemIcon classes={{ root: classes.icon }}>
|
||||||
|
<LinkIcon className={clsx(classes.icon)} />
|
||||||
|
</ListItemIcon>
|
||||||
|
<ListItemText primary={title} />
|
||||||
|
</ListItem>
|
||||||
|
))}
|
||||||
|
</List>
|
||||||
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={classes.root}>
|
<div className={classes.root}>
|
||||||
<Modules modules={services} />
|
<Modules modules={services} />
|
||||||
|
<Addons addons={addons} />
|
||||||
<Modules modules={settings} />
|
<Modules modules={settings} />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
9
packages/console-app/src/gql/addon_list.graphql
Normal file
9
packages/console-app/src/gql/addon_list.graphql
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
#
|
||||||
|
# Copyright 2020 DXOS.org
|
||||||
|
#
|
||||||
|
|
||||||
|
query {
|
||||||
|
addon_list {
|
||||||
|
json
|
||||||
|
}
|
||||||
|
}
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"build": {
|
"build": {
|
||||||
"name": "@dxos/console-app",
|
"name": "@dxos/console-app",
|
||||||
"buildDate": "2020-12-03T20:55:02.102Z",
|
"buildDate": "2020-12-09T23:25:12.047Z",
|
||||||
"version": "1.2.4-alpha.3"
|
"version": "1.2.5-alpha.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@dxos/console-server",
|
"name": "@dxos/console-server",
|
||||||
"version": "1.2.4",
|
"version": "1.2.5-alpha.1",
|
||||||
"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.4",
|
"@dxos/console-app": "^1.2.5-alpha.1",
|
||||||
"@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",
|
||||||
|
@ -22,6 +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!
|
||||||
}
|
}
|
||||||
|
|
||||||
type Mutation {
|
type Mutation {
|
||||||
|
37
packages/console-server/src/resolvers/addons.js
Normal file
37
packages/console-server/src/resolvers/addons.js
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
//
|
||||||
|
// Copyright 2020 DXOS.org
|
||||||
|
//
|
||||||
|
|
||||||
|
import childProcess from 'child_process';
|
||||||
|
|
||||||
|
// TODO(telackey): Make pluggable.
|
||||||
|
const ifRadicle = () => {
|
||||||
|
try {
|
||||||
|
const result = childProcess.execSync('docker ps -f "ancestor=dxos/radicle-seed-node" -q');
|
||||||
|
if (result && result.toString()) {
|
||||||
|
return { title: 'Radicle', url: '/' };
|
||||||
|
}
|
||||||
|
} catch (e) {}
|
||||||
|
};
|
||||||
|
|
||||||
|
// TODO(telackey): Use the local Sentry.
|
||||||
|
const ifSentry = () => {
|
||||||
|
return {
|
||||||
|
title: 'Sentry',
|
||||||
|
url: 'http://sentry.kube.dxos.network:9000/'
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export const addonResolvers = {
|
||||||
|
Query: {
|
||||||
|
addon_list: async (_, __, { config }) => {
|
||||||
|
return {
|
||||||
|
timestamp: new Date().toUTCString(),
|
||||||
|
json: JSON.stringify([
|
||||||
|
ifRadicle(),
|
||||||
|
ifSentry()
|
||||||
|
].filter(x => x))
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
@ -5,6 +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 { ipfsResolvers } from './ipfs';
|
import { ipfsResolvers } from './ipfs';
|
||||||
import { systemResolvers } from './system';
|
import { systemResolvers } from './system';
|
||||||
import { logResolvers } from './log';
|
import { logResolvers } from './log';
|
||||||
@ -22,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);
|
}, ipfsResolvers, systemResolvers, logResolvers, botsResolvers, addonResolvers);
|
||||||
|
Loading…
Reference in New Issue
Block a user