1
0
Fork 0
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:
Mumshad Mannambeth 2017-07-11 11:58:56 -04:00
parent 1690470269
commit bf6c8743c5
15 changed files with 353 additions and 26 deletions

View file

@ -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) {