mirror of
https://github.com/mmumshad/ansible-playable.git
synced 2025-03-09 23:38:54 +00:00
Feature - Integrate System API to view logs in UI
This commit is contained in:
parent
1690470269
commit
bf6c8743c5
15 changed files with 353 additions and 26 deletions
|
@ -2,9 +2,36 @@
|
|||
|
||||
export default class AdminController {
|
||||
/*@ngInject*/
|
||||
constructor(User) {
|
||||
constructor($scope, $sce, User, system, ansi2html) {
|
||||
'ngInject';
|
||||
const admin_ctrl = this;
|
||||
|
||||
// Use the User $resource to fetch all users
|
||||
this.users = User.query();
|
||||
|
||||
/**
|
||||
* Fetch Server Logs
|
||||
*/
|
||||
this.fetchServerLogs = function(){
|
||||
system.getLogs('server', (response) => {
|
||||
admin_ctrl.logsServer = $scope.result = $sce.trustAsHtml(ansi2html.toHtml(response.data).replace(/\n/g, "<br>"));
|
||||
}, (response) => {
|
||||
admin_ctrl.logsServer = $scope.result = $sce.trustAsHtml(ansi2html.toHtml(response.data).replace(/\n/g, "<br>"));
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Fetch API Logs
|
||||
*/
|
||||
this.fetchAPILogs = function(){
|
||||
system.getLogs('api', (response) => {
|
||||
admin_ctrl.logsAPI = $scope.result = $sce.trustAsHtml(ansi2html.toHtml(response.data).replace(/\n/g, "<br>"));
|
||||
}, (response) => {
|
||||
admin_ctrl.logsAPI = $scope.result = $sce.trustAsHtml(ansi2html.toHtml(response.data).replace(/\n/g, "<br>"));
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
delete(user) {
|
||||
|
|
|
@ -1,12 +1,36 @@
|
|||
<div class="container">
|
||||
<p>The delete user and user index api routes are restricted to users with the 'admin' role.</p>
|
||||
<ul class="list-group user-list">
|
||||
<li class="list-group-item" ng-repeat="user in admin.users">
|
||||
<div class="user-info">
|
||||
<strong>{{user.name}}</strong><br>
|
||||
<span class="text-muted">{{user.email}}</span>
|
||||
</div>
|
||||
<a ng-click="admin.delete(user)" class="trash"><span class="fa fa-trash fa-2x"></span></a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<uib-tabset active="active">
|
||||
<uib-tab index="0" heading="Users">
|
||||
<p>The delete user and user index api routes are restricted to users with the 'admin' role.</p>
|
||||
<ul class="list-group user-list">
|
||||
<li class="list-group-item" ng-repeat="user in admin.users">
|
||||
<div class="user-info">
|
||||
<strong>{{user.name}}</strong><br>
|
||||
<span class="text-muted">{{user.email}}</span> | <span class="text-muted">{{user.role}}</span>
|
||||
</div>
|
||||
<a ng-click="admin.delete(user)" class="trash"><span class="fa fa-trash fa-2x"></span></a>
|
||||
</li>
|
||||
</ul>
|
||||
</uib-tab>
|
||||
<uib-tab index="1" heading="Logs">
|
||||
|
||||
<uib-tabset active="active" >
|
||||
<uib-tab index="0" heading="Server" select="admin.fetchServerLogs()">
|
||||
<div style="background:black;color:lightgrey;width:100%;padding:20px;">
|
||||
<p class="logconsole" ng-bind-html="admin.logsServer"></p>
|
||||
</div>
|
||||
</uib-tab>
|
||||
<uib-tab index="1" heading="API" select="admin.fetchAPILogs()">
|
||||
<div style="background:black;color:lightgrey;width:100%;padding:20px;">
|
||||
<p class="logconsole" ng-bind-html="admin.logsAPI"></p>
|
||||
</div>
|
||||
</uib-tab>
|
||||
</uib-tabset>
|
||||
|
||||
|
||||
</uib-tab>
|
||||
|
||||
</uib-tabset>
|
||||
|
||||
</div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue