Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added app info to settings about section #448

Merged
merged 2 commits into from
Jan 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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() {})