Skip to content

Commit

Permalink
Merge pull request #448 from wazuh/3.8-about-info
Browse files Browse the repository at this point in the history
Added app info to settings about section
  • Loading branch information
Jesús Ángel committed Jan 9, 2019
2 parents dd6f86c + 80720fe commit c5f5fb9
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 3 deletions.
24 changes: 24 additions & 0 deletions SplunkAppForWazuh/appserver/controllers/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,30 @@ def extensions(self, **kwargs):
return json.dumps({'error': str(e)})
return data_temp

@expose_page(must_login=False, methods=['GET'])
def app_info(self, **kwargs):
"""Obtain app information from file.
Parameters
----------
kwargs : dict
The request's parameters
"""
try:
stanza = cli.getConfStanza(
'package',
'app')
data_temp = stanza
stanza = cli.getConfStanza(
'package',
'splunk')
data_temp['splunk_version'] = stanza['version']
parsed_data = json.dumps(data_temp)
except Exception as e:
return json.dumps({'error': str(e)})
return parsed_data

@expose_page(must_login=False, methods=['GET'])
def get_api(self, **kwargs):
"""Obtain Wazuh API from DB.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,23 @@ define(['../module'], function(module) {
'/static/app/SplunkAppForWazuh/js/controllers/settings/about/about.html',
onEnter: $navigationService => {
$navigationService.storeRoute('settings.about')
},
controller: 'aboutCtrl',
resolve: {
appInfo: [
'$requestService',
async ($requestService, $state) => {
try {
const result = await $requestService.httpReq(
'GET',
'/manager/app_info'
)
return result.data
} catch (error) {
$state.go('settings.api')
}
}
]
}
})
// settings -> api
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,24 @@
<!-- About card section -->
<br><i class="fa fa-fw fa-info-circle wz-margin-left-5" aria-hidden="true"></i><span class="wz-headline-title">Welcome to the Splunk app for Wazuh</span>
<div layout="row">
<md-card flex class="wz-metric-color wz-md-card">
<md-card-content layout="row" class="wz-padding-metric">
<div class="wz-text-truncatable" flex>App version:
<span class="wz-text-bold" ng-bind="appInfo.version"></span>
</div>
<div class="wz-text-truncatable" flex>App revision:
<span class="wz-text-bold" ng-bind="appInfo.revision"></span>
</div>
<div class="wz-text-truncatable" flex>Splunk version:
<span class="wz-text-bold" ng-bind="appInfo.splunk_version"></span>
</div>
</md-card-content>
</md-card>
</div>

<div layout="row" layout-align="start start">
<md-card flex class="wz-md-card">
<md-card-content>
<i class="fa fa-fw fa-info-circle" aria-hidden="true"></i>
<span class="wz-headline-title">Welcome to the Splunk app for Wazuh</span>
<md-divider class="wz-margin-top-10"></md-divider>
<div layout="column" class="wz-padding-top-10">
<div layout-padding>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
define(['../../module'], function (controllers) {
'use strict'

class About {
constructor($scope, appInfo) {
this.scope = $scope
this.appInfo = appInfo
}

$onInit() {
this.scope.appInfo = this.appInfo
}

}
controllers.controller('aboutCtrl', About)
})
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ define([
'./index/settingsIndexCtrl',
'./api/settingsApiCtrl',
'./extensions/extensionsCtrl',
'./logs/logsCtrl'
'./logs/logsCtrl',
'./about/aboutCtrl'
], function() {})

0 comments on commit c5f5fb9

Please sign in to comment.