Skip to content

Conversation

pzrq
Copy link
Contributor

@pzrq pzrq commented Jan 16, 2017

Design Mock Up

https://mongodb.invisionapp.com/share/6E9XJUCKW#/screens/213327470

Screenshots

NOTE: Expect some changes in style pass ticket COMPASS-705.

New 5 buttons (enabled, e.g. primary, mongos)

create database instance icon

create collection

drop database

drop collection

create database button

New 5 buttons (disabled, e.g. secondary, arbiter)

create database icon secondary

create collection secondary

drop database secondary

drop collection secondary

create database button secondary

Tasks Done

Other bugs and refactoring blocking this PR:

  • COMPASS-664: Dropping the only collection in a database triggers a TypeError
  • COMPASS-665 (COMPASS-665 Decouple DDL into new package #752): Refactor to open Create/Drop Database/Collection modals from anywhere
    • Buttons do not work if you are not in the right place, i.e.
    • Create database modal only displays on click when already at the instance level
    • Create collection modal only displays on click when already at the database level
    • Drop database modal only displays on click when already at the instance level
    • Drop collection modal only displays on click when already at the database level
    • Not sure, but seems like we need to keep these actions around globally for longer rather than loading/unloading them. Might require a deeper refactor?
  • COMPASS-666 (COMPASS-666: Keyboard Enter on forms cause page refresh #753): Keyboard Enter on Create Collection Modal sometimes cause page refresh
  • Rebase after COMPASS 685: fix flexbox redesign #749

Please feel welcome to push commits, test, review and add or check off these TODOs:

  • (Possibly related) Code smell from relative imports, e.g. const CollectionsActions = require('../../../database/lib/actions/collections-actions');
  • Do the z-index removals have any detectable side-effects or were they no-ops? (N/A after rebase on COMPASS 685: fix flexbox redesign #749)
  • Enzyme tests - added for tooltips and click events
  • Functional tests (N/A, enzyme is enough)
  • Is Writable!

From Sam:

  • The + and trashcan icons need more highlight when mousing over the items in the side bar. They seem too dark at the moment unless you actually mouse over the icons themselves. (Moved to COMPASS-705)
  • The create database button at the bottom of the side bar as illustrated in the design mockups is missing.

From Sam & Thomas:

  • Additionally, the newly created db/collection should be selected after creation (just as if the user clicked on it in the sidebar) so the user can instantly start working with this new collection.

@pzrq pzrq force-pushed the COMPASS-558-ddl-buttons branch from b01eee6 to 08b7485 Compare January 16, 2017 07:19
@satyasinha
Copy link

Design wise it makes sense if on clicking the create database/collection modal it also opened the databases/collections table in the background. So that you can see the new entry being created.

If that makes it any easier....

@samweaver-zz
Copy link

samweaver-zz commented Jan 16, 2017

I agree with you that only having the action available when in the right place is a bit odd. Adding some ToDo's:

  • The + and trashcan icons need more highlight when mousing over the items in the side bar. They seem too dark at the moment unless you actually mouse over the icons themselves.
  • The create database button at the bottom of the side bar as illustrated in the design mockups is missing.

@rueckstiess
Copy link
Contributor

If you use the keyboard Enter key to submit, modals refresh the whole page

should be fixable with an onSubmit() handler and a evt.preventDefault(). Can probably done quickly in this PR.

(Possibly related) Code smell from relative imports, e.g. const CollectionsActions = require('../../../database/lib/actions/collections-actions');

should use app.appRegistry.getActions(...). Can probably also be handled right now.

Buttons do not work if you are not in the right place, i.e.

That needs to be changed. I see two possibilities:

  1. Open modal regardless where you are.
  2. Navigate to the respective screen (e.g. instance level for add database) and open the modal there

My preference is for 1. because they are shortcuts. Additionally, the newly created db/collection should be selected after creation (just as if the user clicked on it in the sidebar) so the user can instantly start working with this new collection.

In order to make this work, it may be necessary to move the modal definitions to the "Home" level, so that they can be opened on any screen after connecting.

@pzrq Can you make tickets in the DDL Manipulation epic for the outstanding issues? The refactor to open the modals from anywhere seems like the most pressing one. Maybe you can start working on that, and we put COMPASS-558 in Blocked state in the mean time. It will probably roll over into the new sprint.

@pzrq pzrq force-pushed the COMPASS-558-ddl-buttons branch from 08b7485 to 6cfb4d7 Compare January 17, 2017 00:50
@samweaver-zz
Copy link

samweaver-zz commented Jan 17, 2017 via email

@pzrq pzrq changed the title COMPASS-558 Add DDL buttons [WIP] COMPASS-558 Add DDL buttons Jan 17, 2017
@pzrq pzrq force-pushed the COMPASS-558-ddl-buttons branch 4 times, most recently from 7e21e43 to 694c66e Compare January 20, 2017 05:50
@pzrq pzrq force-pushed the COMPASS-558-ddl-buttons branch from 694c66e to 2017b08 Compare January 20, 2017 06:50
@pzrq pzrq force-pushed the COMPASS-558-ddl-buttons branch 3 times, most recently from d1d1e9f to 87030c0 Compare January 24, 2017 02:31
@fredtruman
Copy link
Contributor

Depending on your preference, I'm happy to handle any and all style on this after its merged, Peter.
Feel free to punt on anything and just file a quick cleanup ticket for me if need be 💄 🐷

@pzrq
Copy link
Contributor Author

pzrq commented Jan 24, 2017

Thanks @fredtruman will take you up on that, definitely at least for @samweaver's request:

The + and trashcan icons need more highlight when mousing over the items in the side bar. They seem too dark at the moment unless you actually mouse over the icons themselves.

EDIT: COMPASS-705

pzrq added 5 commits January 24, 2017 14:33
Implementing:
https://mongodb.invisionapp.com/share/6E9XJUCKW#/screens/213327458

The arrow needs to be moved to the left side of the menu to replace it in a future commit.
Designers can style pass later, e.g. not sure how to do the fade gradient in the top right instance area, the active parent child thing more cleanly or the specific circled plus icon inside another circle from: https://mongodb.invisionapp.com/share/6E9XJUCKW#/screens/213327444
@pzrq pzrq force-pushed the COMPASS-558-ddl-buttons branch from 87030c0 to 4195fb8 Compare January 24, 2017 03:33
@pzrq pzrq force-pushed the COMPASS-558-ddl-buttons branch 5 times, most recently from bf395ca to 664ca29 Compare January 24, 2017 14:46
@pzrq pzrq force-pushed the COMPASS-558-ddl-buttons branch from 664ca29 to 5da030e Compare January 24, 2017 14:48
@pzrq pzrq changed the title [WIP] COMPASS-558 Add DDL buttons COMPASS-558 Add DDL buttons Jan 24, 2017
@pzrq
Copy link
Contributor Author

pzrq commented Jan 24, 2017

After fighting COMPASS-635, COMPASS-690, COMPASS-706 and COMPASS-707 for the last hour, going to just give in, set this ready for review and hope I am lucky later today.

This PR can be reviewed independently of the Travis issues above, and can be merged by Compass adminstrators (or we could stoop to restarting individual builds too).

Copy link

@satyasinha satyasinha left a comment

Choose a reason for hiding this comment

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

LGTM, could use a style pass to move the create database icon to the bottom of the sidebar.

@pzrq
Copy link
Contributor Author

pzrq commented Jan 24, 2017

could use a style pass to move the create database icon to the bottom of the sidebar.

@KeyboardTsundoku Please let @fredtruman know on COMPASS-705 👍

Copy link
Contributor

@rueckstiess rueckstiess left a comment

Choose a reason for hiding this comment

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

Very nice, and unobtrusive (I feared it would be cluttered but the fact that the symbols only show on the hovered row avoids that).

Some small changes (I added the styling ones to COMPASS-705):

Require code changes:

  • Add a -is-disabled BEM class for all icons/button so that the styling can be different for disabled items.
  • Some tooltips include the database/collection name, some don't. I think it's pretty clear which database/collection is meant (it's the highlighted row, and you get another confirmation in the modal), so I would suggest to remove all database/collection names from tooltips and keep them very short and concise:
    • Create Collection
    • Drop Collection
    • Drop Database
    • The tooltip on the big "Create Database" button on the bottom is unnecessary, it just repeats what the button says.

Styling:

  • The tooltips should not be translucent, they should be opaque like all other tooltips.
  • The contrast is a little low on non-active rows (darker gray). The icons are barely visible.
  • For the create database icon in the "Instance Details View" at the top, I did not see that at all (contrast = 0). I only noticed it when going through the code :-)
  • on secondaries, the icons should not light up when hovering. The user should get the impression the icons are disabled.
  • on secondaries, the "Create Database" button should somehow be muted to indicate it's not active (disabled).

/>
<ReactTooltip id={TOOLTIP_IDS.CREATE_COLLECTION} />
<i
className="compass-sidebar-icon compass-sidebar-icon-drop-database fa fa-trash-o"
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's pass in an additional BEM modifier class compass-sidebar-icon-is-disabled or similar when on secondary nodes so that @fredtruman can style disabled items differently.

This should be done on all create/drop icons and the big create database button

renderCreateDatabaseButton() {
const isWritable = app.dataService.isWritable();
const tooltipText = isWritable ?
'Create database' :
Copy link
Contributor

Choose a reason for hiding this comment

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

Big button does not need a tooltip "Create Database", because it just repeats what is on the button already. Only show the "...is not available..." tooltip when secondary.

const collectionName = this.getCollectionName();
const isWritable = app.dataService.isWritable();
const tooltipText = isWritable ?
`Drop ${this.props.database}.${collectionName} collection` :
Copy link
Contributor

Choose a reason for hiding this comment

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

Just "Drop Collection"

'data-tip': createTooltipText
};
const dropTooltipText = isWritable ?
`Drop ${this.props._id} database` :
Copy link
Contributor

Choose a reason for hiding this comment

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

Just "Drop Database"

@rueckstiess
Copy link
Contributor

Looks good, nice job!

:shipit:

@pzrq pzrq merged commit bfc2e50 into master Jan 25, 2017
@pzrq
Copy link
Contributor Author

pzrq commented Jan 25, 2017

Awesome, merging.

Thanks @rueckstiess @KeyboardTsundoku @fredtruman @samweaver 👍

@pzrq pzrq deleted the COMPASS-558-ddl-buttons branch January 25, 2017 04:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants