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

Global nav role switcher hooked up #45

Merged
merged 12 commits into from
Sep 10, 2016
Merged

Conversation

colbycheeze
Copy link
Contributor

Addresses story #2 and task #5

Still need to:

  • Add hover css to role switcher
  • fix some padding
  • Make sure it is keyboard accessible
  • Add a "create new user" UI component (will need another story for that, since it has to have some UI to help you select a state to associate with that user)
  • Remove all "font" icons, and replace with the SVG icons (I did ONE of them for now as an example)
  • Fix the story for GlobalNav (it's missing the redux context, which makes it fail...we can export the state from Redux dev tools in order to set up a store context)

Hooking this up took a bit of refactoring.

The dashboard page currently doesn't call the getAdminData. I'll hook that up next to a real lifecycle or action.

Here is what everything looks like:
screen recording 2016-09-08 at 04 48 pm

Other changes in this PR

  • Added an ENV var pointing to the dev api for npm start (we can remove it at a later time when we expect public users to begin using the demo, but it makes things easy for us atm.)
  • Tests now inject the tap event plugin, so that MUI components dont spit out errors
  • Test config removes extra quotes from stringified json strings.

Demo Data Flow

  • demo module now handles fetching data associated with a demo session and logs in to the supplychainmanager automatically
  • Dashboard component no longer manages data fetching on route loading, instead it is handled properly within the route itself.
  • CreateDemo saga now simply creates a demo and changes the route (In a future task, I want to have it manage adding one retail manager automatically so that demos always begin with that role as a default)

Mock API / stronger saga tests

  • Sagas tests now make use of state changes from actually calling the reducer, which requires proper data passed in....meaning I needed a way to mock the API calls. I made a mock file that gives back faker data in the shape we currently expect from the API.

What this allows, is for saga tests to properly fail if things change in the way data is passed around and modified (whereas before, we just generated made up objects and so it worked in test, but not in the running app)

The Saga tests look a bit more confusing, but are WAY more solid now. Writing and testing complex async actions has never been fun, but this makes them accurate and stable, which is the real win.

@colbycheeze colbycheeze added this to the 9/8 - Sprint milestone Sep 9, 2016
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.4%) to 96.653% when pulling 15b1a34 on colbycheeze:global-nav into 6d3de43 on IBM-Bluemix:dev.

'__CONTROLLER_API__' : config.env === 'test' ?
`${config.controller_service}/api/v1` :
JSON.stringify(`${config.controller_service}/api/v1`),
'__CONTROLLER_API__' : JSON.stringify(config.controller_service || ''),
Copy link
Member

Choose a reason for hiding this comment

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

the removal of /api/v1 here means we will need to update the toolchain and the live pipeline. It currently only passes the host.domain part. Goal was to be able to have multiple API version and let the client - in this case the webui the choice to use v1 or v2, etc. If you want to stick to full host.domain/path make sure to update logistics-wizard-toolchain and the live pipeline.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah right. Let me update it.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.4%) to 96.667% when pulling 7f00770 on colbycheeze:global-nav into 6d3de43 on IBM-Bluemix:dev.

Also refactored to be a bit simpler.
Couple of tests added
RoleItem made a bit simpler to use
WIP - Began wrapping RoleSwitcher with state context
WIP converting demo session retrieval and login to demos module and
kicking it off on route change, not from the dashboard component itself.
Login success now updates logged in user and stores token
updated mock apis to be more flexible
added mock APIs to some reducers on demo reducer tests
Cannot create a new manager yet, no UI built. Can switch roles though.
@rvennam
Copy link
Contributor

rvennam commented Sep 9, 2016

Learned a lot, changes look good to me - no comments.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.3%) to 96.642% when pulling 27a28ab on colbycheeze:global-nav into 44591c4 on IBM-Bluemix:dev.

@colbycheeze colbycheeze merged commit 9628d07 into IBM-Cloud:dev Sep 10, 2016
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.

None yet

4 participants