use of org.ovirt.engine.ui.uicommonweb.models.ListModel in project ovirt-engine by oVirt.
the class DataCenterGuideModel method onAttachStorage.
public void onAttachStorage() {
ListModel<EntityModel<StorageDomain>> model = (ListModel<EntityModel<StorageDomain>>) getWindow();
ArrayList<StorageDomain> items = new ArrayList<>();
for (EntityModel<StorageDomain> a : model.getItems()) {
if (a.getIsSelected()) {
items.add(a.getEntity());
}
}
if (items.size() > 0) {
for (StorageDomain sd : items) {
attachStorageToDataCenter(sd.getId(), getEntity().getId());
}
}
cancel();
postAction();
}
use of org.ovirt.engine.ui.uicommonweb.models.ListModel in project ovirt-engine by oVirt.
the class DataCenterStorageListModel method attachISO.
public void attachISO() {
ListModel listModel = new ListModel();
listModel.setTitle(ConstantsManager.getInstance().getConstants().attachISOLibraryTitle());
listModel.setHelpTag(HelpTag.attach_iso_library);
// $NON-NLS-1$
listModel.setHashName("attach_iso_library");
attachInternal(listModel, StorageDomainType.ISO);
}
use of org.ovirt.engine.ui.uicommonweb.models.ListModel in project ovirt-engine by oVirt.
the class DataCenterStorageListModel method onAttach.
public void onAttach() {
ListModel<EntityModel<StorageDomain>> model = (ListModel<EntityModel<StorageDomain>>) getWindow();
List<StorageDomain> selectedDataStorageDomains = new ArrayList<>();
if (getEntity() == null) {
cancel();
return;
}
selectedStorageDomains = new ArrayList<>();
for (EntityModel<StorageDomain> a : model.getItems()) {
if (a.getIsSelected()) {
StorageDomain storageDomain = a.getEntity();
selectedStorageDomains.add(storageDomain);
if (storageDomain.getStorageDomainType() == StorageDomainType.Data) {
selectedDataStorageDomains.add(storageDomain);
}
}
}
if (selectedStorageDomains.isEmpty()) {
cancel();
return;
}
AsyncDataProvider.getInstance().getStorageDomainsWithAttachedStoragePoolGuid(new AsyncQuery<>(attachedStorageDomains -> {
if (!attachedStorageDomains.isEmpty()) {
ConfirmationModel confirmationModel = new ConfirmationModel();
setWindow(null);
setWindow(confirmationModel);
List<String> stoageDomainNames = attachedStorageDomains.stream().map(StorageDomainStatic::getStorageName).collect(Collectors.toList());
confirmationModel.setItems(stoageDomainNames);
confirmationModel.setTitle(ConstantsManager.getInstance().getConstants().storageDomainsAttachedToDataCenterWarningTitle());
confirmationModel.setMessage(ConstantsManager.getInstance().getConstants().storageDomainsAttachedToDataCenterWarningMessage());
confirmationModel.setHelpTag(HelpTag.attach_storage_domain_confirmation);
// $NON-NLS-1$
confirmationModel.setHashName("attach_storage_domain_confirmation");
confirmationModel.getLatch().setIsAvailable(true);
confirmationModel.getLatch().setIsChangeable(true);
// $NON-NLS-1$
UICommand onApprove = new UICommand("OnAttachApprove", DataCenterStorageListModel.this);
onApprove.setTitle(ConstantsManager.getInstance().getConstants().ok());
onApprove.setIsDefault(true);
confirmationModel.getCommands().add(onApprove);
// $NON-NLS-1$
UICommand cancel = new UICommand("Cancel", DataCenterStorageListModel.this);
cancel.setTitle(ConstantsManager.getInstance().getConstants().cancel());
cancel.setIsCancel(true);
confirmationModel.getCommands().add(cancel);
} else {
executeAttachStorageDomains();
}
}), getEntity(), selectedDataStorageDomains);
}
use of org.ovirt.engine.ui.uicommonweb.models.ListModel in project ovirt-engine by oVirt.
the class DataCenterStorageListModel method attachStorage.
public void attachStorage() {
ListModel listModel = new ListModel();
listModel.setTitle(ConstantsManager.getInstance().getConstants().attachStorageTitle());
listModel.setHelpTag(HelpTag.attach_storage);
// $NON-NLS-1$
listModel.setHashName("attach_storage");
attachInternal(listModel, StorageDomainType.Data);
}
use of org.ovirt.engine.ui.uicommonweb.models.ListModel in project ovirt-engine by oVirt.
the class DataCenterStorageListModel method postAttachInternal.
private void postAttachInternal(List<EntityModel> models) {
ListModel listModel = (ListModel) getWindow();
listModel.setItems(models);
if (models.isEmpty()) {
listModel.setMessage(ConstantsManager.getInstance().getConstants().thereAreNoCompatibleStorageDomainsAttachThisDcMsg());
// $NON-NLS-1$
UICommand tempVar = new UICommand("Cancel", this);
tempVar.setTitle(ConstantsManager.getInstance().getConstants().close());
tempVar.setIsDefault(true);
tempVar.setIsCancel(true);
listModel.getCommands().add(tempVar);
} else {
// $NON-NLS-1$
UICommand tempVar2 = UICommand.createDefaultOkUiCommand("OnAttach", this);
listModel.getCommands().add(tempVar2);
// $NON-NLS-1$
UICommand tempVar3 = UICommand.createCancelUiCommand("Cancel", this);
listModel.getCommands().add(tempVar3);
}
}
Aggregations