use of org.ovirt.engine.ui.frontend.AsyncQuery in project ovirt-engine by oVirt.
the class DownloadImageHandler method start.
public void start() {
Frontend.getInstance().runAction(ActionType.TransferDiskImage, createInitParams(), result -> {
if (result.getReturnValue().getSucceeded()) {
Guid transferId = result.getReturnValue().getActionReturnValue();
Frontend.getInstance().runQuery(QueryType.GetImageTransferById, new IdQueryParameters(transferId), new AsyncQuery<QueryReturnValue>(returnValue -> {
ImageTransfer imageTransfer = returnValue.getReturnValue();
initiateDownload(imageTransfer);
}));
}
}, this);
}
use of org.ovirt.engine.ui.frontend.AsyncQuery in project ovirt-engine by oVirt.
the class VmModelBehaviorBase method postInitStorageDomains.
protected void postInitStorageDomains() {
if (getModel().getDisks() == null) {
return;
}
ActionGroup actionGroup = getModel().isCreateInstanceOnly() ? ActionGroup.CREATE_INSTANCE : ActionGroup.CREATE_VM;
StoragePool dataCenter = getModel().getSelectedDataCenter();
AsyncDataProvider.getInstance().getPermittedStorageDomainsByStoragePoolId(new AsyncQuery<>(storageDomains -> {
ArrayList<StorageDomain> activeStorageDomains = filterStorageDomains(storageDomains);
boolean provisioning = getModel().getProvisioning().getEntity();
ArrayList<DiskModel> disks = (ArrayList<DiskModel>) getModel().getDisks();
activeStorageDomains.sort(new NameableComparator());
List<DiskModel> diskImages = Linq.filterDisksByType(disks, DiskStorageType.IMAGE);
for (DiskModel diskModel : diskImages) {
List<StorageDomain> availableDiskStorageDomains;
diskModel.getQuota().setItems(getModel().getQuota().getItems());
List<Guid> storageIds = ((DiskImage) diskModel.getDisk()).getStorageIds();
// Active storage domains that the disk resides on
List<StorageDomain> activeDiskStorageDomains = Linq.getStorageDomainsByIds(storageIds, activeStorageDomains);
// Set target storage domains
availableDiskStorageDomains = provisioning ? activeStorageDomains : activeDiskStorageDomains;
availableDiskStorageDomains.sort(new NameableComparator());
diskModel.getStorageDomain().setItems(availableDiskStorageDomains);
diskModel.getStorageDomain().setChangeProhibitionReason(constants.noActiveTargetStorageDomainAvailableMsg());
diskModel.getStorageDomain().setIsChangeable(!availableDiskStorageDomains.isEmpty());
}
List<DiskModel> cinderDisks = Linq.filterDisksByType(disks, DiskStorageType.CINDER);
Collection<StorageDomain> cinderStorageDomains = Linq.filterStorageDomainsByStorageType(storageDomains, StorageType.CINDER);
initStorageDomainsForCinderDisks(cinderDisks, cinderStorageDomains);
}), dataCenter.getId(), actionGroup);
}
use of org.ovirt.engine.ui.frontend.AsyncQuery in project ovirt-engine by oVirt.
the class VmModelBehaviorBase method updateNumOfSockets.
protected void updateNumOfSockets() {
Version version = getCompatibilityVersion();
if (version == null) {
return;
}
AsyncDataProvider.getInstance().getMaxNumOfVmSockets(asyncQuery(returnValue -> {
maxNumOfSockets = returnValue;
updataMaxVmsInPool();
}), version.toString());
}
use of org.ovirt.engine.ui.frontend.AsyncQuery in project ovirt-engine by oVirt.
the class VmModelBehaviorBase method updateCustomCpu.
/*
* Updates the cpu model combobox after a cluster change occurs
*/
protected void updateCustomCpu() {
Cluster cluster = getModel().getSelectedCluster();
if (cluster == null || cluster.getCpuName() == null) {
return;
}
AsyncDataProvider.getInstance().getSupportedCpuList(new AsyncQuery<>(returnValue -> {
if (returnValue != null) {
List<String> cpuList = new ArrayList<>();
// $NON-NLS-1$
cpuList.add("");
for (ServerCpu cpu : returnValue) {
cpuList.add(cpu.getVdsVerbData());
}
String oldVal = getModel().getCustomCpu().getSelectedItem();
getModel().getCustomCpu().setItems(cpuList);
getModel().getCustomCpu().setSelectedItem(oldVal);
}
}), cluster.getCpuName());
}
use of org.ovirt.engine.ui.frontend.AsyncQuery in project ovirt-engine by oVirt.
the class VmModelBehaviorBase method updateCdImage.
protected void updateCdImage(boolean forceRefresh) {
StoragePool dataCenter = getModel().getSelectedDataCenter();
if (dataCenter == null) {
return;
}
ImagesDataProvider.getISOImagesList(asyncQuery(images -> setImagesToModel(getModel(), images)), dataCenter.getId(), forceRefresh);
}
Aggregations