|
|
|
@ -86,7 +86,7 @@
|
|
|
|
|
<div class="col-sm-2">
|
|
|
|
|
<select class="select2 form-control" id="system-users-select">
|
|
|
|
|
{% for s in system_users %}
|
|
|
|
|
<option value="{{ s.id }}" {% if s.protocol != 'ssh' or s.login_mode != 'auto' %}disabled{% endif %}>{{ s }}</option>
|
|
|
|
|
<option value="{{ s.id }}" {% if s.login_mode == 'manual' or s.protocol in 'mysql|telnet|vnc'%}disabled{% endif %}>{{ s }}</option>
|
|
|
|
|
{% endfor %}
|
|
|
|
|
</select>
|
|
|
|
|
<button type="button" class="btn btn-primary btn-execute" style="margin-top: 30px; width: 100%">
|
|
|
|
@ -138,11 +138,11 @@
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
callback: {
|
|
|
|
|
onCheck: onCheck
|
|
|
|
|
onCheck: onCheck,
|
|
|
|
|
onClick: onClick,
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$.get(url, function (data, status) {
|
|
|
|
|
$.fn.zTree.init($("#assetTree"), setting, data);
|
|
|
|
|
zTree = $.fn.zTree.getZTreeObj("assetTree");
|
|
|
|
@ -152,25 +152,29 @@
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function onClick(event, treeId, treeNode, clickFlag){
|
|
|
|
|
if (treeNode.meta.type === 'asset'){
|
|
|
|
|
let protocolsStr = treeNode.meta.asset.protocols + '';
|
|
|
|
|
if (protocolsStr.indexOf('ssh/') === -1){
|
|
|
|
|
toastr.warning("{% trans "Asset configuration does not include the SSH protocol" %}");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
function getSelectedAssetsNode() {
|
|
|
|
|
var nodes = zTree.getCheckedNodes(true);
|
|
|
|
|
var assetsNodeId = [];
|
|
|
|
|
var assetsNode = [];
|
|
|
|
|
nodes.forEach(function (node) {
|
|
|
|
|
if (node.meta.type === 'asset' && !node.isHidden) {
|
|
|
|
|
var protocols = node.meta.asset.protocols;
|
|
|
|
|
protocols.forEach(function (val) {
|
|
|
|
|
if (assetsNodeId.indexOf(node.id) === -1 && val.indexOf("ssh") > -1) {
|
|
|
|
|
assetsNodeId.push(node.id);
|
|
|
|
|
assetsNode.push(node)
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
var protocolsStr = node.meta.asset.protocols + '';
|
|
|
|
|
if (assetsNodeId.indexOf(node.id) === -1 && protocolsStr.indexOf('ssh') > -1){
|
|
|
|
|
assetsNodeId.push(node.id);
|
|
|
|
|
assetsNode.push(node)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
return assetsNode;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function onCheck(e, treeId, treeNode) {
|
|
|
|
|
var nodes = getSelectedAssetsNode();
|
|
|
|
|
var nodes_names = nodes.map(function (node) {
|
|
|
|
|