You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by or...@apache.org on 2017/11/03 14:13:46 UTC
qpid-broker-j git commit: QPID-8012:[Broker-J][WMC] Use
ResourceWidget to configure path for access control provider of type AclFile
Repository: qpid-broker-j
Updated Branches:
refs/heads/master b28150f50 -> 1444257d4
QPID-8012:[Broker-J][WMC] Use ResourceWidget to configure path for access control provider of type AclFile
Project: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/commit/1444257d
Tree: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/tree/1444257d
Diff: http://git-wip-us.apache.org/repos/asf/qpid-broker-j/diff/1444257d
Branch: refs/heads/master
Commit: 1444257d44a49b1946704d43695c2f08c16a95e4
Parents: b28150f
Author: Alex Rudyy <or...@apache.org>
Authored: Fri Nov 3 14:13:13 2017 +0000
Committer: Alex Rudyy <or...@apache.org>
Committed: Fri Nov 3 14:13:37 2017 +0000
----------------------------------------------------------------------
.../accesscontrolprovider/aclfile/add.html | 40 +----
.../accesscontrolprovider/aclfile/add.js | 150 ++++---------------
.../qpid/management/addAccessControlProvider.js | 3 +-
3 files changed, 40 insertions(+), 153 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/1444257d/broker-plugins/management-http/src/main/java/resources/accesscontrolprovider/aclfile/add.html
----------------------------------------------------------------------
diff --git a/broker-plugins/management-http/src/main/java/resources/accesscontrolprovider/aclfile/add.html b/broker-plugins/management-http/src/main/java/resources/accesscontrolprovider/aclfile/add.html
index 796988c..33b5310 100644
--- a/broker-plugins/management-http/src/main/java/resources/accesscontrolprovider/aclfile/add.html
+++ b/broker-plugins/management-http/src/main/java/resources/accesscontrolprovider/aclfile/add.html
@@ -21,44 +21,14 @@
<div id="addAccessControlProvider.oldBrowserWarning" class="infoMessage hidden clear"></div>
<div class="clear">
<div id="addAccessControlProvider.serverPathLabel" class="formLabel-labelCell tableContainer-labelCell">Server path or upload*:</div>
- <div class="formLabel-controlCell tableContainer-valueCell">
- <input type="text" id="addAccessControlProvider.serverPath"
- data-dojo-type="dijit/form/ValidationTextBox"
- data-dojo-props="
- name: 'serverPath',
+ <input type="text" id="addAccessControlProvider.path"
+ data-dojo-type="qpid/common/ResourceWidget"
+ data-dojo-props="
+ name: 'path',
placeHolder: 'access control provider file server path',
required: true,
- excluded: true,
promptMessage: 'Location of the access control provider file on the server',
title: 'Enter the access control provider file path'" />
-
- <!-- Hidden and used purely for form submission -->
- <input type="hidden" id="addAccessControlProvider.path"
- data-dojo-type="dijit/form/ValidationTextBox"
- data-dojo-props="
- name: 'path',
- required: true" />
- </div>
-
- <div id="addAccessControlProvider.uploadFields">
- <div id="addAccessControlProvider.fileLabel" class="formLabel-labelCell tableContainer-labelCell"></div>
- <div class="fileUpload clear">
- <span id="addAccessControlProvider.selectedFile" class="infoMessage"></span>
- <span id="addAccessControlProvider.selectedFileStatus"></span>
- </div>
-
- <div class="fileUpload clear">
- <input type="file" id="addAccessControlProvider.file"
- multiple="false"
- data-dojo-type="dojox/form/Uploader"
- data-dojo-props="label: 'Upload'"/>
- <button id="addAccessControlProvider.fileClearButton"
- data-dojo-type="dijit/form/Button"
- data-dojo-props="label: 'Clear',
- disabled: true">
- </button>
- </div>
- </div>
-
</div>
+ <div class="clear"></div>
</div>
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/1444257d/broker-plugins/management-http/src/main/java/resources/js/qpid/management/accesscontrolprovider/aclfile/add.js
----------------------------------------------------------------------
diff --git a/broker-plugins/management-http/src/main/java/resources/js/qpid/management/accesscontrolprovider/aclfile/add.js b/broker-plugins/management-http/src/main/java/resources/js/qpid/management/accesscontrolprovider/aclfile/add.js
index d6b1171..5a7f780 100644
--- a/broker-plugins/management-http/src/main/java/resources/js/qpid/management/accesscontrolprovider/aclfile/add.js
+++ b/broker-plugins/management-http/src/main/java/resources/js/qpid/management/accesscontrolprovider/aclfile/add.js
@@ -18,124 +18,40 @@
* under the License.
*
*/
-define(["dojo/dom", "dojo/query", "dijit/registry", "qpid/common/util"], function (dom, query, registry, util)
-{
- var addACLFileAccessControlProvider = {
- init: function ()
- {
- // Readers are HTML5
- this.reader = window.FileReader ? new FileReader() : undefined;
- },
- show: function (data)
- {
- var that = this;
- util.parseHtmlIntoDiv(data.containerNode, "accesscontrolprovider/aclfile/add.html", function ()
- {
- that._postParse(data);
- });
- },
- _postParse: function (data)
- {
- var that = this;
- this.aclServerPath = registry.byId("addAccessControlProvider.serverPath");
- this.aclUploadFields = dom.byId("addAccessControlProvider.uploadFields");
- this.aclSelectedFileContainer = dom.byId("addAccessControlProvider.selectedFile");
- this.aclSelectedFileStatusContainer = dom.byId("addAccessControlProvider.selectedFileStatus");
- this.aclFile = registry.byId("addAccessControlProvider.file");
- this.aclFileClearButton = registry.byId("addAccessControlProvider.fileClearButton");
- this.aclFileOldBrowserWarning = dom.byId("addAccessControlProvider.oldBrowserWarning");
-
- //Only submitted field
- this.aclPath = registry.byId("addAccessControlProvider.path");
-
- this.addButton = data.parent.addButton;
-
- if (this.reader)
- {
- this.reader.onload = function (evt)
- {
- that._aclUploadFileComplete(evt);
- };
- this.reader.onerror = function (ex)
- {
- console.error("Failed to load ACL file", ex);
- };
- this.aclFile.on("change", function (selected)
- {
- that._aclFileChanged(selected)
- });
- this.aclFileClearButton.on("click", function (event)
- {
- that._aclFileClearButtonClicked(event)
- });
- }
- else
+define(["dojo/dom", "qpid/common/util", "qpid/common/ResourceWidget"],
+ function (dom, util)
+ {
+ return {
+ show: function (data)
{
- // Fall back for IE8/9 which do not support FileReader
- this.aclUploadFields.style.display = "none";
- this.aclFileOldBrowserWarning.innerHTML =
- "File upload requires a more recent browser with HTML5 support";
- this.aclFileOldBrowserWarning.className = this.aclFileOldBrowserWarning.className.replace("hidden", "");
- }
-
- this.aclServerPath.on("blur", function ()
+ var that = this;
+ util.parseHtmlIntoDiv(data.containerNode,
+ "accesscontrolprovider/aclfile/add.html",
+ function ()
+ {
+ that._postParse(data);
+ });
+ },
+ _postParse: function (data)
{
- that._aclServerPathChanged()
- });
- },
- _aclFileChanged: function (evt)
- {
- // We only ever expect a single file
- var file = this.aclFile.domNode.children[0].files[0];
-
- this.addButton.setDisabled(true);
- this.aclSelectedFileContainer.innerHTML = file.name;
- this.aclSelectedFileStatusContainer.className = "loadingIcon";
-
- console.log("Beginning to read ACL file " + file.name);
- this.reader.readAsDataURL(file);
- },
- _aclUploadFileComplete: function (evt)
- {
- var reader = evt.target;
- var result = reader.result;
- console.log("ACL file read complete, contents " + result);
- this.addButton.setDisabled(false);
- this.aclSelectedFileStatusContainer.className = "loadedIcon";
-
- this.aclServerPath.set("value", "");
- this.aclServerPath.setDisabled(true);
- this.aclServerPath.set("required", false);
-
- this.aclFileClearButton.setDisabled(false);
+ var aclFileOldBrowserWarning = dom.byId("addAccessControlProvider.oldBrowserWarning");
- this.aclPath.set("value", result);
- },
- _aclFileClearButtonClicked: function (event)
- {
- this.aclFile.reset();
- this.aclSelectedFileStatusContainer.className = "";
- this.aclSelectedFileContainer.innerHTML = "";
- this.aclServerPath.set("required", true);
- this.aclServerPath.setDisabled(false);
- this.aclFileClearButton.setDisabled(true);
-
- this.aclPath.set("value", "");
- },
- _aclServerPathChanged: function ()
- {
- var serverPathValue = this.aclServerPath.get("value");
- this.aclPath.set("value", serverPathValue);
- }
- };
+ var reader = window.FileReader ? new FileReader() : undefined;
+ if (!reader)
+ {
+ aclFileOldBrowserWarning.innerHTML =
+ "File upload requires a more recent browser with HTML5 support";
+ aclFileOldBrowserWarning.className =
+ aclFileOldBrowserWarning.className.replace("hidden", "");
+ }
+
+ util.applyToWidgets(data.containerNode,
+ "AccessControlProvider",
+ "AclFile",
+ data.initialData,
+ data.metadata,
+ data.effectiveData);
- try
- {
- addACLFileAccessControlProvider.init();
- }
- catch (e)
- {
- console.warn(e);
- }
- return addACLFileAccessControlProvider;
-});
+ }
+ };
+ });
http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/1444257d/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addAccessControlProvider.js
----------------------------------------------------------------------
diff --git a/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addAccessControlProvider.js b/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addAccessControlProvider.js
index d8fb766..7eef299 100644
--- a/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addAccessControlProvider.js
+++ b/broker-plugins/management-http/src/main/java/resources/js/qpid/management/addAccessControlProvider.js
@@ -154,7 +154,8 @@ define(["dojo/_base/lang",
containerNode: typeFieldsContainer,
parent: that,
data: that.initialData,
- effectiveData: that.effectiveData
+ effectiveData: that.effectiveData,
+ metadata: that.management.metadata
});
util.applyMetadataToWidgets(typeFieldsContainer, category, type, that.management.metadata);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org