Skip to content

Commit

Permalink
Merge pull request #1787 from creative-commoners/pulls/2/remove-legacy
Browse files Browse the repository at this point in the history
ENH Remove unused legacy graphql code
  • Loading branch information
GuySartorelli authored Jun 20, 2024
2 parents a1d1f3d + cca9ed5 commit f90a540
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 37 deletions.
5 changes: 0 additions & 5 deletions _config/graphql-schema-admin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@ SilverStripe\Core\Injector\Injector:
on: [ graphqlSchemaBuild.admin ]
handler: '%$SilverStripe\GraphQL\Schema\Services\SchemaTranscribeHandler'



SilverStripe\Admin\LeftAndMain:
graphql_legacy: false

SilverStripe\GraphQL\Schema\Schema:
schemas:
admin:
Expand Down
2 changes: 1 addition & 1 deletion client/dist/js/bundle.js

Large diffs are not rendered by default.

28 changes: 3 additions & 25 deletions client/src/boot/apollo/getGraphqlFragments.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,31 +21,9 @@ const handleError = response => {
return response;
};

const getGraphqlFragments = async (baseUrl, preferStatic = true) => {
// Backward compatibility hack. Remove when GraphQL 4 is in core
const isLegacy = !!document.body.getAttribute('data-graphql-legacy');

const urls = [
joinUrlPaths(baseUrl, '_graphql/admin.types.graphql'),
joinUrlPaths(baseUrl, 'admin.types.graphql'),
];

const legacyURLs = [
joinUrlPaths(baseUrl, 'admin/graphql/types'),
joinUrlPaths(baseUrl, 'assets/admin.types.graphql'),
];

let primaryURL;
let fallbackURL;

if (isLegacy) {
if (preferStatic) {
legacyURLs.reverse();
}
[primaryURL, fallbackURL] = legacyURLs;
} else {
[primaryURL, fallbackURL] = urls;
}
const getGraphqlFragments = async (baseUrl) => {
const primaryURL = joinUrlPaths(baseUrl, '_graphql/admin.types.graphql');
const fallbackURL = joinUrlPaths(baseUrl, 'admin.types.graphql');

const fetchConfig = {
method: 'GET',
Expand Down
5 changes: 1 addition & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,7 @@
},
"autoload": {
"psr-4": {
"SilverStripe\\Admin\\": [
"code/",
"_legacy/"
],
"SilverStripe\\Admin\\": "code/",
"SilverStripe\\Admin\\Tests\\": "tests/php/",
"SilverStripe\\Admin\\Tests\\Behat\\Context\\": "tests/behat/src/"
}
Expand Down
2 changes: 1 addition & 1 deletion templates/SilverStripe/Admin/CMSDialog.ss
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<title>$Title</title>
</head>

<body class="cms cms-dialog $BaseCSSClasses" lang="$Locale.RFC1766" <% if $GraphQLLegacy %>data-graphql-legacy="1"<% end_if %>>
<body class="cms cms-dialog $BaseCSSClasses" lang="$Locale.RFC1766">
<div class="cms-dialog-content">
$Content
$Form
Expand Down
2 changes: 1 addition & 1 deletion templates/SilverStripe/Admin/LeftAndMain.ss
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<title>$Title</title>
</head>
<body class="loading cms" data-frameworkpath="$ModulePath(silverstripe/framework)"
data-member-tempid="$CurrentMember.TempIDHash.ATT" <% if $GraphQLLegacy %>data-graphql-legacy="1"<% end_if %>
data-member-tempid="$CurrentMember.TempIDHash.ATT"
>
<% include SilverStripe\\Admin\\CMSLoadingScreen %>

Expand Down

0 comments on commit f90a540

Please sign in to comment.