diff --git a/apps/assets/api.py b/apps/assets/api.py
index 896aadc88..15afff6d7 100644
--- a/apps/assets/api.py
+++ b/apps/assets/api.py
@@ -39,6 +39,12 @@ class AssetGroupViewSet(viewsets.ModelViewSet):
serializer_class = serializers.AssetGroupSerializer
+class AssetUpdateGroupApi(generics.RetrieveUpdateAPIView):
+ queryset = Asset.objects.all()
+ serializer_class = serializers.AssetUpdateGroupSerializer
+ permission_classes = (IsSuperUser,)
+
+
class IDCViewSet(viewsets.ModelViewSet):
"""API endpoint that allows IDC to be viewed or edited."""
queryset = IDC.objects.all()
@@ -58,6 +64,12 @@ class SystemUserViewSet(viewsets.ModelViewSet):
permission_classes = (IsSuperUser,)
+class SystemUserUpdateApi(generics.RetrieveUpdateAPIView):
+ queryset = Asset.objects.all()
+ serializer_class = serializers.AssetUpdateSystemUserSerializer
+ permission_classes = (IsSuperUser,)
+
+
# class IDCAssetsApi(generics.ListAPIView):
# model = IDC
# serializer_class = serializers.AssetSerializer
diff --git a/apps/assets/serializers.py b/apps/assets/serializers.py
index 7b13606e5..6e6353a86 100644
--- a/apps/assets/serializers.py
+++ b/apps/assets/serializers.py
@@ -17,6 +17,19 @@ class AssetGroupSerializer(serializers.ModelSerializer):
def get_assets_amount(obj):
return obj.assets.count()
+class AssetUpdateGroupSerializer(serializers.ModelSerializer):
+ groups = serializers.PrimaryKeyRelatedField(many=True, queryset=AssetGroup.objects.all())
+
+ class Meta:
+ model = Asset
+ fields = ['id', 'groups']
+
+class AssetUpdateSystemUserSerializer(serializers.ModelSerializer):
+ system_users = serializers.PrimaryKeyRelatedField(many=True, queryset=SystemUser.objects.all())
+
+ class Meta:
+ model = Asset
+ fields = ['id', 'system_users']
class AdminUserSerializer(serializers.ModelSerializer):
class Meta:
diff --git a/apps/assets/templates/assets/asset_detail.html b/apps/assets/templates/assets/asset_detail.html
index bc3a7b147..ca1b667ed 100644
--- a/apps/assets/templates/assets/asset_detail.html
+++ b/apps/assets/templates/assets/asset_detail.html
@@ -96,7 +96,7 @@
{% trans 'Asset status' %}: |
- {{ asset.get_status_display() }} |
+ {{ asset.status }} |
{% trans 'Is active' %}: |
@@ -205,9 +205,9 @@
-
+
|
{% for system_user in system_users %}
- {{ system_user.name }} |
+ {{ system_user.name }} |
-
+
|
{% endfor %}
@@ -275,8 +275,154 @@
{% endblock %}
{% block custom_foot_js %}
{% endblock %}
diff --git a/apps/assets/templates/assets/asset_group_list.html b/apps/assets/templates/assets/asset_group_list.html
index 245ae3bf4..6e46fc70c 100644
--- a/apps/assets/templates/assets/asset_group_list.html
+++ b/apps/assets/templates/assets/asset_group_list.html
@@ -6,7 +6,7 @@
-
+
@@ -27,7 +27,7 @@
{% endblock %}
diff --git a/apps/assets/templates/assets/asset_list.html b/apps/assets/templates/assets/asset_list.html
index a2b1c306c..a5d43579c 100644
--- a/apps/assets/templates/assets/asset_list.html
+++ b/apps/assets/templates/assets/asset_list.html
@@ -127,8 +127,9 @@
}},
{targets: 9, createdCell: function (td, cellData, rowData) {
var update_btn = '{% trans "Update" %}'.replace('99991937', cellData);
- var del_btn = '{% trans "Delete" %}'.replace('99991937', cellData);
+ var del_btn = '{% trans "Delete" %}'.replace('99991937', cellData);
$(td).html(update_btn + del_btn)
+
}}
],
ajax_url: '{% url "api-assets:asset-list" %}',
@@ -179,6 +180,14 @@
$form.ajaxSubmit({success: success});
})
+ })
+ .on('click', '.btn_asset_delete', function () {
+ var $this = $(this);
+ var name = $(this).closest("tr").find(":nth-child(2)").children('a').html();
+ var uid = $this.data('uid');
+ var the_url = '{% url "api-assets:asset-detail" pk=99991937 %}'.replace('99991937', uid);
+
+ objectDelete($this, name, the_url);
});
{% endblock %}
\ No newline at end of file
diff --git a/apps/assets/urls/api_urls.py b/apps/assets/urls/api_urls.py
index f7370962f..77613bdce 100644
--- a/apps/assets/urls/api_urls.py
+++ b/apps/assets/urls/api_urls.py
@@ -17,6 +17,10 @@ urlpatterns = [
url(r'^v1/assets_bulk$', api.AssetListUpdateApi.as_view(), name='asset-bulk-update'),
# url(r'^v1/idc/(?P[0-9]+)/assets/$', api.IDCAssetsApi.as_view(), name='api-idc-assets'),
url(r'^v1/system-user/auth', api.SystemUserAuthApi.as_view(), name='system-user-auth'),
+ url(r'^v1/assets/(?P\d+)/groups$',
+ api.AssetUpdateGroupApi.as_view(), name='asset-update-group'),
+ url(r'^v1/assets/(?P\d+)/system-users$',
+ api.SystemUserUpdateApi.as_view(), name='asset-update-systemusers'),
]
urlpatterns += router.urls
diff --git a/apps/users/templates/users/user_detail.html b/apps/users/templates/users/user_detail.html
index f43bde4f5..ec9162f05 100644
--- a/apps/users/templates/users/user_detail.html
+++ b/apps/users/templates/users/user_detail.html
@@ -255,16 +255,19 @@ function updateUserGroups(groups) {
success: success
});
}
+
$(document).ready(function() {
$('.select2').select2()
.on('select2:select', function(evt) {
var data = evt.params.data;
jumpserver.groups_selected[data.id] = data.text;
- }).on('select2:unselect', function(evt) {
+ })
+ .on('select2:unselect', function(evt) {
var data = evt.params.data;
delete jumpserver.groups_selected[data.id]
})
-}).on('click', '#is_active', function() {
+})
+ .on('click', '#is_active', function() {
var the_url = "{% url 'api-users:user-detail' pk=user.id %}";
var checked = $(this).prop('checked');
var body = {
@@ -276,19 +279,21 @@ $(document).ready(function() {
body: JSON.stringify(body),
success_message: success
});
-}).on('click', '#enable_otp', function() {
- var the_url = "{% url 'api-users:user-detail' pk=user.id %}";
- var checked = $(this).prop('checked');
- var body = {
- 'enable_otp': checked
- };
- var success = '{% trans "Update Successfully!" %}';
- APIUpdateAttr({
- url: the_url,
- body: JSON.stringify(body),
- success_message: success
- });
-}).on('click', '#btn_join_group', function() {
+})
+ .on('click', '#enable_otp', function() {
+ var the_url = "{% url 'api-users:user-detail' pk=user.id %}";
+ var checked = $(this).prop('checked');
+ var body = {
+ 'enable_otp': checked
+ };
+ var success = '{% trans "Update Successfully!" %}';
+ APIUpdateAttr({
+ url: the_url,
+ body: JSON.stringify(body),
+ success_message: success
+ });
+})
+ .on('click', '#btn_join_group', function() {
if (Object.keys(jumpserver.groups_selected).length === 0) {
return false;
}
diff --git a/apps/users/templates/users/user_list.html b/apps/users/templates/users/user_list.html
index f4a353bbd..bf8493f15 100644
--- a/apps/users/templates/users/user_list.html
+++ b/apps/users/templates/users/user_list.html
@@ -132,7 +132,8 @@ $(document).ready(function(){
$form.ajaxSubmit({success: success});
})
-}).on('click', '#btn_bulk_update', function(){
+})
+ .on('click', '#btn_bulk_update', function(){
var action = $('#slct_bulk_update').val();
var $data_table = $('#user_list_table').DataTable();
var id_list = [];
@@ -204,13 +205,15 @@ $(document).ready(function(){
default:
break;
}
-}).on('click', '.btn_user_delete', function(){
+})
+ .on('click', '.btn_user_delete', function(){
var $this = $(this);
var name = $this.data('name');
var uid = $this.data('uid');
var the_url = '{% url "api-users:user-detail" pk=99991937 %}'.replace('99991937', uid);
objectDelete($this, name, the_url);
-}).on('click', '#btn_user_bulk_update', function(){
+})
+ .on('click', '#btn_user_bulk_update', function(){
var json_data = $('#fm_user_bulk_update').serializeObject();
var body = {};
body.enable_otp = (json_data.enable_otp === 'on')? true: false;
diff --git a/deb_requirements.txt b/deb_requirements.txt
new file mode 100644
index 000000000..75a85672b
--- /dev/null
+++ b/deb_requirements.txt
@@ -0,0 +1 @@
+ibtiff4-dev libjpeg8-dev zlib1g-dev libfreetype6-dev liblcms2-dev libwebp-dev tcl8.5-dev tk8.5-dev python-tk
\ No newline at end of file
diff --git a/rpm_requirements.txt b/rpm_requirements.txt
new file mode 100644
index 000000000..3853d8419
--- /dev/null
+++ b/rpm_requirements.txt
@@ -0,0 +1 @@
+libtiff-devel libjpeg-devel libzip-devel freetype-devel lcms2-devel libwebp-devel tcl-devel tk-devel
\ No newline at end of file
|