summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEndi S. Dewata <edewata@redhat.com>2014-05-05 17:31:18 -0400
committerEndi S. Dewata <edewata@redhat.com>2014-05-08 22:59:40 -0400
commit05161afc2f36fc7dcba2a88e8ab4e698934eb6a2 (patch)
treed711710a9493507bff2bc59b8e08745da2e61150
parent4448fb5f16af237f6e9a04d545f515d7726c4618 (diff)
downloadpki-05161afc2f36fc7dcba2a88e8ab4e698934eb6a2.tar.gz
pki-05161afc2f36fc7dcba2a88e8ab4e698934eb6a2.tar.xz
pki-05161afc2f36fc7dcba2a88e8ab4e698934eb6a2.zip
Fixed new group page in TPS UI.
Previously the TPS UI generates an error when adding a new group because it's trying to fetch the members of the new group which has not been added yet. The code has been changed to detect this particular case and avoid fetching the data.
-rw-r--r--base/server/share/webapps/pki/js/pki-ui.js6
-rw-r--r--base/tps-tomcat/shared/webapps/tps/js/group.js11
2 files changed, 16 insertions, 1 deletions
diff --git a/base/server/share/webapps/pki/js/pki-ui.js b/base/server/share/webapps/pki/js/pki-ui.js
index d983dfd40..442c6b27d 100644
--- a/base/server/share/webapps/pki/js/pki-ui.js
+++ b/base/server/share/webapps/pki/js/pki-ui.js
@@ -720,6 +720,12 @@ var ModelTable = Table.extend({
render: function() {
var self = this;
+ // if collection is undefined, don't fetch data, just draw the controls
+ if (!self.collection) {
+ self.renderControls();
+ return;
+ }
+
// set query based on current page, page size, and filter
self.collection.query({
start: (self.page - 1) * self.pageSize,
diff --git a/base/tps-tomcat/shared/webapps/tps/js/group.js b/base/tps-tomcat/shared/webapps/tps/js/group.js
index 874cefa71..50d7d6c67 100644
--- a/base/tps-tomcat/shared/webapps/tps/js/group.js
+++ b/base/tps-tomcat/shared/webapps/tps/js/group.js
@@ -187,12 +187,21 @@ var GroupPage = EntryPage.extend({
// In page edit mode, the members tables is read-only.
self.membersTable.mode = "view";
+ self.membersTable.collection = new GroupMemberCollection(null, { groupID: self.entry.id });
+
+ } else if (self.mode == "add") {
+ // In page add mode, the members table is read-only.
+ self.membersTable.mode = "view";
+
+ // self.membersTable.collection is undefined for new group
+
} else { // self.mode == "view"
// In page view mode, the members table is editable.
self.membersTable.mode = "edit";
+
+ self.membersTable.collection = new GroupMemberCollection(null, { groupID: self.entry.id });
}
- self.membersTable.collection = new GroupMemberCollection(null, { groupID: self.entry.id });
self.membersTable.render();
}
});