blob: f08989b4913c919bc11b1d1a55b83cc7d47b2400 [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
Iftekharul Islamcd789502017-04-19 14:37:55 -05007 */
8
9window.angular && (function (angular) {
10 'use strict';
11
12 angular
13 .module('app.configuration')
14 .controller('networkController', [
Gunnar Millseedefd32018-02-28 17:02:34 -060015 '$scope',
16 '$window',
17 'APIUtils',
Iftekharul Islamcd789502017-04-19 14:37:55 -050018 'dataService',
19 function($scope, $window, APIUtils, dataService){
20 $scope.dataService = dataService;
Iftekharul Islam2a489552017-11-02 13:23:08 -050021 $scope.network = {};
22 $scope.interface = {};
23 $scope.networkDevice = false;
24 $scope.hostname = "";
25
26 $scope.selectInterface = function(interfaceId){
27 $scope.interface = $scope.network.interfaces[interfaceId];
28 $scope.selectedInterface = interfaceId;
29 $scope.networkDevice = false;
30 }
31 APIUtils.getNetworkInfo().then(function(data){
32 $scope.network = data.formatted_data;
33 $scope.hostname = data.hostname;
34 if($scope.network.interface_ids.length){
35 $scope.selectedInterface = $scope.network.interface_ids[0];
36 $scope.interface = $scope.network.interfaces[$scope.selectedInterface];
37 }
38 });
Iftekharul Islamcd789502017-04-19 14:37:55 -050039 }
40 ]
41 );
42
43})(angular);