Add System Configuration Page
Parses json file and writes entites to page.
Change-Id: I486070deb48e0b447c904542148dbc3721f1facf
diff --git a/src/webserver_main.cpp b/src/webserver_main.cpp
index 3af461b..e39368d 100644
--- a/src/webserver_main.cpp
+++ b/src/webserver_main.cpp
@@ -150,6 +150,21 @@
return j;
});
+ CROW_ROUTE(app, "/intel/system_config").methods("GET"_method)([]() {
+ nlohmann::json j;
+ std::ifstream file("/var/configuration/system.json");
+
+ if(!file.good()){
+ return crow::response(400);
+ }
+ file >> j;
+ file.close();
+
+ auto res = crow::response(200);
+ res.json_value = j;
+ return res;
+ });
+
crow::logger::setLogLevel(crow::LogLevel::DEBUG);
auto test = app.get_routes();
app.debug_print();
diff --git a/static/CMakeLists.txt b/static/CMakeLists.txt
index a99abc7..b9137dd 100644
--- a/static/CMakeLists.txt
+++ b/static/CMakeLists.txt
@@ -20,6 +20,7 @@
js/angular.js
js/angular-ui-router-uib-modal.js
js/smart-table.js
+ js/systemConfigController.js
noVNC/core/inflator.js
noVNC/core/input/xtscancodes.js
@@ -60,6 +61,7 @@
partial-systeminfo.html
partial-fwupdate.html
partial-fwupdateconfirm.html
+ partial-systemconfig.html
)
set(OTHER_ASSETS
diff --git a/static/index.html b/static/index.html
index c2b5c98..e0a2058 100644
--- a/static/index.html
+++ b/static/index.html
@@ -37,7 +37,7 @@
<script type="text/javascript" src="static/js/ipmiController.js" defer></script>
<script type="text/javascript" src="static/js/sensorController.js" defer></script>
<script type="text/javascript" src="static/js/fwupdateController.js" defer></script>
-
+ <script type="text/javascript" src="static/js/systemConfigController.js" defer></script>
<script type="text/javascript" src="static/noVNC/core/util.js" defer></script>
<script type="text/javascript" src="static/noVNC/app/webutil.js" defer></script>
@@ -137,6 +137,7 @@
<li><a href="#">SOL</a></li>
<li><a href="#">SDR Configuration</a></li>
<li><a ui-sref="fwupdate">Firmware Update</a></li>
+ <li><a ui-sref="systemconfig">System Configuration</a></li>
</ul>
</li>
<li class="dropdown" uib-dropdown dropdown-append-to-body>
diff --git a/static/js/bmcApp.js b/static/js/bmcApp.js
index 1812261..fb641ab 100644
--- a/static/js/bmcApp.js
+++ b/static/js/bmcApp.js
@@ -128,6 +128,9 @@
.state('sensor',
{url : '/sensor', templateUrl : 'static/partial-sensor.html'})
+ .state('systemconfig',
+ {url: '/systemconfig', templateUrl : 'static/partial-systemconfig.html'})
+
.state(
'fwupdate',
{url : '/fwupdate', templateUrl : 'static/partial-fwupdate.html'})
diff --git a/static/js/systemConfigController.js b/static/js/systemConfigController.js
new file mode 100644
index 0000000..d32f6ce
--- /dev/null
+++ b/static/js/systemConfigController.js
@@ -0,0 +1,11 @@
+angular.module('bmcApp')
+ .controller(
+ 'systemConfigController', [
+ '$scope', '$http',
+ function($scope, $http) {
+ $http.get('/intel/system_config').then(function(response) {
+ $scope.configuration = response.data;
+ });
+ }
+ ]
+ );
diff --git a/static/partial-systemconfig.html b/static/partial-systemconfig.html
new file mode 100644
index 0000000..a6b48d3
--- /dev/null
+++ b/static/partial-systemconfig.html
@@ -0,0 +1,28 @@
+<div class="container" ng-controller="systemConfigController">
+ <div class="row">
+ <div class="col-md-12">
+ <div class="box box-primary">
+ <div class="box-header with-border">
+ <h4>System Configuration
+ </h4>
+ <div class="horizontal-scroll box-body"> </div>
+
+ <table class="table table-striped system-status-table" st-table="smartTableData">
+ <thead>
+ <tr class="sortable ">
+ <th class="table-id" st-sort="id" st-sort-default="true">#</th>
+ <th st-sort="name">Name</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr ng-repeat="(key, item) in configuration">
+ <td class="table-id">{{$index}}</td>
+ <td>{{item.name}}</td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ </div>
+ </div>
+ </div>
+</div>