blob: 1ba731a67defbc4649364596a795fd6addfc7f64 [file] [log] [blame]
Iftekharul Islamcd789502017-04-19 14:37:55 -05001/**
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', [
Gunnar Millseedefd32018-02-28 17:02:34 -060016 '$scope',
17 '$window',
18 'APIUtils',
Iftekharul Islamcd789502017-04-19 14:37:55 -050019 'dataService',
20 function($scope, $window, APIUtils, dataService){
21 $scope.dataService = dataService;
Iftekharul Islam2a489552017-11-02 13:23:08 -050022 $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 });
Iftekharul Islamcd789502017-04-19 14:37:55 -050040 }
41 ]
42 );
43
44})(angular);