Skip to content
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

[Marketplace] Feature - Dashboards for multiple shops #2429

Merged
merged 43 commits into from
Jun 26, 2017

Conversation

spencern
Copy link
Contributor

Change the context of a users dashboard shortcuts and user dropdown shortcuts based on active shop.

For a user with the following roles for the secondary shop:

"FXybdgAYSKYndkRef" : [ 
  "notifications", 
  "dashboard", 
  "seller", 
  "guest", 
  "manage-users", 
  "orders", 
  "account/profile", 
  "accounts", 
  "account/verify", 
  "dashboard/accounts", 
  "product", 
  "createProduct", 
  "tag", 
  "index", 
  "cart/checkout", 
  "cart/completed", 
  "shop"
]

Their dashboard and shortcuts dropdown looks like the following:
image

@spencern spencern requested a review from aaronjudd June 13, 2017 18:15
@spencern spencern assigned impactmass and unassigned impactmass Jun 13, 2017
@spencern spencern requested review from impactmass and removed request for aaronjudd June 13, 2017 18:16
@spencern
Copy link
Contributor Author

@impactmass
Assigning you to this PR since you're working on permissions also. I think it'd be good if you are I are reviewing all permissions related PRs

@spencern spencern changed the title Spencer multi shop dashboards [Marketplace] Feature - Dashboards for multiple shops Jun 13, 2017
@impactmass
Copy link
Contributor

These are the items I see in the dropdown with the permissions set as listed in above description (shown on the side). Taken while on the secondary shop too.

screenshot 2017-06-15 10 41 22

I added the permissions directly on the user in the DB as going through the Accounts dashboard wasn't adding the permissions under the secondary shop. Is this the right way to test the PR?

@spencern
Copy link
Contributor Author

@impactmass While we don't have identical permissions available, I think we probably went about setting it up slightly differently. I don't think that's an issue as what this PR is trying to accomplish is changing the dashboard contextually based on the active shop and enabled permissions. It looks like that is working for you as well.

If you can do a code review for me as well, I think we can probably go ahead and merge this one in.

We can figure out why the same set of permissions are granting different options for the dashboard later, but my guess would be something that changed in the base marketplace branch that you merged in.

@impactmass
Copy link
Contributor

ok, I'll do a code review, plus test it while stepping back that last commit. Will update in a shortly

@spencern
Copy link
Contributor Author

This PR got out of hand, and is a lot bigger than I'd like, but the issues kept cascading.

This solves a number of issues now:

  • Changes the context of the dashboard based on active shop
  • When creating a shop, automatically add packages, setup permissions, and create layouts so a server restart is not necessary (Resolves [Marketplace] Packages are not added for new shop until server restart #2212)
  • Removes the dependency on getSellerShopId through out the app, with the exception of leaving it in the marketplace plugin specific templates.
  • Modifies the getShopId method on the server to return the users active shop
  • Fixes an issue where routes were not loading on a direct route because the packages were not found for the shop.

@impactmass - If you could give this another review asap, we can merge it and get cranking on the rest of marketplace

@@ -59,6 +59,10 @@ Template.registerHelper("hasDashboardAccess", function () {
return Reaction.hasDashboardAccess();
});

Template.registerHelper("hasDashboardAccessForAnyShop", function () {
return Reaction.hasPermissionsForAnyShop();
Copy link
Contributor

Choose a reason for hiding this comment

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

I searched for this function hasPermissionsForAnyShop and couldn't find it. Is it already on the marketplace branch? Or there's some typo here? Is it meant to be

Template.registerHelper("hasDashboardAccessForAnyShop", function () {
  return Reaction.hasDashboardAccessForAnyShop();
});

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch. I think I added this before the navbar was fully converted to react and have since removed the rest of it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is fixed now.

@spencern
Copy link
Contributor Author

Pretty sure this is ready to merge. Waiting on a final 'ok' from @impactmass, which I'll get whenever he gets back. We're planning to walk through the PR at that point, anyone is welcome to join. Will be some time next week. (Monday hopefully). In the mean time if anyone else wants to review, we can go ahead and merge.

Copy link
Contributor

@impactmass impactmass left a comment

Choose a reason for hiding this comment

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

  • Tested the dashboard context switching, when different shops are selected. Works as the PR said.
  • Also worked through parts of the PR that I wasn't familiar with yet with Spencer.
  • This is good to merge

@spencern spencern merged commit 5cca54a into marketplace Jun 26, 2017
@spencern spencern deleted the spencer-multi-shop-dashboards branch August 14, 2017 14:30
@spencern spencern mentioned this pull request Oct 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants