Closed (fixed)
Project:
Drupal core
Version:
8.0.x-dev
Component:
rest.module
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
25 Feb 2013 at 18:47 UTC
Updated:
29 Jul 2014 at 21:57 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
klausiTagging.
Comment #2
Anonymous (not verified) commentedAs I've mentioned outside the issue queue, I strongly favor option #2 or #3. I think making a usable UI for REST Web Services configuration is a bit of a time sink. YAML is an extremely easy markup language, so anyone who is knowledgable enough to configure REST Web Services should also be able to copy and paste a YAML configuration.
By making REST configurable via YAML config files, we free up the sparse resources of our UI review team to work on more important user interfaces... the ones more likely to be encountered by non-technical users.
Comment #3
aspilicious commentedSo you will point to the active storage cmi yml files? Because the ones in the module are only used at installation time.
Comment #4
Bojhan commentedI definitely applaud no UI's :). Given that we are in cleanup phase, I would be even more inclined as there will be to little time to make a useful UI.
Comment #5
klausi@aspilicious: yes, that was the idea if we remove the UI entirely. what is the correct way to change CMI config on a drupal site?
Comment #6
aspilicious commentedThere is no correct way. IRC chat message:
Apparantly there is a drush command to open a .yml file and that one runs the import hooks.
Comment #7
klausiOk, looks like we have an agreement here, so I'm going to rip out the UI parts and move them to a restui.module contributed project.
Comment #8
klausiContrib module created: http://drupal.org/project/restui
Patch attached that removes the admin page and rewrites parts of hook_help().
Comment #9
klausiAlso I don't think this qualifies as feature request, but a feature removal request which better translates into a task.
Comment #10
frega commentedFixed a small typo (entitis -> entities). And - after speaking to tstoeckler - also a small text revision.
Comment #11
frega commentedRemoved superfluous placeholder var. Rerolled as per IRC. Interdiff is against #8.
Comment #12
klausiMoshe per e-mail:
Comment #13
Anonymous (not verified) commentedShouldn't we add an example of how the file should be structured?I just noticed that Moshe said the same thing.
Comment #14
klausiThis patch now includes a rest.settings.example.yml file with some useful comments that are also displayed on the help page.
Do we have a standard where to put and how to name example configuration files?
Comment #15
mtiftI think this should be "only in HAL". The rest looks good to me.
Comment #16
klausiNo, as you can see "json" is listed as second format.
Comment #17
mtiftSorry for not being more specific. I think you meant "only" not "ony"
Comment #18
klausiAh thanks, of course! Fixed that.
Comment #19
klausiCrell said that deleting users as the only enabled option is a bit random/unrealistic, so I replaced that with create/POST.
I also replaced "allow" with "enable" in the example configuration, since the config has nothing to do with access control. That is determined by user permissions in the default implementation, or whatever a more exotic resource plugin defines in its routes() method.
Comment #20
Crell commentedMuch better sample. Thanks, klausi!
Comment #21
Anonymous (not verified) commentedActually, in looking at this closer, we have a few problems. First, it shows posting and patching with XML and JSON, which aren't supported because we don't have deserialization for those. Additionally, it uses "hal" as the shortname instead of "hal_json".
Comment #22
klausiThanks for checking this out Lin! Changed the examples accordingly.
Comment #23
moshe weitzman commentedThe example yml file is great.
typo: resourse
Better (I think) is: Copy rest.settings.example.yml to the staging configuration directory, rename file to rest.settings.yml, edit as needed, and import new configuration.
Comment #24
klausiFixed the typo, improved the help text and also linked to the config UI synchronisation page if config.module is available.
Comment #25
moshe weitzman commentedExcellent.
Comment #26
webchickWow. :( Very sad to see this patch. :( I mean sure, the UI's not perfect, but it does make this functionality far more accessible than hand-editing code files.
This probably deserves a Dries sign-off, IMO. While it's true that setting up a REST server involves some amount of technical competence, so does setting up SQL-powered listings, pulling in data from external feeds, etc. We provide UIs for all of those; in fact, I'd argue that this is the whole point of Drupal; to make really techy tasks accessible to mere mortals who can submit forms.
Comment #27
webchickThe issue summary does a good job of laying out why you want this to be done.
But one thing that's not clear to me from the issue summary is this:
" it is difficult to implement a proper UI for REST module that covers all possible configuration options"
Can you be more specific on the possible configuration options not covered by the current UI? Because the current UI seems to cover per-entity REST endpoints, as well as per-role access to each method on those endpoints (GET, POST, PUT...). One area I find missing relative to the example YAML file is selecting the format (XML/JSON), but that's just a simple select box for the 99% case.
I'm sensitive to not putting more on your folks' plate than you have already, but at the same time I feel like the UI is at least 85% there already, and so I'd love to understand where I am missing a cluebat.
Comment #28
webchickBtw, if what's really blocking this is questions on how to implement crazy hierarchical settings type stuff, the content translation UI is exceptional for this (and user-tested!), and has some patterns we could just copy/paste.
If however, it's the ability to do kind of "out-there" stuff like arbitrarily allow JSON on GETs for entity A but XML on POSTS for entity B, I guess I'd question whether or not the UI needs to cater for that at all. Someone with those kinds of advanced needs could just take the YAML file and hack it.
Comment #29
Crell commentedwebchick: I think in a large part it comes down to "do we spend the next 2 months answering comment #28, or the next 2 months adding more hypermedia relations and ensuring that embedded resources can be handled cleanly from contrib and so forth?" The general consensus from the REST team was that we'd rather focus on the latter and avoid the extra work of refining the UI and discussing the questions in #28, as that would just slow down functionality refinement.
Since it's "just" a CMI file, contrib can experiment to its heart's content with good UI models here. I would actually be completely OK with a UI coming into core in 8.3 or 8.4 or something once we've got a better idea of what it should be. But especially for API-centric stuff like this, good code design first, good UI design second.
Comment #30
xjmA potential compromise would be to open a contrib project now so we're not losing the functionality we already have?
Comment #31
klausixjm: that is already done, see http://drupal.org/project/restui (although the code in it has not been updated to the contrib name yet)
webchick: the UI is somewhat broken right now, because if you have a custom configuration in the YAML file and visit the admin page it will show a resource as enabled, although only certain parts are enabled. If you then save the form you will overwrite the config, enabling all stuff for the resource. The UI does not reflect the configuration state of a resource correctly, making it a rather useless page that allows people to shoot them into their foot. I think it is a usability problem because of that unexpected behaviour.
All people involved with WSCCI and REST have stated that they have no interest in developing a fancy UI and rather focus on more pressing issues in Drupal core so far. That means we would ship with an inconsistent UI that no developer cares about, producing lots of bug reports and support requests somebody will have to deal with. That's why we would rather let that UI evolve in contrib.
Comment #32
dries commentedAs much as I'd love to see a UI for this in core, I don't think it is key to focus on this right now. We have plenty of more important things to do at this stage of the release cycle. I support removing this for now.
We could decide to bring this back in before or after we ship 8.0.
Comment #33
effulgentsia commentedwebchick said she wanted to give the patch one more look before commit.
Comment #34
webchickAh well, you can't win 'em all. :)
Sending for a re-test first.
Comment #35
webchick#24: remove-rest-ui-1927162-24.patch queued for re-testing.
Comment #36
webchickApologies for brevity, just wrapping up a call real quick, but a few issues:
- Configure link on .info file still showing up even though there's no page
- The example to copy/paste should be a useful example that makes sense for 80% of sites. The node stuff looks good, but the rest of it should be moved to a handbook page and linked at the top of the file for more advanced examples.
- There's a missing step in the help text of enabling one of the "serialization format" modules (e.g. HAL), else you get a 405 "Method not allowed" when trying to copy/paste the GET command.
- The config import Diff feature broke with an AJAX error when I tried to initially diff the staging rest.settings.yml with the active config, we hypothesize this might be due to REST module not providing its own default. The default should probably be totally empty, else we could maybe do something like "enable node GET on JSON" so that the examples work.
- The GET command worked, the DELETE command didn't, but I believe that's already covered in a separate issue.
- However, please rename node/5 to node/1. :D
Once those are addressed, looks good to me. Thanks!
Comment #37
klausiThanks for the thorough review!
* Fixed the info file.
* The example should contain other entities as well, so that people see immediately what is possible with other entity types as well. And I don't think there is an 80% sense use case for all sites. We have no idea what people will use this module for. Yes, they will probably want the functionality for nodes, so that is the first example.
* Improving the overall help text is out of scope for this issue, we just want to remove the UI here and replace it with an example YAML config.
* The config diff import feature worked for me as expected. We already provide an empty rest.settings.yml default configuration file. Please open a separate issue with steps to reproduce this problem.
* Fixing the example cURL commands should also be handled in a separate issue.
Comment #38
webchickHm. My feeling is that with the UI removed, this help page *becomes* the UI, so yes, it is in scope to make the text/examples correct (except where there's a bug in some other issue like in the case of DELETE).
And while I realize it's next to impossible to make a call on what makes sense for 80% of sites, I can tell you definitively that the example you provide here and tell people to copy/paste into their staging directory does *not* make any sense for even 1% of sites. :) But people may or may not realize that until they're much further along their learning curve. The example text here is "demoware" to show all of the flexibility of what can be done. And that is all good information, but not coupled with what is sure to become the default config for at least 80% of sites who play around with this module. I'd simply do "For more advanced route configuration, see [url]" from the actually useful example that you tell people to copy/paste, and then that handbook page can grow organically with other examples added by other people.
And yeah, I can no longer reproduce that error in a fresh install in an "incognito" window of Chrome, so that must've been stale JS from before the dialog patch this morning. Sorry about that.
Comment #39
klausiOK, so I reduced the example file to a minimum and put the more extensive one on http://drupal.org/node/1972016
I also added a note to the help page that a serialization module should be enabled.
And here is the doc issue to get a nice URL alias: #2004186: URL alias + book placement for rest module.
Comment #40
klausiReconsidering one more time: now the example file is so short that it does not make sense to keep it even around as YAML file anymore. We can directly embed the lines on the help page. The doc pages still contains the more extensive example.
Comment #41
Crell commentedEmbedding inline like that makes sense to me, especially with the main documentation on d.o instead.
Comment #42
Anonymous (not verified) commentedJust one edit and then I think it's ready to go.
You only need to enable serialization, since that contains JSON and XML. You could say something like, "REST module depends on the serialization module, which provides JSON and XML representations by default. To get other serializations, you can enable modules such as the HAL module."
Comment #43
klausiDone!
Comment #44
Anonymous (not verified) commentedComment #45
alexpottCommitted 3ed3a45 and pushed to 8.x. Thanks!
Interestingly this means these instructions will need to change when we change the config importer to only handle whole sets of config.
Comment #47
juampynr commentedThis piece of logic has been restored in REST UI module.
Comment #47.0
juampynr commentedadded proposed solution