parent
76b05748aa
commit
aec714b56e
@ -1,12 +0,0 @@ |
||||
RocketChat.API.default.helperMethods.set('getLoggedInUser', function _getLoggedInUser() { |
||||
let user; |
||||
|
||||
if (this.request.headers['x-auth-token'] && this.request.headers['x-user-id']) { |
||||
user = RocketChat.models.Users.findOne({ |
||||
'_id': this.request.headers['x-user-id'], |
||||
'services.resume.loginTokens.hashedToken': Accounts._hashLoginToken(this.request.headers['x-auth-token']) |
||||
}); |
||||
} |
||||
|
||||
return user; |
||||
}); |
||||
@ -1,4 +1,4 @@ |
||||
RocketChat.API.v1.helperMethods.set('getLoggedInUser', function _getLoggedInUser() { |
||||
RocketChat.API.helperMethods.set('getLoggedInUser', function _getLoggedInUser() { |
||||
let user; |
||||
|
||||
if (this.request.headers['x-auth-token'] && this.request.headers['x-user-id']) { |
||||
@ -1,5 +1,5 @@ |
||||
//Convenience method, almost need to turn it into a middleware of sorts
|
||||
RocketChat.API.v1.helperMethods.set('getUserFromParams', function _getUserFromParams() { |
||||
RocketChat.API.helperMethods.set('getUserFromParams', function _getUserFromParams() { |
||||
const doesntExist = { _doesntExist: true }; |
||||
let user; |
||||
const params = this.requestParams(); |
||||
@ -1,4 +1,4 @@ |
||||
RocketChat.API.v1.helperMethods.set('isUserFromParams', function _isUserFromParams() { |
||||
RocketChat.API.helperMethods.set('isUserFromParams', function _isUserFromParams() { |
||||
const params = this.requestParams(); |
||||
|
||||
return (!params.userId && !params.username && !params.user) || |
||||
@ -1,4 +1,4 @@ |
||||
RocketChat.API.v1.helperMethods.set('parseJsonQuery', function _parseJsonQuery() { |
||||
RocketChat.API.helperMethods.set('parseJsonQuery', function _parseJsonQuery() { |
||||
let sort; |
||||
if (this.queryParams.sort) { |
||||
try { |
||||
@ -1,3 +1,3 @@ |
||||
RocketChat.API.v1.helperMethods.set('requestParams', function _requestParams() { |
||||
RocketChat.API.helperMethods.set('requestParams', function _requestParams() { |
||||
return ['POST', 'PUT'].includes(this.request.method) ? this.bodyParams : this.queryParams; |
||||
}); |
||||
@ -0,0 +1,39 @@ |
||||
<template name="appLogs"> |
||||
{{#with app}} |
||||
<section class="page-container page-list page-settings flex-tab-main-content"> |
||||
<header class="fixed-title"> |
||||
{{> burger}} |
||||
<a href="{{pathFor "app-manage" appId=id}}" title="{{_ "Back_to_Manage_Apps"}}"> |
||||
<i class="icon-left-open"></i> |
||||
</a> |
||||
|
||||
<h2> |
||||
<span class="room-title">{{_ "View_the_Logs_for"}}: "{{name}}"</span> |
||||
</h2> |
||||
</header> |
||||
<div class="content background-transparent-dark"> |
||||
{{#if isReady}} |
||||
<div class="rocket-form"> |
||||
{{#each logs}} |
||||
<div class="section section-collapsed"> |
||||
<div class="section-title"> |
||||
<div class="section-title-text"> |
||||
Logs for "{{method}}" ({{entries.length}}) {{totalTime}}ms |
||||
</div> |
||||
<div class="section-title-right"> |
||||
<button class="button primary expand"> |
||||
<span>{{_ "Expand"}}</span> |
||||
</button> |
||||
</div> |
||||
</div> |
||||
<div class="section-content"> |
||||
Content |
||||
</div> |
||||
</div> |
||||
{{/each}} |
||||
</div> |
||||
{{/if}} |
||||
</div> |
||||
</section> |
||||
{{/with}} |
||||
</template> |
||||
@ -0,0 +1,58 @@ |
||||
Template.appLogs.onCreated(function() { |
||||
const instance = this; |
||||
this.id = new ReactiveVar(FlowRouter.getParam('appId')); |
||||
this.ready = new ReactiveVar(false); |
||||
this.app = new ReactiveVar({}); |
||||
this.logs = new ReactiveVar([]); |
||||
|
||||
const id = this.id.get(); |
||||
const got = { info: false, logs: false }; |
||||
|
||||
RocketChat.API.get(`apps/${ id }`).then((result) => { |
||||
instance.app.set(result.app); |
||||
|
||||
got.info = true; |
||||
if (got.info && got.logs) { |
||||
this.ready.set(true); |
||||
} |
||||
}); |
||||
|
||||
RocketChat.API.get(`apps/${ id }/logs`).then((result) => { |
||||
console.log('logs result:', result); |
||||
|
||||
instance.logs.set(result.logs); |
||||
|
||||
got.logs = true; |
||||
if (got.info && got.logs) { |
||||
this.ready.set(true); |
||||
} |
||||
}); |
||||
}); |
||||
|
||||
Template.appLogs.helpers({ |
||||
isReady() { |
||||
if (Template.instance().ready != null) { |
||||
return Template.instance().ready.get(); |
||||
} |
||||
|
||||
return false; |
||||
}, |
||||
app() { |
||||
return Template.instance().app.get(); |
||||
}, |
||||
logs() { |
||||
return Template.instance().logs.get(); |
||||
} |
||||
}); |
||||
|
||||
Template.appLogs.events({ |
||||
'click .expand': (e) => { |
||||
$(e.currentTarget).closest('.section').removeClass('section-collapsed'); |
||||
$(e.currentTarget).closest('button').removeClass('expand').addClass('collapse').find('span').text(TAPi18n.__('Collapse')); |
||||
}, |
||||
|
||||
'click .collapse': (e) => { |
||||
$(e.currentTarget).closest('.section').addClass('section-collapsed'); |
||||
$(e.currentTarget).closest('button').addClass('expand').removeClass('collapse').find('span').text(TAPi18n.__('Expand')); |
||||
} |
||||
}); |
||||
Loading…
Reference in new issue