diff --git a/js/apps/system/_admin/aardvark/APP/frontend/js/routers/router.js b/js/apps/system/_admin/aardvark/APP/frontend/js/routers/router.js index c668c56c0c..e2f535a24b 100644 --- a/js/apps/system/_admin/aardvark/APP/frontend/js/routers/router.js +++ b/js/apps/system/_admin/aardvark/APP/frontend/js/routers/router.js @@ -33,7 +33,7 @@ 'graphs/:name': 'showGraph', 'users': 'userManagement', 'user/:name': 'userView', - 'user/:name/permission': 'userPermissionView', + 'user/:name/permission': 'userPermission', 'userProfile': 'userProfile', 'cluster': 'cluster', 'nodes': 'nodes', @@ -515,11 +515,12 @@ return; } var callback = function () { - if (!this.hasOwnProperty('applicationDetailView')) { - this.applicationDetailView = new window.ApplicationDetailView({ - model: this.foxxList.get(decodeURIComponent(mount)) - }); + if (this.hasOwnProperty('applicationDetailView')) { + this.applicationDetailView.remove(); } + this.applicationDetailView = new window.ApplicationDetailView({ + model: this.foxxList.get(decodeURIComponent(mount)) + }); this.applicationDetailView.model = this.foxxList.get(decodeURIComponent(mount)); this.applicationDetailView.render('swagger'); @@ -933,14 +934,19 @@ } }, - userPermissionView: function (name, initialized) { + userPermission: function (name, initialized) { this.checkUser(); if (initialized || initialized === null) { + if (this.userPermissionView) { + this.userPermissionView.remove(); + } + this.userPermissionView = new window.UserPermissionView({ collection: this.userCollection, databases: this.arangoDatabase, username: name }); + this.userPermissionView.render(); } else if (initialized === false) { this.waitForInit(this.userPermissionView.bind(this), name); @@ -967,11 +973,13 @@ this.waitForInit(this.userManagement.bind(this)); return; } - if (!this.userManagementView) { - this.userManagementView = new window.UserManagementView({ - collection: this.userCollection - }); + if (this.userManagementView) { + this.userManagementView.remove(); } + + this.userManagementView = new window.UserManagementView({ + collection: this.userCollection + }); this.userManagementView.render(); }, diff --git a/js/apps/system/_admin/aardvark/APP/frontend/js/views/applicationDetailView.js b/js/apps/system/_admin/aardvark/APP/frontend/js/views/applicationDetailView.js index 99cca595be..4a312419b0 100644 --- a/js/apps/system/_admin/aardvark/APP/frontend/js/views/applicationDetailView.js +++ b/js/apps/system/_admin/aardvark/APP/frontend/js/views/applicationDetailView.js @@ -11,6 +11,14 @@ template: templateEngine.createTemplate('applicationDetailView.ejs'), + remove: function () { + this.$el.empty().off(); /* off to unbind the events */ + this.stopListening(); + this.unbind(); + delete this.el; + return this; + }, + events: { 'click .open': 'openApp', 'click .delete': 'deleteApp', diff --git a/js/apps/system/_admin/aardvark/APP/frontend/js/views/userManagementView.js b/js/apps/system/_admin/aardvark/APP/frontend/js/views/userManagementView.js index a3ceebabd6..da6813edc5 100644 --- a/js/apps/system/_admin/aardvark/APP/frontend/js/views/userManagementView.js +++ b/js/apps/system/_admin/aardvark/APP/frontend/js/views/userManagementView.js @@ -10,6 +10,14 @@ template: templateEngine.createTemplate('userManagementView.ejs'), + remove: function () { + this.$el.empty().off(); /* off to unbind the events */ + this.stopListening(); + this.unbind(); + delete this.el; + return this; + }, + events: { 'click #createUser': 'createUser', 'click #submitCreateUser': 'submitCreateUser', diff --git a/js/apps/system/_admin/aardvark/APP/frontend/js/views/userPermissions.js b/js/apps/system/_admin/aardvark/APP/frontend/js/views/userPermissions.js index 23885d7f86..42581e4686 100644 --- a/js/apps/system/_admin/aardvark/APP/frontend/js/views/userPermissions.js +++ b/js/apps/system/_admin/aardvark/APP/frontend/js/views/userPermissions.js @@ -14,6 +14,14 @@ this.username = options.username; }, + remove: function () { + this.$el.empty().off(); /* off to unbind the events */ + this.stopListening(); + this.unbind(); + delete this.el; + return this; + }, + events: { 'click #userPermissionView [type="checkbox"]': 'setPermission' },