Search in sources :

Example 1 with ICommandTarget

use of org.ovirt.engine.ui.uicommonweb.ICommandTarget in project ovirt-engine by oVirt.

the class RegisterDiskModel method init.

public void init() {
    ICommandTarget target = (ICommandTarget) getEntity();
    // $NON-NLS-1$
    UICommand actionCommand = new UICommand("OnExecute", this);
    actionCommand.setTitle(constants.ok());
    actionCommand.setIsDefault(true);
    getCommands().add(actionCommand);
    // $NON-NLS-1$
    UICommand cancelCommand = new UICommand("Cancel", target);
    cancelCommand.setTitle(constants.cancel());
    cancelCommand.setIsCancel(true);
    getCommands().add(cancelCommand);
}
Also used : ICommandTarget(org.ovirt.engine.ui.uicommonweb.ICommandTarget) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand)

Example 2 with ICommandTarget

use of org.ovirt.engine.ui.uicommonweb.ICommandTarget in project ovirt-engine by oVirt.

the class MoveOrCopyDiskModel method postCopyOrMoveInit.

protected void postCopyOrMoveInit() {
    ICommandTarget target = (ICommandTarget) getEntity();
    if (getActiveStorageDomains().isEmpty()) {
        setMessage(constants.noStorageDomainAvailableMsg());
        // $NON-NLS-1$
        UICommand closeCommand = new UICommand("Cancel", target);
        closeCommand.setTitle(constants.close());
        closeCommand.setIsDefault(true);
        closeCommand.setIsCancel(true);
        getCommands().add(closeCommand);
    } else {
        if (!problematicDisks.isEmpty()) {
            setMessage(getWarning(problematicDisks));
        }
        // $NON-NLS-1$
        UICommand actionCommand = new UICommand("OnExecute", this);
        actionCommand.setTitle(constants.ok());
        actionCommand.setIsDefault(true);
        getCommands().add(actionCommand);
        // $NON-NLS-1$
        UICommand cancelCommand = new UICommand("Cancel", target);
        cancelCommand.setTitle(constants.cancel());
        cancelCommand.setIsCancel(true);
        getCommands().add(cancelCommand);
    }
    stopProgress();
}
Also used : ICommandTarget(org.ovirt.engine.ui.uicommonweb.ICommandTarget) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand)

Example 3 with ICommandTarget

use of org.ovirt.engine.ui.uicommonweb.ICommandTarget in project ovirt-engine by oVirt.

the class DataCenterListModel method checkForQuotaInDC.

private void checkForQuotaInDC(StoragePool storage_pool, final ICommandTarget commandTarget) {
    IdQueryParameters parameters = new IdQueryParameters(storage_pool.getId());
    Frontend.getInstance().runQuery(QueryType.GetQuotaByStoragePoolId, parameters, new AsyncQuery<QueryReturnValue>(returnValue -> {
        if (((ArrayList<Quota>) returnValue.getReturnValue()).size() == 0) {
            promptNoQuotaInDCMessage();
        } else {
            onSaveInternal();
        }
    }));
}
Also used : SearchType(org.ovirt.engine.core.common.interfaces.SearchType) Arrays(java.util.Arrays) SearchObjects(org.ovirt.engine.core.searchbackend.SearchObjects) Inject(com.google.inject.Inject) StorageServerConnections(org.ovirt.engine.core.common.businessentities.StorageServerConnections) ApplicationMode(org.ovirt.engine.core.common.mode.ApplicationMode) ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) QuotaEnforcementTypeEnum(org.ovirt.engine.core.common.businessentities.QuotaEnforcementTypeEnum) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) ActionType(org.ovirt.engine.core.common.action.ActionType) ConstantsManager(org.ovirt.engine.ui.uicompat.ConstantsManager) HasEntity(org.ovirt.engine.ui.uicommonweb.models.HasEntity) Version(org.ovirt.engine.core.compat.Version) AsyncDataProvider(org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider) StorageFormatType(org.ovirt.engine.core.common.businessentities.StorageFormatType) StorageType(org.ovirt.engine.core.common.businessentities.storage.StorageType) SearchParameters(org.ovirt.engine.core.common.queries.SearchParameters) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) Collection(java.util.Collection) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) StorageDomainSharedStatus(org.ovirt.engine.core.common.businessentities.StorageDomainSharedStatus) NameQueryParameters(org.ovirt.engine.core.common.queries.NameQueryParameters) List(java.util.List) Cloner(org.ovirt.engine.ui.uicommonweb.Cloner) ReconstructMasterParameters(org.ovirt.engine.core.common.action.ReconstructMasterParameters) DataCenterCpuQosListModel(org.ovirt.engine.ui.uicommonweb.models.datacenters.qos.DataCenterCpuQosListModel) StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) QueryType(org.ovirt.engine.core.common.queries.QueryType) PermissionListModel(org.ovirt.engine.ui.uicommonweb.models.configure.PermissionListModel) Guid(org.ovirt.engine.core.compat.Guid) StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) HelpTag(org.ovirt.engine.ui.uicommonweb.help.HelpTag) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) ArrayList(java.util.ArrayList) StoragePoolManagementParameter(org.ovirt.engine.core.common.action.StoragePoolManagementParameter) DataCenterHostNetworkQosListModel(org.ovirt.engine.ui.uicommonweb.models.datacenters.qos.DataCenterHostNetworkQosListModel) Frontend(org.ovirt.engine.ui.frontend.Frontend) DataCenterStorageQosListModel(org.ovirt.engine.ui.uicommonweb.models.datacenters.qos.DataCenterStorageQosListModel) ICommandTarget(org.ovirt.engine.ui.uicommonweb.ICommandTarget) VersionStorageFormatUtil(org.ovirt.engine.core.common.utils.VersionStorageFormatUtil) StoragePoolParametersBase(org.ovirt.engine.core.common.action.StoragePoolParametersBase) StoragePoolStatus(org.ovirt.engine.core.common.businessentities.StoragePoolStatus) SearchStringMapping(org.ovirt.engine.ui.uicommonweb.models.SearchStringMapping) Quota(org.ovirt.engine.core.common.businessentities.Quota) TabName(org.ovirt.engine.ui.uicommonweb.models.TabName) ListWithSimpleDetailsModel(org.ovirt.engine.ui.uicommonweb.models.ListWithSimpleDetailsModel) UIConstants(org.ovirt.engine.ui.uicompat.UIConstants) StorageDomainType(org.ovirt.engine.core.common.businessentities.StorageDomainType) WebAdminApplicationPlaces(org.ovirt.engine.ui.uicommonweb.place.WebAdminApplicationPlaces) PropertyChangedEventArgs(org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) ArrayList(java.util.ArrayList)

Example 4 with ICommandTarget

use of org.ovirt.engine.ui.uicommonweb.ICommandTarget in project ovirt-engine by oVirt.

the class RemoveDiskModel method onRemove.

public void onRemove(final ICommandTarget target) {
    boolean removeDisk = getLatch().getEntity();
    ActionType actionType = removeDisk ? ActionType.RemoveDisk : ActionType.DetachDiskFromVm;
    List<ActionParametersBase> parameterList = disksToRemove.stream().map(disk -> removeDisk ? new RemoveDiskParameters(disk.getId()) : new AttachDetachVmDiskParameters(new DiskVmElement(disk.getId(), vm.getId()))).collect(Collectors.toList());
    startProgress();
    Frontend.getInstance().runMultipleAction(actionType, parameterList, result -> {
        stopProgress();
        target.executeCommand(cancelCommand);
    }, this);
}
Also used : DiskVmElement(org.ovirt.engine.core.common.businessentities.storage.DiskVmElement) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) HelpTag(org.ovirt.engine.ui.uicommonweb.help.HelpTag) Disk(org.ovirt.engine.core.common.businessentities.storage.Disk) Collectors(java.util.stream.Collectors) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) ArrayList(java.util.ArrayList) AttachDetachVmDiskParameters(org.ovirt.engine.core.common.action.AttachDetachVmDiskParameters) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) ActionType(org.ovirt.engine.core.common.action.ActionType) RemoveDiskParameters(org.ovirt.engine.core.common.action.RemoveDiskParameters) Frontend(org.ovirt.engine.ui.frontend.Frontend) List(java.util.List) VM(org.ovirt.engine.core.common.businessentities.VM) ConstantsManager(org.ovirt.engine.ui.uicompat.ConstantsManager) ICommandTarget(org.ovirt.engine.ui.uicommonweb.ICommandTarget) AttachDetachVmDiskParameters(org.ovirt.engine.core.common.action.AttachDetachVmDiskParameters) ActionType(org.ovirt.engine.core.common.action.ActionType) DiskVmElement(org.ovirt.engine.core.common.businessentities.storage.DiskVmElement) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase) RemoveDiskParameters(org.ovirt.engine.core.common.action.RemoveDiskParameters)

Aggregations

ICommandTarget (org.ovirt.engine.ui.uicommonweb.ICommandTarget)4 UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)4 ArrayList (java.util.ArrayList)2 List (java.util.List)2 ActionParametersBase (org.ovirt.engine.core.common.action.ActionParametersBase)2 ActionType (org.ovirt.engine.core.common.action.ActionType)2 Frontend (org.ovirt.engine.ui.frontend.Frontend)2 HelpTag (org.ovirt.engine.ui.uicommonweb.help.HelpTag)2 ConfirmationModel (org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)2 EntityModel (org.ovirt.engine.ui.uicommonweb.models.EntityModel)2 ConstantsManager (org.ovirt.engine.ui.uicompat.ConstantsManager)2 Inject (com.google.inject.Inject)1 Arrays (java.util.Arrays)1 Collection (java.util.Collection)1 Collectors (java.util.stream.Collectors)1 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)1 AttachDetachVmDiskParameters (org.ovirt.engine.core.common.action.AttachDetachVmDiskParameters)1 ReconstructMasterParameters (org.ovirt.engine.core.common.action.ReconstructMasterParameters)1 RemoveDiskParameters (org.ovirt.engine.core.common.action.RemoveDiskParameters)1 StoragePoolManagementParameter (org.ovirt.engine.core.common.action.StoragePoolManagementParameter)1