use of org.ovirt.engine.ui.uicommonweb.models.vms.ExportVmModel in project ovirt-engine by oVirt.
the class TemplateListModel method postExportGetMissingTemplates.
private void postExportGetMissingTemplates(ArrayList<String> missingTemplatesFromVms) {
ExportVmModel model = (ExportVmModel) getWindow();
if (!missingTemplatesFromVms.isEmpty()) {
model.stopProgress();
ConfirmationModel confirmModel = new ConfirmationModel();
setConfirmWindow(confirmModel);
confirmModel.setTitle(ConstantsManager.getInstance().getConstants().baseTemplatesNotFoundOnExportDomainTitle());
confirmModel.setHelpTag(HelpTag.base_template_not_found_on_export_domain);
// $NON-NLS-1$
confirmModel.setHashName("base_template_not_found_on_export_domain");
confirmModel.setMessage(ConstantsManager.getInstance().getConstants().theFollowingTemplatesAreMissingOnTargetExportDomainForTemplateVersionsMsg());
confirmModel.setItems(missingTemplatesFromVms);
// $NON-NLS-1$
UICommand tempVar = UICommand.createDefaultOkUiCommand("OnExportNoTemplates", this);
confirmModel.getCommands().add(tempVar);
// $NON-NLS-1$
UICommand tempVar2 = UICommand.createCancelUiCommand("CancelConfirmation", this);
confirmModel.getCommands().add(tempVar2);
} else {
doExport();
}
}
use of org.ovirt.engine.ui.uicommonweb.models.vms.ExportVmModel in project ovirt-engine by oVirt.
the class TemplateListModel method postGetTemplatesNotPresentOnExportDomain.
private void postGetTemplatesNotPresentOnExportDomain(StoragePool storagePool) {
ExportVmModel model = (ExportVmModel) getWindow();
Guid storageDomainId = model.getStorage().getSelectedItem().getId();
if (storagePool != null) {
AsyncDataProvider.getInstance().getAllTemplatesFromExportDomain(new AsyncQuery<>(templatesDiskSet -> {
ArrayList<String> verTempMissingBase = new ArrayList<>();
// check if relevant templates are already there
for (Object selectedItem : getSelectedItems()) {
VmTemplate template = (VmTemplate) selectedItem;
// only relevant for template versions
if (!template.isBaseTemplate()) {
boolean hasMatch = false;
for (VmTemplate a : templatesDiskSet.keySet()) {
if (template.getBaseTemplateId().equals(a.getId())) {
hasMatch = true;
break;
}
}
if (!template.getBaseTemplateId().equals(Guid.Empty) && !hasMatch) {
verTempMissingBase.add(template.getName());
}
}
}
postExportGetMissingTemplates(verTempMissingBase);
}), storagePool.getId(), storageDomainId);
}
}
use of org.ovirt.engine.ui.uicommonweb.models.vms.ExportVmModel in project ovirt-engine by oVirt.
the class TemplateListModel method getTemplatesNotPresentOnExportDomain.
private void getTemplatesNotPresentOnExportDomain() {
ExportVmModel model = (ExportVmModel) getWindow();
Guid storageDomainId = model.getStorage().getSelectedItem().getId();
AsyncDataProvider.getInstance().getDataCentersByStorageDomain(new AsyncQuery<>(storagePools -> {
StoragePool storagePool = storagePools.size() > 0 ? storagePools.get(0) : null;
postGetTemplatesNotPresentOnExportDomain(storagePool);
}), storageDomainId);
}
use of org.ovirt.engine.ui.uicommonweb.models.vms.ExportVmModel in project ovirt-engine by oVirt.
the class VmBaseListModel method postExportGetStorageDomainList.
private void postExportGetStorageDomainList(List<StorageDomain> storageDomains) {
ExportVmModel model = (ExportVmModel) getWindow();
model.getStorage().setItems(storageDomains);
model.getStorage().setSelectedItem(Linq.firstOrNull(storageDomains));
boolean noActiveStorage = true;
for (StorageDomain a : storageDomains) {
if (a.getStatus() == StorageDomainStatus.Active) {
noActiveStorage = false;
break;
}
}
if (entitiesSelectedOnDifferentDataCenters()) {
model.getCollapseSnapshots().setIsChangeable(false);
model.getForceOverride().setIsChangeable(false);
model.setMessage(entityResideOnSeveralDCsMakeSureTheExportedVMResideOnSameDcMsg());
// $NON-NLS-1$
UICommand tempVar = new UICommand("Cancel", this);
tempVar.setTitle(ConstantsManager.getInstance().getConstants().close());
tempVar.setIsDefault(true);
tempVar.setIsCancel(true);
model.getCommands().add(tempVar);
model.stopProgress();
} else if (storageDomains.isEmpty()) {
model.getCollapseSnapshots().setIsChangeable(false);
model.getForceOverride().setIsChangeable(false);
model.setMessage(thereIsNoExportDomainBackupEntityAttachExportDomainToVmsDcMsg());
// $NON-NLS-1$
UICommand tempVar2 = new UICommand("Cancel", this);
tempVar2.setTitle(ConstantsManager.getInstance().getConstants().close());
tempVar2.setIsDefault(true);
tempVar2.setIsCancel(true);
model.getCommands().add(tempVar2);
model.stopProgress();
} else if (noActiveStorage) {
model.getCollapseSnapshots().setIsChangeable(false);
model.getForceOverride().setIsChangeable(false);
model.setMessage(ConstantsManager.getInstance().getConstants().theRelevantExportDomainIsNotActivePleaseActivateItMsg());
// $NON-NLS-1$
UICommand tempVar3 = new UICommand("Cancel", this);
tempVar3.setTitle(ConstantsManager.getInstance().getConstants().close());
tempVar3.setIsDefault(true);
tempVar3.setIsCancel(true);
model.getCommands().add(tempVar3);
model.stopProgress();
} else {
showWarningOnExistingEntities(model, getEntityExportDomain());
// $NON-NLS-1$
UICommand tempVar4 = UICommand.createDefaultOkUiCommand("OnExport", this);
model.getCommands().add(tempVar4);
// $NON-NLS-1$
UICommand tempVar5 = UICommand.createCancelUiCommand("Cancel", this);
model.getCommands().add(tempVar5);
}
}
Aggregations