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

Refine New user modal #3529

Merged
merged 1 commit into from
Mar 5, 2019
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions client/app/lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,22 @@ import { isFunction, each, extend } from 'lodash';
export function routesToAngularRoutes(routes, template) {
const result = {};
template = extend({}, template); // convert to object
each(routes, ({ path, title, key }) => {
result[path] = extend({
each(routes, ({ path, title, key, ...resolve }) => {
// Convert to functions
each(resolve, (value, prop) => {
resolve[prop] = () => value;
});

result[path] = {
...template,
title,
// keep `resolve` from `template` (if exists)
resolve: extend({
resolve: {
...template.resolve,
...resolve,
currentPage: () => key,
}, template.resolve),
}, template);
},
};
});
return result;
}
Expand Down
8 changes: 4 additions & 4 deletions client/app/pages/users/UsersList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { currentUser } from '@/services/auth';
import { policy } from '@/services/policy';
import { User } from '@/services/user';
import navigateTo from '@/services/navigateTo';
import { $location, toastr } from '@/services/ng';
import { toastr } from '@/services/ng';
import { absoluteUrl } from '@/services/utils';

function UsersListActions({ user, enableUser, disableUser, deleteUser }) {
Expand Down Expand Up @@ -121,7 +121,7 @@ class UsersList extends React.Component {
];

componentDidMount() {
if ($location.path() === '/users/new') {
if (this.props.controller.params.isNewUserPage) {
this.showCreateUserDialog();
}
}
Expand Down Expand Up @@ -154,12 +154,12 @@ class UsersList extends React.Component {
this.props.controller.update();
}
}).finally(() => {
if ($location.path() === '/users/new') {
if (this.props.controller.params.isNewUserPage) {
navigateTo('users');
}
});
}
}
};

onTableRowClick = (event, item) => navigateTo('users/' + item.id);

Expand Down
1 change: 1 addition & 0 deletions client/app/pages/users/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export default function init() {
path: '/users/new',
title: 'Users',
key: 'active',
isNewUserPage: true,
gabrieldutra marked this conversation as resolved.
Show resolved Hide resolved
},
{
path: '/users/pending',
Expand Down