-
Notifications
You must be signed in to change notification settings - Fork 11k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #530 from RocketChat/administration
User administration; Statistics
- Loading branch information
Showing
47 changed files
with
558 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -81,3 +81,4 @@ yasaricli:slugify | |
yasinuslu:blaze-meta | ||
rocketchat:colors | ||
raix:[email protected] | ||
monbro:mongodb-mapreduce-aggregation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -85,6 +85,7 @@ mizzao:[email protected] | |
mizzao:[email protected] | ||
[email protected] | ||
momentjs:[email protected] | ||
monbro:[email protected] | ||
[email protected] | ||
[email protected] | ||
mrt:[email protected] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,45 @@ | ||
Template.adminStatistics.helpers | ||
isAdmin: -> | ||
return Meteor.user().admin is true | ||
isReady: -> | ||
return Template.instance().ready.get() | ||
statistics: -> | ||
return Template.instance().statistics.get() | ||
inGB: (size) -> | ||
if size > 1073741824 | ||
return _.numberFormat(size / 1024 / 1024 / 1024, 2) + ' GB' | ||
return _.numberFormat(size / 1024 / 1024, 2) + ' MB' | ||
humanReadable: (time) -> | ||
days = Math.floor time / 86400 | ||
hours = Math.floor (time % 86400) / 3600 | ||
minutes = Math.floor ((time % 86400) % 3600) / 60 | ||
seconds = ((time % 86400) % 3600) % 60 | ||
out = "" | ||
if days > 0 | ||
out += "#{days} #{TAPi18next.t 'project:days'}, " | ||
if hours > 0 | ||
out += "#{hours} #{TAPi18next.t 'project:hours'}, " | ||
if minutes > 0 | ||
out += "#{minutes} #{TAPi18next.t 'project:minutes'}, " | ||
if seconds > 0 | ||
out += "#{seconds} #{TAPi18next.t 'project:seconds'}" | ||
return out | ||
numFormat: (number) -> | ||
return _.numberFormat(number, 2) | ||
|
||
Template.adminUsers.onRendered -> | ||
Template.adminStatistics.onRendered -> | ||
Tracker.afterFlush -> | ||
SideNav.setFlex "adminFlex" | ||
SideNav.openFlex() | ||
|
||
Template.adminStatistics.onCreated -> | ||
instance = @ | ||
@statistics = new ReactiveVar {} | ||
@ready = new ReactiveVar false | ||
|
||
Meteor.call 'generateStatistics', (error, statistics) -> | ||
instance.ready.set true | ||
if error | ||
toastr.error error.reason | ||
else | ||
instance.statistics.set statistics |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,11 @@ | ||
Template.adminUserChannels.helpers | ||
type: -> | ||
return if @t is 'd' then 'at' else if @t is 'p' then 'lock' else 'hash' | ||
return if @t is 'd' then 'at' else if @t is 'p' then 'lock' else 'hash' | ||
route: -> | ||
return switch @t | ||
when 'd' | ||
FlowRouter.path('direct', {username: @name}) | ||
when 'p' | ||
FlowRouter.path('group', {name: @name}) | ||
when 'c' | ||
FlowRouter.path('channel', {name: @name}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<template name="adminUserChannels"> | ||
<div class="user-info-channel"> | ||
<h3><a href="{{pathFor 'room' _id=rid}}"><i class="icon-{{type}}"></i> {{name}}</a></h3> | ||
<h3><a href="{{route}}"><i class="icon-{{type}}"></i> {{name}}</a></h3> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
Template.adminUserEdit.helpers | ||
email: -> | ||
return @emails?[0]?.address | ||
|
||
Template.adminUserEdit.events | ||
'click .cancel': (e, t) -> | ||
e.stopPropagation() | ||
e.preventDefault() | ||
t.cancel() | ||
|
||
'click .save': (e, t) -> | ||
e.stopPropagation() | ||
e.preventDefault() | ||
t.save() | ||
|
||
Template.adminUserEdit.onCreated -> | ||
instance = @ | ||
|
||
@cancel = -> | ||
$('.user-info-content').hide() | ||
$('#adminUserInfo').show() | ||
|
||
@save = -> | ||
userData = { _id: Template.currentData()._id } | ||
userData.name = $("#name", ".edit-form").val() | ||
|
||
unless userData._id and userData.name | ||
toastr.error TAPi18next.t 'project:The_field_is_required', TAPi18next.t 'project:Name' | ||
else | ||
Meteor.call 'updateUser', userData, (error, result) -> | ||
if result | ||
toastr.success t('User_updated_successfully') | ||
instance.cancel() | ||
if error | ||
toastr.error error.reason |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<template name="adminUserEdit"> | ||
<div class="about clearfix"> | ||
<form class="edit-form"> | ||
<h3>{{name}}</h3> | ||
<div class="input-line"> | ||
<label for="name">{{_ "Name"}}</label> | ||
<input type="text" id="name" autocomplete="off" value="{{name}}"> | ||
</div> | ||
</form> | ||
</div> | ||
<nav> | ||
<button class='button button-block cancel secondary'><span>{{_ "Cancel"}}</span></button> | ||
<button class='button button-block blue save'><span>{{_ "Save"}}</span></button> | ||
</nav> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.