parent
ce9a90ec84
commit
f3a50b4aaf
@ -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>
|
||||||
);
|
);
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
query {
|
query {
|
||||||
addon_list {
|
extensions {
|
||||||
json
|
json
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"build": {
|
"build": {
|
||||||
"name": "@dxos/console-app",
|
"name": "@dxos/console-app",
|
||||||
"buildDate": "2020-12-10T09:59:41.380Z",
|
"buildDate": "2020-12-10T18:33:21.012Z",
|
||||||
"version": "1.2.6-alpha.1"
|
"version": "1.2.6-alpha.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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 {
|
||||||
|
@ -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([
|
@ -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);
|
||||||
|
Loading…
Reference in New Issue
Block a user