1/** 2 * Controller for network 3 * 4 * @module app/configuration 5 * @exports networkController 6 * @name networkController 7 * @version 0.1.0 8 */ 9 10window.angular && (function (angular) { 11 'use strict'; 12 13 angular 14 .module('app.configuration') 15 .controller('networkController', [ 16 '$scope', 17 '$window', 18 'APIUtils', 19 'dataService', 20 function($scope, $window, APIUtils, dataService){ 21 $scope.dataService = dataService; 22 $scope.network = {}; 23 $scope.interface = {}; 24 $scope.networkDevice = false; 25 $scope.hostname = ""; 26 27 $scope.selectInterface = function(interfaceId){ 28 $scope.interface = $scope.network.interfaces[interfaceId]; 29 $scope.selectedInterface = interfaceId; 30 $scope.networkDevice = false; 31 } 32 APIUtils.getNetworkInfo().then(function(data){ 33 $scope.network = data.formatted_data; 34 $scope.hostname = data.hostname; 35 if($scope.network.interface_ids.length){ 36 $scope.selectedInterface = $scope.network.interface_ids[0]; 37 $scope.interface = $scope.network.interfaces[$scope.selectedInterface]; 38 } 39 }); 40 } 41 ] 42 ); 43 44})(angular); 45