Skip to content
Snippets Groups Projects
Commit c5c34d0a authored by Erik Reid's avatar Erik Reid
Browse files

Finished feature static-demo.

parents 5e6b4616 329e8a2c
No related branches found
No related tags found
No related merge requests found
var myApp = angular.module('inventoryApp', []);
myApp.controller('inventoryProvider', function($scope, $http) {
$scope.routers = [];
$scope.router = '';
$scope.interfaces = 'not yet loaded';
$scope.bgp = 'not yet loaded';
$scope.snmp = 'not yet loaded';
$http({
method: 'GET',
url: window.location.origin + "/data/routers"
}).then(
function(rsp) {$scope.routers = rsp.data;},
function(rsp) {$scope.routers = ['error'];}
);
$scope.update_interface = function() {
$http({
method: 'GET',
url: window.location.origin + "/data/interfaces/" + $scope.router
}).then(
function(rsp) {$scope.interfaces = rsp.data;},
function(rsp) {$scope.interfaces = 'error';}
);
$http({
method: 'GET',
url: window.location.origin + "/data/bgp/" + $scope.router
}).then(
function(rsp) {$scope.bgp = rsp.data;},
function(rsp) {$scope.bgp = 'error';}
);
$http({
method: 'GET',
url: window.location.origin + "/data/snmp/" + $scope.router
}).then(
function(rsp) {$scope.snmp = rsp.data;},
function(rsp) {$scope.snmp = 'error';}
);
}
});
\ No newline at end of file
<!doctype html>
<html ng-app="inventoryApp">
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.7.5/angular.min.js"></script>
<script src="inventoryProvider.js"></script>
<link rel="stylesheet" href="style.css">
</head>
<body>
<!--
<h2>Routers</h2>
<div ng-controller="inventoryProvider">
<ul name="routers" class="unstyled">
<li ng-repeat="r in routers">{{r}}</li>
</ul>
</div>
-->
<div ng-controller="inventoryProvider">
<h2>Interfaces</h2>
<div>
<select
ng-options="r for r in routers"
ng-change="update_interface()"
ng-model="router"></select>
</div>
<div class="column">
<p><b>interfaces</b></p>
{{interfaces}}
</div>
<div class="column">
<p><b>bgp</b></p>
{{bgp}}
</div>
<div class="column">
<p><b>snmp</b></p>
{{snmp}}
</div>
</div>
</body>
</html>
\ No newline at end of file
.column {
float: left;
width: 33.33%;
}
/* Clear floats after the columns */
.row:after {
content: "";
display: table;
clear: both;
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment