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

Finished feature more-static-demo-stuff.

parents b0d5fc33 f334c95c
No related branches found
No related tags found
No related merge requests found
<!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="interfaces.js"></script>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div ng-controller="interfaces">
<h2>Interfaces</h2>
<div>
<select
ng-options="r for r in routers"
ng-change="update_interfaces()"
ng-model="router"></select>
<select
ng-options="i for i in interfaces"
ng-change="update_status()"
ng-model="interface">
</select>
</div>
<div>
STATUS: {{status}}
</div>
</div>
</body>
</html>
\ No newline at end of file
var myApp = angular.module('inventoryApp', []);
myApp.controller('interfaces', function($scope, $http) {
$scope.routers = [];
$scope.router = '';
$scope.interfaces = [];
$scope.interface = '';
$scope.status = '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_interfaces = function() {
$http({
method: 'GET',
url: window.location.origin + "/data/interfaces/" + $scope.router
}).then(
function(rsp) {
$scope.interfaces = rsp.data.map(function(x){
return x.name
});
},
function(rsp) {$scope.interfaces = ['error'];}
);
}
$scope.update_status = function() {
$http({
method: 'GET',
url: window.location.origin
+ "/alarmsdb/interface-status?equipment="
+ $scope.router
+ "&interface="
+ $scope.interface
}).then(
function(rsp) {$scope.status = rsp.data.status;},
function(rsp) {$scope.interfaces = 'query error';}
);
}
});
\ No newline at end of file
......@@ -2,21 +2,12 @@
<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>
<script src="juniper.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">
<div ng-controller="juniper">
<h2>Interfaces</h2>
<div>
<select
......
var myApp = angular.module('inventoryApp', []);
myApp.controller('inventoryProvider', function($scope, $http) {
myApp.controller('juniper', function($scope, $http) {
$scope.routers = [];
$scope.router = '';
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment