Frank Kobzik has uploaded a new change for review. Change subject: frontend: console native execution in iframes ......................................................................
frontend: console native execution in iframes currently when user runs a console using 'native' invocation, the request is made in a new tab. this patch changes the behavior and opens requests in iframes instead. this is more convenient as the execution doesn't open a new tab for every vm involved. Change-Id: I042213dd16fdab94b431ea0564a3780b79234e69 Signed-off-by: Frantisek Kobzik <[email protected]> Bug-Url: https://bugzilla.redhat.com/1026842 --- M frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/ConsoleModel.java 1 file changed, 19 insertions(+), 5 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/76/21076/1 diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/ConsoleModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/ConsoleModel.java index d31215d..dea25c9 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/ConsoleModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/ConsoleModel.java @@ -1,5 +1,9 @@ package org.ovirt.engine.ui.uicommonweb.models.vms; +import com.google.gwt.dom.client.FrameElement; +import com.google.gwt.event.dom.client.LoadEvent; +import com.google.gwt.event.dom.client.LoadHandler; +import com.google.gwt.user.client.ui.Frame; import org.ovirt.engine.core.common.businessentities.VM; import org.ovirt.engine.core.common.businessentities.VMStatus; import org.ovirt.engine.core.common.queries.HasAdElementReconnectPermissionParameters; @@ -298,9 +302,11 @@ } public static void makeConsoleConfigRequest(String fileName, String contentType, String configFileContent) { - // open form always in a new window - final FormPanel formPanel = new FormPanel(new NamedFrame("_blank")); //$NON-NLS-1$ + final Frame iframe = new Frame(); + final FormPanel formPanel = new FormPanel(new NamedFrame("_self")); //$NON-NLS-1$ + formPanel.setMethod(FormPanel.METHOD_POST); + formPanel.getElement().setId("conform" + Double.valueOf(Math.random() * 100000).toString());//$NON-NLS-1$ final FlowPanel innerPanel = new FlowPanel(); innerPanel.add(buildTextArea("contenttype", contentType));//$NON-NLS-1$ @@ -313,17 +319,25 @@ final FormElement form = FormElement.as(formPanel.getElement()); formPanel.setEncoding(FormPanel.ENCODING_URLENCODED); - RootPanel.getBodyElement().appendChild(form); // clean-up after form submit formPanel.addSubmitCompleteHandler(new SubmitCompleteHandler() { @Override public void onSubmitComplete(SubmitCompleteEvent event) { - RootPanel.getBodyElement().removeChild(form); + RootPanel.get().remove(iframe); } }); - form.submit(); + RootPanel.get().add(iframe); + iframe.addLoadHandler(new LoadHandler() { + @Override + public void onLoad(LoadEvent event) { + FrameElement iframeElem = iframe.getElement().cast(); + iframeElem.getContentDocument().getDocumentElement().appendChild(form); + + form.submit(); + } + }); } private static TextArea buildTextArea(String name, String value) { -- To view, visit http://gerrit.ovirt.org/21076 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I042213dd16fdab94b431ea0564a3780b79234e69 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Frank Kobzik <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
