Skip to content

Commit 9b05ec7

Browse files
committed
Improve the way create user button is handled. Set connection cutoff to its final value
1 parent a568730 commit 9b05ec7

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

client/containers/Users/Users.jsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import './Users.styles.css';
1515
class Users extends Component {
1616
static propTypes = {
1717
loading: PropTypes.bool.isRequired,
18+
connectionsLoading: PropTypes.bool.isRequired,
1819
error: PropTypes.string,
1920
users: PropTypes.array,
2021
connections: PropTypes.array,
@@ -44,7 +45,9 @@ class Users extends Component {
4445

4546
componentWillMount = () => {
4647
this.props.fetchUsers();
47-
this.props.fetchConnections();
48+
if (!this.props.connectionsLoading) {
49+
this.props.fetchConnections();
50+
}
4851
};
4952

5053
onPageChange = (page) => {
@@ -77,7 +80,7 @@ class Users extends Component {
7780
error,
7881
users,
7982
total,
80-
connections,
83+
connectionsLoading,
8184
accessLevel,
8285
nextPage,
8386
pages,
@@ -102,7 +105,7 @@ class Users extends Component {
102105
<div className="row content-header">
103106
<div className="col-xs-12 user-table-content">
104107
<h1>{languageDictionary.usersTitle || 'Users'}</h1>
105-
{( role > 0 && showCreateUser) ?
108+
{( !connectionsLoading && role > 0 && showCreateUser) ?
106109
<button id="create-user-button" className="btn btn-success pull-right new" onClick={this.createUser}>
107110
<i className="icon-budicon-473"></i>
108111
{languageDictionary.createUserButtonText || 'Create User'}
@@ -158,6 +161,7 @@ function mapStateToProps(state) {
158161
loading: state.users.get('loading'),
159162
users: state.users.get('records').toJS(),
160163
connections: state.connections.get('records').toJS(),
164+
connectionsLoading: state.connections.get('loading'),
161165
total: state.users.get('total'),
162166
nextPage: state.users.get('nextPage'),
163167
pages: state.users.get('pages'),

server/lib/multipartRequest.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ export default function(client, entity, opts = {}, fetchOptions = {} ) {
2121
let total = 0;
2222
let pageCount = 0;
2323

24-
console.log({options})
25-
2624
const getTotals = () =>
2725
getter({ ...options, include_totals: true, page: 0 })
2826
.then((response) => {

server/routes/connections.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import multipartRequest from '../lib/multipartRequest';
66
// This is the number of connections in a tenant which the DAE can reasonably handle. More than this and it fails to
77
// finish loading connections and the "create user" button is never shown. If there are more connections than this
88
// in the tenant, we will return zero connections to the front end, and it will use a free text box for connection name
9-
// in the create user dialogue.
10-
const CONNECTIONS_FETCH_LIMIT = 200;
9+
// in the create user dialogue.
10+
const CONNECTIONS_FETCH_LIMIT = 20000;
1111

1212
export default (scriptManager) => {
1313
const api = Router();
@@ -16,7 +16,7 @@ export default (scriptManager) => {
1616
req.auth0,
1717
'connections',
1818
{ strategy: 'auth0', fields: 'id,name,strategy,options' },
19-
{ limit: CONNECTIONS_FETCH_LIMIT, perPage: 20 }
19+
{ limit: CONNECTIONS_FETCH_LIMIT, perPage: 100 }
2020
)
2121
.then((connections) => {
2222
global.connections = connections.map(conn => ({ name: conn.name, id: conn.id }));

0 commit comments

Comments
 (0)