Skip to content

Commit

Permalink
API Remove GraphQL
Browse files Browse the repository at this point in the history
  • Loading branch information
emteknetnz committed Sep 2, 2024
1 parent 3a4d204 commit 564166a
Show file tree
Hide file tree
Showing 44 changed files with 194 additions and 1,941 deletions.
43 changes: 0 additions & 43 deletions _config/graphql-schema-admin.yml

This file was deleted.

14 changes: 0 additions & 14 deletions _config/routes.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,4 @@
---
Name: admin-graphql-routes
Only:
moduleexists: silverstripe/graphql
Before:
- '#adminroutes'
---
SilverStripe\Control\Director:
rules:
'admin/graphql':
Controller: '%$SilverStripe\GraphQL\Controller.admin'
Stage: Stage
Permissions:
CMS_ACCESS: CMS_ACCESS
---
Name: adminroutes
After:
- '#rootroutes'
Expand Down
39 changes: 1 addition & 38 deletions client/dist/js/bundle.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion client/dist/js/vendor.js

Large diffs are not rendered by default.

17 changes: 4 additions & 13 deletions client/src/boot/BootRoutes.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import Config from 'lib/Config';
import pageRouter from 'lib/Router';
import reactRouteRegister from 'lib/ReactRouteRegister';
import App from 'containers/App/App';
import { ApolloProvider } from '@apollo/client';
import i18n from 'i18n';
import { isDirty } from 'redux-form';
import getFormState from 'lib/getFormState';
Expand All @@ -25,11 +24,9 @@ import NavigationBlocker from '../components/NavigationBlocker/NavigationBlocker
class BootRoutes {
/**
* @param {Object} store Redux store
* @param {Object} client The Apollo client
*/
constructor(store, client) {
constructor(store) {
this.store = store;
this.client = client;

// pageRouter must be initialised, regardless of whether we are
// using page.js routing for this request.
Expand All @@ -43,10 +40,6 @@ class BootRoutes {
this.store = store;
}

setClient(client) {
this.client = client;
}

/**
* Conditionally registers routes either as legacy (via page.js) or react-route powered routes
*
Expand Down Expand Up @@ -129,11 +122,9 @@ class BootRoutes {
);

createRoot(document.getElementsByClassName('cms-content')[0]).render(
<ApolloProvider client={this.client}>
<ReduxProvider store={this.store}>
<RouterProvider router={router} />
</ReduxProvider>
</ApolloProvider>
<ReduxProvider store={this.store}>
<RouterProvider router={router} />
</ReduxProvider>
);
}

Expand Down
20 changes: 0 additions & 20 deletions client/src/boot/apollo/buildCache.js

This file was deleted.

23 changes: 0 additions & 23 deletions client/src/boot/apollo/buildClient.js

This file was deleted.

37 changes: 0 additions & 37 deletions client/src/boot/apollo/buildNetworkComponents.js

This file was deleted.

9 changes: 0 additions & 9 deletions client/src/boot/apollo/dataIdFromObject.js

This file was deleted.

61 changes: 0 additions & 61 deletions client/src/boot/apollo/getGraphqlFragments.js

This file was deleted.

8 changes: 1 addition & 7 deletions client/src/boot/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import Injector from 'lib/Injector';
import { combineReducers, createStore, applyMiddleware } from 'redux';
import thunkMiddleware from 'redux-thunk';
import Config from 'lib/Config';
import buildApolloClient from 'boot/apollo/buildClient';
import { setConfig } from 'state/config/ConfigActions';
import registerComponents from 'boot/registerComponents';
import registerReducers from 'boot/registerReducers';
Expand All @@ -14,8 +13,6 @@ import BootRoutes from './BootRoutes';
window.ss = window.ss || {};

async function appBoot() {
const baseUrl = Config.get('absoluteBaseUrl');
const apolloClient = await buildApolloClient(baseUrl);
registerComponents();
registerReducers();
const middleware = [
Expand All @@ -30,11 +27,8 @@ async function appBoot() {

const createStoreWithMiddleware = runMiddleware(createStore);

// Expose store stuff for legacy use
window.ss.apolloClient = apolloClient;

// Bootstrap routing
const routes = new BootRoutes(null, apolloClient);
const routes = new BootRoutes(null);

// Apply any injector transformations
applyTransforms();
Expand Down
1 change: 1 addition & 0 deletions client/src/bundles/bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import 'expose-loader?exposes=FormAlert!components/FormAlert/FormAlert';
import 'expose-loader?exposes=Injector!lib/Injector';
import 'expose-loader?exposes=reduxFieldReducer!lib/reduxFieldReducer';
import 'expose-loader?exposes=getFormState!lib/getFormState';
import 'expose-loader?exposes=getJsonErrorMessage!lib/getJsonErrorMessage';
import 'expose-loader?exposes=PopoverField!components/PopoverField/PopoverField';
import 'expose-loader?exposes=FieldHolder!components/FieldHolder/FieldHolder';
import 'expose-loader?exposes=Form!components/Form/Form';
Expand Down
5 changes: 0 additions & 5 deletions client/src/bundles/vendor.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,6 @@ import 'expose-loader?exposes=ReactDND!react-dnd';
import 'expose-loader?exposes=ReactDNDHtml5Backend!react-dnd-html5-backend';
import 'expose-loader?exposes=Page!page.js';
import 'expose-loader?exposes=validator!validator';
// @apollo/client needs virtual.js to help expose it correctly - see https://github.com/webpack-contrib/expose-loader/issues/188
import 'virtual.js!=!expose-loader?exposes=ApolloClient!@apollo/client';
import 'virtual.js!=!expose-loader?exposes=ApolloClientReactHoc!@apollo/client/react/hoc';
import 'expose-loader?exposes=GraphQLTag!graphql-tag';
import 'expose-loader?exposes=GraphQLFragments!graphql-fragments';
import 'expose-loader?exposes=NodeUrl!url';
import 'expose-loader?exposes=modernizr!modernizr';
import 'expose-loader?exposes=moment!moment';
Expand Down
5 changes: 4 additions & 1 deletion client/src/legacy/ToastsContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@ const ToastsContainer = loadComponent('ToastsContainer');

/**
* Initialised the toast container
*
* Using "toastcontainernamespace" instead of "ss" as this seems to have fixed a sporadic
* issue with the toast container not being initialised sometimes
*/
jQuery.entwine('ss', ($) => {
jQuery.entwine('toastcontainernamespace', ($) => {
$('body').entwine({
onmatch() {
const container = $('<div class="toasts-container"></div>');
Expand Down
4 changes: 0 additions & 4 deletions client/src/lib/Injector.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import provideInjector from './dependency-injection/provideInjector';
import provideContext from './dependency-injection/provideContext';
import withInjector from './dependency-injection/withInjector';
import inject from './dependency-injection/inject';
import injectGraphql from './dependency-injection/injectGraphql';
import * as graphqlTemplates from './dependency-injection/graphql/templates';
import loadComponent from './dependency-injection/loadComponent';
import Container from './dependency-injection/Container';

Expand All @@ -12,9 +10,7 @@ export {
provideContext,
withInjector,
inject,
injectGraphql,
loadComponent,
graphqlTemplates,
};

export default Container;
Loading

0 comments on commit 564166a

Please sign in to comment.