diff --git a/apps/assets/models/__init__.py b/apps/assets/models/__init__.py
index 5ee3050c4..0414d03b3 100644
--- a/apps/assets/models/__init__.py
+++ b/apps/assets/models/__init__.py
@@ -6,3 +6,4 @@ from .idc import *
from .user import *
from .group import *
from .asset import *
+from .utils import *
diff --git a/apps/assets/models/utils.py b/apps/assets/models/utils.py
index ed2727cdb..b6c2d2ae6 100644
--- a/apps/assets/models/utils.py
+++ b/apps/assets/models/utils.py
@@ -2,19 +2,19 @@
# -*- coding: utf-8 -*-
#
-from . import IDC, SystemUser, AdminUser, AssetGroup, Asset, Tag
+from . import IDC, SystemUser, AdminUser, AssetGroup, Asset
-__all__ = ['initial', 'generate_fake']
+__all__ = ['init_model', 'generate_fake']
-def initial():
- for cls in [IDC, SystemUser, AdminUser, AssetGroup, Asset, Tag]:
+def init_model():
+ for cls in [IDC, SystemUser, AdminUser, AssetGroup, Asset]:
if hasattr(cls, 'initial'):
cls.initial()
def generate_fake():
- for cls in [IDC, SystemUser, AdminUser, AssetGroup, Asset, Tag]:
+ for cls in [IDC, SystemUser, AdminUser, AssetGroup, Asset]:
if hasattr(cls, 'generate_fake'):
cls.generate_fake()
diff --git a/apps/assets/templates/assets/asset_create.html b/apps/assets/templates/assets/asset_create.html
index 5535f2b64..d19fbb893 100644
--- a/apps/assets/templates/assets/asset_create.html
+++ b/apps/assets/templates/assets/asset_create.html
@@ -17,6 +17,7 @@
{{ form.public_ip|bootstrap_horizontal }}
{{ form.port|bootstrap_horizontal }}
{{ form.type|bootstrap_horizontal }}
+ {{ form.env|bootstrap_horizontal }}
{% trans 'Group' %}
diff --git a/apps/assets/templates/assets/asset_detail.html b/apps/assets/templates/assets/asset_detail.html
index d78da68f4..54aa387d6 100644
--- a/apps/assets/templates/assets/asset_detail.html
+++ b/apps/assets/templates/assets/asset_detail.html
@@ -22,6 +22,11 @@
Update
+
+
+ Delete
+
+
{% endif %}
@@ -55,6 +60,14 @@
{% trans 'IP' %}: |
{{ asset.ip }} |
+
+ {% trans 'Public IP' %}: |
+ {{ asset.public_ip }} |
+
+
+ {% trans 'Port' %}: |
+ {{ asset.port }} |
+
{% trans 'Admin user' %}: |
{% if asset.admin_user %}
@@ -63,25 +76,33 @@
None |
{% endif %}
-
- {% trans 'Other IP' %}: |
- {{ asset.other_ip }} |
-
{% trans 'Remote card IP' %}: |
{{ asset.remote_card_ip }} |
- {% trans 'Port' %}: |
- {{ asset.port }} |
+ {% trans 'IDC' %}: |
+ {{ asset.idc.name }} |
- {% trans 'Mac address' %}: |
- {{ asset.mac_addr }} |
+ {% trans 'Cabinet no' %}: |
+ {{ asset.cabinet_no }} |
+
+
+ {% trans 'Cabinet pos' %}: |
+ {{ asset.cabinet_pos }} |
+
+
+ {% trans 'Vendor' %}: |
+ {{ asset.vendor }} |
+
+
+ {% trans 'Model' %}: |
+ {{ asset.model }} |
{% trans 'CPU' %}: |
- {{ asset.cpu }} |
+ {{ asset.cpu_model }} {{ asset.cpu_count }}*{{ asset.cpu_cores }} |
{% trans 'Memory' %}: |
@@ -89,11 +110,15 @@
{% trans 'Disk' %}: |
- {{ asset.disk }} |
+ {{ asset.disk_total }} |
+
+
+ {% trans 'Platform' %}: |
+ {{ asset.platform }} |
{% trans 'OS' %}: |
- {{ asset.os }} |
+ {{ asset.os }} {{ asset.os_version }} {{ asset.os_arch }} |
{% trans 'Asset status' %}: |
@@ -415,6 +440,13 @@ $(document).ready(function () {
}).get();
updateAssetSystem(system_users)
+}).on('click', '.btn-delete-asset', function () {
+ var $this = $(this);
+ var name = "{{ asset.hostname }}";
+ var uid = "{{ asset.id }}";
+ var the_url = '{% url "api-assets:asset-detail" pk=99991937 %}'.replace('99991937', uid);
+ var redirect_url = "{% url 'assets:asset-list' %}";
+ objectDelete($this, name, the_url, redirect_url);
})
diff --git a/apps/assets/views.py b/apps/assets/views.py
index f5bbcd216..cfa2cb60b 100644
--- a/apps/assets/views.py
+++ b/apps/assets/views.py
@@ -68,6 +68,7 @@ class AssetCreateView(AdminUserRequiredMixin, CreateView):
def form_valid(self, form):
self.asset = asset = form.save()
asset.created_by = self.request.user.username or 'Admin'
+ asset.date_created = timezone.now()
asset.save()
return super(AssetCreateView, self).form_valid(form)
diff --git a/apps/fixtures/init.json b/apps/fixtures/init.json
index 8707430c9..5b9a6a674 100644
--- a/apps/fixtures/init.json
+++ b/apps/fixtures/init.json
@@ -1 +1 @@
-[{"model": "users.usergroup", "pk": 1, "fields": {"is_discard": false, "discard_time": null, "name": "Default", "comment": "Default user group for all user", "date_created": "2016-11-25T06:50:28.410Z", "created_by": "System"}}, {"model": "assets.assetgroup", "pk": 1, "fields": {"name": "Default", "created_by": "", "date_created": "2016-11-25T06:50:28.627Z", "comment": "Default asset group", "system_users": []}}, {"model": "users.user", "pk": 1, "fields": {"password": "pbkdf2_sha256$30000$RwSpXYAYQGbQ$PADpsQmM+cO5Y/R1CVSx3qNV4EbGIm2k+iMBXUtwvNc=", "last_login": null, "first_name": "", "last_name": "", "is_active": true, "date_joined": "2016-11-25T06:50:28.412Z", "username": "admin", "name": "Administrator", "email": "admin@jumpserver.org", "role": "Admin", "avatar": "", "wechat": "", "phone": null, "enable_otp": false, "secret_key_otp": "", "_private_key": "", "_public_key": "", "comment": "Administrator is the super user of system", "is_first_login": false, "date_expired": "2086-11-08T06:50:28.412Z", "created_by": "System", "user_permissions": [], "groups": [1]}}]
\ No newline at end of file
+[{"model": "users.usergroup", "pk": 1, "fields": {"is_discard": false, "discard_time": null, "name": "Default", "comment": "Default user group", "date_created": "2017-04-04T01:59:21.128Z", "created_by": "System"}}, {"model": "assets.idc", "pk": 1, "fields": {"name": "Default", "bandwidth": "", "contact": "", "phone": "", "address": "", "intranet": "", "extranet": "", "date_created": "2017-04-04T01:59:21.140Z", "operator": "", "created_by": "System", "comment": "Default IDC"}}, {"model": "assets.assetgroup", "pk": 1, "fields": {"name": "Default", "created_by": "", "date_created": "2017-04-04T01:59:21.142Z", "comment": "Default asset group", "system_users": []}}, {"model": "users.user", "pk": 1, "fields": {"password": "pbkdf2_sha256$30000$f8HLJLRwydBR$M+X1huSgQOojfaG01SGNBYPOlbYnHHw/A4/RdcSBEQQ=", "last_login": null, "first_name": "", "last_name": "", "is_active": true, "date_joined": "2017-04-04T01:59:20.932Z", "username": "admin", "name": "Administrator", "email": "admin@jumpserver.org", "role": "Admin", "avatar": "", "wechat": "", "phone": null, "enable_otp": false, "secret_key_otp": "", "_private_key": "", "_public_key": "", "comment": "Administrator is the super user of system", "is_first_login": false, "date_expired": "2087-03-18T01:59:20.932Z", "created_by": "System", "user_permissions": [], "groups": [1]}}]
\ No newline at end of file
diff --git a/apps/users/models/__init__.py b/apps/users/models/__init__.py
index 9cdf1d61d..269f68bd4 100644
--- a/apps/users/models/__init__.py
+++ b/apps/users/models/__init__.py
@@ -5,3 +5,4 @@
from .group import *
from .user import *
from .authentication import *
+from .utils import *
diff --git a/apps/users/models/utils.py b/apps/users/models/utils.py
index 8a9b6c370..669e48f5a 100644
--- a/apps/users/models/utils.py
+++ b/apps/users/models/utils.py
@@ -5,7 +5,7 @@
from . import User, UserGroup
-def initial_model():
+def init_model():
for cls in [User, UserGroup]:
if getattr(cls, 'initial'):
cls.initial()