-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Spike: Edit link for logged in user on dataset page #65
Comments
InvestigationUsing the JSON API in Drupal.It may be that just turning on jsonAPI will give us all the endpoints we need and this is a question of writing a small request function and component on the dataset page. Load a DKAN and switch on JSON API to see what is available. This means enabling the jsonapi module, which is straightforward. After enabling it you will have access to read only endpoints, which you can view in the browser here: http://dkan.localtest.me/jsonapi dktl drush en jsonapi -y Create sample contentdktl drush en sample_content -y
dktl drush dkan:sample-content:create View JSON content for the example datasets:To see one of our example datasets nodes, such as node with NID 31 http://dkan.localtest.me/node/31, http://dkan.localtest.me/jsonapi/node/data/31 Is the user logged in and with an active session?http://dkan.localtest.me/jsonapi/ Not logged in {
"jsonapi": {
"version": "1.0",
"meta": {
"links": {
"self": {
"href": "http://jsonapi.org/format/1.0/"
}
}
}
},
"data": [],
} Logged in we also get the "me" property os not the object, so we could easily check if it is set and has an ID, otherwise not show the link. {
"jsonapi": {
"version": "1.0",
"meta": {
"links": {
"self": {
"href": "http://jsonapi.org/format/1.0/"
}
}
}
},
"data": [],
"meta": {
"links": {
"me": {
"meta": {
"id": "d9030164-354e-4f1c-90f7-d707e257bd22"
},
"href": "http://dkan.localtest.me/jsonapi/user/user/d9030164-354e-4f1c-90f7-d707e257bd22"
}
}
}
} ConclusionThough we might not need the JSON API to build the URL from the dataset UUID as it is already included in the title link, it would come in useful for querying whether the current user is logged in. References |
Hi @dgading Could you please review this ticket or let me know when you're planning on reviewing it? Thanks! |
I'm fine with whatever approach works best to get the logged status from Drupal. The big issues I would like to see addressed in implementation is creating a React context provider that has a function we can use to check for logged in status. The context would need to be wrapped around the entire app and then we could request it in any component that needs to know the current logged in status. It should probably recheck also whenever a new page asks for the information to catch possible logouts and stuff. I don't see that in this ticket, but could be added to the implementation ticket. |
A new ticket (#74) came out of this. So closing this one. |
Working on the implementation for this in #74 |
Background
On DKAN1, users were accustomed to going to a dataset page and seeing an edit button they could use make changes. Currently, to edit a dataset, users need to go to a manage content page in order to find and edit link to datasets. In user tests testing, this was found to be confusing for users who were accustomed to DKAN1.
User story
As a data publisher, when I am looking at a dataset page, I would like to be able to choose to edit it from that page, so that I don't need to leave the page to make changes.
Notes
If a user is logged in and has an active session, it would be a big UX improvement to see an edit link of some kind on a dataset.
To investigate: Is there an existing drop-in solution for decoupled Drupal sites to check for an authenticated user and provide contextual links?
Possible starting places:
It may be that just turning on jsonAPI will give us all the endpoints we need and this is a question of writing a small request function and component on the dataset page.
Acceptance criteria
Estimate: 5
The text was updated successfully, but these errors were encountered: