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