Skip to content

Commit

Permalink
add charts to admin exploration of user #4
Browse files Browse the repository at this point in the history
  • Loading branch information
matyaskopp committed Dec 8, 2021
1 parent 5843a29 commit 7cdf3fb
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
20 changes: 19 additions & 1 deletion app/routes/adminRoutes.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,31 @@ router.get('/admin/user/:userId', function (req, res, next) {
let user = req.session.user;
adminController.getUser(user.user_id, req.params.userId)
.then(data => {
res.render('user-detail', {user: user, user_detail: data, users_active: true});
//res.render('user-detail', {user: user, user_detail: data, users_active: true});
const len = 21;
const last_date = (new Date).toISOString().slice(0,10);
userController.getWeeklyCountsByService(req.params.userId, last_date , len).then(weekly => {
res.render('user-detail', {
user: user,
servicecounts: weekly,
period_length: len,
date: Date.parse(last_date),
initialview: (new Date).toISOString().slice(0,7),
users_active: true,
user_detail: data,
type: 'user',
filter: req.params.userId,
datalines: ["units", "requests", "body_bytes_sent"]
});
})
})
.catch(err => {
res.render('user-detail', {user: user, error: 'No User Found', users_active: true});
});
});



router.get('/admin/ips', function (req, res, next) {
logger.trace();
let user = req.session.user;
Expand Down
5 changes: 3 additions & 2 deletions app/views/user-detail.pug
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,12 @@ block content
i.material-icons= user_detail.is_admin ? 'settings' : ''
.divider
p= user_detail.email +" | " + user_detail.organization
.col.s12
.col.s12.hide
.card
.card-content
.card-title Service Pricing
p TODO
include includes/data.pug
.col.s12
.card
.card-image
Expand All @@ -57,7 +58,7 @@ block content
"render": function ( data, type, row, meta ) { return row[meta['col']] ? moment(row[meta['col']]).format('YYYY-MM-DD') : '';}
}
]
.col.s12
.col.s12.hide
.card
.card-content
.card-title Activity Log
Expand Down

0 comments on commit 7cdf3fb

Please sign in to comment.