Skip to content

Commit

Permalink
remove apollo
Browse files Browse the repository at this point in the history
Signed-off-by: Huong Nguyen <[email protected]>
  • Loading branch information
Huong Nguyen committed Jan 20, 2025
1 parent 44117eb commit f3e7b13
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 173 deletions.
26 changes: 0 additions & 26 deletions cypress/support/commands.js
Original file line number Diff line number Diff line change
@@ -1,32 +1,6 @@
// Add any reusable custom commands here
import { join } from 'path';

/**
* Custom command for intercepting network requests using fixtures for GraphQL
* @param {String} operationName
* @returns {Object} The mock/fixtured json response
*/
Cypress.Commands.add('__interceptGql__', (operationName, mutationFor) => {
// Assign an alias to the intercept based on the graphql request (mutation or query).
const interceptAlias = mutationFor ? mutationFor : operationName;

cy.intercept('POST', '/graphql', (req) => {
const requestBody = req.body;

// check for the operation name match in the graphql request body
if (requestBody?.operationName === operationName) {
// Assign a fixture path based on the graphql request (mutation or query).
const fixturePath = mutationFor
? `graphql/${mutationFor}.json`
: `graphql/${operationName}.json`;

// Stub the server response (request will never reach the origin server, instead the response is
// served from the fixture)
req.reply({ fixture: fixturePath });
}
}).as(interceptAlias);
});

/**
* Custom command for intercepting network requests for REST
* @param {String} url
Expand Down
77 changes: 0 additions & 77 deletions src/apollo/config.js

This file was deleted.

12 changes: 0 additions & 12 deletions src/apollo/queries.js

This file was deleted.

11 changes: 0 additions & 11 deletions src/apollo/schema.graphql

This file was deleted.

20 changes: 0 additions & 20 deletions src/apollo/utils.js

This file was deleted.

11 changes: 0 additions & 11 deletions src/components/provider/provider.js

This file was deleted.

22 changes: 6 additions & 16 deletions src/components/wrapper/wrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,7 @@ import { connect } from 'react-redux';
import { BrowserRouter as Router, Switch, Route } from 'react-router-dom';
import classnames from 'classnames';
import { isRunningLocally } from '../../utils';
import { useApolloQuery } from '../../apollo/utils';
import { client } from '../../apollo/config';
import { GraphQLProvider } from '../provider/provider';
import { GET_VERSIONS } from '../../apollo/queries';
import { getVersion } from '../../utils';

import FeatureHints from '../feature-hints';
import GlobalToolbar from '../global-toolbar';
import FlowChartWrapper from '../flowchart-wrapper';
Expand All @@ -22,12 +17,9 @@ import './wrapper.scss';
* Main app container. Handles showing/hiding the sidebar nav, and theme classes.
*/
export const Wrapper = ({ displayGlobalNavigation, theme }) => {
const { data: versionData } = useApolloQuery(GET_VERSIONS, {
client,
skip: !displayGlobalNavigation || !isRunningLocally(),
});
const [isOutdated, setIsOutdated] = useState(false);
const [latestVersion, setLatestVersion] = useState(null);
const [versions, setVersions] = useState(null);

useEffect(() => {
async function checkKedroVizVersion() {
Expand All @@ -38,6 +30,7 @@ export const Wrapper = ({ displayGlobalNavigation, theme }) => {
if (request.ok) {
setIsOutdated(response.is_outdated);
setLatestVersion(response.latest);
setVersions(response);
}
} catch (error) {
console.error('Error fetching Kedro-Viz version:', error);
Expand All @@ -57,26 +50,23 @@ export const Wrapper = ({ displayGlobalNavigation, theme }) => {
<h1 className="pipeline-title">Kedro-Viz</h1>
<Router>
{displayGlobalNavigation ? (
<GraphQLProvider>
<>
<GlobalToolbar isOutdated={isOutdated} />
<SettingsModal
isOutdated={isOutdated}
latestVersion={latestVersion}
/>
{isRunningLocally() ? <ShareableUrlModal /> : null}
{versionData && (
<UpdateReminder
isOutdated={isOutdated}
versions={versionData.version}
/>
{versions && (
<UpdateReminder isOutdated={isOutdated} versions={versions} />
)}
<Switch>
<Route exact path="/">
<FlowChartWrapper />
<FeatureHints />
</Route>
</Switch>
</GraphQLProvider>
</>
) : (
<FlowChartWrapper />
)}
Expand Down

0 comments on commit f3e7b13

Please sign in to comment.