Search in sources :

Example 41 with EntityModel

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

the class VmRunOncePopupWidget method updateBootSequenceItems.

private void updateBootSequenceItems() {
    // Update list box
    bootSequenceBox.clear();
    bootSequenceBox.setVisibleItemCount(bootSequenceModel.getItems().size());
    // Set items
    for (EntityModel bootItem : bootSequenceModel.getItems()) {
        bootSequenceBox.addItem(bootItem.getTitle());
        updateItemAvailability(bootItem.getTitle(), bootItem.getIsChangable());
    }
}
Also used : EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel)

Example 42 with EntityModel

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

the class DataCenterGuideModel method onAttachStorage.

public void onAttachStorage() {
    ListModel<EntityModel<StorageDomain>> model = (ListModel<EntityModel<StorageDomain>>) getWindow();
    ArrayList<StorageDomain> items = new ArrayList<>();
    for (EntityModel<StorageDomain> a : model.getItems()) {
        if (a.getIsSelected()) {
            items.add(a.getEntity());
        }
    }
    if (items.size() > 0) {
        for (StorageDomain sd : items) {
            attachStorageToDataCenter(sd.getId(), getEntity().getId());
        }
    }
    cancel();
    postAction();
}
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)

Example 43 with EntityModel

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

the class DataCenterListModel method recoveryStorage.

public void recoveryStorage() {
    final ConfirmationModel windowModel = new ConfirmationModel();
    setWindow(windowModel);
    windowModel.setTitle(ConstantsManager.getInstance().getConstants().dataCenterReInitializeTitle());
    windowModel.setHelpTag(HelpTag.data_center_re_initialize);
    // $NON-NLS-1$
    windowModel.setHashName("data_center_re-initialize");
    windowModel.getLatch().setIsAvailable(true);
    windowModel.getLatch().setIsChangeable(true);
    windowModel.startProgress();
    AsyncDataProvider.getInstance().getStorageDomainList(new AsyncQuery<>(storageDomainList -> {
        windowModel.stopProgress();
        List<EntityModel> models = new ArrayList<>();
        for (StorageDomain a : storageDomainList) {
            if (a.getStorageDomainType() == StorageDomainType.Data && (a.getStorageDomainSharedStatus() == StorageDomainSharedStatus.Unattached)) {
                EntityModel tempVar = new EntityModel();
                tempVar.setEntity(a);
                models.add(tempVar);
            }
        }
        windowModel.setItems(models);
        if (models.size() > 0) {
            EntityModel entityModel = models.size() != 0 ? models.get(0) : null;
            if (entityModel != null) {
                entityModel.setIsSelected(true);
            }
        }
        if (models.isEmpty()) {
            windowModel.setMessage(ConstantsManager.getInstance().getConstants().thereAreNoCompatibleStorageDomainsAttachThisDcMsg());
            windowModel.getLatch().setIsAvailable(false);
            // $NON-NLS-1$
            UICommand tempVar2 = new UICommand("Cancel", DataCenterListModel.this);
            tempVar2.setTitle(ConstantsManager.getInstance().getConstants().close());
            tempVar2.setIsDefault(true);
            tempVar2.setIsCancel(true);
            windowModel.getCommands().add(tempVar2);
        } else {
            // $NON-NLS-1$
            UICommand tempVar3 = UICommand.createDefaultOkUiCommand("OnRecover", DataCenterListModel.this);
            windowModel.getCommands().add(tempVar3);
            // $NON-NLS-1$
            UICommand tempVar4 = UICommand.createCancelUiCommand("Cancel", DataCenterListModel.this);
            windowModel.getCommands().add(tempVar4);
        }
    }));
}
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) List(java.util.List) ArrayList(java.util.ArrayList) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)

Example 44 with EntityModel

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

the class DataCenterStorageListModel method onAttach.

public void onAttach() {
    ListModel<EntityModel<StorageDomain>> model = (ListModel<EntityModel<StorageDomain>>) getWindow();
    List<StorageDomain> selectedDataStorageDomains = new ArrayList<>();
    if (getEntity() == null) {
        cancel();
        return;
    }
    selectedStorageDomains = new ArrayList<>();
    for (EntityModel<StorageDomain> a : model.getItems()) {
        if (a.getIsSelected()) {
            StorageDomain storageDomain = a.getEntity();
            selectedStorageDomains.add(storageDomain);
            if (storageDomain.getStorageDomainType() == StorageDomainType.Data) {
                selectedDataStorageDomains.add(storageDomain);
            }
        }
    }
    if (selectedStorageDomains.isEmpty()) {
        cancel();
        return;
    }
    AsyncDataProvider.getInstance().getStorageDomainsWithAttachedStoragePoolGuid(new AsyncQuery<>(attachedStorageDomains -> {
        if (!attachedStorageDomains.isEmpty()) {
            ConfirmationModel confirmationModel = new ConfirmationModel();
            setWindow(null);
            setWindow(confirmationModel);
            List<String> stoageDomainNames = attachedStorageDomains.stream().map(StorageDomainStatic::getStorageName).collect(Collectors.toList());
            confirmationModel.setItems(stoageDomainNames);
            confirmationModel.setTitle(ConstantsManager.getInstance().getConstants().storageDomainsAttachedToDataCenterWarningTitle());
            confirmationModel.setMessage(ConstantsManager.getInstance().getConstants().storageDomainsAttachedToDataCenterWarningMessage());
            confirmationModel.setHelpTag(HelpTag.attach_storage_domain_confirmation);
            // $NON-NLS-1$
            confirmationModel.setHashName("attach_storage_domain_confirmation");
            confirmationModel.getLatch().setIsAvailable(true);
            confirmationModel.getLatch().setIsChangeable(true);
            // $NON-NLS-1$
            UICommand onApprove = new UICommand("OnAttachApprove", DataCenterStorageListModel.this);
            onApprove.setTitle(ConstantsManager.getInstance().getConstants().ok());
            onApprove.setIsDefault(true);
            confirmationModel.getCommands().add(onApprove);
            // $NON-NLS-1$
            UICommand cancel = new UICommand("Cancel", DataCenterStorageListModel.this);
            cancel.setTitle(ConstantsManager.getInstance().getConstants().cancel());
            cancel.setIsCancel(true);
            confirmationModel.getCommands().add(cancel);
        } else {
            executeAttachStorageDomains();
        }
    }), getEntity(), selectedDataStorageDomains);
}
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) StorageDomainStatic(org.ovirt.engine.core.common.businessentities.StorageDomainStatic) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) ArrayList(java.util.ArrayList) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) SearchableListModel(org.ovirt.engine.ui.uicommonweb.models.SearchableListModel) ListModel(org.ovirt.engine.ui.uicommonweb.models.ListModel) ArrayList(java.util.ArrayList) List(java.util.List) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand)

Example 45 with EntityModel

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

the class VolumeBrickModel method addBrick.

private void addBrick() {
    VDS server = servers.getSelectedItem();
    String brickDir = null;
    if (getShowBricksList().getEntity()) {
        brickDir = bricksFromServer.getSelectedItem();
    } else {
        brickDir = getBrickDirectory().getEntity();
    }
    if (server == null) {
        setMessage(ConstantsManager.getInstance().getConstants().emptyServerBrickMsg());
        return;
    }
    if (brickDir == null || brickDir.trim().length() == 0) {
        setMessage(ConstantsManager.getInstance().getConstants().emptyBrickDirectoryMsg());
        return;
    }
    brickDir = brickDir.trim();
    if (!validateBrickDirectory(brickDir)) {
        return;
    }
    GlusterBrickEntity brickEntity = new GlusterBrickEntity();
    brickEntity.setServerId(server.getId());
    brickEntity.setServerName(server.getHostName());
    brickEntity.setBrickDirectory(brickDir);
    EntityModel<GlusterBrickEntity> entityModel = new EntityModel<>(brickEntity);
    List<EntityModel<GlusterBrickEntity>> items = (List<EntityModel<GlusterBrickEntity>>) bricks.getItems();
    if (items == null) {
        items = new ArrayList<>();
    }
    for (EntityModel<GlusterBrickEntity> model : items) {
        GlusterBrickEntity existingBrick = model.getEntity();
        if (existingBrick.getServerId().equals(brickEntity.getServerId()) && existingBrick.getBrickDirectory().equals(brickEntity.getBrickDirectory())) {
            setMessage(ConstantsManager.getInstance().getConstants().duplicateBrickMsg());
            return;
        }
    }
    items.add(entityModel);
    bricks.setItems(null);
    bricks.setItems(items);
    clearBrickDetails();
}
Also used : GlusterBrickEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity) VDS(org.ovirt.engine.core.common.businessentities.VDS) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) ArrayList(java.util.ArrayList) List(java.util.List)

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