Search in sources :

Example 6 with UIConstants

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

the class VolumeListModel method configureClusterSnapshotOptions.

/**
 * This action is handled here in VolumeLisModel only, because there is a use case where no volume would be selected
 * for setting the configuration. And in this scenario the GlusrerVolumeSnapshotListModel would not be initialized.
 */
public void configureClusterSnapshotOptions() {
    if (getWindow() != null) {
        return;
    }
    final UIConstants constants = ConstantsManager.getInstance().getConstants();
    final GlusterClusterSnapshotConfigModel clusterSnapshotConfigModel = new GlusterClusterSnapshotConfigModel();
    clusterSnapshotConfigModel.setHelpTag(HelpTag.configure_volume_snapshot);
    // $NON-NLS-1$
    clusterSnapshotConfigModel.setHashName("configure_volume_snapshot");
    clusterSnapshotConfigModel.setTitle(ConstantsManager.getInstance().getConstants().configureClusterSnapshotOptionsTitle());
    setWindow(clusterSnapshotConfigModel);
    AsyncDataProvider.getInstance().getClustersHavingHosts(new AsyncQuery<>(returnValue -> {
        if (getSelectedItems() != null) {
            GlusterVolumeEntity volumeEntity = getSelectedItems().get(0);
            if (volumeEntity != null) {
                AsyncDataProvider.getInstance().getClusterById(new AsyncQuery<>(cluster -> clusterSnapshotConfigModel.getClusters().setItems(returnValue, cluster)), volumeEntity.getClusterId());
            }
        } else {
            clusterSnapshotConfigModel.getClusters().setItems(returnValue);
        }
    }));
    clusterSnapshotConfigModel.getClusterConfigOptions().setTitle(ConstantsManager.getInstance().getConstants().configureClusterSnapshotOptionsTitle());
    // $NON-NLS-1$
    UICommand updateCommand = new UICommand("confirmConfigureClusterSnapshotOptions", this);
    updateCommand.setTitle(constants.snapshotConfigUpdateButtonLabel());
    updateCommand.setIsDefault(true);
    clusterSnapshotConfigModel.getCommands().add(updateCommand);
    // $NON-NLS-1$
    UICommand cancelCommand = new UICommand("Cancel", this);
    cancelCommand.setTitle(constants.cancel());
    cancelCommand.setIsCancel(true);
    clusterSnapshotConfigModel.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) GlusterClusterSnapshotConfigModel(org.ovirt.engine.ui.uicommonweb.models.gluster.GlusterClusterSnapshotConfigModel) GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) UIConstants(org.ovirt.engine.ui.uicompat.UIConstants)

Example 7 with UIConstants

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

the class SanStorageModelBase method updateGrayedOut.

private void updateGrayedOut(boolean isInMaintenance, Set<String> metadataDevices, LunModel lunModel) {
    UIConstants constants = ConstantsManager.getInstance().getConstants();
    UIMessages messages = ConstantsManager.getInstance().getMessages();
    LUNs lun = lunModel.getEntity();
    boolean nonEmpty = lun.getStorageDomainId() != null || lun.getDiskId() != null || lun.getStatus() == LunStatus.Unusable;
    // Graying out LUNs
    lunModel.setIsGrayedOut(isIgnoreGrayedOut() ? lun.getDiskId() != null : nonEmpty);
    // Adding 'GrayedOutReasons'
    if (lun.getDiskId() != null) {
        lunModel.getGrayedOutReasons().add(messages.lunUsedByDiskWarning(lun.getDiskAlias()));
    } else if (lun.getStorageDomainId() != null && !isInMaintenance) {
        lunModel.getGrayedOutReasons().add(messages.lunAlreadyPartOfStorageDomainWarning(lun.getStorageDomainName()));
    } else if (isInMaintenance && metadataDevices.contains(lun.getId())) {
        lunModel.getGrayedOutReasons().add(messages.lunIsMetadataDevice(lun.getStorageDomainName()));
    } else if (lun.getStatus() == LunStatus.Unusable) {
        lunModel.getGrayedOutReasons().add(constants.lunUnusable());
    }
}
Also used : UIMessages(org.ovirt.engine.ui.uicompat.UIMessages) UIConstants(org.ovirt.engine.ui.uicompat.UIConstants) LUNs(org.ovirt.engine.core.common.businessentities.storage.LUNs)

Example 8 with UIConstants

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

the class ImportTemplateModel method init.

public void init(final Collection<VmTemplate> externalTemplates, final Guid storageDomainId) {
    Frontend.getInstance().runQuery(QueryType.Search, new SearchParameters(createSearchPattern(externalTemplates), SearchType.VmTemplate), new AsyncQuery<>(new AsyncCallback<QueryReturnValue>() {

        @Override
        public void onSuccess(QueryReturnValue returnValue) {
            UIConstants constants = ConstantsManager.getInstance().getConstants();
            List<VmTemplate> vmtList = returnValue.getReturnValue();
            List<ImportTemplateData> templateDataList = new ArrayList<>();
            for (VmTemplate template : externalTemplates) {
                ImportTemplateData templateData = new ImportTemplateData(template);
                boolean templateExistsInSystem = vmtList.contains(template);
                templateData.setExistsInSystem(templateExistsInSystem);
                if (templateExistsInSystem) {
                    templateData.enforceClone(constants.importTemplateThatExistsInSystemMustClone());
                } else if (!template.isBaseTemplate() && findAnyVmTemplateById(vmtList, template.getBaseTemplateId()) == null) {
                    templateData.enforceClone(constants.importTemplateWithoutBaseMustClone());
                }
                templateDataList.add(templateData);
            }
            setItems(templateDataList);
            withDataCenterLoaded(storageDomainId, r -> doInit());
        }

        private VmTemplate findAnyVmTemplateById(List<VmTemplate> vmtList, Guid templateId) {
            for (VmTemplate vmt : vmtList) {
                if (templateId.equals(vmt.getId())) {
                    return vmt;
                }
            }
            return null;
        }
    }));
}
Also used : AsyncCallback(org.ovirt.engine.ui.frontend.AsyncCallback) ArrayList(java.util.ArrayList) Guid(org.ovirt.engine.core.compat.Guid) SearchParameters(org.ovirt.engine.core.common.queries.SearchParameters) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) ImportTemplateData(org.ovirt.engine.ui.uicommonweb.models.vms.ImportTemplateData) VmTemplate(org.ovirt.engine.core.common.businessentities.VmTemplate) ArrayList(java.util.ArrayList) List(java.util.List) UIConstants(org.ovirt.engine.ui.uicompat.UIConstants)

Example 9 with UIConstants

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

the class DataCenterListModel method edit.

public void edit() {
    StoragePool dataCenter = getSelectedItem();
    final UIConstants constants = ConstantsManager.getInstance().getConstants();
    if (getWindow() != null) {
        return;
    }
    final DataCenterModel model = new DataCenterModel();
    setWindow(model);
    model.setEntity(dataCenter);
    model.setDataCenterId(dataCenter.getId());
    model.setTitle(constants.editDataCenterTitle());
    model.setHelpTag(HelpTag.edit_data_center);
    // $NON-NLS-1$
    model.setHashName("edit_data_center");
    model.getName().setEntity(dataCenter.getName());
    model.getDescription().setEntity(dataCenter.getdescription());
    model.getComment().setEntity(dataCenter.getComment());
    model.setOriginalName(dataCenter.getName());
    model.getStoragePoolType().setSelectedItem(dataCenter.isLocal());
    model.getQuotaEnforceTypeListModel().setSelectedItem(dataCenter.getQuotaEnforcementType());
    // $NON-NLS-1$
    UICommand tempVar = UICommand.createDefaultOkUiCommand("OnSave", this);
    model.getCommands().add(tempVar);
    // $NON-NLS-1$
    UICommand tempVar2 = UICommand.createCancelUiCommand("Cancel", this);
    model.getCommands().add(tempVar2);
}
Also used : StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) UIConstants(org.ovirt.engine.ui.uicompat.UIConstants)

Example 10 with UIConstants

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

the class VolumeGeoRepListModel method showGeoRepSessionDetails.

public void showGeoRepSessionDetails(GlusterGeoRepSession session) {
    ArrayList<GlusterGeoRepSessionDetails> details = session.getSessionDetails();
    if (getWindow() != null) {
        return;
    }
    if (details == null || details.size() == 0) {
        final UIConstants constants = ConstantsManager.getInstance().getConstants();
        final ConfirmationModel cModel = new ConfirmationModel();
        cModel.setTitle(constants.geoReplicationSessionDetailsTitle());
        // $NON-NLS-1$
        UICommand okCommand = new UICommand("closeConfirmWindow", this);
        okCommand.setTitle(constants.ok());
        okCommand.setIsCancel(true);
        cModel.getCommands().add(okCommand);
        setConfirmWindow(cModel);
        cModel.setMessage(constants.geoRepSessionStatusDetailFetchFailed());
    } else {
        populateStatus(details);
    }
}
Also used : GlusterGeoRepSessionDetails(org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSessionDetails) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) 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