-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
add identifiers to author edit page #5093
add identifiers to author edit page #5093
Conversation
@RayBB this is great that we're pushing the frontier on vue. This PR is useful as proof of concept even if we decide some changes may be required. Here's my first batch of opinionated feedback:
|
Yes please. Out of interest foes Python have any linting tools we could use to detect when that happens to assist volunteer contributors? |
As far as I can tell editing links on authors already requires JS and so does editing identifiers on editions (which this is based on). If the idea is that JS shouldn't be used for editing going lets add that to the Vue documentation and clarify where it is appropriate to use Vue. It is possible to avoid JS all together if we require the users to save and reload the page after adding each identifier but I imagine that would feel quite cumbersome. @jdlrobson It is possible to run a script that checks if any .vue or .js files were added outside of the Please let me know how to move forward. Since @cdrini initially setup the Vue work perhaps he has thought on this. |
I defer to Mek on this one but my belief about this is that without javascript it should be possible to read any page, search, and navigate to any page that can be rendered. Basic editing should be possible using a form submission, but its okay if it's a limited experience. For JavaScript enabled clients we can and should give the best experience possible. Using Vue.js on the editor seems perfectly sensible to me. I do think we should adopt a storybook instance (#4179) and document our components before building too many things in Vue. That remains a high priority on my side for the frontend if we are going to maintain these Vue based components going forward. If we don't we may be destined to repeat the same mistakes of the past
Sorry I should have looked at the pull request rather than done a drive by comment on my phone. Sorry about that. This patch is fine Mek. We can and should use inline script tags inside Vue files. The only issue is inside python rendered templates. Sorry for the confusion here. #4474 captures that. |
@cdrini could you help me with the two things I wrote under |
Discussed on call:
|
@cdrini If there is anything I should change let me know and I'll work on it this weekend. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work @RayBB ! A number of style/naming things, and a few suggestions on how to get the author_config working and make the logic a little simpler. Great work on testing the tires of the Vue flow!
Created the page here: https://openlibrary.org/config/author Note I used a different link for Wikidata. |
@cdrini ready for another review. Thanks for the great comments! These are the only two issues you raised that need a second look: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking great! A few small final changes. I think those 3 vars will be clearer if we dissolve assignedIdentifiersWithConfigs
; that's the piece that's making this a little harder to read for me. Let me know if you have any questions!
<button class="form-control" type="button" name="set" :disabled="!setButtonEnabled" @click=setIdentifier>Set</button> | ||
</th> | ||
</tr> | ||
<tr :key="identifier.name" v-for="identifier in assignedIdentifiersWithConfigs"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also add a v-if="value"
; we don't want rows without identifiers to show up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that we can do that using Vue 2 https://v3.vuejs.org/guide/migration/v-if-v-for.html#_2-x-syntax
Since this is only assigned identifiers, the only time rows with blank values will show up is if a user clicks remove.
That seems ok to me and lets us avoid more computed properties (the vue recommended solution).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The way they've written the docs there is super confusing :P But I think in Vue 3 this will no longer be possible; Vue 2 should support it: https://vuejs.org/v2/guide/list.html#v-for-with-v-if
Grrr, that's an annoying change in Vue 3 :/ Let's use it here for now, since we're still on Vue 2. I use this pattern profusely throughout library explorer 😅
@cdrini your code reviews are amazing and I'm so impressed by how much you simplified this! Ready for another review now |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code lgtm! Two small fixes, and then I'll toss the latest code on testing for some... testing!
…tches from server and cleaned up
Co-authored-by: Drini Cami <cdrini@gmail.com>
Co-authored-by: Drini Cami <cdrini@gmail.com>
…tches from server and cleaned up
Co-authored-by: Drini Cami <cdrini@gmail.com>
Co-authored-by: Drini Cami <cdrini@gmail.com>
Co-authored-by: Drini Cami <cdrini@gmail.com>
Tested on testing:
Tested locally:
|
1391baa
to
fc7a989
Compare
Closes #853
I am addressing the PR in the minimum way following this comment.
To me, that means for this PR to be a success only the following need to be true:
All three of these are possible using this minimal code.
Some possible future enhancements:
Enhancements with bigger scope:
Technical
From what I can see, this is one of the first implementation of Vue as an addition to an existing page. I'd really love feedback for how to make it better since I imagine others may be following this as an example.
I tried to keep things as simple as possible to meet the criteria.
For editions, the identifiers are setup as a list. However, for authors identifiers seem to be setup as dictionary. I'm not sure why this is but I figure for the scope of this PR I should just deal with it since I imagine doing a data conversion is not trivial.
I'm using
template
with the v-for because it allows me to have two root elements for each item in the list and that is need to use css grid.Testing
Try adding and removing some identifiers from an author.
Setup
In order for this to work the appropriate config must be added to your environment by going to http://localhost:8080/config/author.yml?m=edit and setting:
Screenshot
Screen.Recording.2021-05-04.at.8.42.27.PM.mov
Stakeholders