Search in sources :

Example 6 with DiskModel

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

the class MoveOrCopyDiskModel method getParameters.

protected ArrayList<ActionParametersBase> getParameters() {
    ArrayList<ActionParametersBase> parameters = new ArrayList<>();
    for (DiskModel diskModel : getDisks()) {
        StorageDomain destStorageDomain = diskModel.getStorageDomain().getSelectedItem();
        StorageDomain sourceStorageDomain = diskModel.getSourceStorageDomain().getSelectedItem();
        Guid sourceStorageDomainGuid = sourceStorageDomain != null ? sourceStorageDomain.getId() : Guid.Empty;
        DiskImage disk = (DiskImage) diskModel.getDisk();
        DiskProfile diskProfile = diskModel.getDiskProfile().getSelectedItem();
        disk.setDiskProfileId(diskProfile != null ? diskProfile.getId() : null);
        disk.setDiskAlias(diskModel.getAlias().getEntity());
        if (diskModel.getQuota().getSelectedItem() != null) {
            disk.setQuotaId(diskModel.getQuota().getSelectedItem().getId());
        }
        if (destStorageDomain == null || sourceStorageDomain == null) {
            continue;
        }
        Guid destStorageDomainGuid = destStorageDomain.getId();
        addMoveOrCopyParameters(parameters, sourceStorageDomainGuid, destStorageDomainGuid, disk);
    }
    return parameters;
}
Also used : DiskModel(org.ovirt.engine.ui.uicommonweb.models.vms.DiskModel) StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) ArrayList(java.util.ArrayList) Guid(org.ovirt.engine.core.compat.Guid) DiskImage(org.ovirt.engine.core.common.businessentities.storage.DiskImage) DiskProfile(org.ovirt.engine.core.common.businessentities.profiles.DiskProfile) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase)

Example 7 with DiskModel

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

the class StorageDomainModel method getDisksModels.

public ArrayList<DiskModel> getDisksModels() {
    ArrayList<DiskModel> diskModels = new ArrayList<>();
    for (DiskImage diskImage : getDisks()) {
        DiskModel diskModel = new DiskModel();
        diskModel.setDisk(diskImage);
        ListModel<StorageDomain> storageDomain = new ListModel<>();
        storageDomain.setSelectedItem(getStorageDomain());
        diskModel.setStorageDomain(storageDomain);
        diskModels.add(diskModel);
    }
    return diskModels;
}
Also used : DiskModel(org.ovirt.engine.ui.uicommonweb.models.vms.DiskModel) StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) ListModel(org.ovirt.engine.ui.uicommonweb.models.ListModel) ArrayList(java.util.ArrayList) DiskImage(org.ovirt.engine.core.common.businessentities.storage.DiskImage)

Example 8 with DiskModel

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

the class CopyDiskModel method onInitDisks.

@Override
protected void onInitDisks() {
    ArrayList<DiskModel> disks = new ArrayList<>();
    for (DiskImage disk : getDiskImages()) {
        disks.add(DiskModel.diskToModel(disk));
    }
    setDisks(disks);
    initStorageDomains();
}
Also used : MoveOrCopyDiskModel(org.ovirt.engine.ui.uicommonweb.models.storage.MoveOrCopyDiskModel) DiskModel(org.ovirt.engine.ui.uicommonweb.models.vms.DiskModel) ArrayList(java.util.ArrayList) DiskImage(org.ovirt.engine.core.common.businessentities.storage.DiskImage)

Example 9 with DiskModel

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

the class VmDiskAttachPopupWidget method getReadOnlyCheckBoxColumn.

private AbstractCheckboxColumn<EntityModel> getReadOnlyCheckBoxColumn() {
    AbstractCheckboxColumn<EntityModel> readOnlyCheckboxColumn = new AbstractCheckboxColumn<EntityModel>((idx, object, value) -> {
        DiskModel diskModel = (DiskModel) object.getEntity();
        diskModel.setReadOnly(value);
    }) {

        @Override
        protected boolean canEdit(EntityModel object) {
            DiskModel diskModel = (DiskModel) object.getEntity();
            Disk disk = diskModel.getDisk();
            boolean isScsiPassthrough = disk.isScsiPassthrough();
            boolean ideLimitation = diskModel.getDiskInterface().getSelectedItem() == DiskInterface.IDE;
            return !isScsiPassthrough && !ideLimitation;
        }

        @Override
        public Boolean getValue(EntityModel object) {
            DiskModel diskModel = (DiskModel) object.getEntity();
            return diskModel.isReadOnly();
        }
    };
    return readOnlyCheckboxColumn;
}
Also used : AttachDiskModel(org.ovirt.engine.ui.uicommonweb.models.vms.AttachDiskModel) DiskModel(org.ovirt.engine.ui.uicommonweb.models.vms.DiskModel) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) AbstractCheckboxColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractCheckboxColumn) CinderDisk(org.ovirt.engine.core.common.businessentities.storage.CinderDisk) LunDisk(org.ovirt.engine.core.common.businessentities.storage.LunDisk) Disk(org.ovirt.engine.core.common.businessentities.storage.Disk)

Example 10 with DiskModel

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

the class VmDiskAttachPopupWidget method getBootCheckBoxColumn.

private AbstractCheckboxColumn<EntityModel> getBootCheckBoxColumn() {
    AbstractCheckboxColumn<EntityModel> bootCheckboxColumn = new AbstractCheckboxColumn<EntityModel>((idx, object, value) -> {
        DiskModel diskModel = (DiskModel) object.getEntity();
        diskModel.getIsBootable().setEntity(value);
    }) {

        @Override
        public SafeHtml getTooltip(EntityModel object) {
            EntityModel<Boolean> bootModel = ((DiskModel) object.getEntity()).getIsBootable();
            return bootModel.getChangeProhibitionReason() == null ? null : SafeHtmlUtils.fromString(bootModel.getChangeProhibitionReason());
        }

        @Override
        protected boolean canEdit(EntityModel object) {
            EntityModel<Boolean> bootModel = ((DiskModel) object.getEntity()).getIsBootable();
            return bootModel.getIsChangable() || bootModel.getEntity();
        }

        @Override
        public Boolean getValue(EntityModel object) {
            DiskModel diskModel = (DiskModel) object.getEntity();
            return diskModel.getIsBootable().getEntity();
        }
    };
    return bootCheckboxColumn;
}
Also used : AttachDiskModel(org.ovirt.engine.ui.uicommonweb.models.vms.AttachDiskModel) DiskModel(org.ovirt.engine.ui.uicommonweb.models.vms.DiskModel) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) AbstractCheckboxColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractCheckboxColumn)

Aggregations

DiskModel (org.ovirt.engine.ui.uicommonweb.models.vms.DiskModel)24 DiskImage (org.ovirt.engine.core.common.businessentities.storage.DiskImage)13 StorageDomain (org.ovirt.engine.core.common.businessentities.StorageDomain)9 ArrayList (java.util.ArrayList)8 DiskProfile (org.ovirt.engine.core.common.businessentities.profiles.DiskProfile)4 Guid (org.ovirt.engine.core.compat.Guid)4 EntityModel (org.ovirt.engine.ui.uicommonweb.models.EntityModel)4 Disk (org.ovirt.engine.core.common.businessentities.storage.Disk)3 ListModel (org.ovirt.engine.ui.uicommonweb.models.ListModel)3 AttachDiskModel (org.ovirt.engine.ui.uicommonweb.models.vms.AttachDiskModel)3 I18NNameValidation (org.ovirt.engine.ui.uicommonweb.validation.I18NNameValidation)3 NotEmptyValidation (org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation)3 ActionParametersBase (org.ovirt.engine.core.common.action.ActionParametersBase)2 CinderDisk (org.ovirt.engine.core.common.businessentities.storage.CinderDisk)2 LunDisk (org.ovirt.engine.core.common.businessentities.storage.LunDisk)2 VolumeFormat (org.ovirt.engine.core.common.businessentities.storage.VolumeFormat)2 VolumeType (org.ovirt.engine.core.common.businessentities.storage.VolumeType)2 AbstractCheckboxColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractCheckboxColumn)2 UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)2 ConfirmationModel (org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)2