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

COMPASS-458 Decoupling and improving no collections visible message #679

Merged
merged 4 commits into from
Dec 13, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 0 additions & 8 deletions src/app/home/index.jade
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,4 @@
.content.with-sidebar
div(data-hook='collection-view')
div.report-zero-state(data-hook='report-zero-state')
div.state-arrow
img(src='images/zero-state-arrow-collections.png', width="110")
span Choose a collection to analyze
div.no-collections-zero-state(data-hook='no-collections-zero-state')
span
|The MongoDB instance you are connected to does not contain any collections. 
a.show-connect-window Connect to another instance
|.
.compass-sidebar-container(data-hook='sidebar')
14 changes: 2 additions & 12 deletions src/app/home/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,6 @@ var HomeView = View.extend({
showDefaultZeroState: {
type: 'boolean',
default: false
},
showNoCollectionsZeroState: {
type: 'boolean',
default: false
}
},
bindings: {
showNoCollectionsZeroState: {
hook: 'no-collections-zero-state',
type: 'booleanClass',
no: 'hidden'
}
},
events: {
Expand Down Expand Up @@ -149,7 +138,8 @@ var HomeView = View.extend({
if (!NamespaceStore.ns) {
app.instance.collections.unselectAll();
if (app.instance.collections.length === 0) {
this.showNoCollectionsZeroState = true;
// NOTE: Now handled by the Databases tab
// this.showNoCollectionsZeroState = true;
} else {
this.showDefaultZeroState = true;
}
Expand Down
14 changes: 0 additions & 14 deletions src/app/home/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -44,20 +44,6 @@
flex-direction: row;
}

.no-collections-zero-state {
font-size: 18px;
color: @gray4;
font-weight: 200;
position: absolute;
left: ~"calc(50% - 250px)";
top: 50%;
z-index: 2;

a {
cursor: pointer;
}
}

.collection-view {
header {
padding: 12px 0 0;
Expand Down
Binary file removed src/app/images/zero-state-arrow-collections.png
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const React = require('react');
const app = require('ampersand-app');
const { shell } = require('electron');
const { TextButton } = require('hadron-react-buttons');
const DatabasesActions = require('../action/databases-actions');
const CreateDatabaseDialog = require('./create-database-dialog');
Expand All @@ -10,6 +11,11 @@ const _ = require('lodash');

// const debug = require('debug')('mongodb-compass:server-stats:databases');

/**
* The help url linking to role-based authorization.
*/
const AUTH_HELP_URL = 'https://docs.mongodb.com/master/core/authorization/';

class DatabasesTable extends React.Component {

constructor(props) {
Expand All @@ -29,6 +35,26 @@ class DatabasesTable extends React.Component {
DatabasesActions.openCreateDatabaseDialog();
}

onAuthHelpClicked(evt) {
evt.preventDefault();
evt.stopPropagation();
shell.openExternal(AUTH_HELP_URL);
}

renderNoCollections(writable) {
return (
<div className="no-collections-zero-state">
The MongoDB instance you are connected to
does not contain any collections, or you are &nbsp;
<a onClick={this.onAuthHelpClicked.bind(this)}>not authorized</a>
&nbsp;to view them.
{!writable ?
<a className="show-connect-window">Connect to another instance</a>
: null}
</div>
);
}

render() {
// convert storage size to human-readable units (MB, GB, ...)
// we do this here so that sorting is not affected in the store
Expand Down Expand Up @@ -62,6 +88,8 @@ class DatabasesTable extends React.Component {
onColumnHeaderClicked={this.onColumnHeaderClicked.bind(this)}
onRowDeleteButtonClicked={this.onRowDeleteButtonClicked.bind(this)}
/>
{this.props.databases.length === 0 ?
this.renderNoCollections(this, writable) : null}
<CreateDatabaseDialog />
<DropDatabaseDialog />
</div>
Expand Down
15 changes: 15 additions & 0 deletions src/internal-packages/server-stats/styles/rtss-databases.less
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,18 @@
z-index: 1;
}
}

.no-collections-zero-state {
font-size: 18px;
color: @gray4;
font-weight: 200;
position: absolute;
left: ~"calc(50% - 250px)";
right: 15%;
top: 50%;
z-index: 2;

a {
cursor: pointer;
}
}