use of org.ovirt.engine.ui.frontend.AsyncQuery in project ovirt-engine by oVirt.
the class AddClusterRM method prepare1.
public void prepare1() {
EnlistmentContext enlistmentContext = (EnlistmentContext) context.enlistment.getContext();
HostListModel<?> model = enlistmentContext.getModel();
ConfigureLocalStorageModel configureModel = (ConfigureLocalStorageModel) model.getWindow();
ClusterModel clusterModel = configureModel.getCluster();
String clusterName = clusterModel.getName().getEntity();
if (!StringHelper.isNullOrEmpty(clusterName)) {
AsyncDataProvider.getInstance().getClusterListByName(new AsyncQuery<>(returnValue -> {
context.clusterFoundByName = Linq.firstOrNull(returnValue);
prepare2();
}), clusterName);
} else {
prepare2();
}
}
use of org.ovirt.engine.ui.frontend.AsyncQuery in project ovirt-engine by oVirt.
the class AddDataCenterRM method rollback1.
public void rollback1() {
Enlistment enlistment = context.enlistment;
EnlistmentContext enlistmentContext = (EnlistmentContext) enlistment.getContext();
if (enlistmentContext.getDataCenterId() != null) {
AsyncDataProvider.getInstance().getDataCenterById(new AsyncQuery<>(returnValue -> {
context.dataCenterFoundById = returnValue;
rollback2();
}), enlistmentContext.getDataCenterId());
} else {
rollback3();
}
}
use of org.ovirt.engine.ui.frontend.AsyncQuery in project ovirt-engine by oVirt.
the class AddDataCenterRM method prepare1.
private void prepare1() {
EnlistmentContext enlistmentContext = (EnlistmentContext) context.enlistment.getContext();
HostListModel<?> model = enlistmentContext.getModel();
ConfigureLocalStorageModel configureModel = (ConfigureLocalStorageModel) model.getWindow();
DataCenterModel dataCenterModel = configureModel.getDataCenter();
String dataCenterName = dataCenterModel.getName().getEntity();
if (!StringHelper.isNullOrEmpty(dataCenterName)) {
AsyncDataProvider.getInstance().getDataCenterListByName(new AsyncQuery<>(returnValue -> {
context.dataCenterFoundByName = Linq.firstOrNull(returnValue);
prepare2();
}), dataCenterName);
} else {
prepare2();
}
}
use of org.ovirt.engine.ui.frontend.AsyncQuery in project ovirt-engine by oVirt.
the class NewTemplateVmModelBehavior method initialize.
@Override
public void initialize() {
super.initialize();
getModel().getVmInitEnabled().setEntity(vm.getVmInit() != null);
getModel().getVmInitModel().init(vm.getStaticData());
getModel().getVmType().setIsChangeable(true);
getModel().getCopyPermissions().setIsAvailable(true);
DisksAllocationModel disksAllocationModel = getModel().getDisksAllocationModel();
disksAllocationModel.setIsVolumeFormatAvailable(true);
disksAllocationModel.setIsVolumeFormatChangeable(true);
disksAllocationModel.setIsAliasChangable(true);
disksAllocationModel.setContainer(getModel());
disksAllocationModel.setIsThinProvisioning(false);
AsyncDataProvider.getInstance().getDataCenterById(new AsyncQuery<>(dataCenter -> {
if (dataCenter == null) {
disableNewTemplateModel(ConstantsManager.getInstance().getConstants().dataCenterIsNotAccessibleMsg());
} else {
AsyncDataProvider.getInstance().getClusterListByService(new AsyncQuery<>(clusters -> {
List<Cluster> filteredClusters = AsyncDataProvider.getInstance().filterByArchitecture(clusters, vm.getClusterArch());
getModel().setDataCentersAndClusters(getModel(), Arrays.asList(dataCenter), filteredClusters, vm.getClusterId());
initTemplate();
}), true, false);
AsyncDataProvider.getInstance().isSoundcardEnabled(new AsyncQuery<>(returnValue -> getModel().getIsSoundcardEnabled().setEntity(returnValue)), vm.getId());
}
}), vm.getStoragePoolId());
}
use of org.ovirt.engine.ui.frontend.AsyncQuery in project ovirt-engine by oVirt.
the class ProfileBehavior method initProfiles.
public void initProfiles(final Guid clusterId, final Guid dcId, final AsyncQuery<List<VnicProfileView>> profilesQuery) {
AsyncQuery<QueryReturnValue> networksQuery = new AsyncQuery<>(response -> {
clusterNetworks = response.getReturnValue();
managementNetworkName = clusterNetworks.stream().filter(n -> n.getCluster().isManagement()).map(Network::getName).findFirst().orElse(null);
profilesQuery.converterCallback = returnValue -> {
List<VnicProfileView> vnicProfiles = new ArrayList<>();
vnicProfiles.add(VnicProfileView.EMPTY);
if (returnValue == null) {
return vnicProfiles;
}
for (VnicProfileView vnicProfile : (List<VnicProfileView>) returnValue) {
Network network = findNetworkById(vnicProfile.getNetworkId());
if (network != null) {
vnicProfiles.add(vnicProfile);
}
}
Collections.sort(vnicProfiles, Linq.VnicProfileViewComparator);
return vnicProfiles;
};
AsyncDataProvider.getInstance().getVnicProfilesByDcId(profilesQuery, dcId);
});
Frontend.getInstance().runQuery(QueryType.GetAllVmNetworksByClusterId, new IdQueryParameters(clusterId), networksQuery);
}
Aggregations