mirror of
https://github.com/vale981/Vulcan
synced 2025-03-05 09:31:43 -05:00
allow single user view
This commit is contained in:
parent
e93f4062d8
commit
ec745b2d86
6 changed files with 18 additions and 17 deletions
|
@ -2,23 +2,25 @@ import React from 'react';
|
||||||
import { Components, withCurrentUser, AdminColumns } from 'meteor/vulcan:core';
|
import { Components, withCurrentUser, AdminColumns } from 'meteor/vulcan:core';
|
||||||
import { FormattedMessage } from 'meteor/vulcan:i18n';
|
import { FormattedMessage } from 'meteor/vulcan:i18n';
|
||||||
import Users from 'meteor/vulcan:users';
|
import Users from 'meteor/vulcan:users';
|
||||||
|
import { withRouter } from 'react-router';
|
||||||
|
|
||||||
import '../modules/columns.js';
|
import '../modules/columns.js';
|
||||||
|
|
||||||
const AdminHome = ({ currentUser }) =>
|
const AdminHome = ({ currentUser, match }) => {
|
||||||
<div className="admin-home page">
|
return <div className="admin-home page">
|
||||||
<Components.ShowIf check={Users.isAdmin} document={currentUser} failureComponent={<p className="admin-home-message"><FormattedMessage id="app.noPermission" /></p>}>
|
<Components.ShowIf check={Users.isAdmin} document={currentUser} failureComponent={<p className="admin-home-message"><FormattedMessage id="app.noPermission" /></p>}>
|
||||||
<Components.Datatable
|
<Components.Datatable
|
||||||
collection={Users}
|
collection={Users}
|
||||||
columns={AdminColumns}
|
columns={AdminColumns}
|
||||||
options={{
|
options={{
|
||||||
fragmentName: 'UsersAdmin',
|
fragmentName: 'UsersAdmin',
|
||||||
terms: {view: 'usersAdmin'},
|
terms: {view: 'usersAdmin', query: match.params.id},
|
||||||
limit: 20
|
|
||||||
}}
|
}}
|
||||||
showEdit={true}
|
showEdit={true}
|
||||||
|
query={match.params.id}
|
||||||
/>
|
/>
|
||||||
</Components.ShowIf>
|
</Components.ShowIf>
|
||||||
</div>;
|
</div>;
|
||||||
|
};
|
||||||
|
|
||||||
export default withCurrentUser(AdminHome);
|
export default withRouter(withCurrentUser(AdminHome));
|
||||||
|
|
|
@ -5,9 +5,7 @@ import { Components } from 'meteor/vulcan:core';
|
||||||
const AdminUsersName = ({ document: user, flash }) =>
|
const AdminUsersName = ({ document: user, flash }) =>
|
||||||
<div>
|
<div>
|
||||||
|
|
||||||
<Components.Avatar user={user} link={false}/>
|
<span>{user.fullName}</span>
|
||||||
|
|
||||||
<span>{Users.getDisplayName(user)}</span>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ import AdminUsersCreated from '../components/users/columns/AdminUsersCreated.jsx
|
||||||
|
|
||||||
addAdminColumn([
|
addAdminColumn([
|
||||||
{
|
{
|
||||||
name: 'name',
|
name: 'fullName',
|
||||||
order: 1,
|
order: 1,
|
||||||
component: AdminUsersName
|
component: AdminUsersName
|
||||||
},
|
},
|
||||||
|
|
|
@ -9,6 +9,6 @@ addRoute({
|
||||||
});
|
});
|
||||||
addRoute({
|
addRoute({
|
||||||
name: 'admin2',
|
name: 'admin2',
|
||||||
path: '/admin/users',
|
path: '/admin/users/:id?',
|
||||||
component: () => getDynamicComponent(import('../components/AdminHome.jsx')),
|
component: () => getDynamicComponent(import('../components/AdminHome.jsx')),
|
||||||
});
|
});
|
||||||
|
|
|
@ -31,12 +31,12 @@ const getColumnName = column => (
|
||||||
|
|
||||||
class Datatable extends PureComponent {
|
class Datatable extends PureComponent {
|
||||||
|
|
||||||
constructor() {
|
constructor(props) {
|
||||||
super();
|
super(props);
|
||||||
this.updateQuery = this.updateQuery.bind(this);
|
this.updateQuery = this.updateQuery.bind(this);
|
||||||
this.state = {
|
this.state = {
|
||||||
value: '',
|
value: '',
|
||||||
query: '',
|
query: props.query ? props.query : '',
|
||||||
currentSort: {}
|
currentSort: {}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,6 +48,7 @@ const schema = {
|
||||||
type: String,
|
type: String,
|
||||||
optional: true,
|
optional: true,
|
||||||
canRead: ['guests'],
|
canRead: ['guests'],
|
||||||
|
searchable: true,
|
||||||
},
|
},
|
||||||
username: {
|
username: {
|
||||||
type: String,
|
type: String,
|
||||||
|
|
Loading…
Add table
Reference in a new issue