Search in sources :

Example 1 with Frontend

use of org.ovirt.engine.ui.frontend.Frontend in project ovirt-engine by oVirt.

the class VncConsoleModel method invokeConsole.

private void invokeConsole() {
    final GraphicsInfo vncInfo = getEntity().getGraphicsInfos().get(GraphicsType.VNC);
    if (vncInfo == null) {
        // $NON-NLS-1$
        throw new IllegalStateException("Trying to invoke VNC console but VM GraphicsInfo is null.");
    }
    vncImpl.getOptions().setVmId(getEntity().getId());
    ConfigureConsoleOptionsParams parameters = new ConfigureConsoleOptionsParams(vncImpl.getOptions(), true);
    parameters.setEngineBaseUrl(FrontendUrlUtils.getRootURL());
    parameters.setConsoleClientResourcesUrl(dynamicMessages.consoleClientResourcesUrl());
    Frontend.getInstance().runQuery(QueryType.ConfigureConsoleOptions, parameters, new ShowErrorAsyncQuery(returnValue -> {
        ConsoleOptions configuredOptions = ((QueryReturnValue) returnValue).getReturnValue();
        // overriding global server settings by frontend settings
        configuredOptions.setRemapCtrlAltDelete(vncImpl.getOptions().isRemapCtrlAltDelete());
        vncImpl.setOptions(configuredOptions);
        vncImpl.getOptions().setTitle(getClientTitle());
        vncImpl.getOptions().setVmName(getEntity().getName());
        vncImpl.invokeClient();
    }));
}
Also used : DynamicMessages(org.ovirt.engine.ui.uicommonweb.DynamicMessages) QueryType(org.ovirt.engine.core.common.queries.QueryType) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) ConsoleUtils(org.ovirt.engine.ui.uicommonweb.ConsoleUtils) ConfigValues(org.ovirt.engine.core.common.config.ConfigValues) ConfigureConsoleOptionsParams(org.ovirt.engine.core.common.queries.ConfigureConsoleOptionsParams) FrontendUrlUtils(org.ovirt.engine.ui.frontend.utils.FrontendUrlUtils) GraphicsInfo(org.ovirt.engine.core.common.businessentities.GraphicsInfo) ConsoleOptions(org.ovirt.engine.core.common.console.ConsoleOptions) Frontend(org.ovirt.engine.ui.frontend.Frontend) VM(org.ovirt.engine.core.common.businessentities.VM) ShowErrorAsyncQuery(org.ovirt.engine.ui.uicommonweb.ShowErrorAsyncQuery) BaseCommandTarget(org.ovirt.engine.ui.uicommonweb.BaseCommandTarget) TypeResolver(org.ovirt.engine.ui.uicommonweb.TypeResolver) ConstantsManager(org.ovirt.engine.ui.uicompat.ConstantsManager) GraphicsType(org.ovirt.engine.core.common.businessentities.GraphicsType) AsyncDataProvider(org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider) Model(org.ovirt.engine.ui.uicommonweb.models.Model) ConfigureConsoleOptionsParams(org.ovirt.engine.core.common.queries.ConfigureConsoleOptionsParams) ShowErrorAsyncQuery(org.ovirt.engine.ui.uicommonweb.ShowErrorAsyncQuery) GraphicsInfo(org.ovirt.engine.core.common.businessentities.GraphicsInfo) ConsoleOptions(org.ovirt.engine.core.common.console.ConsoleOptions)

Example 2 with Frontend

use of org.ovirt.engine.ui.frontend.Frontend in project ovirt-engine by oVirt.

the class SpiceConsoleModel method invokeClient.

public void invokeClient() {
    final GraphicsInfo spiceInfo = getEntity().getGraphicsInfos().get(GraphicsType.SPICE);
    if (spiceInfo == null) {
        // $NON-NLS-1$
        throw new IllegalStateException("Trying to invoke SPICE console but VM GraphicsInfo is null.");
    }
    final ConsoleOptions options = getSpiceImpl().getOptions();
    options.setVmId(getEntity().getId());
    // configure options
    ConfigureConsoleOptionsParams parameters = new ConfigureConsoleOptionsParams(options, true);
    parameters.setEngineBaseUrl(FrontendUrlUtils.getRootURL());
    parameters.setConsoleClientResourcesUrl(dynamicMessages.consoleClientResourcesUrl());
    Frontend.getInstance().runQuery(QueryType.ConfigureConsoleOptions, parameters, new ShowErrorAsyncQuery(returnValue -> {
        final ConsoleOptions configuredOptions = returnValue.getReturnValue();
        // overriding global server settings by frontend settings
        configuredOptions.setRemapCtrlAltDelete(options.isRemapCtrlAltDelete());
        configuredOptions.setTitle(getClientTitle());
        configuredOptions.setVmName(getEntity().getName());
        configuredOptions.setFullScreen(options.isFullScreen());
        configuredOptions.setSmartcardEnabledOverridden(options.isSmartcardEnabledOverridden());
        if (!configuredOptions.isSpiceProxyEnabled()) {
            // override spice proxy from backend
            configuredOptions.setSpiceProxy(null);
        }
        try {
            getSpiceImpl().setOptions(configuredOptions);
            getSpiceImpl().invokeClient();
        } catch (RuntimeException ex) {
            // $NON-NLS-1$
            getLogger().error("Exception on Spice connect", ex);
        }
    }));
}
Also used : DynamicMessages(org.ovirt.engine.ui.uicommonweb.DynamicMessages) QueryType(org.ovirt.engine.core.common.queries.QueryType) ILogger(org.ovirt.engine.ui.uicommonweb.ILogger) HelpTag(org.ovirt.engine.ui.uicommonweb.help.HelpTag) ConsoleUtils(org.ovirt.engine.ui.uicommonweb.ConsoleUtils) ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) GraphicsInfo(org.ovirt.engine.core.common.businessentities.GraphicsInfo) ConsoleOptions(org.ovirt.engine.core.common.console.ConsoleOptions) ActionType(org.ovirt.engine.core.common.action.ActionType) Frontend(org.ovirt.engine.ui.frontend.Frontend) ConstantsManager(org.ovirt.engine.ui.uicompat.ConstantsManager) SsoMethod(org.ovirt.engine.core.common.businessentities.SsoMethod) AsyncDataProvider(org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider) Model(org.ovirt.engine.ui.uicommonweb.models.Model) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) ConfigureConsoleOptionsParams(org.ovirt.engine.core.common.queries.ConfigureConsoleOptionsParams) FrontendUrlUtils(org.ovirt.engine.ui.frontend.utils.FrontendUrlUtils) EngineError(org.ovirt.engine.core.common.errors.EngineError) VM(org.ovirt.engine.core.common.businessentities.VM) ShowErrorAsyncQuery(org.ovirt.engine.ui.uicommonweb.ShowErrorAsyncQuery) VmOperationParameterBase(org.ovirt.engine.core.common.action.VmOperationParameterBase) BaseCommandTarget(org.ovirt.engine.ui.uicommonweb.BaseCommandTarget) TypeResolver(org.ovirt.engine.ui.uicommonweb.TypeResolver) EventDefinition(org.ovirt.engine.ui.uicompat.EventDefinition) GraphicsType(org.ovirt.engine.core.common.businessentities.GraphicsType) VMStatus(org.ovirt.engine.core.common.businessentities.VMStatus) ConfigureConsoleOptionsParams(org.ovirt.engine.core.common.queries.ConfigureConsoleOptionsParams) ShowErrorAsyncQuery(org.ovirt.engine.ui.uicommonweb.ShowErrorAsyncQuery) GraphicsInfo(org.ovirt.engine.core.common.businessentities.GraphicsInfo) ConsoleOptions(org.ovirt.engine.core.common.console.ConsoleOptions)

Aggregations

GraphicsInfo (org.ovirt.engine.core.common.businessentities.GraphicsInfo)2 GraphicsType (org.ovirt.engine.core.common.businessentities.GraphicsType)2 VM (org.ovirt.engine.core.common.businessentities.VM)2 ConsoleOptions (org.ovirt.engine.core.common.console.ConsoleOptions)2 ConfigureConsoleOptionsParams (org.ovirt.engine.core.common.queries.ConfigureConsoleOptionsParams)2 QueryType (org.ovirt.engine.core.common.queries.QueryType)2 Frontend (org.ovirt.engine.ui.frontend.Frontend)2 FrontendUrlUtils (org.ovirt.engine.ui.frontend.utils.FrontendUrlUtils)2 BaseCommandTarget (org.ovirt.engine.ui.uicommonweb.BaseCommandTarget)2 ConsoleUtils (org.ovirt.engine.ui.uicommonweb.ConsoleUtils)2 DynamicMessages (org.ovirt.engine.ui.uicommonweb.DynamicMessages)2 ShowErrorAsyncQuery (org.ovirt.engine.ui.uicommonweb.ShowErrorAsyncQuery)2 TypeResolver (org.ovirt.engine.ui.uicommonweb.TypeResolver)2 UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)2 AsyncDataProvider (org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider)2 Model (org.ovirt.engine.ui.uicommonweb.models.Model)2 ConstantsManager (org.ovirt.engine.ui.uicompat.ConstantsManager)2 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)1 ActionType (org.ovirt.engine.core.common.action.ActionType)1 VmOperationParameterBase (org.ovirt.engine.core.common.action.VmOperationParameterBase)1