Search in sources :

Example 1 with UIConstants

use of org.ovirt.engine.ui.uicompat.UIConstants in project ovirt-engine by oVirt.

the class ClusterModel method migrationPoliciesChanged.

private void migrationPoliciesChanged() {
    boolean hasMigrationPolicy = getMigrationPolicies().getSelectedItem() != null && !NoMigrationPolicy.ID.equals(getMigrationPolicies().getSelectedItem().getId());
    UIConstants constants = ConstantsManager.getInstance().getConstants();
    getAutoConverge().setIsChangeable(!hasMigrationPolicy, constants.availableOnlyWithLegacyPolicy());
    getMigrateCompressed().setIsChangeable(!hasMigrationPolicy, constants.availableOnlyWithLegacyPolicy());
}
Also used : UIConstants(org.ovirt.engine.ui.uicompat.UIConstants)

Example 2 with UIConstants

use of org.ovirt.engine.ui.uicompat.UIConstants in project ovirt-engine by oVirt.

the class VmListModel method initImportModelForVmsToImportNamesOnly.

private void initImportModelForVmsToImportNamesOnly(final ImportVmsModel importVmsModel, final ImportVmModel importVmModel) {
    final UIMessages messages = ConstantsManager.getInstance().getMessages();
    final UIConstants constants = ConstantsManager.getInstance().getConstants();
    final List<String> vmsToImport = new ArrayList<>();
    OriginType originType = convertImportSourceToOriginType(importVmsModel.getImportSources().getSelectedItem());
    final List<VM> externalVms = importVmsModel.getVmsToImport();
    for (VM vm : externalVms) {
        vmsToImport.add(vm.getName());
    }
    importVmsModel.clearProblem();
    importVmsModel.startProgress();
    importVmModel.setMessage("");
    AsyncQuery query = new AsyncQuery(returnValue -> {
        if (returnValue instanceof QueryReturnValue) {
            importVmsModel.setError(messages.providerFailure());
            importVmsModel.stopProgress();
        } else {
            List<VM> remoteVms = (List<VM>) returnValue;
            List<VM> remoteDownVms = new ArrayList<>();
            List<VM> nonRetrievedVms = new ArrayList<>();
            // find vms with status=down
            for (VM vm : remoteVms) {
                if (vm.isDown()) {
                    remoteDownVms.add(vm);
                }
            }
            // i.e. they were retrieved with their names only but not with their full info
            if (remoteVms.size() != externalVms.size()) {
                for (VM vm : externalVms) {
                    if (!remoteVms.contains(vm)) {
                        nonRetrievedVms.add(vm);
                    }
                }
            }
            importVmsModel.stopProgress();
            // prepare error message to be displayed in one of the models
            String messageForImportVm = null;
            String messageForImportVms = null;
            if (remoteVms.size() != remoteDownVms.size()) {
                if (!nonRetrievedVms.isEmpty()) {
                    messageForImportVm = constants.nonRetrievedAndRunningVmsWereFilteredOnImportVm();
                    messageForImportVms = constants.nonRetrievedAndRunningVmsWereAllFilteredOnImportVm();
                } else {
                    messageForImportVm = constants.runningVmsWereFilteredOnImportVm();
                    messageForImportVms = constants.runningVmsWereAllFilteredOnImportVm();
                }
            } else if (!nonRetrievedVms.isEmpty()) {
                messageForImportVm = constants.nonRetrievedVmsWereFilteredOnImportVm();
                messageForImportVms = constants.nonRetrievedVmsWereAllFilteredOnImportVm();
            }
            if (remoteDownVms.isEmpty() && messageForImportVms != null) {
                importVmsModel.setError(messageForImportVms);
            }
            if (!importVmsModel.validateArchitectures(remoteDownVms)) {
                return;
            }
            // init and display next dialog - the importVmsModel model
            importVmModel.init(remoteDownVms, importVmsModel.getDataCenters().getSelectedItem().getId());
            setWindow(null);
            setWindow(importVmModel);
            if (messageForImportVm != null) {
                importVmModel.setMessage(messageForImportVm);
            }
        }
    });
    if (!(importVmModel instanceof ImportVmFromExternalSourceModel)) {
        importVmsModel.setError(messages.providerImportFailure());
        importVmsModel.stopProgress();
        return;
    }
    ImportVmFromExternalSourceModel importVmsFromExternalSource = (ImportVmFromExternalSourceModel) importVmModel;
    query.setHandleFailure(true);
    AsyncDataProvider.getInstance().getVmsFromExternalServer(query, importVmsModel.getDataCenters().getSelectedItem().getId(), importVmsFromExternalSource.getProxyHostId(), importVmsFromExternalSource.getUrl(), importVmsFromExternalSource.getUsername(), importVmsFromExternalSource.getPassword(), originType, vmsToImport);
}
Also used : QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) OriginType(org.ovirt.engine.core.common.businessentities.OriginType) UIMessages(org.ovirt.engine.ui.uicompat.UIMessages) VM(org.ovirt.engine.core.common.businessentities.VM) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) UIConstants(org.ovirt.engine.ui.uicompat.UIConstants)

Example 3 with UIConstants

use of org.ovirt.engine.ui.uicompat.UIConstants in project ovirt-engine by oVirt.

the class VmListModel method stop.

private void stop() {
    UIConstants constants = ConstantsManager.getInstance().getConstants();
    powerAction(STOP, constants.stopVirtualMachinesTitle(), constants.areYouSureYouWantToStopTheFollowingVirtualMachinesMsg());
}
Also used : UIConstants(org.ovirt.engine.ui.uicompat.UIConstants)

Example 4 with UIConstants

use of org.ovirt.engine.ui.uicompat.UIConstants in project ovirt-engine by oVirt.

the class VmListModel method reboot.

private void reboot() {
    UIConstants constants = ConstantsManager.getInstance().getConstants();
    powerAction(REBOOT, constants.rebootVirtualMachinesTitle(), constants.areYouSureYouWantToRebootTheFollowingVirtualMachinesMsg(), false);
}
Also used : UIConstants(org.ovirt.engine.ui.uicompat.UIConstants)

Example 5 with UIConstants

use of org.ovirt.engine.ui.uicompat.UIConstants in project ovirt-engine by oVirt.

the class VolumeListModel method configureVolumeSnapshotOptions.

public void configureVolumeSnapshotOptions() {
    if (getWindow() != null) {
        return;
    }
    final UIConstants constants = ConstantsManager.getInstance().getConstants();
    GlusterVolumeEntity volumeEntity = getSelectedItems().get(0);
    final GlusterVolumeSnapshotConfigModel volumeSnapshotConfigModel = new GlusterVolumeSnapshotConfigModel(volumeEntity);
    volumeSnapshotConfigModel.setHelpTag(HelpTag.configure_volume_snapshot);
    // $NON-NLS-1$
    volumeSnapshotConfigModel.setHashName("configure_volume_snapshot");
    volumeSnapshotConfigModel.setTitle(ConstantsManager.getInstance().getConstants().configureVolumeSnapshotOptionsTitle());
    setWindow(volumeSnapshotConfigModel);
    AsyncDataProvider.getInstance().getClusterById(new AsyncQuery<>(cluster -> volumeSnapshotConfigModel.getClusterName().setEntity(cluster.getName())), volumeEntity.getClusterId());
    volumeSnapshotConfigModel.getVolumeName().setEntity(volumeEntity.getName());
    // $NON-NLS-1$
    UICommand updateCommand = new UICommand("confirmConfigureVolumeSnapshotOptions", this);
    updateCommand.setTitle(constants.snapshotConfigUpdateButtonLabel());
    updateCommand.setIsDefault(true);
    volumeSnapshotConfigModel.getCommands().add(updateCommand);
    // $NON-NLS-1$
    UICommand cancelCommand = new UICommand("Cancel", this);
    cancelCommand.setTitle(constants.cancel());
    cancelCommand.setIsCancel(true);
    volumeSnapshotConfigModel.getCommands().add(cancelCommand);
}
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) ApplicationMode(org.ovirt.engine.core.common.mode.ApplicationMode) ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) ActionType(org.ovirt.engine.core.common.action.ActionType) GlusterVolumeActionParameters(org.ovirt.engine.core.common.action.gluster.GlusterVolumeActionParameters) GlusterBrickEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity) GetConfigurationValueParameters(org.ovirt.engine.core.common.queries.GetConfigurationValueParameters) GlusterVolumeSnapshotConfig(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotConfig) ConstantsManager(org.ovirt.engine.ui.uicompat.ConstantsManager) GlusterVolumeParameters(org.ovirt.engine.core.common.action.gluster.GlusterVolumeParameters) TransportType(org.ovirt.engine.core.common.businessentities.gluster.TransportType) HasEntity(org.ovirt.engine.ui.uicommonweb.models.HasEntity) VolumeBrickListModel(org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeBrickListModel) VolumeRebalanceStatusModel(org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeRebalanceStatusModel) AsyncDataProvider(org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider) GlusterVolumeUtils(org.ovirt.engine.ui.frontend.utils.GlusterVolumeUtils) JobExecutionStatus(org.ovirt.engine.core.common.job.JobExecutionStatus) SearchParameters(org.ovirt.engine.core.common.queries.SearchParameters) VolumeSnapshotOptionModel(org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeSnapshotOptionModel) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) GlusterClusterSnapshotConfigModel(org.ovirt.engine.ui.uicommonweb.models.gluster.GlusterClusterSnapshotConfigModel) GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) GlusterStatus(org.ovirt.engine.core.common.businessentities.gluster.GlusterStatus) List(java.util.List) GlusterAsyncTask(org.ovirt.engine.core.common.asynctasks.gluster.GlusterAsyncTask) VolumeGeneralModel(org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeGeneralModel) VolumeGeoRepListModel(org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeGeoRepListModel) GlusterTaskType(org.ovirt.engine.core.common.asynctasks.gluster.GlusterTaskType) QueryType(org.ovirt.engine.core.common.queries.QueryType) PermissionListModel(org.ovirt.engine.ui.uicommonweb.models.configure.PermissionListModel) GlusterVolumeTaskStatusEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeTaskStatusEntity) Guid(org.ovirt.engine.core.compat.Guid) HelpTag(org.ovirt.engine.ui.uicommonweb.help.HelpTag) GlusterVolumeType(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeType) GlusterVolumeSnapshotListModel(org.ovirt.engine.ui.uicommonweb.models.gluster.GlusterVolumeSnapshotListModel) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) ArrayList(java.util.ArrayList) Frontend(org.ovirt.engine.ui.frontend.Frontend) GlusterVolumeSnapshotConfigModel(org.ovirt.engine.ui.uicommonweb.models.gluster.GlusterVolumeSnapshotConfigModel) GlusterVolumeOptionEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeOptionEntity) CreateGlusterVolumeParameters(org.ovirt.engine.core.common.action.gluster.CreateGlusterVolumeParameters) Linq(org.ovirt.engine.ui.uicommonweb.Linq) SearchStringMapping(org.ovirt.engine.ui.uicommonweb.models.SearchStringMapping) ConfigValues(org.ovirt.engine.core.common.config.ConfigValues) VolumeEventListModel(org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeEventListModel) VolumeParameterListModel(org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeParameterListModel) VolumeProfileStatisticsModel(org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeProfileStatisticsModel) VolumeModel(org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeModel) ListWithSimpleDetailsModel(org.ovirt.engine.ui.uicommonweb.models.ListWithSimpleDetailsModel) UIConstants(org.ovirt.engine.ui.uicompat.UIConstants) GlusterVolumeOptionParameters(org.ovirt.engine.core.common.action.gluster.GlusterVolumeOptionParameters) GlusterVolumeRebalanceParameters(org.ovirt.engine.core.common.action.gluster.GlusterVolumeRebalanceParameters) WebAdminApplicationPlaces(org.ovirt.engine.ui.uicommonweb.place.WebAdminApplicationPlaces) UpdateGlusterVolumeSnapshotConfigParameters(org.ovirt.engine.core.common.action.gluster.UpdateGlusterVolumeSnapshotConfigParameters) VolumeStatus(org.ovirt.engine.ui.frontend.utils.GlusterVolumeUtils.VolumeStatus) GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) GlusterVolumeSnapshotConfigModel(org.ovirt.engine.ui.uicommonweb.models.gluster.GlusterVolumeSnapshotConfigModel) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) UIConstants(org.ovirt.engine.ui.uicompat.UIConstants)

Aggregations

UIConstants (org.ovirt.engine.ui.uicompat.UIConstants)21 UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)11 ArrayList (java.util.ArrayList)10 ConfirmationModel (org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)7 List (java.util.List)6 GlusterVolumeEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity)6 ActionParametersBase (org.ovirt.engine.core.common.action.ActionParametersBase)4 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)4 ActionType (org.ovirt.engine.core.common.action.ActionType)4 GlusterVolumeParameters (org.ovirt.engine.core.common.action.gluster.GlusterVolumeParameters)4 GlusterStatus (org.ovirt.engine.core.common.businessentities.gluster.GlusterStatus)4 SearchParameters (org.ovirt.engine.core.common.queries.SearchParameters)4 Guid (org.ovirt.engine.core.compat.Guid)4 Frontend (org.ovirt.engine.ui.frontend.Frontend)4 Inject (com.google.inject.Inject)3 Arrays (java.util.Arrays)3 CreateGlusterVolumeParameters (org.ovirt.engine.core.common.action.gluster.CreateGlusterVolumeParameters)3 GlusterVolumeActionParameters (org.ovirt.engine.core.common.action.gluster.GlusterVolumeActionParameters)3 GlusterVolumeOptionParameters (org.ovirt.engine.core.common.action.gluster.GlusterVolumeOptionParameters)3 GlusterVolumeRebalanceParameters (org.ovirt.engine.core.common.action.gluster.GlusterVolumeRebalanceParameters)3