use of org.ovirt.engine.ui.uicommonweb.models.vms.ExportVmModel in project ovirt-engine by oVirt.
the class TemplateListModel method onExport.
private void onExport() {
ExportVmModel model = (ExportVmModel) getWindow();
if (model.getProgress() != null) {
return;
}
if (!model.validate()) {
return;
}
model.startProgress();
getTemplatesNotPresentOnExportDomain();
}
use of org.ovirt.engine.ui.uicommonweb.models.vms.ExportVmModel in project ovirt-engine by oVirt.
the class VmBaseListModel method postShowWarningOnExistingVms.
private void postShowWarningOnExistingVms(final ExportVmModel exportModel, List<StoragePool> storagePools, QueryType getVmOrTemplateQuery) {
StoragePool storagePool = storagePools.size() > 0 ? storagePools.get(0) : null;
if (storagePool != null) {
Guid storageDomainId = exportModel.getStorage().getSelectedItem().getId();
GetAllFromExportDomainQueryParameters tempVar = new GetAllFromExportDomainQueryParameters(storagePool.getId(), storageDomainId);
Frontend.getInstance().runQuery(getVmOrTemplateQuery, tempVar, new AsyncQuery<>((AsyncCallback<QueryReturnValue>) returnValue -> {
ExportVmModel windowModel = (ExportVmModel) getWindow();
List<T> foundVms = new ArrayList<>();
if (returnValue != null) {
Iterable<T> iterableReturnValue = asIterableReturnValue(returnValue.getReturnValue());
for (T selectedItem1 : getSelectedItems()) {
for (T returnValueItem : iterableReturnValue) {
if (entititesEqualsNullSafe(returnValueItem, selectedItem1)) {
foundVms.add(selectedItem1);
break;
}
}
}
}
if (foundVms.size() != 0) {
windowModel.setMessage(composeEntityOnStorage(composeExistingVmsWarningMessage(foundVms)));
}
exportModel.stopProgress();
}));
} else {
exportModel.stopProgress();
}
}
use of org.ovirt.engine.ui.uicommonweb.models.vms.ExportVmModel in project ovirt-engine by oVirt.
the class VmBaseListModel method showWarningOnExistingEntities.
protected void showWarningOnExistingEntities(final ExportVmModel model, final QueryType getVmOrTemplateQuery) {
Guid storageDomainId = model.getStorage().getSelectedItem().getId();
AsyncDataProvider.getInstance().getDataCentersByStorageDomain(new AsyncQuery<>(storagePools -> postShowWarningOnExistingVms(model, storagePools, getVmOrTemplateQuery)), storageDomainId);
}
use of org.ovirt.engine.ui.uicommonweb.models.vms.ExportVmModel in project ovirt-engine by oVirt.
the class VmBaseListModel method export.
protected void export() {
T selectedEntity = getSelectedItem();
if (selectedEntity == null) {
return;
}
if (getWindow() != null) {
return;
}
ExportVmModel model = new ExportVmModel();
setWindow(model);
model.startProgress();
setupExportModel(model);
AsyncDataProvider.getInstance().getStorageDomainList(new AsyncQuery<>(storageDomains -> {
List<StorageDomain> filteredStorageDomains = new ArrayList<>();
for (StorageDomain a : storageDomains) {
if (a.getStorageDomainType() == StorageDomainType.ImportExport) {
filteredStorageDomains.add(a);
}
}
postExportGetStorageDomainList(filteredStorageDomains);
}), extractStoragePoolIdNullSafe(selectedEntity));
// check, if the VM has a disk which doesn't allow snapshot
sendWarningForNonExportableDisks(selectedEntity);
}
use of org.ovirt.engine.ui.uicommonweb.models.vms.ExportVmModel in project ovirt-engine by oVirt.
the class TemplateListModel method doExport.
private void doExport() {
ExportVmModel model = (ExportVmModel) getWindow();
ArrayList<ActionParametersBase> list = new ArrayList<>();
for (Object item : getSelectedItems()) {
VmTemplate a = (VmTemplate) item;
if (a.getId().equals(Guid.Empty)) {
continue;
}
MoveOrCopyParameters tempVar = new MoveOrCopyParameters(a.getId(), model.getStorage().getSelectedItem().getId());
tempVar.setForceOverride(model.getForceOverride().getEntity());
list.add(tempVar);
}
model.startProgress();
Frontend.getInstance().runMultipleAction(ActionType.ExportVmTemplate, list, result -> {
ExportVmModel localModel = (ExportVmModel) result.getState();
localModel.stopProgress();
cancel();
}, model);
}
Aggregations