mirror of
https://github.com/ansible/awx.git
synced 2026-03-06 03:01:06 -03:30
fixes issue with ui-view for network UI
and closes network UI socket connections after closing the network UI
This commit is contained in:
@@ -19,14 +19,13 @@
|
|||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body data-user-agent="{{userAgent}}">
|
<body data-user-agent="{{userAgent}}">
|
||||||
<div ui-view="networking"><div>
|
<div ui-view="networking"></div>
|
||||||
<at-layout>
|
<at-layout>
|
||||||
<bread-crumb></bread-crumb>
|
<bread-crumb></bread-crumb>
|
||||||
<toast></toast>
|
<toast></toast>
|
||||||
<div class="container-fluid" id="content-container">
|
<div class="container-fluid" id="content-container">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-lg-12" ui-view>
|
<div class="col-lg-12" ui-view></div>
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<!-- Password Dialog -->
|
<!-- Password Dialog -->
|
||||||
<div id="password-modal" style="display: none;"></div>
|
<div id="password-modal" style="display: none;"></div>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<div class="at-Layout-side"
|
<div class="at-Layout-side"
|
||||||
ng-class="{'at-Layout-side--expanded': vm.isExpanded && layoutVm.isLoggedIn}" ng-show="layoutVm.isLoggedIn && !layoutVm.licenseIsMissing">
|
ng-class="{'at-Layout-side--expanded': vm.isExpanded && layoutVm.isLoggedIn}" ng-show="layoutVm.isLoggedIn && !layoutVm.licenseIsMissing && layoutVm.currentState !== 'inventories.edit.networking'">
|
||||||
<div class="at-Layout-sideNavItem at-Layout-sideNavToggle" ng-click="vm.toggleExpansion()"
|
<div class="at-Layout-sideNavItem at-Layout-sideNavToggle" ng-click="vm.toggleExpansion()"
|
||||||
ng-show="layoutVm.isLoggedIn && !layoutVm.licenseIsMissing">
|
ng-show="layoutVm.isLoggedIn && !layoutVm.licenseIsMissing && layoutVm.currentState !== 'inventories.edit.networking'">
|
||||||
<i class="fa fa-bars"></i>
|
<i class="fa fa-bars"></i>
|
||||||
</div>
|
</div>
|
||||||
<ng-transclude></ng-transclude>
|
<ng-transclude></ng-transclude>
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
width:100%;
|
width:100%;
|
||||||
align-items: flex-end;
|
align-items: flex-end;
|
||||||
position:absolute;
|
position:absolute;
|
||||||
|
z-index: 1100;
|
||||||
}
|
}
|
||||||
|
|
||||||
.Networking-top{
|
.Networking-top{
|
||||||
@@ -135,6 +136,7 @@
|
|||||||
|
|
||||||
.Networking-dropDown{
|
.Networking-dropDown{
|
||||||
left:-2px!important;
|
left:-2px!important;
|
||||||
|
z-index: 1101;
|
||||||
}
|
}
|
||||||
|
|
||||||
.Networking-searchButton{
|
.Networking-searchButton{
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ function NetworkingController (models, $state, $scope, strings) {
|
|||||||
vm.groups = [];
|
vm.groups = [];
|
||||||
$scope.devices = [];
|
$scope.devices = [];
|
||||||
vm.close = () => {
|
vm.close = () => {
|
||||||
|
$scope.$broadcast('awxNet-closeNetworkUI');
|
||||||
$state.go('inventories');
|
$state.go('inventories');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ var NetworkUIController = function($scope,
|
|||||||
$http,
|
$http,
|
||||||
$q,
|
$q,
|
||||||
$state,
|
$state,
|
||||||
|
$log,
|
||||||
ProcessErrors,
|
ProcessErrors,
|
||||||
ConfigService,
|
ConfigService,
|
||||||
rbacUiControlService) {
|
rbacUiControlService) {
|
||||||
@@ -269,19 +270,19 @@ var NetworkUIController = function($scope,
|
|||||||
$scope.for_each_page('/api/v2/inventories/' + $scope.inventory_id + '/hosts/',
|
$scope.for_each_page('/api/v2/inventories/' + $scope.inventory_id + '/hosts/',
|
||||||
function(all_results) {
|
function(all_results) {
|
||||||
let hosts = all_results;
|
let hosts = all_results;
|
||||||
console.log(hosts.length);
|
$log.debug(hosts.length);
|
||||||
for(var i = 0; i<hosts.length; i++) {
|
for(var i = 0; i<hosts.length; i++) {
|
||||||
console.log(i);
|
$log.debug(i);
|
||||||
try {
|
try {
|
||||||
let device_type = null;
|
let device_type = null;
|
||||||
let device_name = null;
|
let device_name = null;
|
||||||
let device = null;
|
let device = null;
|
||||||
let host = hosts[i];
|
let host = hosts[i];
|
||||||
device_name = host.name;
|
device_name = host.name;
|
||||||
console.log(device_name);
|
$log.debug(device_name);
|
||||||
if (host.variables !== "") {
|
if (host.variables !== "") {
|
||||||
host.data = jsyaml.safeLoad(host.variables);
|
host.data = jsyaml.safeLoad(host.variables);
|
||||||
console.log(host.data);
|
$log.debug(host.data);
|
||||||
} else {
|
} else {
|
||||||
host.data = {};
|
host.data = {};
|
||||||
}
|
}
|
||||||
@@ -297,14 +298,14 @@ var NetworkUIController = function($scope,
|
|||||||
$scope.update_links_in_vars_by_device(device_name, host.data);
|
$scope.update_links_in_vars_by_device(device_name, host.data);
|
||||||
}
|
}
|
||||||
if ($scope.devices_by_name[device_name] === undefined) {
|
if ($scope.devices_by_name[device_name] === undefined) {
|
||||||
console.log(['adding', device_name]);
|
$log.debug(['adding', device_name]);
|
||||||
device = new models.Device(0, device_name, 0, 0, device_type, host.id);
|
device = new models.Device(0, device_name, 0, 0, device_type, host.id);
|
||||||
device.icon = true;
|
device.icon = true;
|
||||||
device.variables = host.data;
|
device.variables = host.data;
|
||||||
$scope.inventory_toolbox.items.push(device);
|
$scope.inventory_toolbox.items.push(device);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
$log.debug(error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, 100);
|
}, 100);
|
||||||
@@ -950,7 +951,7 @@ var NetworkUIController = function($scope,
|
|||||||
};
|
};
|
||||||
|
|
||||||
$scope.create_device = function(data) {
|
$scope.create_device = function(data) {
|
||||||
console.log(data);
|
$log.debug(data);
|
||||||
var device = new models.Device(data.id,
|
var device = new models.Device(data.id,
|
||||||
data.name,
|
data.name,
|
||||||
data.x,
|
data.x,
|
||||||
@@ -979,7 +980,7 @@ var NetworkUIController = function($scope,
|
|||||||
};
|
};
|
||||||
|
|
||||||
$scope.onLinkCreate = function(data) {
|
$scope.onLinkCreate = function(data) {
|
||||||
console.log(data);
|
$log.debug(data);
|
||||||
$scope.create_link(data);
|
$scope.create_link(data);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1011,7 +1012,7 @@ var NetworkUIController = function($scope,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.log(new_link);
|
$log.debug(new_link);
|
||||||
if (new_link.from_interface !== null && new_link.to_interface !== null) {
|
if (new_link.from_interface !== null && new_link.to_interface !== null) {
|
||||||
new_link.from_interface.dot();
|
new_link.from_interface.dot();
|
||||||
new_link.to_interface.dot();
|
new_link.to_interface.dot();
|
||||||
@@ -1227,12 +1228,12 @@ var NetworkUIController = function($scope,
|
|||||||
$scope.link_id_seq = util.natural_numbers(max_link_id);
|
$scope.link_id_seq = util.natural_numbers(max_link_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(['data.inventory_toolbox', data.inventory_toolbox]);
|
$log.debug(['data.inventory_toolbox', data.inventory_toolbox]);
|
||||||
if (data.inventory_toolbox !== undefined) {
|
if (data.inventory_toolbox !== undefined) {
|
||||||
$scope.inventory_toolbox.items = [];
|
$scope.inventory_toolbox.items = [];
|
||||||
for (i = 0; i < data.inventory_toolbox.length; i++) {
|
for (i = 0; i < data.inventory_toolbox.length; i++) {
|
||||||
device = data.inventory_toolbox[i];
|
device = data.inventory_toolbox[i];
|
||||||
console.log(device);
|
$log.debug(device);
|
||||||
if (device.device_type === undefined) {
|
if (device.device_type === undefined) {
|
||||||
device.device_type = device.type;
|
device.device_type = device.type;
|
||||||
}
|
}
|
||||||
@@ -1247,7 +1248,7 @@ var NetworkUIController = function($scope,
|
|||||||
}
|
}
|
||||||
$scope.inventory_toolbox.items.push(new_device);
|
$scope.inventory_toolbox.items.push(new_device);
|
||||||
}
|
}
|
||||||
console.log($scope.inventory_toolbox.items);
|
$log.debug($scope.inventory_toolbox.items);
|
||||||
}
|
}
|
||||||
|
|
||||||
$scope.updateInterfaceDots();
|
$scope.updateInterfaceDots();
|
||||||
@@ -1322,6 +1323,12 @@ var NetworkUIController = function($scope,
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$scope.$on('awxNet-closeNetworkUI', function(){
|
||||||
|
$scope.control_socket.close();
|
||||||
|
if ($scope.tests_enabled) {
|
||||||
|
$scope.test_socket.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// End web socket
|
// End web socket
|
||||||
//
|
//
|
||||||
@@ -1345,10 +1352,10 @@ var NetworkUIController = function($scope,
|
|||||||
$scope.$apply();
|
$scope.$apply();
|
||||||
}, 17);
|
}, 17);
|
||||||
|
|
||||||
console.log("Network UI started");
|
$log.debug("Network UI started");
|
||||||
|
|
||||||
$scope.$on('$destroy', function () {
|
$scope.$on('$destroy', function () {
|
||||||
console.log("Network UI stopping");
|
$log.debug("Network UI stopping");
|
||||||
$scope.first_channel.send('UnbindDocument', {});
|
$scope.first_channel.send('UnbindDocument', {});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -1380,7 +1387,7 @@ var NetworkUIController = function($scope,
|
|||||||
try {
|
try {
|
||||||
$scope.first_channel.send(test_event.msg_type, test_event);
|
$scope.first_channel.send(test_event.msg_type, test_event);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log(["Test Error:", $scope.current_test, err]);
|
$log.debug(["Test Error:", $scope.current_test, err]);
|
||||||
$scope.test_errors.push(err);
|
$scope.test_errors.push(err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1455,7 +1462,7 @@ var NetworkUIController = function($scope,
|
|||||||
}
|
}
|
||||||
$scope.animations = [];
|
$scope.animations = [];
|
||||||
};
|
};
|
||||||
|
$log.debug("Network UI loaded");
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.NetworkUIController = NetworkUIController;
|
exports.NetworkUIController = NetworkUIController;
|
||||||
console.log("Network UI loaded");
|
|
||||||
|
|||||||
@@ -42,6 +42,7 @@
|
|||||||
|
|
||||||
.NetworkUI {
|
.NetworkUI {
|
||||||
background-color: @light-toolbox-background;
|
background-color: @light-toolbox-background;
|
||||||
|
z-index: 1100;
|
||||||
}
|
}
|
||||||
|
|
||||||
.NetworkUI__text {
|
.NetworkUI__text {
|
||||||
|
|||||||
Reference in New Issue
Block a user