1
0
Fork 0

ui - fixed some event issues

This commit is contained in:
hkernbach 2017-03-21 12:26:20 +01:00
parent ec0e5e39a7
commit 2381e2a798
4 changed files with 42 additions and 10 deletions

View File

@ -33,7 +33,7 @@
'graphs/:name': 'showGraph', 'graphs/:name': 'showGraph',
'users': 'userManagement', 'users': 'userManagement',
'user/:name': 'userView', 'user/:name': 'userView',
'user/:name/permission': 'userPermissionView', 'user/:name/permission': 'userPermission',
'userProfile': 'userProfile', 'userProfile': 'userProfile',
'cluster': 'cluster', 'cluster': 'cluster',
'nodes': 'nodes', 'nodes': 'nodes',
@ -515,11 +515,12 @@
return; return;
} }
var callback = function () { var callback = function () {
if (!this.hasOwnProperty('applicationDetailView')) { if (this.hasOwnProperty('applicationDetailView')) {
this.applicationDetailView = new window.ApplicationDetailView({ this.applicationDetailView.remove();
model: this.foxxList.get(decodeURIComponent(mount))
});
} }
this.applicationDetailView = new window.ApplicationDetailView({
model: this.foxxList.get(decodeURIComponent(mount))
});
this.applicationDetailView.model = this.foxxList.get(decodeURIComponent(mount)); this.applicationDetailView.model = this.foxxList.get(decodeURIComponent(mount));
this.applicationDetailView.render('swagger'); this.applicationDetailView.render('swagger');
@ -933,14 +934,19 @@
} }
}, },
userPermissionView: function (name, initialized) { userPermission: function (name, initialized) {
this.checkUser(); this.checkUser();
if (initialized || initialized === null) { if (initialized || initialized === null) {
if (this.userPermissionView) {
this.userPermissionView.remove();
}
this.userPermissionView = new window.UserPermissionView({ this.userPermissionView = new window.UserPermissionView({
collection: this.userCollection, collection: this.userCollection,
databases: this.arangoDatabase, databases: this.arangoDatabase,
username: name username: name
}); });
this.userPermissionView.render(); this.userPermissionView.render();
} else if (initialized === false) { } else if (initialized === false) {
this.waitForInit(this.userPermissionView.bind(this), name); this.waitForInit(this.userPermissionView.bind(this), name);
@ -967,11 +973,13 @@
this.waitForInit(this.userManagement.bind(this)); this.waitForInit(this.userManagement.bind(this));
return; return;
} }
if (!this.userManagementView) { if (this.userManagementView) {
this.userManagementView = new window.UserManagementView({ this.userManagementView.remove();
collection: this.userCollection
});
} }
this.userManagementView = new window.UserManagementView({
collection: this.userCollection
});
this.userManagementView.render(); this.userManagementView.render();
}, },

View File

@ -11,6 +11,14 @@
template: templateEngine.createTemplate('applicationDetailView.ejs'), 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: { events: {
'click .open': 'openApp', 'click .open': 'openApp',
'click .delete': 'deleteApp', 'click .delete': 'deleteApp',

View File

@ -10,6 +10,14 @@
template: templateEngine.createTemplate('userManagementView.ejs'), 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: { events: {
'click #createUser': 'createUser', 'click #createUser': 'createUser',
'click #submitCreateUser': 'submitCreateUser', 'click #submitCreateUser': 'submitCreateUser',

View File

@ -14,6 +14,14 @@
this.username = options.username; 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: { events: {
'click #userPermissionView [type="checkbox"]': 'setPermission' 'click #userPermissionView [type="checkbox"]': 'setPermission'
}, },