blob: 4eff0cd5bd84f30b21a12954012dbc50b71ad99a [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
Andrew Geisslerba5e3f32018-05-24 10:58:00 -07009window.angular && (function(angular) {
10 'use strict';
Iftekharul Islamcd789502017-04-19 14:37:55 -050011
Andrew Geisslerba5e3f32018-05-24 10:58:00 -070012 angular
13 .module('app.configuration')
14 .controller('networkController', [
15 '$scope',
16 '$window',
17 'APIUtils',
18 'dataService',
19 function($scope, $window, APIUtils, dataService) {
20 $scope.dataService = dataService;
21 $scope.network = {};
22 $scope.interface = {};
23 $scope.networkDevice = false;
24 $scope.hostname = '';
Iftekharul Islam2a489552017-11-02 13:23:08 -050025
Andrew Geisslerba5e3f32018-05-24 10:58:00 -070026 $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 });
39 }
40 ]);
Iftekharul Islamcd789502017-04-19 14:37:55 -050041
42})(angular);