summaryrefslogtreecommitdiff
path: root/qpid/java
diff options
context:
space:
mode:
authorAlex Rudyy <orudyy@apache.org>2013-09-14 11:28:28 +0000
committerAlex Rudyy <orudyy@apache.org>2013-09-14 11:28:28 +0000
commit43a52f691e64d400d798c9766fec0c22d9704415 (patch)
treededf67b86418910dc2d2ac9c176ac3c27275f0c4 /qpid/java
parent4c2bc5696d9a05e0adecd3f3a91db95ce1b1aeef (diff)
downloadqpid-python-43a52f691e64d400d798c9766fec0c22d9704415.tar.gz
QPID-5138: Add UI into web management console for creation and editing preferences providers
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1523220 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java')
-rw-r--r--qpid/java/broker-plugins/management-http/src/main/java/resources/addPreferencesProvider.html47
-rw-r--r--qpid/java/broker-plugins/management-http/src/main/java/resources/authenticationprovider/preferences/filesystempreferences/add.html29
-rw-r--r--qpid/java/broker-plugins/management-http/src/main/java/resources/authenticationprovider/preferences/filesystempreferences/show.html21
-rw-r--r--qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/AuthenticationProvider.js106
-rw-r--r--qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/PreferencesProvider.js179
-rw-r--r--qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addAuthenticationProvider.js7
-rw-r--r--qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addPreferencesProvider.js196
-rw-r--r--qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/PrincipalDatabaseAuthenticationManager.js49
-rw-r--r--qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/preferences/filesystempreferences/add.js48
-rw-r--r--qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/preferences/filesystempreferences/show.js46
-rw-r--r--qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/controller.js5
-rw-r--r--qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/treeView.js2
-rw-r--r--qpid/java/broker-plugins/management-http/src/main/java/resources/showAuthProvider.html7
-rw-r--r--qpid/java/broker-plugins/management-http/src/main/java/resources/showPreferencesProvider.html40
14 files changed, 727 insertions, 55 deletions
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/addPreferencesProvider.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/addPreferencesProvider.html
new file mode 100644
index 0000000000..ac5dd32119
--- /dev/null
+++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/addPreferencesProvider.html
@@ -0,0 +1,47 @@
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~ contributor license agreements. See the NOTICE file distributed with
+ ~ this work for additional information regarding copyright ownership.
+ ~ The ASF licenses this file to You under the Apache License, Version 2.0
+ ~ (the "License"); you may not use this file except in compliance with
+ ~ the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+<div class="dijitHidden">
+ <div data-dojo-type="dijit.Dialog" data-dojo-props="title:'Preferences Provider'" id="addPreferencesProvider">
+ <form id="formAddPreferencesProvider" method="post" data-dojo-type="dijit.form.Form">
+ <input type="hidden" id="preferencesProvider.id" name="id"/>
+ <div style="height:100px; width:420px; overflow: auto">
+ <table class="tableContainer-table tableContainer-table-horiz" width="100%" cellspacing="1">
+ <tr>
+ <td class="tableContainer-labelCell" style="width: 200px;"><strong>Type*:</strong></td>
+ <td class="tableContainer-valueCell"><div id="addPreferencesProvider.selectPreferencesProviderDiv"></div></td>
+ </tr>
+ <tr>
+ <td class="tableContainer-labelCell" style="width: 200px;"><strong>Name*:</strong></td>
+ <td class="tableContainer-valueCell"><input type="text" name="name"
+ id="preferencesProvider.name" data-dojo-type="dijit.form.ValidationTextBox"
+ data-dojo-props="placeHolder: 'Name',
+ required: true,
+ missingMessage: 'A name must be supplied',
+ title: 'Enter name',
+ pattern: '^[\x20-\x2e\x30-\x7F]{1,255}$'" /></td>
+ </tr>
+ </table>
+ <div id="preferencesProvider.fieldsContainer"></div>
+ </div>
+ <div class="dijitDialogPaneActionBar">
+ <!-- submit buttons -->
+ <input type="submit" value="Save Preferences Provider" data-dojo-props="label: 'Save Preferences Provider'" data-dojo-type="dijit.form.Button" />
+ <input type="button" value="Cancel" data-dojo-props="label: 'Cancel'" data-dojo-type="dijit.form.Button" id="addPreferencesProvider.cancelButton"/>
+ </div>
+ </form>
+ </div>
+</div>
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/authenticationprovider/preferences/filesystempreferences/add.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/authenticationprovider/preferences/filesystempreferences/add.html
new file mode 100644
index 0000000000..f46da4b017
--- /dev/null
+++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/authenticationprovider/preferences/filesystempreferences/add.html
@@ -0,0 +1,29 @@
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~ contributor license agreements. See the NOTICE file distributed with
+ ~ this work for additional information regarding copyright ownership.
+ ~ The ASF licenses this file to You under the Apache License, Version 2.0
+ ~ (the "License"); you may not use this file except in compliance with
+ ~ the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+<table class="tableContainer-table tableContainer-table-horiz" style="margin:0; width:100%" cellspacing="1">
+ <tr>
+ <td class="tableContainer-labelCell" style="width: 200px;"><strong>Path*: </strong></td>
+ <td class="tableContainer-valueCell" >
+ <input type="text" name="path"
+ id="preferencesProvider.path"
+ data-dojo-type="dijit.form.ValidationTextBox"
+ data-dojo-props="placeHolder: 'Path/to/file',
+ required: true,
+ missingMessage: 'A path must be supplied',
+ title: 'Enter path'"/></td>
+ </tr>
+</table>
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/authenticationprovider/preferences/filesystempreferences/show.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/authenticationprovider/preferences/filesystempreferences/show.html
new file mode 100644
index 0000000000..bc302d1e65
--- /dev/null
+++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/authenticationprovider/preferences/filesystempreferences/show.html
@@ -0,0 +1,21 @@
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~ contributor license agreements. See the NOTICE file distributed with
+ ~ this work for additional information regarding copyright ownership.
+ ~ The ASF licenses this file to You under the Apache License, Version 2.0
+ ~ (the "License"); you may not use this file except in compliance with
+ ~ the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<div style="clear:both">
+ <div class="formLabel-labelCell" style="float:left; width: 100px;">Path:</div>
+ <div class="fileSystemPreferencesProviderPath" style="float:left;"></div>
+</div> \ No newline at end of file
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/AuthenticationProvider.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/AuthenticationProvider.js
index 978ac4b45f..208a6f99c6 100644
--- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/AuthenticationProvider.js
+++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/AuthenticationProvider.js
@@ -32,10 +32,13 @@ define(["dojo/_base/xhr",
"dijit/registry",
"dojo/dom-style",
"dojox/html/entities",
- "dojox/grid/enhanced/plugins/Pagination",
- "dojox/grid/enhanced/plugins/IndirectSelection",
+ "dojo/dom",
+ "qpid/management/addPreferencesProvider",
+ "qpid/management/PreferencesProvider",
+ "qpid/management/authenticationprovider/PrincipalDatabaseAuthenticationManager",
"dojo/domReady!"],
- function (xhr, parser, query, connect, properties, updater, util, UpdatableStore, EnhancedGrid, addAuthenticationProvider, event, registry, domStyle, entities) {
+ function (xhr, parser, query, connect, properties, updater, util, UpdatableStore, EnhancedGrid,
+ addAuthenticationProvider, event, registry, domStyle, entities, dom, addPreferencesProvider, PreferencesProvider, PrincipalDatabaseAuthenticationManager) {
function AuthenticationProvider(name, parent, controller) {
this.name = name;
@@ -48,7 +51,7 @@ define(["dojo/_base/xhr",
}
AuthenticationProvider.prototype.getTitle = function() {
- return "AuthenticationProvider";
+ return "AuthenticationProvider:" + this.name;
};
AuthenticationProvider.prototype.open = function(contentPane) {
@@ -62,8 +65,6 @@ define(["dojo/_base/xhr",
that.authProviderUpdater = new AuthProviderUpdater(contentPane.containerNode, that.modelObj, that.controller, that);
- updater.add( that.authProviderUpdater );
-
that.authProviderUpdater.update();
var editButton = query(".editAuthenticationProviderButton", contentPane.containerNode)[0];
@@ -81,6 +82,16 @@ define(["dojo/_base/xhr",
event.stop(evt);
that.deleteAuthenticationProvider();
});
+
+ var addPreferencesProviderButton = query(".addPreferencesProviderButton", contentPane.containerNode)[0];
+ var addPreferencesProviderWidget = registry.byNode(addPreferencesProviderButton);
+ connect.connect(addPreferencesProviderWidget, "onClick",
+ function(evt){
+ event.stop(evt);
+ that.addPreferencesProvider();
+ });
+
+ updater.add( that.authProviderUpdater );
}});
};
@@ -111,6 +122,14 @@ define(["dojo/_base/xhr",
}
};
+ AuthenticationProvider.prototype.addPreferencesProvider = function() {
+ if (this.authProviderUpdater && this.authProviderUpdater.authProviderData
+ && (!this.authProviderUpdater.authProviderData.preferencesproviders
+ || !this.authProviderUpdater.authProviderData.preferencesproviders[0])){
+ addPreferencesProvider.show(this.name);
+ }
+ };
+
function AuthProviderUpdater(node, authProviderObj, controller, authenticationProvider)
{
this.controller = controller;
@@ -118,6 +137,13 @@ define(["dojo/_base/xhr",
this.type = query(".type", node)[0];
this.state = query(".state", node)[0];
this.authenticationProvider = authenticationProvider;
+ this.preferencesProviderType=dom.byId("preferencesProviderType");
+ this.preferencesProviderName=dom.byId("preferencesProviderName");
+ this.preferencesProviderState=dom.byId("preferencesProviderState");
+ this.addPreferencesProviderButton = query(".addPreferencesProviderButton", node)[0];
+ this.editPreferencesProviderButton = query(".editPreferencesProviderButton", node)[0];
+ this.deletePreferencesProviderButton = query(".deletePreferencesProviderButton", node)[0];
+ this.preferencesProviderAttributes = dom.byId("preferencesProviderAttributes")
this.query = "rest/authenticationprovider/" + encodeURIComponent(authProviderObj.name);
@@ -139,16 +165,38 @@ define(["dojo/_base/xhr",
if (util.isProviderManagingUsers(that.authProviderData.type))
{
- require(["qpid/management/authenticationprovider/PrincipalDatabaseAuthenticationManager"],
- function(PrincipalDatabaseAuthenticationManager) {
- that.details = new PrincipalDatabaseAuthenticationManager(node, data[0], controller, that);
- that.details.update();
- });
+ that.details = new PrincipalDatabaseAuthenticationManager(node, that.authProviderData, controller);
+ that.details.update(that.authProviderData);
}
+ var preferencesProviderData = that.authProviderData.preferencesproviders? that.authProviderData.preferencesproviders[0]: null;
+ that.preferencesNode = query(".preferencesProviderDetails", node)[0];
+ that.updatePreferencesProvider(preferencesProviderData);
});
}
+ AuthProviderUpdater.prototype.updatePreferencesProvider = function(preferencesProviderData)
+ {
+ if (preferencesProviderData)
+ {
+ this.addPreferencesProviderButton.style.display = 'none';
+ if (!this.preferencesProvider)
+ {
+ this.preferencesProvider=new PreferencesProvider(preferencesProviderData.name, this.authProviderData);
+ this.preferencesProvider.init(this.preferencesNode);
+ }
+ this.preferencesProvider.update(preferencesProviderData);
+ }
+ else
+ {
+ if (this.preferencesProvider)
+ {
+ this.preferencesProvider.update(null);
+ }
+ this.addPreferencesProviderButton.style.display = 'inline';
+ }
+ };
+
AuthProviderUpdater.prototype.updateHeader = function()
{
this.authenticationProvider.name = this.authProviderData[ "name" ]
@@ -159,8 +207,40 @@ define(["dojo/_base/xhr",
AuthProviderUpdater.prototype.update = function()
{
-
- var that = this;
+ var that = this;
+
+ xhr.get({url: this.query, sync: properties.useSyncGet, handleAs: "json"})
+ .then(function(data) {
+ that.authProviderData = data[0];
+ that.name = data[0].name
+ util.flattenStatistics( that.authProviderData );
+ that.updateHeader();
+ if (that.details)
+ {
+ try
+ {
+ that.details.update(that.authProviderData);
+ }
+ catch(e)
+ {
+ if (console)
+ {
+ console.error(e);
+ }
+ }
+ }
+ try
+ {
+ that.updatePreferencesProvider(that.authProviderData.preferencesproviders? that.authProviderData.preferencesproviders[0]: null);
+ }
+ catch(e)
+ {
+ if (console)
+ {
+ console.error(e);
+ }
+ }
+ });
};
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/PreferencesProvider.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/PreferencesProvider.js
new file mode 100644
index 0000000000..c8e6f9845c
--- /dev/null
+++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/PreferencesProvider.js
@@ -0,0 +1,179 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+define(["dojo/_base/xhr",
+ "dojo/parser",
+ "dojo/query",
+ "dojo/_base/connect",
+ "qpid/common/properties",
+ "qpid/common/updater",
+ "qpid/common/util",
+ "dojo/_base/event",
+ "dijit/registry",
+ "dojo/dom-style",
+ "dojox/html/entities",
+ "qpid/management/addPreferencesProvider",
+ "dojo/domReady!"],
+ function (xhr, parser, query, connect, properties, updater, util, event, registry, domStyle, entities, addPreferencesProvider) {
+
+ function PreferencesProvider(name, parent, controller) {
+ this.name = name;
+ this.controller = controller;
+ this.modelObj = { type: "preferencesprovider", name: name };
+ this.authenticationProviderName = parent.name;
+ if(parent) {
+ this.modelObj.parent = {};
+ this.modelObj.parent[parent.type] = parent;
+ }
+ }
+
+ PreferencesProvider.prototype.getTitle = function() {
+ return "PreferencesProvider:" + this.authenticationProviderName + "/" + this.name ;
+ };
+
+ PreferencesProvider.prototype.init = function(node) {
+ var that = this;
+ xhr.get({url: "showPreferencesProvider.html",
+ sync: true,
+ load: function(data) {
+ node.innerHTML = data;
+ parser.parse(node);
+
+ that.preferencesProviderType=query(".preferencesProviderType", node)[0];
+ that.preferencesProviderName=query(".preferencesProviderName", node)[0];
+ that.preferencesProviderState=query(".preferencesProviderState", node)[0];
+ that.editPreferencesProviderButton = query(".editPreferencesProviderButton", node)[0];
+ that.deletePreferencesProviderButton = query(".deletePreferencesProviderButton", node)[0];
+ that.preferencesProviderAttributes = query(".preferencesProviderAttributes", node)[0];
+ that.preferencesDetailsDiv = query(".preferencesDetails", node)[0];
+ var editPreferencesProviderWidget = registry.byNode(that.editPreferencesProviderButton);
+ editPreferencesProviderWidget.on("click", function(evt){ event.stop(evt); that.editPreferencesProvider();});
+ var deletePreferencesProviderWidget = registry.byNode(that.deletePreferencesProviderButton);
+ deletePreferencesProviderWidget.on("click", function(evt){ event.stop(evt); that.deletePreferencesProvider();});
+ }});
+ this.reload();
+ };
+
+ PreferencesProvider.prototype.open = function(contentPane) {
+ this.contentPane = contentPane;
+ this.init(contentPane.containerNode);
+ this.updater = new PreferencesProviderUpdater(this);
+ updater.add(this.updater);
+ };
+
+ PreferencesProvider.prototype.close = function() {
+ if (this.updater)
+ {
+ updater.remove( this.updater);
+ }
+ };
+
+ PreferencesProvider.prototype.deletePreferencesProvider = function() {
+ if (this.preferencesProviderData){
+ var preferencesProviderData = this.preferencesProviderData;
+ if(confirm("Are you sure you want to delete preferences provider '" + preferencesProviderData.name + "'?")) {
+ var query = "rest/preferencesprovider/" + encodeURIComponent(this.authenticationProviderName) + "/" + encodeURIComponent(preferencesProviderData.name);
+ this.success = true
+ var that = this;
+ xhr.del({url: query, sync: true, handleAs: "json"}).then(
+ function(data) {
+ that.update(null);
+
+ // if opened in tab
+ if (that.contentPane)
+ {
+ that.close();
+ that.contentPane.onClose()
+ that.controller.tabContainer.removeChild(that.contentPane);
+ that.contentPane.destroyRecursive();
+ }
+ },
+ function(error) {that.success = false; that.failureReason = error;});
+ if(!this.success ) {
+ alert("Error:" + this.failureReason);
+ }
+ }
+ }
+ };
+
+ PreferencesProvider.prototype.editPreferencesProvider = function() {
+ if (this.preferencesProviderData){
+ addPreferencesProvider.show(this.authenticationProviderName, this.name);
+ }
+ };
+
+ PreferencesProvider.prototype.update = function(data) {
+ this.preferencesProviderData = data;
+ if (data)
+ {
+ this.name = data.name;
+ this.preferencesProviderAttributes.style.display = 'block';
+ this.editPreferencesProviderButton.style.display = 'inline';
+ this.deletePreferencesProviderButton.style.display = 'inline';
+ this.preferencesProviderType.innerHTML = entities.encode(String(data.type));
+ this.preferencesProviderName.innerHTML = entities.encode(String(data.name));
+ this.preferencesProviderState.innerHTML = entities.encode(String(data.state));
+ if (!this.details)
+ {
+ var that = this;
+ require(["qpid/management/authenticationprovider/preferences/" + data.type.toLowerCase() + "/show"],
+ function(PreferencesProviderDetails) {
+ that.details = new PreferencesProviderDetails(that.preferencesDetailsDiv);
+ that.details.update(data);
+ });
+ }
+ else
+ {
+ this.details.update(data);
+ }
+ }
+ else
+ {
+ this.editPreferencesProviderButton.style.display = 'none';
+ this.deletePreferencesProviderButton.style.display = 'none';
+ this.preferencesProviderAttributes.style.display = 'none';
+ this.details = null;
+ }
+ };
+
+ PreferencesProvider.prototype.reload = function()
+ {
+ var query = "rest/preferencesprovider/" + encodeURIComponent(this.authenticationProviderName) + "/" + encodeURIComponent(this.name);
+ var that = this;
+ xhr.get({url: query, sync: properties.useSyncGet, handleAs: "json"})
+ .then(function(data) {
+ var preferencesProviderData = data[0];
+ util.flattenStatistics( preferencesProviderData );
+ that.update(preferencesProviderData);
+ });
+ };
+
+ function PreferencesProviderUpdater(preferencesProvider)
+ {
+ this.preferencesProvider = preferencesProvider;
+ };
+
+ PreferencesProviderUpdater.prototype.update = function()
+ {
+ this.preferencesProvider.reload();
+ };
+
+ return PreferencesProvider;
+ });
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addAuthenticationProvider.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addAuthenticationProvider.js
index d2891c7d3b..4f4b22a784 100644
--- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addAuthenticationProvider.js
+++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addAuthenticationProvider.js
@@ -31,6 +31,7 @@ define(["dojo/_base/xhr",
"dijit/form/FilteringSelect",
"dojo/_base/connect",
"dojo/dom-style",
+ "qpid/management/addPreferencesProvider",
/* dojox/ validate resources */
"dojox/validate/us", "dojox/validate/web",
/* basic dijit classes */
@@ -44,7 +45,7 @@ define(["dojo/_base/xhr",
"dojox/form/BusyButton", "dojox/form/CheckedMultiSelect",
"dojox/layout/TableContainer",
"dojo/domReady!"],
- function (xhr, dom, construct, win, registry, parser, array, event, json, Memory, FilteringSelect, connect, domStyle) {
+ function (xhr, dom, construct, win, registry, parser, array, event, json, Memory, FilteringSelect, connect, domStyle, addPreferencesProvider) {
var addAuthenticationProvider = {};
@@ -163,6 +164,10 @@ define(["dojo/_base/xhr",
if(this.success === true)
{
registry.byId("addAuthenticationProvider").hide();
+ if (dojo.byId("formAddAuthenticationProvider.id").value == "")
+ {
+ addPreferencesProvider.show(newAuthenticationManager.name);
+ }
}
else
{
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addPreferencesProvider.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addPreferencesProvider.js
new file mode 100644
index 0000000000..158a5f8fa2
--- /dev/null
+++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addPreferencesProvider.js
@@ -0,0 +1,196 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+define(["dojo/_base/xhr",
+ "dojo/dom",
+ "dojo/dom-construct",
+ "dojo/query",
+ "dojo/_base/window",
+ "dijit/registry",
+ "dojo/parser",
+ "dojo/_base/array",
+ "dojo/_base/event",
+ 'dojo/_base/json',
+ "dojo/store/Memory",
+ "dijit/form/FilteringSelect",
+ "dojo/_base/connect",
+ "dojo/dom-style",
+ "dojo/string",
+ "dojox/validate/us",
+ "dojox/validate/web",
+ "dijit/Dialog",
+ "dijit/form/CheckBox",
+ "dijit/form/Textarea",
+ "dijit/form/TextBox",
+ "dijit/form/ValidationTextBox",
+ "dijit/form/Button",
+ "dijit/form/Form",
+ "dojox/form/BusyButton",
+ "dojox/form/CheckedMultiSelect",
+ "dojox/layout/TableContainer",
+ "dojo/domReady!"],
+ function (xhr, dom, construct, query, win, registry, parser, array, event, json, Memory, FilteringSelect, connect, domStyle, string) {
+
+ var addPreferencesProvider = {};
+
+ var node = construct.create("div", null, win.body(), "last");
+
+ var convertToPreferencesProvider = function convertToPreferencesProvider(formValues)
+ {
+ var newProvider = {};
+
+ newProvider.name = dijit.byId("preferencesProvider.name").value;
+ newProvider.type = dijit.byId("preferencesProvider.type").value;
+ var id = dojo.byId("preferencesProvider.id").value;
+ if (id)
+ {
+ newProvider.id = id;
+ }
+ for(var propName in formValues)
+ {
+ if(formValues.hasOwnProperty(propName))
+ {
+ if(formValues[ propName ] !== "") {
+ newProvider[ propName ] = formValues[propName];
+ }
+
+ }
+ }
+ return newProvider;
+ }
+
+ var selectPreferencesProviderType = function(type) {
+ if(type && string.trim(type) != "")
+ {
+ require(["qpid/management/authenticationprovider/preferences/" + type.toLowerCase() + "/add"],
+ function(addType)
+ {
+ addType.show(dom.byId("preferencesProvider.fieldsContainer"), addPreferencesProvider.data)
+ });
+ }
+ }
+
+ xhr.get({url: "addPreferencesProvider.html",
+ sync: true,
+ load: function(data) {
+ node.innerHTML = data;
+ addPreferencesProvider.dialogNode = dom.byId("addPreferencesProvider");
+ parser.instantiate([addPreferencesProvider.dialogNode]);
+
+ var cancelButton = registry.byId("addPreferencesProvider.cancelButton");
+ cancelButton.on("click", function(){
+ registry.byId("addPreferencesProvider").hide();
+ });
+ var theForm = registry.byId("formAddPreferencesProvider");
+ theForm.on("submit", function(e) {
+
+ event.stop(e);
+ if(theForm.validate()){
+ var newProvider = convertToPreferencesProvider(theForm.getValues());
+ var that = this;
+ var nameWidget = registry.byId("preferencesProvider.name")
+ xhr.put({url: "rest/preferencesprovider/" +encodeURIComponent(addPreferencesProvider.authenticationProviderName) + "/" + encodeURIComponent(nameWidget.value),
+ sync: true, handleAs: "json",
+ headers: { "Content-Type": "application/json"},
+ putData: json.toJson(newProvider),
+ load: function(x) {that.success = true; },
+ error: function(error) {that.success = false; that.failureReason = error;}});
+ if(this.success === true)
+ {
+ registry.byId("addPreferencesProvider").hide();
+ }
+ else
+ {
+ alert("Error:" + this.failureReason);
+ }
+ return false;
+ }else{
+ alert('Form contains invalid data. Please correct first');
+ return false;
+ }
+ });
+ xhr.get({
+ sync: true,
+ url: "rest/helper?action=ListPreferencesProvidersTypes",
+ handleAs: "json"
+ }).then(
+ function(data) {
+ var preferencesProvidersTypes = data;
+ var storeData = [];
+ for (var i =0 ; i < preferencesProvidersTypes.length; i++)
+ {
+ storeData[i]= {id: preferencesProvidersTypes[i], name: preferencesProvidersTypes[i]};
+ }
+ var store = new Memory({ data: storeData });
+ var preferencesProviderTypesDiv = dom.byId("addPreferencesProvider.selectPreferencesProviderDiv");
+ var input = construct.create("input", {id: "preferencesProviderType", required: true}, preferencesProviderTypesDiv);
+ addPreferencesProvider.preferencesProviderTypeChooser = new FilteringSelect({ id: "preferencesProvider.type",
+ name: "type",
+ store: store,
+ searchAttr: "name",
+ required: true,
+ onChange: selectPreferencesProviderType }, input);
+ addPreferencesProvider.preferencesProviderTypeChooser.startup();
+ });
+ }});
+
+ addPreferencesProvider.show = function(authenticationProviderName, providerName) {
+ this.authenticationProviderName = authenticationProviderName;
+ this.data = null;
+ var that = this;
+ var theForm = registry.byId("formAddPreferencesProvider");
+ theForm.reset();
+ dojo.byId("preferencesProvider.id").value="";
+ var nameWidget = registry.byId("preferencesProvider.name");
+ nameWidget.set("disabled", false);
+ registry.byId("preferencesProvider.type").set("disabled", false);
+ if (this.preferencesProviderTypeChooser)
+ {
+ this.preferencesProviderTypeChooser.set("disabled", false);
+ this.preferencesProviderTypeChooser.set("value", null);
+ }
+ var dialog = registry.byId("addPreferencesProvider");
+ if (providerName)
+ {
+ xhr.get({
+ url: "rest/preferencesprovider/" +encodeURIComponent(authenticationProviderName) + "/" + encodeURIComponent(providerName),
+ sync: false,
+ handleAs: "json"
+ }).then(
+ function(data) {
+ var provider = data[0];
+ var providerType = provider.type;
+ that.data = provider;
+ nameWidget.set("value", provider.name);
+ nameWidget.set("disabled", true);
+ that.preferencesProviderTypeChooser.set("value", providerType);
+ that.preferencesProviderTypeChooser.set("disabled", true);
+ dojo.byId("preferencesProvider.id").value=provider.id;
+ dialog.show();
+ });
+ }
+ else
+ {
+ dialog.show();
+ }
+ }
+
+ return addPreferencesProvider;
+ }); \ No newline at end of file
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/PrincipalDatabaseAuthenticationManager.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/PrincipalDatabaseAuthenticationManager.js
index 0a607c71d4..09433b196d 100644
--- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/PrincipalDatabaseAuthenticationManager.js
+++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/PrincipalDatabaseAuthenticationManager.js
@@ -30,7 +30,6 @@ define(["dojo/_base/xhr",
"dijit/registry",
"qpid/common/util",
"qpid/common/properties",
- "qpid/common/updater",
"qpid/common/UpdatableStore",
"dojox/grid/EnhancedGrid",
"dojox/grid/enhanced/plugins/Pagination",
@@ -43,8 +42,8 @@ define(["dojo/_base/xhr",
"dijit/form/Form",
"dijit/form/DateTextBox",
"dojo/domReady!"],
- function (xhr, dom, parser, query, construct, connect, win, event, json, registry, util, properties, updater, UpdatableStore, EnhancedGrid) {
- function DatabaseAuthManager(containerNode, authProviderObj, controller, authenticationManagerUpdater) {
+ function (xhr, dom, parser, query, construct, connect, win, event, json, registry, util, properties, UpdatableStore, EnhancedGrid) {
+ function DatabaseAuthManager(containerNode, authProviderObj, controller) {
var node = construct.create("div", null, containerNode, "last");
var that = this;
this.name = authProviderObj.name;
@@ -53,14 +52,7 @@ define(["dojo/_base/xhr",
load: function(data) {
node.innerHTML = data;
parser.parse(node);
-
-
- that.authDatabaseUpdater= new AuthProviderUpdater(node, authProviderObj, controller, authenticationManagerUpdater);
- updater.add( that.authDatabaseUpdater);
-
- that.authDatabaseUpdater.update();
-
-
+ that.init(node, authProviderObj, controller);
}});
}
@@ -72,19 +64,12 @@ define(["dojo/_base/xhr",
updater.remove( this.authDatabaseUpdater );
};
- function AuthProviderUpdater(node, authProviderObj, controller, authenticationManagerUpdater)
+ DatabaseAuthManager.prototype.init = function(node, authProviderObj, controller)
{
this.controller = controller;
- this.query = "rest/authenticationprovider?id="+encodeURIComponent(authProviderObj.id);
- this.name = authProviderObj.name;
- this.authenticationManagerUpdater = authenticationManagerUpdater;
var that = this;
- xhr.get({url: this.query, sync: properties.useSyncGet, handleAs: "json"})
- .then(function(data) {
- that.authProviderData = data[0];
- that.name = data[0].name
- util.flattenStatistics( that.authProviderData );
+ that.authProviderData = authProviderObj;
var userDiv = query(".users")[0];
@@ -131,10 +116,9 @@ define(["dojo/_base/xhr",
event.stop(evt);
that.deleteUsers();
});
- });
}
- AuthProviderUpdater.prototype.deleteUsers = function()
+ DatabaseAuthManager.prototype.deleteUsers = function()
{
var grid = this.usersGrid.grid;
var data = grid.selection.getSelected();
@@ -168,24 +152,11 @@ define(["dojo/_base/xhr",
}
};
- AuthProviderUpdater.prototype.update = function()
+ DatabaseAuthManager.prototype.update = function(data)
{
-
- var that = this;
-
- xhr.get({url: this.query, sync: properties.useSyncGet, handleAs: "json"})
- .then(function(data) {
- that.authProviderData = data[0];
- that.name = data[0].name
- util.flattenStatistics( that.authProviderData );
-
- that.usersGrid.update(that.authProviderData.users);
-
- that.authenticationManagerUpdater.authProviderData = data[0];
- that.authenticationManagerUpdater.updateHeader();
- });
-
-
+ this.authProviderData = data;
+ this.name = data.name
+ this.usersGrid.update(this.authProviderData.users);
};
var addUser = {};
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/preferences/filesystempreferences/add.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/preferences/filesystempreferences/add.js
new file mode 100644
index 0000000000..0d9542ca39
--- /dev/null
+++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/preferences/filesystempreferences/add.js
@@ -0,0 +1,48 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+define(["dojo/_base/xhr",
+ "dojo/dom",
+ "dojo/dom-construct",
+ "dojo/_base/window",
+ "dijit/registry",
+ "dojo/parser",
+ "dojo/_base/array",
+ "dojo/_base/event",
+ "dojo/_base/json",
+ "dojo/string",
+ "dojo/text!../../../../../authenticationprovider/preferences/filesystempreferences/add.html",
+ "dojo/domReady!"],
+ function (xhr, dom, domConstruct, win, registry, parser, array, event, json, string, template) {
+ return {
+ show: function(node, data) {
+ dojo.forEach(dijit.findWidgets(node), function(w) {
+ w.destroyRecursive();
+ });
+ node.innerHTML = template;
+ parser.parse(node);
+ var pathWidget = registry.byId("preferencesProvider.path")
+ if (data)
+ {
+ pathWidget.set("value", data["path"]);
+ }
+ }
+ };
+ });
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/preferences/filesystempreferences/show.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/preferences/filesystempreferences/show.js
new file mode 100644
index 0000000000..7521f820b9
--- /dev/null
+++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/authenticationprovider/preferences/filesystempreferences/show.js
@@ -0,0 +1,46 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+define(["dojo/_base/xhr",
+ "dojo/parser",
+ "dojo/string",
+ "dojox/html/entities",
+ "dojo/query",
+ "dojo/domReady!"],
+ function (xhr, parser, json, entities, query) {
+
+ function FileSystemPreferences(containerNode) {
+ var that = this;
+ xhr.get({url: "authenticationprovider/preferences/filesystempreferences/show.html",
+ sync: true,
+ load: function(template) {
+ containerNode.innerHTML = template;
+ parser.parse(containerNode);
+ that.preferencesProviderPath=query(".fileSystemPreferencesProviderPath", containerNode)[0];
+ }});
+ }
+
+ FileSystemPreferences.prototype.update=function(data)
+ {
+ this.preferencesProviderPath.innerHTML = entities.encode(String(data["path"]));
+ };
+
+ return FileSystemPreferences;
+});
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/controller.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/controller.js
index b487ab62f2..e8d7bdd9cf 100644
--- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/controller.js
+++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/controller.js
@@ -36,10 +36,11 @@ define(["dojo/dom",
"qpid/management/Port",
"qpid/management/Plugin",
"qpid/management/logs/LogViewer",
+ "qpid/management/PreferencesProvider",
"dojo/ready",
"dojo/domReady!"],
function (dom, registry, ContentPane, entities, Broker, VirtualHost, Exchange, Queue, Connection, AuthProvider,
- GroupProvider, Group, KeyStore, TrustStore, AccessControlProvider, Port, Plugin, LogViewer, ready) {
+ GroupProvider, Group, KeyStore, TrustStore, AccessControlProvider, Port, Plugin, LogViewer, PreferencesProvider, ready) {
var controller = {};
var constructors = { broker: Broker, virtualhost: VirtualHost, exchange: Exchange,
@@ -47,7 +48,7 @@ define(["dojo/dom",
authenticationprovider: AuthProvider, groupprovider: GroupProvider,
group: Group, keystore: KeyStore, truststore: TrustStore,
accesscontrolprovider: AccessControlProvider, port: Port,
- plugin: Plugin, logViewer: LogViewer};
+ plugin: Plugin, logViewer: LogViewer, preferencesprovider: PreferencesProvider};
var tabDiv = dom.byId("managedViews");
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/treeView.js b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/treeView.js
index 8dc336b347..8770509c27 100644
--- a/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/treeView.js
+++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/treeView.js
@@ -284,6 +284,8 @@ define(["dojo/_base/xhr",
controller.show("accesscontrolprovider", details.accesscontrolprovider, {broker: {type:"broker", name:""}});
} else if (details.type == 'plugin') {
controller.show("plugin", details.plugin, {broker: {type:"broker", name:""}});
+ } else if (details.type == "preferencesprovider") {
+ controller.show("preferencesprovider", details.preferencesprovider, { type: "authenticationprovider", name: details.authenticationprovider, parent: {broker: {type:"broker", name:""}}});
}
};
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/showAuthProvider.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/showAuthProvider.html
index 5e876fdc1f..aabaee1e9d 100644
--- a/qpid/java/broker-plugins/management-http/src/main/java/resources/showAuthProvider.html
+++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/showAuthProvider.html
@@ -27,4 +27,11 @@
<br/>
<button data-dojo-type="dijit.form.Button" class="editAuthenticationProviderButton">Edit</button>
<button data-dojo-type="dijit.form.Button" class="deleteAuthenticationProviderButton">Delete</button>
+ <br/>
+ <br/>
+ <div class="preferencesPanel" data-dojo-type="dijit.TitlePane" data-dojo-props="title: 'Preferences Provider', open: true">
+ <div class="preferencesProviderDetails"></div>
+ <button data-dojo-type="dijit.form.Button" class="addPreferencesProviderButton">Add</button>
+ </div>
+ <br/>
</div> \ No newline at end of file
diff --git a/qpid/java/broker-plugins/management-http/src/main/java/resources/showPreferencesProvider.html b/qpid/java/broker-plugins/management-http/src/main/java/resources/showPreferencesProvider.html
new file mode 100644
index 0000000000..a1885acddf
--- /dev/null
+++ b/qpid/java/broker-plugins/management-http/src/main/java/resources/showPreferencesProvider.html
@@ -0,0 +1,40 @@
+<!--
+ -
+ - Licensed to the Apache Software Foundation (ASF) under one
+ - or more contributor license agreements. See the NOTICE file
+ - distributed with this work for additional information
+ - regarding copyright ownership. The ASF licenses this file
+ - to you under the Apache License, Version 2.0 (the
+ - "License"); you may not use this file except in compliance
+ - with the License. You may obtain a copy of the License at
+ -
+ - http://www.apache.org/licenses/LICENSE-2.0
+ -
+ - Unless required by applicable law or agreed to in writing,
+ - software distributed under the License is distributed on an
+ - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ - KIND, either express or implied. See the License for the
+ - specific language governing permissions and limitations
+ - under the License.
+ -
+ -->
+ <div class="preferencesProvider">
+ <div class="preferencesProviderAttributes">
+ <div style="clear:both">
+ <div class="formLabel-labelCell" style="float:left; width: 100px;">Type:</div>
+ <div class="preferencesProviderType" style="float:left;"></div>
+ </div>
+ <div style="clear:both">
+ <div class="formLabel-labelCell" style="float:left; width: 100px;">Name:</div>
+ <div class="preferencesProviderName" style="float:left;"></div>
+ </div>
+ <div style="clear:both">
+ <div class="formLabel-labelCell" style="float:left; width: 100px;">State:</div>
+ <div class="preferencesProviderState" style="float:left;"></div>
+ </div>
+ <div class="preferencesDetails"></div>
+ </div>
+ <br/>
+ <button data-dojo-type="dijit.form.Button" class="deletePreferencesProviderButton">Delete</button>
+ <button data-dojo-type="dijit.form.Button" class="editPreferencesProviderButton">Edit</button>
+</div> \ No newline at end of file