Skip to content
This repository has been archived by the owner on Apr 17, 2023. It is now read-only.

js: Namespaces#index refactoring w/ Vue #1371

Merged

Conversation

vitoravelino
Copy link
Contributor

@vitoravelino vitoravelino commented Aug 8, 2017

Well, I wasn't expecting a long PR but... \_("/)_/

Here are some of the changes:

demo

If we agree on going with Vue all the way, I'll start working on the missing checklist below. Let me know if I should proceed with it or not.

Missing

@vitoravelino vitoravelino force-pushed the namespace-index-vue-refactoring branch 3 times, most recently from 0a8ff43 to a751fe6 Compare August 8, 2017 13:06
active_model_serializers (0.10.6)
actionpack (>= 4.1, < 6)
activemodel (>= 4.1, < 6)
case_transform (>= 0.2)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't find a package for this. :(

actionpack (>= 4.1, < 6)
activemodel (>= 4.1, < 6)
case_transform (>= 0.2)
jsonapi-renderer (>= 0.1.1.beta1, < 0.2)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't find a package for this either. :(

@@ -20,8 +20,11 @@ GEM
erubis (~> 2.7.0)
rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.3)
active_model_serializers (0.9.0)
activemodel (>= 3.2)
active_model_serializers (0.10.6)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Upgraded because 0.9 was buggy

@mssola mssola added this to the Release 2.3 milestone Aug 8, 2017
@vitoravelino vitoravelino force-pushed the namespace-index-vue-refactoring branch from a751fe6 to 3ba8794 Compare August 8, 2017 15:55
@vitoravelino vitoravelino force-pushed the namespace-index-vue-refactoring branch 16 times, most recently from 74eb204 to 4bede10 Compare August 10, 2017 10:35
@vitoravelino
Copy link
Contributor Author

@mssola ready for review! 😄

@vitoravelino vitoravelino force-pushed the namespace-index-vue-refactoring branch 2 times, most recently from b061785 to 8626e07 Compare August 10, 2017 12:46
@vitoravelino vitoravelino changed the title [WIP] js: Namespaces#index refactoring w/ Vue js: Namespaces#index refactoring w/ Vue Aug 10, 2017
@mssola
Copy link
Collaborator

mssola commented Aug 14, 2017

I just merged #1299, I think this affects this PR.

@vitoravelino vitoravelino force-pushed the namespace-index-vue-refactoring branch from 8626e07 to 999953a Compare August 14, 2017 11:27
@vitoravelino
Copy link
Contributor Author

@mssola Rebased!

@vitoravelino
Copy link
Contributor Author

@mssola Are we going with Grape or are we still waiting @jordimassaguerpla packaging feedback on it?
Because If we won't revert that, I believe I could already take advantage of it on this PR instead of going with the standard rails controllers. What are your thoughts?

@mssola
Copy link
Collaborator

mssola commented Aug 14, 2017

@vitoravelino I've already merged it, so it's safe to say that we are at least giving Grape a try 😉 As for the packaging side, now I need to update quite some bits, but if @jordimassaguerpla doesn't like the whole idea, or he thinks that it brings more harm than good, then we have two options:

  • My personal pick: rollback to a version that supports our version of ruby.
  • Worst case: redirect the API part into mere Rails controllers.

I'm liking grape, and I'm already benefiting of some of its features (check #1384), so I'd like to evaluate all our options before going back to the worst case scenario 😁

@vitoravelino
Copy link
Contributor Author

@mssola I also like Grape and would love to stay with it. I'm just trying to play safe but if you want to go wild... Let's go! Haha...

I've worked in a project with Grape a few years ago (ruby 1.9 era) and it used to do his job. So I guess going with your personal pick wouldn't be a big deal unless we are using a fancy new feature. Based on that I think we are safer than what I thought.

If you approve this PR, we can merge it and I can rewrite the API part in Grape but in another PR.

@mssola
Copy link
Collaborator

mssola commented Aug 14, 2017

Cool, I'll review later 😉

mssola
mssola previously approved these changes Aug 14, 2017
Copy link
Collaborator

@mssola mssola left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works wonders. Just two things:

  • Fix the issues I mentioned
  • Write a more complete commit message. Right now it's pretty raw... So, explain the changes you made and why you made them 😉

= render "namespaces/components/panel"

script#js-namespaces-table-tmpl type="text/x-template"
== render "namespaces/components/table"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo, should be a single =.

= render "namespaces/components/table_row"

script#js-namespace-visibility-tmpl type="text/x-template"
== render "namespaces/components/visibility"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

@@ -0,0 +1,16 @@
tr :class="scopeClass"
td
a{ :href="namespace.links.self.href" }
Copy link
Contributor Author

@vitoravelino vitoravelino Aug 14, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If :class="scopeClass" works, then :href="..." should also work. Will try without the curly brackets.

= render "namespaces/components/panel"

script#js-namespaces-table-tmpl type="text/x-template"
== render "namespaces/components/table"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe the == is not necessary here.

- Created custom elements for namespaces (namespace-panel, new-namespace-form,
  namespace-table, namespace-table-row, namespace-visibility)
- Added sorting columns (similar to SUSE#590)
- Fixed pagination (similar to SUSE#585)
- Improved UX of changing namespace visibility (see gif below)
- Updated slim gem
- Updated active_model_serializers gem
- Used serializers (check namespace_serializer.rb) for json rendering
- Added moment for dates (kind of overkill but a good thing in the long term)
- Added lodash and lodash babel plugin (makes partial imports possible)
- And other minor changes
@vitoravelino vitoravelino force-pushed the namespace-index-vue-refactoring branch from 6518e29 to 3e145dc Compare August 15, 2017 21:30
@vitoravelino
Copy link
Contributor Author

Since the requested changes were made and travis is passing, I'll merge this by myself to unblock other issues.

@vitoravelino vitoravelino merged commit 83da646 into SUSE:master Aug 15, 2017
@vitoravelino vitoravelino deleted the namespace-index-vue-refactoring branch January 3, 2018 10:23
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants