parent
ce9a90ec84
commit
f3a50b4aaf
@ -13,8 +13,9 @@ import ListItem from '@material-ui/core/ListItem';
|
||||
import ListItemIcon from '@material-ui/core/ListItemIcon';
|
||||
import LinkIcon from '@material-ui/icons/ExitToApp';
|
||||
import ListItemText from '@material-ui/core/ListItemText';
|
||||
|
||||
import EXTENSIONS from '../gql/extensions.graphql';
|
||||
import { useQueryStatusReducer } from '../hooks';
|
||||
import ADDON_LIST from '../gql/addon_list.graphql';
|
||||
|
||||
const useStyles = makeStyles(theme => ({
|
||||
root: {
|
||||
@ -35,6 +36,10 @@ const useStyles = makeStyles(theme => ({
|
||||
|
||||
selected: {
|
||||
color: theme.palette.primary.main
|
||||
},
|
||||
|
||||
expand: {
|
||||
flex: 1
|
||||
}
|
||||
}));
|
||||
|
||||
@ -43,12 +48,8 @@ const Sidebar = ({ modules: { services, settings } }) => {
|
||||
const history = useHistory();
|
||||
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 { data: extensionsData } = useQueryStatusReducer(useQuery(EXTENSIONS));
|
||||
const extensions = extensionsData ? JSON.parse(extensionsData.extensions.json) : [];
|
||||
|
||||
const isSelected = path => path === `/${module}`;
|
||||
|
||||
@ -65,9 +66,9 @@ const Sidebar = ({ modules: { services, settings } }) => {
|
||||
</List>
|
||||
);
|
||||
|
||||
const Addons = ({ addons }) => (
|
||||
const Extensions = ({ extensions }) => (
|
||||
<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; }}>
|
||||
<ListItemIcon classes={{ root: classes.icon }}>
|
||||
<LinkIcon className={clsx(classes.icon)} />
|
||||
@ -81,7 +82,8 @@ const Sidebar = ({ modules: { services, settings } }) => {
|
||||
return (
|
||||
<div className={classes.root}>
|
||||
<Modules modules={services} />
|
||||
<Addons addons={addons} />
|
||||
<Extensions extensions={extensions} />
|
||||
<div className={classes.expand} />
|
||||
<Modules modules={settings} />
|
||||
</div>
|
||||
);
|
||||
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
|
||||
query {
|
||||
addon_list {
|
||||
extensions {
|
||||
json
|
||||
}
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"build": {
|
||||
"name": "@dxos/console-app",
|
||||
"buildDate": "2020-12-10T09:59:41.380Z",
|
||||
"version": "1.2.6-alpha.1"
|
||||
"buildDate": "2020-12-10T18:33:21.012Z",
|
||||
"version": "1.2.6-alpha.2"
|
||||
}
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ type Query {
|
||||
system_status: JSONResult!
|
||||
wns_status: JSONResult!
|
||||
bot_list: JSONResult!
|
||||
addon_list: JSONResult!
|
||||
extensions: JSONResult!
|
||||
}
|
||||
|
||||
type Mutation {
|
||||
|
@ -9,7 +9,10 @@ const ifRadicle = () => {
|
||||
try {
|
||||
const result = childProcess.execSync('docker ps -f "ancestor=dxos/radicle-seed-node" -q');
|
||||
if (result && result.toString()) {
|
||||
return { title: 'Radicle', url: '/radicle/' };
|
||||
return {
|
||||
title: 'Radicle',
|
||||
url: '/radicle/'
|
||||
};
|
||||
}
|
||||
} catch (e) {}
|
||||
};
|
||||
@ -22,9 +25,9 @@ const ifSentry = () => {
|
||||
};
|
||||
};
|
||||
|
||||
export const addonResolvers = {
|
||||
export const extensionResolvers = {
|
||||
Query: {
|
||||
addon_list: async (_, __, { config }) => {
|
||||
extensions: async (_, __, { config }) => {
|
||||
return {
|
||||
timestamp: new Date().toUTCString(),
|
||||
json: JSON.stringify([
|
@ -5,7 +5,7 @@
|
||||
import debug from 'debug';
|
||||
import defaultsDeep from 'lodash.defaultsdeep';
|
||||
|
||||
import { addonResolvers } from './addons';
|
||||
import { extensionResolvers } from './extensions';
|
||||
import { ipfsResolvers } from './ipfs';
|
||||
import { systemResolvers } from './system';
|
||||
import { logResolvers } from './log';
|
||||
@ -23,4 +23,4 @@ export const resolvers = defaultsDeep({
|
||||
// TODO(burdon): Auth.
|
||||
// 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