diff --git a/jasset/views.py b/jasset/views.py index 253e6ee24..1a77f517b 100644 --- a/jasset/views.py +++ b/jasset/views.py @@ -306,6 +306,54 @@ def asset_list(request): def asset_edit_batch(request): af = AssetForm() asset_group_all = AssetGroup.objects.all() + + if request.method == 'POST': + env = request.POST.get('env', '') + idc_id = request.POST.get('idc', '') + port = request.POST.get('port', '') + use_default_auth = request.POST.get('use_default_auth', '') + username = request.POST.get('username', '') + password = request.POST.get('password', '') + group = request.POST.getlist('group', []) + cabinet = request.POST.get('cabinet', '') + comment = request.POST.get('comment', '') + asset_id_all = unicode(request.GET.get('asset_id_all', '')) + asset_id_all = asset_id_all.split(',') + for asset_id in asset_id_all: + asset = get_object(Asset, id=asset_id) + if asset: + if env: + asset.env = env + if idc_id: + idc = get_object(IDC, id=idc_id) + if idc: + asset.idc = idc + if port: + asset.port = port + if use_default_auth: + if use_default_auth == 'default': + asset.use_default_auth = 1 + asset.username = '' + asset.password = '' + elif use_default_auth == 'user_passwd': + asset.use_default_auth = 0 + asset.username = username + password_encode = CRYPTOR.encrypt(password) + asset.password = password_encode + if group: + group_instance = [] + for group_id in group: + g = get_object(AssetGroup, id=group_id) + if g: + group_instance.append(g) + asset.group = group_instance + if cabinet: + asset.cabinet = cabinet + if comment: + asset.comment = comment + asset.save() + return HttpResponse('ok') + return my_render('jasset/asset_edit_batch.html', locals(), request) diff --git a/static/files/excels/cmdb_excel_2015_11_19_22_05.xlsx b/static/files/excels/cmdb_excel_2015_11_19_22_05.xlsx new file mode 100644 index 000000000..0c2778b89 Binary files /dev/null and b/static/files/excels/cmdb_excel_2015_11_19_22_05.xlsx differ diff --git a/templates/jasset/asset_add_bak.html b/templates/jasset/asset_add_bak.html deleted file mode 100644 index 397d60aeb..000000000 --- a/templates/jasset/asset_add_bak.html +++ /dev/null @@ -1,166 +0,0 @@ -{% extends 'base.html' %} -{% load mytags %} -{% block content %} -{% include 'nav_cat_bar.html' %} -
-
-
-
-
-
填写资产基本信息
- -
- -
-
- -
-
-
- {% if error %} -
{{ error }}
- {% endif %} - {% if msg %} -
{{ msg }}
- {% endif %} -
-
-
-
- -
-
- -
- -
-
- -
-
- -
-
- -
-
-
- - - -
-
- -
- -
-
- -
-
-
-
- - -
-
-
- -
-
-
-
- -
-
-
- - -
-
-
-
-
-
-
-
-
-
-
-
-{% endblock %} - -{% block self_footer_js %} - - -{% endblock %} \ No newline at end of file diff --git a/templates/jasset/asset_edit_batch.html b/templates/jasset/asset_edit_batch.html index b41afcb7b..65987cd64 100644 --- a/templates/jasset/asset_edit_batch.html +++ b/templates/jasset/asset_edit_batch.html @@ -49,33 +49,31 @@ {{ af.port|bootstrap_horizontal }}
-
+
- - -{% endblock %} \ No newline at end of file diff --git a/templates/jasset/host_list_nop.html b/templates/jasset/host_list_nop.html deleted file mode 100644 index eb1e3dd34..000000000 --- a/templates/jasset/host_list_nop.html +++ /dev/null @@ -1,177 +0,0 @@ -{% extends 'base.html' %} -{% load mytags %} -{% block content %} -{% include 'nav_cat_bar.html' %} - -
-
-
-
-
-
主机详细信息列表
- -
- -
-
- 添加 - - - - - - - - - - - -
- -
- - - - - - - - - - - - - - - - - {% for post in posts %} - - - - - - - - - - - - - {% endfor %} - -
IP地址 端口号 登录方式 所属IDC 所属部门 所属主机组 是否激活 备注 操作
{{ post.ip }} {{ post.port }} {{ post.login_type|get_login_type }} {{ post.idc.name }} {{ post.dept.all | group_str2 }}{{ post.bis_group.all | group_str2_all }} {{ post.is_active|bool2str }} {{ post.comment }} - 详情 - {% ifnotequal session_role_id 0 %} - 编辑 - 删除 - {% endifnotequal %} -
-
-
- - -
- -
-
-
-
-
-
-
- - - -{% endblock %} \ No newline at end of file diff --git a/templates/jasset/host_search.html b/templates/jasset/host_search.html deleted file mode 100644 index 38ed8c1ad..000000000 --- a/templates/jasset/host_search.html +++ /dev/null @@ -1,169 +0,0 @@ -{% load mytags %} - - - - - - - - - - {% ifnotequal session_role_id 0 %} - - {% else %} - - {% endifnotequal %} - - - - - - - {% for post in contacts.object_list %} - - - - - - - - {% ifnotequal session_role_id 0 %} - - {% else %} - - {% endifnotequal %} - - - - - {% endfor %} - -
IP地址 端口号 登录方式 所属IDC 所属业务组 是否激活 别名 添加时间 备注 操作
{{ post.ip }} {{ post.port }} {{ post.login_type|get_login_type }} {{ post.idc.name }} {{ post.bis_group.all | group_str2 }} {{ post.is_active|bool2str }} {{ post|get_user_alias:user_id }} {{ post.date_added|date:"Y-m-d H:i:s" }} {{ post.comment }} - 详情 - {% ifnotequal session_role_id 0 %} - 编辑 - 删除 - {% endifnotequal %} -
-
-
- - -
-
-
-
    - - {% if contacts.has_previous %} - - {% else %} - - {% endif %} - {% ifequal show_first 1 %} -
  • 1...
  • - {% endifequal %} - {% for page in page_range %} - {% ifequal current_page page %} -
  • {{ page }}
  • - {% else %} -
  • {{ page }}
  • - {% endifequal %} - {% endfor %} - {% ifequal show_end 1 %} -
  • ...{{ p.num_pages }}
  • - {% endifequal %} - {% if contacts.has_next %} - - {% else %} - - {% endif %} -
-
-
- -
- - diff --git a/templates/nav.html b/templates/nav.html index 979110492..12ae07d44 100644 --- a/templates/nav.html +++ b/templates/nav.html @@ -20,7 +20,7 @@