use of org.ovirt.engine.ui.uicommonweb.models.clusters.ClusterModel in project ovirt-engine by oVirt.
the class ClusterPopupPresenterWidget method init.
@Override
public void init(final ClusterModel model) {
super.init(model);
model.getPropertyChangedEvent().addListener((ev, sender, args) -> {
String propName = args.propertyName;
if ("AllowClusterWithVirtGlusterEnabled".equals(propName)) {
// $NON-NLS-1$
getView().allowClusterWithVirtGlusterEnabled(model.getAllowClusterWithVirtGlusterEnabled());
}
});
String spiceProxyInConfig = (String) AsyncDataProvider.getInstance().getConfigValuePreConverted(ConfigValues.SpiceProxyDefault);
String spiceProxyMessage = StringHelper.isNullOrEmpty(spiceProxyInConfig) ? messages.noSpiceProxyDefined() : spiceProxyInConfig;
getView().setSpiceProxyOverrideExplanation(messages.consoleOverrideSpiceProxyMessage(messages.consoleOverrideDefinedInGlobalConfig(), spiceProxyMessage));
getModel().getVersion().getSelectedItemChangedEvent().addListener((ev, sender, args) -> {
final Version selectedVersion = getModel().getVersion().getSelectedItem();
if (selectedVersion == null) {
return;
}
if (AsyncDataProvider.getInstance().isMigrationPoliciesSupported(selectedVersion)) {
getView().getMigrationBandwidthLimitTypeEditor().setEnabled(true);
updateCustomMigrationBandwidthLimitEnabledState(model, null);
} else {
final String supportedVersions = String.join(", ", // $NON-NLS-1$
AsyncDataProvider.getInstance().getMigrationPoliciesSupportedVersions());
final String message = messages.onlyAvailableInCompatibilityVersions(supportedVersions);
getView().getMigrationBandwidthLimitTypeEditor().disable(message);
getView().getMigrationBandwidthLimitTypeEditor().setEnabled(false);
updateCustomMigrationBandwidthLimitEnabledState(model, message);
}
});
getModel().getMigrationBandwidthLimitType().getSelectedItemChangedEvent().addListener((ev, sender, args) -> updateCustomMigrationBandwidthLimitEnabledState(model, null));
model.getMacPoolModel().getEntityChangedEvent().addListener((ev, sender, args) -> getView().updateMacPool(model.getMacPoolModel()));
final UICommand addMacPoolCommand = model.getAddMacPoolCommand();
if (addMacPoolCommand == null) {
getView().makeMacPoolButtonInvisible();
} else {
getView().getMacPoolButton().setCommand(addMacPoolCommand);
registerHandler(getView().getMacPoolButton().addClickHandler(event -> getView().getMacPoolButton().getCommand().execute(model)));
}
}
use of org.ovirt.engine.ui.uicommonweb.models.clusters.ClusterModel in project ovirt-engine by oVirt.
the class DataCenterGuideModel method postOnAddCluster.
public void postOnAddCluster(ActionReturnValue returnValue) {
ClusterModel model = (ClusterModel) getWindow();
model.stopProgress();
if (returnValue != null && returnValue.getSucceeded()) {
cancel();
postAction();
}
}
use of org.ovirt.engine.ui.uicommonweb.models.clusters.ClusterModel in project ovirt-engine by oVirt.
the class DataCenterGuideModel method addCluster.
public void addCluster() {
if (getWindow() != null) {
return;
}
ClusterModel model = ClusterListModel.createNewClusterModel();
setWindow(model);
ArrayList<StoragePool> dataCenters = new ArrayList<>();
dataCenters.add(getEntity());
model.getDataCenter().setItems(dataCenters, getEntity());
model.getDataCenter().setIsChangeable(false);
// $NON-NLS-1$
UICommand tempVar = UICommand.createDefaultOkUiCommand("OnAddCluster", this);
model.getCommands().add(tempVar);
// $NON-NLS-1$
UICommand tempVar2 = UICommand.createCancelUiCommand("Cancel", this);
model.getCommands().add(tempVar2);
}
use of org.ovirt.engine.ui.uicommonweb.models.clusters.ClusterModel in project ovirt-engine by oVirt.
the class DataCenterGuideModel method onAddCluster.
public void onAddCluster() {
ClusterModel model = (ClusterModel) getWindow();
Cluster cluster = ClusterListModel.buildCluster(model, new Cluster());
if (model.getProgress() != null) {
return;
}
model.startProgress();
Frontend.getInstance().runAction(ActionType.AddCluster, new ManagementNetworkOnClusterOperationParameters(cluster), result -> {
DataCenterGuideModel localModel = (DataCenterGuideModel) result.getState();
localModel.postOnAddCluster(result.getReturnValue());
}, this);
}
use of org.ovirt.engine.ui.uicommonweb.models.clusters.ClusterModel in project ovirt-engine by oVirt.
the class AddClusterRM method prepare2.
public void prepare2() {
PreparingEnlistment enlistment = (PreparingEnlistment) context.enlistment;
EnlistmentContext enlistmentContext = (EnlistmentContext) enlistment.getContext();
HostListModel<?> model = enlistmentContext.getModel();
ConfigureLocalStorageModel configureModel = (ConfigureLocalStorageModel) model.getWindow();
Cluster candidate = configureModel.getCandidateCluster();
ClusterModel clusterModel = configureModel.getCluster();
String clusterName = clusterModel.getName().getEntity();
if (candidate == null || !Objects.equals(candidate.getName(), clusterName)) {
// Try to find existing cluster with the specified name.
Cluster cluster = context.clusterFoundByName;
if (cluster != null) {
enlistmentContext.setClusterId(cluster.getId());
context.enlistment = null;
enlistment.prepared();
} else {
Version version = clusterModel.getVersion().getSelectedItem();
cluster = new Cluster();
cluster.setName(clusterName);
cluster.setDescription(clusterModel.getDescription().getEntity());
cluster.setStoragePoolId(enlistmentContext.getDataCenterId());
cluster.setCpuName(clusterModel.getCPU().getSelectedItem().getCpuName());
cluster.setMaxVdsMemoryOverCommit(clusterModel.getMemoryOverCommit());
cluster.setCountThreadsAsCores(Boolean.TRUE.equals(clusterModel.getVersionSupportsCpuThreads().getEntity()) && Boolean.TRUE.equals(clusterModel.getCountThreadsAsCores().getEntity()));
cluster.setTransparentHugepages(true);
cluster.setCompatibilityVersion(version);
cluster.setMigrateOnError(clusterModel.getMigrateOnErrorOption());
ClusterOperationParameters parameters = new ManagementNetworkOnClusterOperationParameters(cluster);
parameters.setCorrelationId(getCorrelationId());
Frontend.getInstance().runAction(ActionType.AddCluster, parameters, result -> {
ActionReturnValue returnValue = result.getReturnValue();
context.addClusterReturnValue = returnValue;
prepare3();
});
}
} else {
enlistmentContext.setClusterId(configureModel.getCluster().getClusterId());
context.enlistment = null;
enlistment.prepared();
}
}
Aggregations