Search in sources :

Example 11 with StorageDomainType

use of org.ovirt.engine.core.common.businessentities.StorageDomainType in project ovirt-engine by oVirt.

the class StorageModelBehavior method getSelectableModelsByRole.

public ArrayList<IStorageModel> getSelectableModelsByRole() {
    StorageDomainType role = getModel().getAvailableStorageDomainTypeItems().getSelectedItem();
    List<IStorageModel> items = getModel().getStorageModelsByRole(role);
    return getSelectableModels(items);
}
Also used : StorageDomainType(org.ovirt.engine.core.common.businessentities.StorageDomainType)

Example 12 with StorageDomainType

use of org.ovirt.engine.core.common.businessentities.StorageDomainType in project ovirt-engine by oVirt.

the class DataCenterStorageListModel method attachInternal.

private void attachInternal(ListModel listModel, StorageDomainType storageType) {
    if (getWindow() != null) {
        return;
    }
    this.setStorageDomainType(storageType);
    setWindow(listModel);
    if (storageType == StorageDomainType.ISO) {
        AsyncDataProvider.getInstance().getISOStorageDomainList(new AsyncQuery<>(list -> {
            Collection<StorageDomain> currItems = getItems() != null ? getItems() : new ArrayList<>();
            List<EntityModel> models = list.stream().filter(a -> currItems.stream().noneMatch(new Linq.IdPredicate<>(a.getId()))).map(EntityModel::new).collect(Collectors.toList());
            postAttachInternal(models);
        }));
    } else {
        AsyncDataProvider.getInstance().getStorageDomainList(new AsyncQuery<>(list -> {
            List<EntityModel> models = new ArrayList<>();
            boolean addToList;
            Collection<StorageDomain> items1 = getItems() != null ? getItems() : new ArrayList<>();
            for (StorageDomain a : list) {
                addToList = false;
                if (a.getStorageDomainSharedStatus() != StorageDomainSharedStatus.Unattached || items1.stream().anyMatch(new Linq.IdPredicate<>(a.getId()))) {
                    continue;
                }
                if (a.getStorageDomainType() == StorageDomainType.Volume) {
                    addToList = true;
                } else if (a.getStorageDomainType() == getStorageDomainType()) {
                    if (getStorageDomainType() == StorageDomainType.Data) {
                        if (getEntity().getStoragePoolFormatType() == null) {
                            addToList = true;
                        } else if (getEntity().getStoragePoolFormatType().compareTo(a.getStorageStaticData().getStorageFormat()) >= 0) {
                            addToList = true;
                        } else {
                            if (a.getStorageStaticData().getStorageFormat() == StorageFormatType.V1 || a.getStorageStaticData().getStorageFormat() == StorageFormatType.V2) {
                                addToList = true;
                            }
                        }
                    } else if (getStorageDomainType() == StorageDomainType.ImportExport) {
                        addToList = true;
                    }
                }
                if (addToList) {
                    EntityModel tempVar2 = new EntityModel();
                    tempVar2.setEntity(a);
                    models.add(tempVar2);
                }
            }
            postAttachInternal(models);
        }));
    }
}
Also used : StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) QueryType(org.ovirt.engine.core.common.queries.QueryType) StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) HelpTag(org.ovirt.engine.ui.uicommonweb.help.HelpTag) StorageDomainStatus(org.ovirt.engine.core.common.businessentities.StorageDomainStatus) SearchableListModel(org.ovirt.engine.ui.uicommonweb.models.SearchableListModel) 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) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) ActionType(org.ovirt.engine.core.common.action.ActionType) Frontend(org.ovirt.engine.ui.frontend.Frontend) StorageDomainStatic(org.ovirt.engine.core.common.businessentities.StorageDomainStatic) ConstantsManager(org.ovirt.engine.ui.uicompat.ConstantsManager) StorageDomainPoolParametersBase(org.ovirt.engine.core.common.action.StorageDomainPoolParametersBase) AsyncDataProvider(org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider) StorageFormatType(org.ovirt.engine.core.common.businessentities.StorageFormatType) Model(org.ovirt.engine.ui.uicommonweb.models.Model) AttachStorageDomainToPoolParameters(org.ovirt.engine.core.common.action.AttachStorageDomainToPoolParameters) RemoveStorageDomainParameters(org.ovirt.engine.core.common.action.RemoveStorageDomainParameters) StorageType(org.ovirt.engine.core.common.businessentities.storage.StorageType) ActionUtils(org.ovirt.engine.core.common.ActionUtils) Linq(org.ovirt.engine.ui.uicommonweb.Linq) Collection(java.util.Collection) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) ListModel(org.ovirt.engine.ui.uicommonweb.models.ListModel) StorageDomainSharedStatus(org.ovirt.engine.core.common.businessentities.StorageDomainSharedStatus) Collectors(java.util.stream.Collectors) NotifyCollectionChangedEventArgs(org.ovirt.engine.ui.uicompat.NotifyCollectionChangedEventArgs) List(java.util.List) StorageDomainType(org.ovirt.engine.core.common.businessentities.StorageDomainType) DeactivateStorageDomainWithOvfUpdateParameters(org.ovirt.engine.core.common.action.DeactivateStorageDomainWithOvfUpdateParameters) PropertyChangedEventArgs(org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs) DetachStorageDomainFromPoolParameters(org.ovirt.engine.core.common.action.DetachStorageDomainFromPoolParameters) StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) Linq(org.ovirt.engine.ui.uicommonweb.Linq) ArrayList(java.util.ArrayList) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) Collection(java.util.Collection) ArrayList(java.util.ArrayList) List(java.util.List)

Example 13 with StorageDomainType

use of org.ovirt.engine.core.common.businessentities.StorageDomainType in project ovirt-engine by oVirt.

the class StoragesTree method getRootItem.

@Override
protected TreeItem getRootItem(StorageDomainModel storageDomainModel) {
    HorizontalPanel panel = new HorizontalPanel();
    panel.setSpacing(1);
    // $NON-NLS-1$
    panel.setWidth("100%");
    StorageDomain storage = storageDomainModel.getStorageDomain();
    // $NON-NLS-1$
    addItemToPanel(panel, new Image(resources.storageImage()), "25px");
    // $NON-NLS-1$
    addTextBoxToPanel(panel, new StringValueLabel(), storage.getStorageName(), "");
    // $NON-NLS-1$
    addValueLabelToPanel(panel, new EnumLabel<StorageDomainType>(), storage.getStorageDomainType(), "120px");
    // $NON-NLS-1$
    addValueLabelToPanel(panel, new EnumLabel<StorageDomainSharedStatus>(), storage.getStorageDomainSharedStatus(), "120px");
    // $NON-NLS-1$
    addValueLabelToPanel(panel, new DiskSizeLabel<Integer>(), storage.getAvailableDiskSize(), "120px");
    // $NON-NLS-1$
    addValueLabelToPanel(panel, new DiskSizeLabel<Integer>(), storage.getUsedDiskSize(), "120px");
    // $NON-NLS-1$
    addValueLabelToPanel(panel, new DiskSizeLabel<Integer>(), storage.getTotalDiskSize(), "90px");
    TreeItem treeItem = new TreeItem(panel);
    treeItem.setUserObject(storage.getId());
    return treeItem;
}
Also used : StorageDomainType(org.ovirt.engine.core.common.businessentities.StorageDomainType) StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) TreeItem(com.google.gwt.user.client.ui.TreeItem) HorizontalPanel(com.google.gwt.user.client.ui.HorizontalPanel) Image(com.google.gwt.user.client.ui.Image) DiskImage(org.ovirt.engine.core.common.businessentities.storage.DiskImage) StringValueLabel(org.ovirt.engine.ui.common.widget.label.StringValueLabel) StorageDomainSharedStatus(org.ovirt.engine.core.common.businessentities.StorageDomainSharedStatus)

Aggregations

StorageDomainType (org.ovirt.engine.core.common.businessentities.StorageDomainType)13 StorageDomainStatic (org.ovirt.engine.core.common.businessentities.StorageDomainStatic)4 StorageType (org.ovirt.engine.core.common.businessentities.storage.StorageType)4 ValidationResult (org.ovirt.engine.core.bll.ValidationResult)3 StorageDomain (org.ovirt.engine.core.common.businessentities.StorageDomain)3 StorageDomainSharedStatus (org.ovirt.engine.core.common.businessentities.StorageDomainSharedStatus)3 StorageFormatType (org.ovirt.engine.core.common.businessentities.StorageFormatType)3 DiskImage (org.ovirt.engine.core.common.businessentities.storage.DiskImage)3 HorizontalPanel (com.google.gwt.user.client.ui.HorizontalPanel)2 Image (com.google.gwt.user.client.ui.Image)2 TreeItem (com.google.gwt.user.client.ui.TreeItem)2 ArrayList (java.util.ArrayList)2 Test (org.junit.Test)2 Guid (org.ovirt.engine.core.compat.Guid)2 StringValueLabel (org.ovirt.engine.ui.common.widget.label.StringValueLabel)2 Collection (java.util.Collection)1 List (java.util.List)1 Collectors (java.util.stream.Collectors)1 ActionUtils (org.ovirt.engine.core.common.ActionUtils)1 ActionParametersBase (org.ovirt.engine.core.common.action.ActionParametersBase)1