pro-console: add rest endpoints

Co-authored-by: Karthik Venkateswaran <25095884+karthikvt26@users.noreply.github.com>
Co-authored-by: Rishichandra Wawhal <27274869+wawhal@users.noreply.github.com>
GitOrigin-RevId: d9cafd23683f9c8ac45e978fffa513d76e90308a
This commit is contained in:
Aleksandra Sikora 2021-02-24 12:42:17 +01:00 committed by hasura-bot
parent e063d90abf
commit 6dff6e97ab
5 changed files with 28 additions and 16 deletions

View File

@ -217,4 +217,4 @@
"engines": {
"node": ">=8.9.1"
}
}
}

View File

@ -8,7 +8,7 @@ import { redirectToMetadataStatus } from '../Common/utils/routesUtils';
import { loadInconsistentObjects } from '../../metadata/actions';
import { Dispatch, FixMe } from '../../types';
const isMetadataStatusPage = () => {
export const isMetadataStatusPage = () => {
return window.location.pathname.includes('/settings/metadata-status');
};

View File

@ -1,6 +1,8 @@
import * as React from 'react';
import { connect } from 'react-redux';
import Helmet from 'react-helmet';
import { RouteComponentProps } from 'react-router';
import generatedApiExplorer from './ApiExplorer';
import TopBar from './TopNav';
@ -8,14 +10,19 @@ type ContainerProps = {
location: RouteComponentProps<unknown, unknown>['location'];
};
const Container: React.FC<ContainerProps> = ({ location, children }) => (
<>
<Helmet title="API Explorer | Hasura" />
<div id="left-bar">
<TopBar location={location} />
</div>
<div id="right-bar">{children}</div>
</>
);
const ApiExplorer: React.FC = generatedApiExplorer(connect);
const Container: React.FC<ContainerProps> = props => {
const { location, children } = props;
return (
<>
<Helmet title="API Explorer | Hasura" />
<div id="left-bar">
<TopBar location={location} />
</div>
<div id="right-bar">{children || <ApiExplorer {...props} />}</div>
</>
);
};
export default Container;

View File

@ -23,7 +23,12 @@ const TopNav: React.FC<TopNavProps> = ({ location }) => {
},
];
const isActive = (link: string) => location.pathname.includes(link);
const isActive = (link: string) => {
if (location.pathname === '' || location.pathname === '/') {
return link.includes('api-explorer');
}
return location.pathname.includes(link);
};
return (
<div className={styles.topNavContainer}>

View File

@ -1,5 +1,5 @@
import React from 'react';
import { Route, IndexRedirect } from 'react-router';
import { Route, IndexRedirect, IndexRoute } from 'react-router';
import { connect } from 'react-redux';
@ -30,7 +30,7 @@ import generatedVoyagerConnector from './components/Services/VoyagerView/Voyager
import generatedLoginConnector from './components/Login/Login';
import settingsContainer from './components/Services/Settings/Container';
import apiContainer from './components/Services/ApiExplorer/Container';
import ApiContainer from './components/Services/ApiExplorer/Container';
import metadataOptionsConnector from './components/Services/Settings/MetadataOptions/MetadataOptions';
import metadataStatusConnector from './components/Services/Settings/MetadataStatus/MetadataStatus';
import allowedQueriesConnector from './components/Services/Settings/AllowedQueries/AllowedQueries';
@ -121,8 +121,8 @@ const routes = store => {
requireAsyncGlobals(store),
])}
>
<IndexRedirect to="api/api-explorer" />
<Route path="api" component={apiContainer}>
<IndexRoute component={ApiContainer} />
<Route path="api" component={ApiContainer}>
<IndexRedirect to="api-explorer" />
<Route
path="api-explorer"