use of org.ovirt.engine.ui.uicommonweb.models.EntityModel in project ovirt-engine by oVirt.
the class ForceRemoveConfirmationPopupView method edit.
@Override
public void edit(final ConfirmationModel object) {
driver.edit(object);
// Bind "Latch.IsAvailable"
object.getLatch().getPropertyChangedEvent().addListener((ev, sender, args) -> {
if ("IsAvailable".equals(args.propertyName)) {
// $NON-NLS-1$
EntityModel entity = (EntityModel) sender;
if (entity.getIsAvailable()) {
latch.setVisible(true);
}
}
});
object.getItemsChangedEvent().addListener((ev, sender, args) -> updateMessage(object));
}
use of org.ovirt.engine.ui.uicommonweb.models.EntityModel in project ovirt-engine by oVirt.
the class AsyncDataProvider method getBondingOptionListDependingOnNetwork.
public ArrayList<Map.Entry<String, EntityModel<String>>> getBondingOptionListDependingOnNetwork(RefObject<Map.Entry<String, EntityModel<String>>> defaultItem, boolean hasVmNetworkAttached) {
ArrayList<Map.Entry<String, EntityModel<String>>> list = new ArrayList<>();
for (BondMode mode : BondMode.values()) {
if (!mode.isBondModeValidForVmNetwork() && hasVmNetworkAttached) {
continue;
}
KeyValuePairCompat<String, EntityModel<String>> bondOption = getBondOption(mode);
list.add(bondOption);
if (mode.equals(BondMode.BOND4)) {
defaultItem.argvalue = bondOption;
}
}
EntityModel<String> entityModel = new EntityModel<>();
// $NON-NLS-1$
entityModel.setEntity("");
list.add(new KeyValuePairCompat<>(SetupNetworksBondModel.CUSTOM_BONDING_MODE, entityModel));
return list;
}
use of org.ovirt.engine.ui.uicommonweb.models.EntityModel in project ovirt-engine by oVirt.
the class StorageListModel method saveNewNfsStorage.
public void saveNewNfsStorage() {
StorageModel model = (StorageModel) getWindow();
NfsStorageModel nfsModel = (NfsStorageModel) model.getCurrentStorageItem();
VDS host = model.getHost().getSelectedItem();
hostId = host.getId();
// Create storage connection.
StorageServerConnections storageConnection = new StorageServerConnections();
storageConnection.setConnection(path);
storageConnection.setStorageType(nfsModel.getType());
if (isConnectionOverriden()) {
storageConnection.setNfsVersion((NfsVersion) ((EntityModel) nfsModel.getVersion().getSelectedItem()).getEntity());
storageConnection.setNfsRetrans(nfsModel.getRetransmissions().asConvertible().nullableShort());
storageConnection.setNfsTimeo(nfsModel.getTimeout().asConvertible().nullableShort());
storageConnection.setMountOptions(nfsModel.getMountOptions().getEntity());
}
connection = storageConnection;
ArrayList<ActionType> actionTypes = new ArrayList<>();
ArrayList<ActionParametersBase> parameters = new ArrayList<>();
actionTypes.add(ActionType.AddStorageServerConnection);
actionTypes.add(ActionType.AddNFSStorageDomain);
actionTypes.add(ActionType.DisconnectStorageServerConnection);
parameters.add(new StorageServerConnectionParametersBase(connection, host.getId(), false));
StorageDomainManagementParameter tempVar2 = new StorageDomainManagementParameter(storageDomain);
tempVar2.setVdsId(host.getId());
StoragePool dataCenter = model.getDataCenter().getSelectedItem();
tempVar2.setStoragePoolId(dataCenter.getId());
parameters.add(tempVar2);
parameters.add(new StorageServerConnectionParametersBase(connection, host.getId(), false));
IFrontendActionAsyncCallback callback1 = result -> {
StorageListModel storageListModel = (StorageListModel) result.getState();
ActionReturnValue actionReturnValue = result.getReturnValue();
storageListModel.storageDomain.setStorage((String) actionReturnValue.getActionReturnValue());
storageListModel.connection.setId((String) actionReturnValue.getActionReturnValue());
};
IFrontendActionAsyncCallback callback2 = result -> {
StorageListModel storageListModel = (StorageListModel) result.getState();
ActionReturnValue actionReturnValue = result.getReturnValue();
storageListModel.storageId = actionReturnValue.getActionReturnValue();
};
IFrontendActionAsyncCallback callback3 = result -> {
StorageListModel storageListModel = (StorageListModel) result.getState();
StorageModel storageModel = (StorageModel) storageListModel.getWindow();
// Attach storage to data center as necessary.
StoragePool dataCenter1 = storageModel.getDataCenter().getSelectedItem();
if (!dataCenter1.getId().equals(StorageModel.UnassignedDataCenterId)) {
storageListModel.attachStorageToDataCenter(storageListModel.storageId, dataCenter1.getId(), storageModel.getActivateDomain().getEntity());
}
storageListModel.onFinish(storageListModel.context, true, storageListModel.storageModel);
};
IFrontendActionAsyncCallback failureCallback = result -> {
StorageListModel storageListModel = (StorageListModel) result.getState();
storageListModel.cleanConnection(storageListModel.connection, storageListModel.hostId);
storageListModel.onFinish(storageListModel.context, false, storageListModel.storageModel);
};
Frontend.getInstance().runMultipleActions(actionTypes, parameters, new ArrayList<>(Arrays.asList(callback1, callback2, callback3)), failureCallback, this);
}
use of org.ovirt.engine.ui.uicommonweb.models.EntityModel in project ovirt-engine by oVirt.
the class AdElementListModel method addGroupsToModel.
protected void addGroupsToModel(QueryReturnValue returnValue, Set<String> excludeUsers) {
for (Queryable item : (Collection<Queryable>) returnValue.getReturnValue()) {
DirectoryGroup a = (DirectoryGroup) item;
if (!excludeUsers.contains(a.getId())) {
// TODO: This is a hack, we should either use DbGroup or reimplement user/group representation in GWT
DbUser group = new DbUser();
group.setExternalId(a.getId());
group.setFirstName(a.getName());
// $NON-NLS-1$
group.setLastName("");
// TODO: Due to group -> DbUser mapping hack we have to use note to represent display name of group
group.setNote(a.getDisplayName());
group.setDomain(a.getDirectoryName());
group.setNamespace(a.getNamespace());
EntityModel<DbUser> groupEntity = new EntityModel<>();
groupEntity.setEntity(group);
getgroups().add(groupEntity);
}
}
}
use of org.ovirt.engine.ui.uicommonweb.models.EntityModel in project ovirt-engine by oVirt.
the class SanStorageModelBase method updateInternal.
protected void updateInternal() {
if (!(getContainer().isNewStorage() || getContainer().isStorageActive())) {
return;
}
VDS host = getContainer().getHost().getSelectedItem();
if (host == null) {
proposeDiscover();
return;
}
final Collection<EntityModel<?>> prevSelected = Linq.findSelectedItems((Collection<EntityModel<?>>) getSelectedItem());
clearItems();
initializeItems(null, null);
final SanStorageModelBase model = this;
AsyncQuery<QueryReturnValue> asyncQuery = new AsyncQuery<>(response -> {
if (response.getSucceeded()) {
setValuesForMaintenance(model);
model.applyData((ArrayList<LUNs>) response.getReturnValue(), false, prevSelected, isInMaintenance, metadata);
model.initLunSelection();
// $NON-NLS-1$
model.setGetLUNsFailure("");
model.stopProgress();
} else {
model.setGetLUNsFailure(ConstantsManager.getInstance().getConstants().couldNotRetrieveLUNsLunsFailure());
}
}, true);
Frontend.getInstance().runQuery(QueryType.GetDeviceList, new GetDeviceListQueryParameters(host.getId(), getType(), false, null, false), asyncQuery);
getContainer().startProgress();
}
Aggregations