Cms: FR: Remove GraphQL from the sidebar until it's asked for

Created on 28 Aug 2019  路  12Comments  路  Source: craftcms/cms

All the other items in the sidebar (Assets, Categories, Entries etc) only show up once you're deliberately using them and have created them in the Settings. I'm never going to use GraphQL and I'm not writing an API, so it would be great if the new GraphQL sidebar option was removed until it was turned on somehow.

image

enhancement ux

Most helpful comment

Just added an enableGql config setting for the next release. Set to false from config/general.php to disable the API and also the Control Panel section.

return [
    'enableGql' => false,
];

All 12 comments

It鈥檚 only visible for admin users, FTR.

I think ultimately we should move it into Settings, once we鈥檝e implemented #4371, and give settings pages a way of telling Craft that they鈥檙e safe to use even when allowAdminChanges is set to false.

Hmm, kind of feel it should remain in the left panel -- you play with it a lot when getting a GraphQL query to work, unless you use a (better) side tool like Insomnia.

Its appearance could be nicely conditioned on a) being logged in as Admin b) if a flag in general.php config is set (your choice on default, likely true so people find it?)

Yeah good point.

I agree with darylknight. I'm an admin user on my Craft sites but I doubt I'll ever use GraphQL and don't think it should appear in the sidebar by default. I also get an "Unauthorised Administrative changes are disallowed in this environment" when I click it on my live site due to the admin changes config setting.

If it's actively being used on a site, of course it could be in the sidebar - I expect it's useful. But my point is that the several dozen Craft sites I have will never use it, so I feel like it shouldn't be there unless the functionality is turned on in a similar way to how the other sidebar items work. A setting in general.php sounds good.

Yes I'm an admin, yes it's only visible to admins, but I'm still not using it. I guess I'm comparing it to Categories or Globals being in the sidebar if you're not using them? Even if it's on by default, it can still be disabled then. At the moment I'd need to use the Control Panel CSS plugin to hide #nav-graphql.

Agreed. I don't think it necessarily matters to me if its in Utilities or the sidebar, but I think there should be an option to disable it. Maybe an enableGraphQl general config setting which could, in addition to hiding the menu item, also disable anything else not necessary for sites not using GraphQL (if there is anything else to disable).

Just added an enableGql config setting for the next release. Set to false from config/general.php to disable the API and also the Control Panel section.

return [
    'enableGql' => false,
];

Thanks!

@brandonkelly Would be nice if enableGql defaulted to false. That way only people who want to utilize it need to edit a setting. I keep finding myself having to edit configs to hide this as we update various sites.

@jsunsawyer That would be a breaking change for everyone that is using GraphQL currently without needing to explicitly enable it. Plus it鈥檚 only shown for admins, and we think in the long run most Craft sites are going to be using GraphQL in some capacity (especially considering the gql() Twig function that was added in 3.3.12). So it will stay enabled by default.

especially considering the gql() Twig function that was added in 3.3.12

馃槺

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lukebailey picture lukebailey  路  3Comments

darylknight picture darylknight  路  3Comments

rynpsc picture rynpsc  路  3Comments

michaelhue picture michaelhue  路  3Comments

bitboxfw picture bitboxfw  路  3Comments