Modified: qpid/trunk/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/editVirtualHostNode.js
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/editVirtualHostNode.js?rev=1624345&r1=1624344&r2=1624345&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/editVirtualHostNode.js
(original)
+++ qpid/trunk/qpid/java/broker-plugins/management-http/src/main/java/resources/js/qpid/management/editVirtualHostNode.js
Thu Sep 11 17:37:32 2014
@@ -34,6 +34,7 @@ define(["dojo/_base/xhr",
"dojo/data/ObjectStore",
"qpid/common/util",
"dojo/text!editVirtualHostNode.html",
+ "qpid/common/ContextVariablesEditor",
"dijit/Dialog",
"dijit/form/CheckBox",
"dijit/form/FilteringSelect",
@@ -61,11 +62,16 @@ define(["dojo/_base/xhr",
this.name = registry.byId("editVirtualHostNode.name");
this.form = registry.byId("editVirtualHostNodeForm");
},
- show: function(nodeName)
+ show: function(effectiveData)
{
var that=this;
- this.query = "api/latest/virtualhostnode/" + encodeURIComponent(nodeName);
- this.dialog.set("title", "Edit Virtual Host Node - " + entities.encode(String(nodeName)));
+ if (!this.context)
+ {
+ this.context = new qpid.common.ContextVariablesEditor({name: 'context', title: 'Context
variables'});
+ this.context.placeAt(dom.byId("editVirtualHostNode.context"));
+ }
+ this.query = "api/latest/virtualhostnode/" + encodeURIComponent(effectiveData.name);
+ this.dialog.set("title", "Edit Virtual Host Node - " + entities.encode(String(effectiveData.name)));
xhr.get(
{
url: this.query,
@@ -74,7 +80,7 @@ define(["dojo/_base/xhr",
handleAs: "json",
load: function(data)
{
- that._show(data[0]);
+ that._show(data[0], effectiveData);
}
}
);
@@ -103,7 +109,11 @@ define(["dojo/_base/xhr",
if(this.form.validate())
{
var data = util.getFormWidgetValues(this.form, this.initialData);
-
+ var context = this.context.get("value");
+ if (context && !util.equals(context, this.initialData.context))
+ {
+ data["context"] = context;
+ }
var success = false,failureReason=null;
xhr.put({
url: this.query,
@@ -129,10 +139,11 @@ define(["dojo/_base/xhr",
alert('Form contains invalid data. Please correct first');
}
},
- _show:function(nodeData)
+ _show:function(actualData, effectiveData)
{
- this.initialData = nodeData;
- this.name.set("value", nodeData.name);
+ this.initialData = actualData;
+ this.name.set("value", actualData.name);
+ this.context.load( this.query, {actualValues: actualData.context, effectiveValues:
effectiveData.context});
var that = this;
@@ -140,15 +151,15 @@ define(["dojo/_base/xhr",
array.forEach(widgets, function(item) { item.destroyRecursive();});
domConstruct.empty(this.typeFieldsContainer);
- require(["qpid/management/virtualhostnode/" + nodeData.type.toLowerCase() + "/edit"],
+ require(["qpid/management/virtualhostnode/" + actualData.type.toLowerCase() + "/edit"],
function(TypeUI)
{
try
{
- TypeUI.show({containerNode:that.typeFieldsContainer, parent: that, data:
nodeData});
+ TypeUI.show({containerNode:that.typeFieldsContainer, parent: that, data:
actualData});
that.form.connectChildren();
- util.applyMetadataToWidgets(that.allFieldsContainer, "VirtualHostNode",
nodeData.type);
+ util.applyMetadataToWidgets(that.allFieldsContainer, "VirtualHostNode",
actualData.type);
}
catch(e)
{
Modified: qpid/trunk/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/servlet/rest/ConfiguredObjectToMapConverterTest.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/servlet/rest/ConfiguredObjectToMapConverterTest.java?rev=1624345&r1=1624344&r2=1624345&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/servlet/rest/ConfiguredObjectToMapConverterTest.java
(original)
+++ qpid/trunk/qpid/java/broker-plugins/management-http/src/test/java/org/apache/qpid/server/management/plugin/servlet/rest/ConfiguredObjectToMapConverterTest.java
Thu Sep 11 17:37:32 2014
@@ -139,6 +139,7 @@ public class ConfiguredObjectToMapConver
when(_configuredObject.getContextValue(eq(String.class),eq("inheritedkey"))).thenReturn("foo");
when(_configuredObject.getContextKeys(anyBoolean())).thenReturn(inheritedKeys);
when(_configuredObject.getContext()).thenReturn(actualContext);
+ when(_configuredObject.getActualAttributes()).thenReturn(Collections.singletonMap(ConfiguredObject.CONTEXT,
actualContext));
when(mockChild.getAttributeNames()).thenReturn(Arrays.asList(childAttributeName,
ConfiguredObject.CONTEXT));
when(mockChild.getAttribute(childAttributeName)).thenReturn(childAttributeValue);
when(mockChild.getActualAttributes()).thenReturn(Collections.singletonMap(childAttributeName,
childActualAttributeValue));
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org
|