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;
}
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;
}
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();
}
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;
}
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;
}
Aggregations