use of org.ovirt.engine.core.common.businessentities.storage.DiskImage in project ovirt-engine by oVirt.
the class DisksViewColumns method getQoutaColumn.
public static AbstractTextColumn<Disk> getQoutaColumn(String sortBy) {
AbstractTextColumn<Disk> column = new AbstractTextColumn<Disk>() {
@Override
public String getValue(Disk object) {
String value = "";
if (object.getDiskStorageType() == DiskStorageType.IMAGE) {
DiskImage diskImage = (DiskImage) object;
List<String> quotaNamesArr = diskImage.getQuotaNames();
if (quotaNamesArr != null) {
// $NON-NLS-1$
value = String.join(", ", quotaNamesArr);
}
}
return value;
}
};
return makeSortable(column, sortBy);
}
use of org.ovirt.engine.core.common.businessentities.storage.DiskImage in project ovirt-engine by oVirt.
the class StorageDomainsColumn method getValue.
@Override
public String getValue(Disk object) {
if (object.getDiskStorageType() != DiskStorageType.IMAGE && object.getDiskStorageType() != DiskStorageType.CINDER) {
return constants.empty();
}
DiskImage diskImage = (DiskImage) object;
int numOfStorageDomains = diskImage.getStoragesNames() != null ? diskImage.getStoragesNames().size() : 0;
if (numOfStorageDomains == 0) {
return constants.empty();
} else if (numOfStorageDomains == 1) {
return diskImage.getStoragesNames().get(0);
} else {
return numOfStorageDomains + constants.space() + constants.storageDomainsLabelDisk();
}
}
use of org.ovirt.engine.core.common.businessentities.storage.DiskImage in project ovirt-engine by oVirt.
the class DiskStatusColumn method getTooltip.
@Override
public SafeHtml getTooltip(Disk disk) {
String tooltipContent;
if (disk.getDiskStorageType().equals(DiskStorageType.IMAGE) || disk.getDiskStorageType().equals(DiskStorageType.CINDER)) {
DiskImage diskImage = (DiskImage) disk;
if (diskImage.getImageStatus().equals(ImageStatus.LOCKED)) {
tooltipContent = EnumTranslator.getInstance().translate(diskImage.getImageStatus());
return SafeHtmlUtils.fromString(tooltipContent);
}
}
tooltipContent = disk.getPlugged() ? constants.active() : constants.inactive();
return SafeHtmlUtils.fromString(tooltipContent);
}
use of org.ovirt.engine.core.common.businessentities.storage.DiskImage in project ovirt-engine by oVirt.
the class DisksAllocationModel method setDiskProfilesList.
private void setDiskProfilesList(final ListModel<DiskProfile> diskProfiles, List<DiskProfile> fetchedDiskProfiles) {
if (fetchedDiskProfiles != null) {
// normal flow, set items and selected item according to current selected.
if (diskProfiles == null) {
for (DiskModel diskModel : getDisks()) {
diskModel.getDiskProfile().setItems(fetchedDiskProfiles);
for (DiskProfile diskProfile : fetchedDiskProfiles) {
if (diskModel.getDisk().getDiskStorageType() == DiskStorageType.IMAGE && diskProfile.getId().equals(((DiskImage) diskModel.getDisk()).getDiskProfileId())) {
diskModel.getDiskProfile().setSelectedItem(diskProfile);
}
}
}
// inner model disk profiles
} else {
DiskProfile selectedDiskProfile = null;
if (diskProfiles.getSelectedItem() != null) {
selectedDiskProfile = diskProfiles.getSelectedItem();
}
diskProfiles.setItems(fetchedDiskProfiles);
if (selectedDiskProfile != null && fetchedDiskProfiles.size() > 1) {
for (DiskProfile diskProfile : fetchedDiskProfiles) {
if (diskProfile.getId().equals(selectedDiskProfile.getId())) {
diskProfiles.setSelectedItem(diskProfile);
break;
}
}
}
}
}
}
use of org.ovirt.engine.core.common.businessentities.storage.DiskImage in project ovirt-engine by oVirt.
the class DisksAllocationModel method setDefaultVolumeInformationSelection.
protected void setDefaultVolumeInformationSelection(List<DiskModel> diskModels) {
final Map<Guid, DiskModel> diskModelsMap = new HashMap<>();
for (DiskModel diskModel : diskModels) {
diskModelsMap.put(((DiskImage) diskModel.getDisk()).getImageId(), diskModel);
}
AsyncDataProvider.getInstance().getAncestorImagesByImagesIds(new AsyncQuery<>(imagesAncestors -> {
for (Map.Entry<Guid, DiskImage> entry : imagesAncestors.entrySet()) {
DiskModel diskModel = diskModelsMap.get(entry.getKey());
diskModel.getVolumeType().setSelectedItem(entry.getValue().getVolumeType());
diskModel.getVolumeFormat().setSelectedItem(entry.getValue().getVolumeFormat());
updateStorageDomainsAvailability();
}
}), new ArrayList<>(diskModelsMap.keySet()));
}
Aggregations