Search in sources :

Example 76 with EntityModel

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

the class ImportTemplateModel method initDisksStorageDomainsList.

@Override
protected void initDisksStorageDomainsList() {
    for (Object item : getItems()) {
        VmTemplate template = ((ImportTemplateData) item).getTemplate();
        for (Disk disk : template.getDiskList()) {
            DiskImage diskImage = (DiskImage) disk;
            addDiskImportData(diskImage.getId(), filteredStorageDomains, diskImage.getVolumeType(), new EntityModel(true));
        }
    }
    postInitDisks();
}
Also used : ImportTemplateData(org.ovirt.engine.ui.uicommonweb.models.vms.ImportTemplateData) VmTemplate(org.ovirt.engine.core.common.businessentities.VmTemplate) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) Disk(org.ovirt.engine.core.common.businessentities.storage.Disk) DiskImage(org.ovirt.engine.core.common.businessentities.storage.DiskImage)

Example 77 with EntityModel

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

the class DataCenterGuideModel method attachStorageInternal.

private void attachStorageInternal(List<StorageDomain> storages, String title) {
    ListModel model = new ListModel();
    model.setTitle(title);
    setWindow(model);
    ArrayList<EntityModel> items = new ArrayList<>();
    for (StorageDomain sd : storages) {
        EntityModel tempVar = new EntityModel();
        tempVar.setEntity(sd);
        items.add(tempVar);
    }
    model.setItems(items);
    // $NON-NLS-1$
    UICommand tempVar2 = UICommand.createDefaultOkUiCommand("OnAttachStorage", this);
    model.getCommands().add(tempVar2);
    // $NON-NLS-1$
    UICommand tempVar3 = UICommand.createCancelUiCommand("Cancel", this);
    model.getCommands().add(tempVar3);
}
Also used : StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) ListModel(org.ovirt.engine.ui.uicommonweb.models.ListModel) ClusterListModel(org.ovirt.engine.ui.uicommonweb.models.clusters.ClusterListModel) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) ArrayList(java.util.ArrayList) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand)

Example 78 with EntityModel

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

the class DataCenterListModel method onRecover.

public void onRecover() {
    final ConfirmationModel windowModel = (ConfirmationModel) getWindow();
    if (!windowModel.validate()) {
        return;
    }
    AsyncDataProvider.getInstance().getStorageDomainList(new AsyncQuery<>(storageDomainList -> {
        for (StorageDomain a : storageDomainList) {
            if (a.getStorageDomainType() == StorageDomainType.Master) {
                break;
            }
        }
        List<StorageDomain> items = new ArrayList<>();
        for (Object item : windowModel.getItems()) {
            EntityModel<StorageDomain> a = (EntityModel<StorageDomain>) item;
            if (a.getIsSelected()) {
                items.add(a.getEntity());
            }
        }
        if (items.size() > 0) {
            if (windowModel.getProgress() != null) {
                return;
            }
            ArrayList<ActionParametersBase> parameters = new ArrayList<>();
            for (StorageDomain a : items) {
                parameters.add(new ReconstructMasterParameters(getSelectedItem().getId(), a.getId()));
            }
            windowModel.startProgress();
            Frontend.getInstance().runMultipleAction(ActionType.RecoveryStoragePool, parameters, result -> {
                ConfirmationModel localModel = (ConfirmationModel) result.getState();
                localModel.stopProgress();
                cancel();
            }, windowModel);
        } else {
            cancel();
        }
    }), getSelectedItem().getId());
}
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) StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) ArrayList(java.util.ArrayList) List(java.util.List) ArrayList(java.util.ArrayList) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) ReconstructMasterParameters(org.ovirt.engine.core.common.action.ReconstructMasterParameters)

Example 79 with EntityModel

use of org.ovirt.engine.ui.uicommonweb.models.EntityModel 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 80 with EntityModel

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

the class VolumeGeoRepListModel method populateStatus.

private void populateStatus(final List<GlusterGeoRepSessionDetails> details) {
    final VolumeGeoRepSessionDetailsModel windowModel = new VolumeGeoRepSessionDetailsModel();
    windowModel.setHelpTag(HelpTag.geo_replication_status_detail);
    // $NON-NLS-1$
    windowModel.setHashName("geo_replication_status_detail");
    final UIConstants constants = ConstantsManager.getInstance().getConstants();
    windowModel.setTitle(constants.geoReplicationSessionDetailsTitle());
    // $NON-NLS-1$
    UICommand okCommand = new UICommand("closeWindow", this);
    okCommand.setIsCancel(true);
    okCommand.setTitle(constants.ok());
    windowModel.getCommands().add(okCommand);
    setWindow(windowModel);
    final List<EntityModel<GlusterGeoRepSessionDetails>> detailRows = new ArrayList<>();
    for (GlusterGeoRepSessionDetails detail : details) {
        detailRows.add(new EntityModel<>(detail));
    }
    windowModel.getGeoRepSessionSummary().setItems(detailRows, detailRows.get(0));
}
Also used : EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) ArrayList(java.util.ArrayList) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) GlusterGeoRepSessionDetails(org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSessionDetails) UIConstants(org.ovirt.engine.ui.uicompat.UIConstants)

Aggregations

EntityModel (org.ovirt.engine.ui.uicommonweb.models.EntityModel)105 ArrayList (java.util.ArrayList)56 UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)27 List (java.util.List)26 ActionParametersBase (org.ovirt.engine.core.common.action.ActionParametersBase)23 AsyncDataProvider (org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider)22 ListModel (org.ovirt.engine.ui.uicommonweb.models.ListModel)22 ConstantsManager (org.ovirt.engine.ui.uicompat.ConstantsManager)22 ConfirmationModel (org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)20 HelpTag (org.ovirt.engine.ui.uicommonweb.help.HelpTag)19 ActionType (org.ovirt.engine.core.common.action.ActionType)18 Frontend (org.ovirt.engine.ui.frontend.Frontend)18 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)17 Guid (org.ovirt.engine.core.compat.Guid)17 PropertyChangedEventArgs (org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs)17 VDS (org.ovirt.engine.core.common.businessentities.VDS)16 QueryType (org.ovirt.engine.core.common.queries.QueryType)16 NoSelectionModel (com.google.gwt.view.client.NoSelectionModel)13 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)13 StoragePool (org.ovirt.engine.core.common.businessentities.StoragePool)13