From f72c5753c9c4b96e0976a3a993bb571ca365bfc4 Mon Sep 17 00:00:00 2001 From: ibuler Date: Tue, 1 Dec 2015 11:58:11 +0800 Subject: [PATCH 01/43] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=8E=A8=E9=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jperm/views.py | 3 +++ static/js/base.js | 6 +++--- templates/jperm/perm_role_detail.html | 26 +++++++++++++++++++++----- templates/jperm/perm_role_push.html | 2 +- 4 files changed, 28 insertions(+), 9 deletions(-) diff --git a/jperm/views.py b/jperm/views.py index 12ca395ba..da33d7ff7 100644 --- a/jperm/views.py +++ b/jperm/views.py @@ -396,9 +396,12 @@ def perm_role_push(request): # 渲染数据 header_title, path1, path2 = "系统角色", "角色管理", "角色推送" role_id = request.GET.get('id') + asset_ids = request.GET.get('asset_id') role = get_object(PermRole, id=role_id) assets = Asset.objects.all() asset_groups = AssetGroup.objects.all() + if asset_ids: + need_push_asset = [get_object(Asset, id=asset_id) for asset_id in asset_ids.split(',')] if request.method == "POST": # 获取推荐角色的名称列表 diff --git a/static/js/base.js b/static/js/base.js index a8aa99b70..b872558f3 100644 --- a/static/js/base.js +++ b/static/js/base.js @@ -16,9 +16,9 @@ function check_all(form) { } } -function checkAll(){ - var checklist = document.getElementsByName ("checked"); - if(document.getElementById("check_all").checked) +function checkAll(id, name){ + var checklist = document.getElementsByName(name); + if(document.getElementById(id).checked) { for(var i=0;i - + 主机 密钥 @@ -188,7 +188,7 @@ {% for asset, info in pushed_asset.items %} - + {{ asset.hostname }} {{ info.key | yesno:"是,否,未知" }} @@ -220,7 +220,6 @@ - @@ -229,9 +228,13 @@
- +
+ 推送 + @@ -239,6 +242,9 @@ {% for asset in need_push_asset %} + @@ -276,10 +282,11 @@ $('.del_muti').click(function(){ var check_array = []; if (confirm("确定删除")) { - $(".gradeX input:checked").each(function() { + $(".gradeX input[name='asset_id']:checked").each(function() { check_array.push($(this).attr("value")) }); var url = '/jperm/role/recycle/?role_id={{ role.id }}&asset_id=' + check_array.join(','); + console.log(check_array); $.get(url, {}, function(data){ @@ -290,6 +297,15 @@ return false; }); + $('.push_muti').click(function(){ + var check_array = []; + $(".gradeX input[name='asset_no_push_id']:checked").each(function() { + check_array.push($(this).attr("value")) + }); + var url = '/jperm/role/push/?id={{ role.id }}&asset_id=' + check_array.join(','); + $(this).attr('href', url) + }) + }) {% endblock %} \ No newline at end of file diff --git a/templates/jperm/perm_role_push.html b/templates/jperm/perm_role_push.html index dfa4a109c..480e4ef1b 100644 --- a/templates/jperm/perm_role_push.html +++ b/templates/jperm/perm_role_push.html @@ -45,7 +45,7 @@
From 6b7937c639e7386edfc3348f7e0111f91c5ec08e Mon Sep 17 00:00:00 2001 From: ibuler Date: Tue, 1 Dec 2015 13:21:42 +0800 Subject: [PATCH 02/43] =?UTF-8?q?=E6=99=AE=E9=80=9A=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- templates/index_cu.html | 245 +++++++++++----------------------------- templates/nav.html | 73 +----------- 2 files changed, 68 insertions(+), 250 deletions(-) diff --git a/templates/index_cu.html b/templates/index_cu.html index bfc8ef030..5130338d7 100644 --- a/templates/index_cu.html +++ b/templates/index_cu.html @@ -5,197 +5,84 @@
-
-
-
-
使用说明
-
- - - - - - - - - +
+
+
+
+
使用说明
+
-
-
- 迎使用Jumpserver跳板机系统, - 首先需要 下载 登录跳板机的SSH密钥文件,然后导入到工具或者ssh命令指定密钥文件(确保密钥文件权限600),输入收到的密钥密码,登录跳板机。 - 登录后根据提示进行操作。跳板机web界面支持修改密码、个人信息和上传下载文件等功能,可以向管理员申请权限。 +
+ 迎使用Jumpserver跳板机系统, + 首先需要 下载 登录跳板机的SSH密钥文件,然后导入到工具或者ssh命令指定密钥文件(确保密钥文件权限600),输入收到的密钥密码,登录跳板机。 + 登录后根据提示进行操作。跳板机web界面支持修改密码、个人信息和上传下载文件等功能,可以向管理员申请权限。 +
- -
-
-
已授权主机
-
-
总共:{{ host_count }}
- - - - - - - - - - -
-
- -
-
-
- +
+
+
+
登录记录
+
+ 最近登录 +
-
- -
+ {% if not logs_last %} + (暂无) + {% endif %} +
+ {% if logs_num > 10 %} + + {% endif %} +
-
- -
-
- -
-
-
- - - -
- -
- -
-
+ + 主机 IP
+ + {{ asset.hostname }} {{ asset.ip }}
- - - - - - - - {# #} - - - - - - - {% for asset in assets %} - - - - - - - {# #} - - - - - {% endfor %} - -
- - 主机名 IP地址 IDC 所属主机组 配置信息 操作系统 使用默认管理 操作
- - {{ asset.hostname|default_if_none:"" }} {{ asset.ip|default_if_none:"" }} {{ asset.idc.name|default_if_none:"" }} {{ asset.group.all|group_str2 }}{{ asset.cpu }}|{{ asset.memory }}|{{ asset.disk }} - {{ asset.system_type|default_if_none:"" }}{{ asset.system_version|default_if_none:"" }} {{ asset.use_default_auth|bool2str }} - 详情 - {% ifnotequal session_role_id 0 %} - {% if user.role == 'admin' %} - - 编辑 - 更新 - 删除 - {% endif %} - {% endifnotequal %} -
-
-
- {% if user.role == 'admin' %} - - 修改 - {% endif %} -
- {% include 'paginator.html' %} -
- +
-
diff --git a/templates/nav.html b/templates/nav.html index 61bd8fe36..27c2a675e 100644 --- a/templates/nav.html +++ b/templates/nav.html @@ -51,58 +51,6 @@
{% endif %} -{% if request.session.role_id == 1 %} - -{% endif %} {% if request.session.role_id == 0 %}