Browse Source

[Update] 修改command 批量执行左侧选择系统用户

pull/3366/head
ibuler 5 years ago
parent
commit
87deb18791
  1. 2
      apps/assets/backends/manager.py
  2. 5
      apps/ops/templates/ops/command_execution_create.html
  3. 2
      apps/ops/views/command.py

2
apps/assets/backends/manager.py

@ -67,8 +67,6 @@ class AssetUserManager:
return AssetUserQuerySet(instances)
def get(self, username, asset, **kwargs):
print(username)
print(asset)
instances = self.filter(username, assets=[asset], **kwargs)
if len(instances) == 1:
return instances[0]

5
apps/ops/templates/ops/command_execution_create.html

@ -80,9 +80,7 @@
<select class="select2 form-control"
id="system-users-select">
{% for s in system_users %}
{% if s.protocol == 'ssh' and s.login_mode == 'auto' %}
<option value="{{ s.id }}">{{ s }}</option>
{% endif %}
<option value="{{ s.id }}" {% if s.protocol != 'ssh' or s.login_mode != 'auto' %}disabled{% endif %}>{{ s }}</option>
{% endfor %}
</select>
<button type="button"
@ -207,6 +205,7 @@
lineHeight: 1,
rightClickSelectsWord: true,
disableStdin: true,
cursorBlink: false,
theme: {
background: '#1f1b1b'
}

2
apps/ops/views/command.py

@ -70,7 +70,7 @@ class CommandExecutionStartView(PermissionsMixin, TemplateView):
user = self.request.user
with tmp_to_root_org():
util = AssetPermissionUtilV2(user)
system_users = [s for s in util.get_system_users() if s.protocol == 'ssh']
system_users = util.get_system_users()
return system_users
def get_context_data(self, **kwargs):

Loading…
Cancel
Save