diff options
-rw-r--r-- | deps/rabbitmq_management/priv/www/js/dispatcher.js | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/deps/rabbitmq_management/priv/www/js/dispatcher.js b/deps/rabbitmq_management/priv/www/js/dispatcher.js index feb1974c3c..758a240d30 100644 --- a/deps/rabbitmq_management/priv/www/js/dispatcher.js +++ b/deps/rabbitmq_management/priv/www/js/dispatcher.js @@ -190,12 +190,15 @@ dispatcher_add(function(sammy) { 'permissions': '/permissions'}, 'users'); sammy.get('#/users/:id', function() { var vhosts = JSON.parse(sync_get('/vhosts')); - render({'user': '/users/' + esc(this.params['id']), + const current_vhost = get_pref('vhost'); + let index_vhost = vhosts.findIndex(v => v.name === current_vhost); + index_vhost = index_vhost === -1 ? 0 : index_vhost; + render({'user': '/users/' + esc(this.params['id']), 'permissions': '/users/' + esc(this.params['id']) + '/permissions', 'topic_permissions': '/users/' + esc(this.params['id']) + '/topic-permissions', 'vhosts': '/vhosts/', - 'exchanges': '/exchanges/' + esc(vhosts[0].name)}, 'user', - '#/users'); + 'exchanges': '/exchanges/' + esc(vhosts[index_vhost].name)}, + 'user','#/users'); }); sammy.put('#/users-add', function() { res = sync_put(this, '/users/:username'); |