use of org.ovirt.engine.ui.uicommonweb.models.hosts.HostModel in project ovirt-engine by oVirt.
the class ClusterGuideModel method onConfirmPMHost.
public void onConfirmPMHost() {
HostModel model = (HostModel) getWindow();
if (!model.validate()) {
return;
}
if (!model.getIsPm().getEntity() && ApplicationModeHelper.getUiMode() != ApplicationMode.GlusterOnly) {
ConfirmationModel confirmModel = new ConfirmationModel();
setConfirmWindow(confirmModel);
confirmModel.setTitle(ConstantsManager.getInstance().getConstants().powerManagementConfigurationTitle());
confirmModel.setHelpTag(HelpTag.power_management_configuration);
// $NON-NLS-1$
confirmModel.setHashName("power_management_configuration");
confirmModel.setMessage(ConstantsManager.getInstance().getConstants().youHavntConfigPmMsg());
// $NON-NLS-1$
UICommand tempVar = UICommand.createDefaultOkUiCommand("OnAddHost", this);
confirmModel.getCommands().add(tempVar);
// $NON-NLS-1$
UICommand tempVar2 = UICommand.createCancelUiCommand("CancelConfirmWithFocus", this);
confirmModel.getCommands().add(tempVar2);
} else {
onAddHost();
}
}
use of org.ovirt.engine.ui.uicommonweb.models.hosts.HostModel in project ovirt-engine by oVirt.
the class ClusterGuideModel method cancelConfirmWithFocus.
public void cancelConfirmWithFocus() {
setConfirmWindow(null);
HostModel hostModel = (HostModel) getWindow();
hostModel.setIsPowerManagementTabSelected(true);
}
use of org.ovirt.engine.ui.uicommonweb.models.hosts.HostModel in project ovirt-engine by oVirt.
the class ClusterGuideModel method onAddHost.
public void onAddHost() {
cancelConfirm();
HostModel model = (HostModel) getWindow();
if (model.getProgress() != null) {
return;
}
if (!model.validate()) {
return;
}
// Save changes.
VDS host = new VDS();
host.setVdsName(model.getName().getEntity());
host.setHostName(model.getHost().getEntity());
host.setPort(model.getPort().getEntity());
host.setSshPort(model.getAuthSshPort().getEntity());
host.setSshUsername(model.getUserName().getEntity());
host.setSshKeyFingerprint(model.getFetchSshFingerprint().getEntity());
host.setClusterId(model.getCluster().getSelectedItem().getId());
host.setVdsSpmPriority(model.getSpmPriorityValue());
// Save other PM parameters.
host.setPmEnabled(model.getIsPm().getEntity());
host.setDisablePowerManagementPolicy(model.getDisableAutomaticPowerManagement().getEntity());
host.setPmKdumpDetection(model.getPmKdumpDetection().getEntity());
AddVdsActionParameters vdsActionParams = new AddVdsActionParameters();
vdsActionParams.setvds(host);
vdsActionParams.setVdsId(host.getId());
if (model.getUserPassword().getEntity() != null) {
vdsActionParams.setPassword(model.getUserPassword().getEntity());
}
vdsActionParams.setAuthMethod(model.getAuthenticationMethod());
vdsActionParams.setOverrideFirewall(model.getOverrideIpTables().getEntity());
vdsActionParams.setFenceAgents(model.getFenceAgentListModel().getFenceAgents());
model.startProgress();
Frontend.getInstance().runAction(ActionType.AddVds, vdsActionParams, result -> {
ClusterGuideModel localModel = (ClusterGuideModel) result.getState();
localModel.postOnAddHost(result.getReturnValue());
}, this);
}
use of org.ovirt.engine.ui.uicommonweb.models.hosts.HostModel in project ovirt-engine by oVirt.
the class HostPopupView method edit.
@Override
public void edit(final HostModel object) {
driver.edit(object);
setTabIndexes(0);
object.getFetchResult().getEntityChangedEvent().addListener((ev, sender, args) -> {
String fetchResultText = object.getFetchResult().getEntity();
if (ConstantsManager.getInstance().getConstants().errorLoadingFingerprint().equals(fetchResultText)) {
fetchResult.addStyleName(style.fetchResultErrorLabel());
} else {
fetchResult.removeStyleName(style.fetchResultErrorLabel());
}
fetchResult.setText(fetchResultText);
});
object.getPkSection().getPropertyChangedEvent().addListener((ev, sender, args) -> {
if ("IsAvailable".equals(args.propertyName)) {
// $NON-NLS-1$
setPkPasswordSectionVisiblity(false);
}
});
object.getProviders().getSelectedItemChangedEvent().addListener((ev, sender, args) -> object.updateHosts());
object.getExternalHostProviderEnabled().getEntityChangedEvent().addListener((ev, sender, args) -> {
boolean showForemanProviders = object.getExternalHostProviderEnabled().getEntity();
boolean doProvisioning = object.externalProvisionEnabled();
boolean isProvisioned = showForemanProviders && doProvisioning;
providersEditor.setVisible(showForemanProviders);
// showing or hiding radio buttons
provisionedHostSection.setVisible(isProvisioned);
discoveredHostSection.setVisible(isProvisioned);
// disabling ip and name textbox when using provisioned hosts
hostAddressEditor.setEnabled(!isProvisioned);
hostAddressLabel.setStyleName(OvirtCss.LABEL_DISABLED, isProvisioned);
if (isProvisioned) {
object.updateHosts();
object.getIsDiscoveredHosts().setEntity(true);
} else {
if (doProvisioning) {
object.cleanHostParametersFields();
}
hideProviderWidgets(object);
object.getIsDiscoveredHosts().setEntity(null);
}
});
object.getIsDiscoveredHosts().getEntityChangedEvent().addListener((ev, sender, args) -> {
if (object.getIsDiscoveredHosts().getEntity() != null) {
if (object.getIsDiscoveredHosts().getEntity()) {
rbDiscoveredHost.asRadioButton().setValue(true);
showDiscoveredHostsWidgets(true);
} else if (!object.getIsDiscoveredHosts().getEntity()) {
rbProvisionedHost.asRadioButton().setValue(true);
showProvisionedHostsWidgets(true);
}
}
});
nameEditor.asValueBox().addKeyDownHandler(event -> Scheduler.get().scheduleDeferred(() -> {
if (object.getExternalHostProviderEnabled().getEntity() && Boolean.TRUE.equals(object.getIsDiscoveredHosts().getEntity())) {
ExternalHostGroup dhg = (ExternalHostGroup) object.getExternalHostGroups().getSelectedItem();
if (dhg != null) {
String base = nameEditor.asEditor().getSubEditor().getValue();
if (base == null) {
base = constants.empty();
}
String generatedHostName = // $NON-NLS-1$
base + "." + (dhg.getDomainName() != null ? dhg.getDomainName() : constants.empty());
object.getHost().setEntity(generatedHostName);
}
}
}));
if (object.isPasswordSectionViewable()) {
rbPassword.setValue(true);
rbPassword.setFocus(true);
fetchSshFingerprint.hideLabel();
object.setAuthenticationMethod(AuthenticationMethod.Password);
displayPassPkWindow(true);
rbPassword.addClickHandler(event -> {
object.setAuthenticationMethod(AuthenticationMethod.Password);
displayPassPkWindow(true);
});
rbPublicKey.addClickHandler(event -> {
object.setAuthenticationMethod(AuthenticationMethod.PublicKey);
displayPassPkWindow(false);
});
} else {
passwordSection.getElement().getStyle().setDisplay(Display.NONE);
rbPublicKey.getElement().getStyle().setDisplay(Display.NONE);
rbPublicKeyLabel.setStyleName(OvirtCss.LABEL_DISABLED);
object.setAuthenticationMethod(AuthenticationMethod.PublicKey);
}
updateHostsButton.setResource(resources.searchButtonImage());
// Create SPM related controls.
IEventListener<EventArgs> spmListener = (ev, sender, args) -> createSpmControls(object);
object.getSpmPriority().getItemsChangedEvent().addListener(spmListener);
object.getSpmPriority().getSelectedItemChangedEvent().addListener(spmListener);
createSpmControls(object);
initExternalHostProviderWidgets(object.showExternalProviderPanel());
// TODO: remove setIsChangeable when configured ssh username is enabled
userNameEditor.setEnabled(false);
networkProviderTab.setVisible(object.showNetworkProviderTab());
networkProviderWidget.edit(object.getNetworkProviderModel());
this.fenceAgentsEditor.edit(object.getFenceAgentListModel());
this.proxySourceEditor.edit(object.getPmProxyPreferencesList());
addTextAndLinkAlert(fetchPanel, constants.fetchingHostFingerprint(), object.getSSHFingerPrint());
providerSearchFilterLabel.setText(constants.hostPopupProviderSearchFilter());
nameEditor.setFocus(true);
hostedEngineTab.setVisible(object.getIsHeSystem() && object.getIsNew());
object.getHostedEngineWarning().getPropertyChangedEvent().addListener((ev, sender, args) -> {
EntityModel entity = (EntityModel) sender;
if ("IsAvailable".equals(args.propertyName)) {
// $NON-NLS-1$
hostedEngineWarningLabel.setVisible(entity.getIsAvailable());
}
});
affinityLabelSelectionWidget.init(object.getLabelList());
}
use of org.ovirt.engine.ui.uicommonweb.models.hosts.HostModel in project ovirt-engine by oVirt.
the class DataCenterGuideModel method onAddHost.
public void onAddHost() {
cancelConfirm();
HostModel model = (HostModel) getWindow();
if (model.getProgress() != null) {
return;
}
// Save changes.
VDS host = new VDS();
host.setVdsName(model.getName().getEntity());
host.setHostName(model.getHost().getEntity());
host.setPort(model.getPort().getEntity());
host.setSshPort(model.getAuthSshPort().getEntity());
host.setSshUsername(model.getUserName().getEntity());
host.setSshKeyFingerprint(model.getFetchSshFingerprint().getEntity());
host.setClusterId(model.getCluster().getSelectedItem().getId());
host.setVdsSpmPriority(model.getSpmPriorityValue());
// Save other PM parameters.
host.setPmEnabled(model.getIsPm().getEntity());
host.setDisablePowerManagementPolicy(model.getDisableAutomaticPowerManagement().getEntity());
host.setPmKdumpDetection(model.getPmKdumpDetection().getEntity());
AddVdsActionParameters addVdsParams = new AddVdsActionParameters();
addVdsParams.setVdsId(host.getId());
addVdsParams.setvds(host);
if (model.getUserPassword().getEntity() != null) {
addVdsParams.setPassword(model.getUserPassword().getEntity());
}
addVdsParams.setOverrideFirewall(model.getOverrideIpTables().getEntity());
addVdsParams.setFenceAgents(model.getFenceAgentListModel().getFenceAgents());
model.startProgress();
Frontend.getInstance().runAction(ActionType.AddVds, addVdsParams, result -> {
DataCenterGuideModel localModel = (DataCenterGuideModel) result.getState();
localModel.postOnAddHost(result.getReturnValue());
}, this);
}
Aggregations