pageballoon / headstart

Decoupled GraphQL-driven content management using OctoberCMS
https://octobercms.com/plugin/nocio-headstart
MIT License
7 stars 2 forks source link

Make Headstart compatible with the latest OctoberCMS build 465 #10

Open creativeesprit opened 4 years ago

creativeesprit commented 4 years ago

Hi @frthjf

Again, great work on the plugin and thanks for the swift response to the GraphQL endpoint issue a couple of days ago.

I thought I'd mention other issues I had come across and fixes I had applied. I would have created a pull request but as most affect files from the actual plugin that do not exist in this repo, I thought I'd list them here.

Okay, first of all I'm in the following environment:

PHP 7.2.11 October Build 465

On enabling the plugin and navigating to API in the top menu, I had the following error:

"Call to undefined method Nocio\Headstart\FormWidgets\AssetList::checkUploadPostback()" on line 431 of [project_root]/vendor/october/rain/src/Extension/ExtendableTrait.php

I'm not sure whether the plugin is dependent on the checkUploadPostback method (at least not in my case), I simply deleted the line:

$this->checkUploadPostback();

Next, the "Test" link was not firing due to a js error in the following file:

nocio > headstart > assets > js > graphiql.js

I changed line 35 from:

head.insertBefore(script, document.getElementsByTagName("script")[0]);

to

head.insertBefore(script, document.getElementsByTagName("script").nextSibling);

Last of all, in the rainlab.pages template, under the Resolvers tab, I changed:

use Lang;

to

use Backend\Controllers\Lang;

To avoid the graphql error The use statement with non-compound name 'Lang' has no effect

Other than that it might be worth clarifying that pageObject: String in rainlab.pages template schema should be a reference to the page objects properties, therefore:

type StaticPage {
    title: String,
    url: String
}

Hope this is helpful!

Cheers

frthjf commented 4 years ago

I thought I'd mention other issues I had come across and fixes I had applied. I would have created a pull request but as most affect files from the actual plugin that do not exist in this repo, I thought I'd list them here.

Awesome, thanks a lot @creativeesprit and sorry for the issues you've experienced.

Okay, first of all I'm in the following environment:

PHP 7.2.11 October Build 465

On enabling the plugin and navigating to API in the top menu, I had the following error:

"Call to undefined method Nocio\Headstart\FormWidgets\AssetList::checkUploadPostback()" on line 431 of /Users/sheldondaniels/apps/murphy-wealth-website/api/vendor/october/rain/src/Extension/ExtendableTrait.php

Looks like this is caused by this patch that renamed the method. Removing the line is probably fine. I plan to release a major update that fully supports the latest Laravel-6 October version which should resolve this problem. This would also allow me to upgrade to the latest Lighthouse server as Headstart's version is currently a bit behind.

Next, the "Test" link was not firing due to a js error in the following file:

nocio > headstart > assets > js > graphiql.js

I changed line 35 from:

head.insertBefore(script, document.getElementsByTagName("script")[0]);

to

head.insertBefore(script, document.getElementsByTagName("script").nextSibling);

Cheers, I'll incorporate this fix.

Last of all, in the rainlab.pages template, under the Resolvers tab, I changed:

use Lang;

to

use Backend\Controllers\Lang;

To avoid the graphql error The use statement with non-compound name 'Lang' has no effect

Good point, I believe it would be fine to remove the use statement altogether in that case.

Other than that it might be worth clarifying that pageObject: String in rainlab.pages template schema should be a reference to the page objects properties, therefore:

type StaticPage {
    title: String,
    url: String
}

Yes, the StaticPage type could use some improvement. I'll prepare a patch. In the meantime, if you find other missing fields or ways to improve the Schema templates in this repository, feel free to send a PR. Many thanks!