Commit 5745c8cc authored by ibuler's avatar ibuler

Finish url namespace change

parent a5e48744
......@@ -52,7 +52,7 @@ $(document).ready(function(){
var del_btn = '<a class="btn btn-xs btn-danger m-l-xs btn_admin_user_delete" data-uid="99991937">{% trans "Delete" %}</a>'.replace('99991937', cellData);
$(td).html(script_btn + update_btn + del_btn)
}}],
ajax_url: '{% url "assets:api-admin-user-list" %}',
ajax_url: '{% url "api-assets:admin-user-list" %}',
columns: [{data: function(){return ""}}, {data: "name" }, {data: "username" }, {data: "assets_amount" }, {data: function () {return 'lost'} },
{data: "comment" }, {data: "id" }],
op_html: $('#actions').html()
......
......@@ -72,7 +72,7 @@
</td>
<td class="text-center">
<a href="{% url 'assets:asset-update' pk=asset.id %}" class="btn btn-xs btn-info">{% trans 'Update' %}</a>
<a onclick="objectDelete(this,'{{ asset.hostname }}','{% url 'assets:api-asset-detail' pk=asset.id %}')" class="btn btn-xs btn-danger del">
<a onclick="objectDelete(this,'{{ asset.hostname }}','{% url 'api-assets:asset-detail' pk=asset.id %}')" class="btn btn-xs btn-danger del">
{% trans 'Delete' %}</a>
</td>
</tr>
......@@ -190,7 +190,7 @@
var column2 = table.rows('.selected').data();
var id_list = [];
var plain_id_list = [];
var the_url = "{% url 'assets:api-asset-bulk-update' %}";
var the_url = "{% url 'api-assets:asset-bulk-update' %}";
for(var i=0;i<column2.length;i++){
id_list.push({id: column2[i].id,hostname:column2[i].ip});
plain_id_list.push(parseInt(column2[i].id));
......
......@@ -118,7 +118,7 @@
$(td).html('<i class="fa fa-check text-navy"></i>')
}
}}],
ajax_url: '{% url "assets:api-asset-list" %}?idc={{ idc.id }}',
ajax_url: '{% url "api-assets:asset-list" %}?idc={{ idc.id }}',
columns: [{data: function(){return ""}}, {data: "hostname" }, {data: "ip" }, {data: "port" },
{data: "type" }, {data: "is_active" }]
};
......
......@@ -50,7 +50,7 @@ $(document).ready(function(){
var del_btn = '<a class="btn btn-xs btn-danger m-l-xs btn_user_delete" data-uid="99991937">{% trans "Delete" %}</a>'.replace('99991937', cellData);
$(td).html(update_btn + del_btn)
}}],
ajax_url: '{% url "assets:api-idc-list" %}',
ajax_url: '{% url "api-assets:idc-list" %}',
columns: [{data: function(){return ""}}, {data: "name" }, {data: "assets_amount" }, {data: "contact" }, {data: "phone" },
{data: "operator" }, {data: "id" }],
op_html: $('#actions').html()
......
......@@ -34,12 +34,12 @@ urlpatterns += [
# Select user permission of asset and asset group
url(r'^v1/user/(?P<pk>[0-9]+)/assets/$', api.UserGrantedAssetsApi.as_view(), name='user-assets'),
url(r'^v1/user/(?P<pk>[0-9]+)/asset-groups/$', api.UserGrantedAssetGroupsApi.as_view(),
name='api-user-asset-groups'),
name='user-asset-groups'),
# Select user group permission of asset and asset group
url(r'^v1/user-group/(?P<pk>[0-9]+)/assets/$', api.UserGroupGrantedAssetsApi.as_view(), name='user-group-assets'),
url(r'^v1/user-group/(?P<pk>[0-9]+)/asset-groups/$', api.UserGroupGrantedAssetGroupsApi.as_view(),
name='api-user-group-asset-groups'),
name='user-group-asset-groups'),
# Revoke permission api
......
......@@ -73,7 +73,7 @@ $(document).ready(function(){
$(td).html(update_btn + delete_btn)
}}
],
ajax_url: '{% url "terminal:api-terminal-list" %}',
ajax_url: '{% url "api-terminal:terminal-list" %}',
columns: [{data: function(){return ""}}, {data: "name" }, {data: "ip" }, {data: "get_type_display" },
{data: "proxy_online"}, {data: "is_active" }, {data: 'is_active'}, {data: "id"}],
op_html: $('#actions').html()
......@@ -83,7 +83,7 @@ $(document).ready(function(){
var $this = $(this);
var uid = $this.data('uid');
var name = $(this).data('name');
var the_url = '{% url "terminal:api-terminal-detail" pk=99991937 %}'.replace('99991937', uid);
var the_url = '{% url "api-terminal:terminal-detail" pk=99991937 %}'.replace('99991937', uid);
objectDelete($this, name, the_url)
})
</script>
......
......@@ -16,8 +16,8 @@ urlpatterns = [
]
router = routers.DefaultRouter()
router.register(r'v1/terminal/heatbeat', api.TerminalHeatbeatViewSet, 'api-terminal-heatbeat')
router.register(r'v1/terminal', api.TerminalViewSet, 'api-terminal')
router.register(r'v1/terminal/heatbeat', api.TerminalHeatbeatViewSet, 'terminal-heatbeat')
router.register(r'v1/terminal', api.TerminalViewSet, 'terminal')
# urlpatterns += [
# url(r'v1/terminal/heatbeat/', api.TerminalHeatbeatApi.as_view(), name='api-terminal-heatbeat')
# ]
......
......@@ -158,7 +158,7 @@
}
}}
],
ajax_url: '{% url "perms:api-asset-permission-list" %}?user={{ user.id }}',
ajax_url: '{% url "api-perms:asset-permission-list" %}?user={{ user.id }}',
columns: [{data: function(){return ""}}, {data: "name" }, {data: "assets" }, {data: "asset_groups"},
{data: "system_users"}, {data: "is_active"}, {data: "id"}]
};
......
......@@ -228,7 +228,7 @@
jumpserver.groups_selected = {};
function updateUserGroups(groups) {
var the_url = "{% url 'users:api-user-update-group' pk=user.id %}";
var the_url = "{% url 'api-users:user-update-group' pk=user.id %}";
var body = {
groups: Object.assign([], groups)
};
......@@ -265,7 +265,7 @@ $(document).ready(function() {
delete jumpserver.groups_selected[data.id]
})
}).on('click', '#is_active', function() {
var the_url = "{% url 'users:api-user-detail' pk=user.id %}";
var the_url = "{% url 'api-users:user-detail' pk=user.id %}";
var checked = $(this).prop('checked');
var body = {
'is_active': checked
......@@ -277,7 +277,7 @@ $(document).ready(function() {
success_message: success
});
}).on('click', '#enable_otp', function() {
var the_url = "{% url 'users:api-user-detail' pk=user.id %}";
var the_url = "{% url 'api-users:user-detail' pk=user.id %}";
var checked = $(this).prop('checked');
var body = {
'enable_otp': checked
......@@ -316,7 +316,7 @@ $(document).ready(function() {
updateUserGroups(groups)
}).on('click', '#btn_reset_password', function() {
function doReset() {
var the_url = '{% url "users:api-user-reset-password" pk=user.id %}';
var the_url = '{% url "api-users:user-reset-password" pk=user.id %}';
var body = {};
var success = function() {
var msg = "{% trans "An e-mail has been sent to the user\'s mailbox." %}";
......@@ -341,7 +341,7 @@ $(document).ready(function() {
});
}).on('click', '#btn_reset_pk', function() {
function doReset() {
var the_url = '{% url "users:api-user-reset-pk" pk=user.id %}';
var the_url = '{% url "api-users:user-reset-pk" pk=user.id %}';
var body = {};
var success = function() {
var msg = "{% trans 'The reset-ssh-public-key E-mail has been sent successfully. Please inform the user to update his new ssh public key.' %}";
......@@ -367,7 +367,7 @@ $(document).ready(function() {
}).on('click', '#btn_user_update_pk', function(){
var $this = $(this);
var pk = $('#txt_pk').val();
var the_url = '{% url "users:api-user-update-pk" pk=user.id %}';
var the_url = '{% url "api-users:user-update-pk" pk=user.id %}';
var body = {'_public_key': pk};
var success = function() {
$('#txt_pk').val('');
......
......@@ -133,7 +133,7 @@
}
}}
],
ajax_url: '{% url "perms:api-user-assets" pk=user.id %}',
ajax_url: '{% url "api-perms:user-assets" pk=user.id %}',
columns: [{data: function(){return ""}}, {data: "hostname" }, {data: "ip" }, {data: "port"},
{data: "system_users_join"}, {data: "is_active"}]
};
......@@ -148,7 +148,7 @@
$(td).html(detail_btn.replace('99991937', rowData.id));
}}
],
ajax_url: '{% url "perms:api-user-asset-groups" pk=user.id %}',
ajax_url: '{% url "api-perms:user-asset-groups" pk=user.id %}',
columns: [{data: function(){return ""}}, {data: "name" }, {data: "assets_amount" }]
};
jumpserver.initDataTable(options);
......
......@@ -154,7 +154,7 @@
$(td).html(btn)
}}
],
ajax_url: '{% url "perms:api-asset-permission-list" %}?user_group={{ user_group.id }}',
ajax_url: '{% url "api-perms:asset-permission-list" %}?user_group={{ user_group.id }}',
columns: [{data: function(){return ""}}, {data: "name" }, {data: "assets" }, {data: "asset_groups"},
{data: "system_users"}, {data: "is_active"}, {data: "id"}]
};
......
......@@ -119,7 +119,7 @@
jumpserver.users_selected = {};
function updateGroupMember(users) {
var the_url = "{% url 'users:api-user-group-update-user' pk=user_group.id %}";
var the_url = "{% url 'api-users:user-group-update-user' pk=user_group.id %}";
var body = {
users: Object.assign([], users)
};
......
......@@ -148,7 +148,7 @@
$(td).html(detail_btn.replace('99991937', rowData.id));
}}
],
ajax_url: '{% url "perms:api-user-group-asset-groups" pk=user_group.id %}',
ajax_url: '{% url "api-perms:user-group-asset-groups" pk=user_group.id %}',
columns: [{data: function(){return ""}}, {data: "name" }, {data: "assets_amount" }]
};
jumpserver.initDataTable(options);
......
......@@ -55,7 +55,7 @@ $(document).ready(function() {
$(td).html(update_btn + del_btn)
}
}}],
ajax_url: '{% url "users:api-user-group-list" %}',
ajax_url: '{% url "api-users:user-group-list" %}',
columns: [{data: function(){return ""}}, {data: "name" }, {data: "user_amount"},
{data: "comment"}, {data: "id" }],
op_html: $('#actions').html()
......@@ -65,7 +65,7 @@ $(document).ready(function() {
var $this = $(this);
function doDelete() {
var group_id = $this.data('gid');
var the_url = "{% url 'users:api-user-group-detail' pk=99991937 %}".replace('99991937', group_id);
var the_url = "{% url 'api-users:user-group-detail' pk=99991937 %}".replace('99991937', group_id);
var body = {};
var success = function() {
var msg = "{% trans 'Group Deleted.' %}";
......@@ -105,7 +105,7 @@ $(document).ready(function() {
if (plain_id_list === []) {
return false;
}
var the_url = "{% url 'users:api-user-group-list' %}";
var the_url = "{% url 'api-users:user-group-list' %}";
function doDelete() {
swal({
title: "{% trans 'Are you sure?' %}",
......
......@@ -81,7 +81,7 @@ $(document).ready(function(){
$(td).html(update_btn + del_btn)
}
}}],
ajax_url: '{% url "users:api-user-list" %}',
ajax_url: '{% url "api-users:user-list" %}',
columns: [{data: "id"}, {data: "username" }, {data: "name" }, {data: "get_role_display" },
{data: "groups_display" }, {data: "is_valid" }, {data: "id" }]
};
......@@ -107,7 +107,7 @@ $(document).ready(function(){
if (id_list === []) {
return false;
}
var the_url = "{% url 'users:api-user-list' %}";
var the_url = "{% url 'api-users:user-list' %}";
function doDeactive() {
var body = $.each(id_list, function(index, user_object) {
user_object['is_active'] = false;
......@@ -160,7 +160,7 @@ $(document).ready(function(){
var $this = $(this);
function doDelete() {
var uid = $this.data('uid');
var the_url = '{% url "users:api-user-detail" pk=99991937 %}'.replace('99991937', uid);
var the_url = '{% url "api-users:user-detail" pk=99991937 %}'.replace('99991937', uid);
var body = {};
var success = function() {
var msg = "{% trans 'User Deleted.' %}";
......@@ -215,7 +215,7 @@ $(document).ready(function(){
if (post_list === []) {
return false
}
var the_url = "{% url 'users:api-user-list' %}";
var the_url = "{% url 'api-users:user-list' %}";
var success = function() {
var msg = "{% trans 'The selected users has been updated successfully.' %}";
swal("{% trans 'User Updated' %}", msg, "success");
......
......@@ -44,25 +44,25 @@ urlpatterns = [
router = BulkRouter()
router.register(r'v1/users', api.UserViewSet, 'api-user')
router.register(r'v1/user-groups', api.UserGroupViewSet, 'api-user-group')
router.register(r'v1/users', api.UserViewSet, 'user')
router.register(r'v1/user-groups', api.UserGroupViewSet, 'user-group')
# router.register(r'v1/user-groups', api.AssetViewSet, 'api-groups')
urlpatterns += [
# url(r'^v1/users/$', api.UserListUpdateApi.as_view(), name='user-bulk-update-api'),
url(r'^v1/users/token/$', api.UserAuthApi.as_view(), name='api-user-token'),
url(r'^v1/users/(?P<pk>\d+)/reset-password/$', api.UserResetPasswordApi.as_view(), name='api-user-reset-password'),
url(r'^v1/users/(?P<pk>\d+)/reset-pk/$', api.UserResetPKApi.as_view(), name='api-user-reset-pk'),
url(r'^v1/users/(?P<pk>\d+)/update-pk/$', api.UserUpdatePKApi.as_view(), name='api-user-update-pk'),
url(r'^v1/users/token/$', api.UserAuthApi.as_view(), name='user-token'),
url(r'^v1/users/(?P<pk>\d+)/reset-password/$', api.UserResetPasswordApi.as_view(), name='user-reset-password'),
url(r'^v1/users/(?P<pk>\d+)/reset-pk/$', api.UserResetPKApi.as_view(), name='user-reset-pk'),
url(r'^v1/users/(?P<pk>\d+)/update-pk/$', api.UserUpdatePKApi.as_view(), name='user-update-pk'),
# url(r'^v1/user-groups/$', api.GroupListUpdateApi.as_view(), name='user-group-bulk-update-api'),
# url(r'^v1/user-groups/(?P<pk>\d+)/$', api.GroupDetailApi.as_view(), name='user-group-detail-api'),
# url(r'^v1/user-groups/(?P<pk>\d+)/user/(?P<uid>\d+)/$',
# api.DeleteUserFromGroupApi.as_view(), name='delete-user-from-group-api'),
url(r'^v1/users/(?P<pk>\d+)/groups/$',
api.UserUpdateGroupApi.as_view(), name='api-user-update-group'),
api.UserUpdateGroupApi.as_view(), name='user-update-group'),
url(r'^v1/user-groups/(?P<pk>\d+)/users/$',
api.UserGroupUpdateUserApi.as_view(), name='api-user-group-update-user'),
api.UserGroupUpdateUserApi.as_view(), name='user-group-update-user'),
]
urlpatterns += router.urls
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment