James Feist | e8634e6 | 2018-09-07 14:25:48 -0700 | [diff] [blame] | 1 | /** |
| 2 | * Controller for Redfish |
| 3 | * |
| 4 | * @module app/redfish |
| 5 | * @exports redfishController |
| 6 | * @name redfishController |
| 7 | * @version 0.1.0 |
| 8 | */ |
| 9 | |
| 10 | window.angular && (function(angular) { |
| 11 | 'use strict'; |
| 12 | |
| 13 | angular.module('app.redfish').controller('redfishController', [ |
| 14 | '$scope', '$http', 'dataService', '$routeParams', |
| 15 | function($scope, $http, DataService, $routeParams) { |
| 16 | $scope.redfishData = {}; |
| 17 | $scope.isObject = angular.isObject; |
| 18 | $scope.isArray = angular.isArray; |
| 19 | $scope.loading = true; |
| 20 | $http({ |
| 21 | method: 'GET', |
| 22 | url: DataService.getHost() + '/redfish/' + $routeParams.path, |
| 23 | withCredentials: true |
| 24 | }) |
| 25 | .then( |
| 26 | function(response) { |
| 27 | $scope.redfishData = response.data; |
| 28 | }, |
| 29 | function(error) { |
| 30 | $scope.display_error = true; |
| 31 | console.log(error); |
| 32 | }) |
| 33 | .finally(function() { |
| 34 | $scope.loading = false; |
| 35 | }); |
| 36 | } |
| 37 | |
| 38 | ]); |
| 39 | })(angular); |