xref: /openbmc/phosphor-webui/app/configuration/controllers/snmp-controller.js (revision ff64c54a93aaf1ffb4df4b2d4c16c392d869f533)
1*ff64c54aSGunnar Mills/**
2*ff64c54aSGunnar Mills * Controller for SNMP
3*ff64c54aSGunnar Mills *
4*ff64c54aSGunnar Mills * @module app/configuration
5*ff64c54aSGunnar Mills * @exports snmpController
6*ff64c54aSGunnar Mills * @name snmpController
7*ff64c54aSGunnar Mills */
8*ff64c54aSGunnar Mills
9*ff64c54aSGunnar Millswindow.angular && (function(angular) {
10*ff64c54aSGunnar Mills  'use strict';
11*ff64c54aSGunnar Mills
12*ff64c54aSGunnar Mills  angular.module('app.configuration').controller('snmpController', [
13*ff64c54aSGunnar Mills    '$scope', '$window', 'APIUtils',
14*ff64c54aSGunnar Mills    function($scope, $window, APIUtils) {
15*ff64c54aSGunnar Mills      $scope.managers = {};
16*ff64c54aSGunnar Mills      $scope.loading = true;
17*ff64c54aSGunnar Mills
18*ff64c54aSGunnar Mills      var getSNMPManagers = APIUtils.getSNMPManagers().then(
19*ff64c54aSGunnar Mills          function(data) {
20*ff64c54aSGunnar Mills            $scope.managers = data.data;
21*ff64c54aSGunnar Mills          },
22*ff64c54aSGunnar Mills          function(error) {
23*ff64c54aSGunnar Mills            console.log(JSON.stringify(error));
24*ff64c54aSGunnar Mills          });
25*ff64c54aSGunnar Mills
26*ff64c54aSGunnar Mills      getSNMPManagers.finally(function() {
27*ff64c54aSGunnar Mills        $scope.loading = false;
28*ff64c54aSGunnar Mills      });
29*ff64c54aSGunnar Mills    }
30*ff64c54aSGunnar Mills  ]);
31*ff64c54aSGunnar Mills})(angular);
32