use of org.ovirt.engine.ui.uicompat.UIConstants in project ovirt-engine by oVirt.
the class ClusterModel method migrationPoliciesChanged.
private void migrationPoliciesChanged() {
boolean hasMigrationPolicy = getMigrationPolicies().getSelectedItem() != null && !NoMigrationPolicy.ID.equals(getMigrationPolicies().getSelectedItem().getId());
UIConstants constants = ConstantsManager.getInstance().getConstants();
getAutoConverge().setIsChangeable(!hasMigrationPolicy, constants.availableOnlyWithLegacyPolicy());
getMigrateCompressed().setIsChangeable(!hasMigrationPolicy, constants.availableOnlyWithLegacyPolicy());
}
use of org.ovirt.engine.ui.uicompat.UIConstants in project ovirt-engine by oVirt.
the class VmListModel method initImportModelForVmsToImportNamesOnly.
private void initImportModelForVmsToImportNamesOnly(final ImportVmsModel importVmsModel, final ImportVmModel importVmModel) {
final UIMessages messages = ConstantsManager.getInstance().getMessages();
final UIConstants constants = ConstantsManager.getInstance().getConstants();
final List<String> vmsToImport = new ArrayList<>();
OriginType originType = convertImportSourceToOriginType(importVmsModel.getImportSources().getSelectedItem());
final List<VM> externalVms = importVmsModel.getVmsToImport();
for (VM vm : externalVms) {
vmsToImport.add(vm.getName());
}
importVmsModel.clearProblem();
importVmsModel.startProgress();
importVmModel.setMessage("");
AsyncQuery query = new AsyncQuery(returnValue -> {
if (returnValue instanceof QueryReturnValue) {
importVmsModel.setError(messages.providerFailure());
importVmsModel.stopProgress();
} else {
List<VM> remoteVms = (List<VM>) returnValue;
List<VM> remoteDownVms = new ArrayList<>();
List<VM> nonRetrievedVms = new ArrayList<>();
// find vms with status=down
for (VM vm : remoteVms) {
if (vm.isDown()) {
remoteDownVms.add(vm);
}
}
// i.e. they were retrieved with their names only but not with their full info
if (remoteVms.size() != externalVms.size()) {
for (VM vm : externalVms) {
if (!remoteVms.contains(vm)) {
nonRetrievedVms.add(vm);
}
}
}
importVmsModel.stopProgress();
// prepare error message to be displayed in one of the models
String messageForImportVm = null;
String messageForImportVms = null;
if (remoteVms.size() != remoteDownVms.size()) {
if (!nonRetrievedVms.isEmpty()) {
messageForImportVm = constants.nonRetrievedAndRunningVmsWereFilteredOnImportVm();
messageForImportVms = constants.nonRetrievedAndRunningVmsWereAllFilteredOnImportVm();
} else {
messageForImportVm = constants.runningVmsWereFilteredOnImportVm();
messageForImportVms = constants.runningVmsWereAllFilteredOnImportVm();
}
} else if (!nonRetrievedVms.isEmpty()) {
messageForImportVm = constants.nonRetrievedVmsWereFilteredOnImportVm();
messageForImportVms = constants.nonRetrievedVmsWereAllFilteredOnImportVm();
}
if (remoteDownVms.isEmpty() && messageForImportVms != null) {
importVmsModel.setError(messageForImportVms);
}
if (!importVmsModel.validateArchitectures(remoteDownVms)) {
return;
}
// init and display next dialog - the importVmsModel model
importVmModel.init(remoteDownVms, importVmsModel.getDataCenters().getSelectedItem().getId());
setWindow(null);
setWindow(importVmModel);
if (messageForImportVm != null) {
importVmModel.setMessage(messageForImportVm);
}
}
});
if (!(importVmModel instanceof ImportVmFromExternalSourceModel)) {
importVmsModel.setError(messages.providerImportFailure());
importVmsModel.stopProgress();
return;
}
ImportVmFromExternalSourceModel importVmsFromExternalSource = (ImportVmFromExternalSourceModel) importVmModel;
query.setHandleFailure(true);
AsyncDataProvider.getInstance().getVmsFromExternalServer(query, importVmsModel.getDataCenters().getSelectedItem().getId(), importVmsFromExternalSource.getProxyHostId(), importVmsFromExternalSource.getUrl(), importVmsFromExternalSource.getUsername(), importVmsFromExternalSource.getPassword(), originType, vmsToImport);
}
use of org.ovirt.engine.ui.uicompat.UIConstants in project ovirt-engine by oVirt.
the class VmListModel method stop.
private void stop() {
UIConstants constants = ConstantsManager.getInstance().getConstants();
powerAction(STOP, constants.stopVirtualMachinesTitle(), constants.areYouSureYouWantToStopTheFollowingVirtualMachinesMsg());
}
use of org.ovirt.engine.ui.uicompat.UIConstants in project ovirt-engine by oVirt.
the class VmListModel method reboot.
private void reboot() {
UIConstants constants = ConstantsManager.getInstance().getConstants();
powerAction(REBOOT, constants.rebootVirtualMachinesTitle(), constants.areYouSureYouWantToRebootTheFollowingVirtualMachinesMsg(), false);
}
use of org.ovirt.engine.ui.uicompat.UIConstants in project ovirt-engine by oVirt.
the class VolumeListModel method configureVolumeSnapshotOptions.
public void configureVolumeSnapshotOptions() {
if (getWindow() != null) {
return;
}
final UIConstants constants = ConstantsManager.getInstance().getConstants();
GlusterVolumeEntity volumeEntity = getSelectedItems().get(0);
final GlusterVolumeSnapshotConfigModel volumeSnapshotConfigModel = new GlusterVolumeSnapshotConfigModel(volumeEntity);
volumeSnapshotConfigModel.setHelpTag(HelpTag.configure_volume_snapshot);
// $NON-NLS-1$
volumeSnapshotConfigModel.setHashName("configure_volume_snapshot");
volumeSnapshotConfigModel.setTitle(ConstantsManager.getInstance().getConstants().configureVolumeSnapshotOptionsTitle());
setWindow(volumeSnapshotConfigModel);
AsyncDataProvider.getInstance().getClusterById(new AsyncQuery<>(cluster -> volumeSnapshotConfigModel.getClusterName().setEntity(cluster.getName())), volumeEntity.getClusterId());
volumeSnapshotConfigModel.getVolumeName().setEntity(volumeEntity.getName());
// $NON-NLS-1$
UICommand updateCommand = new UICommand("confirmConfigureVolumeSnapshotOptions", this);
updateCommand.setTitle(constants.snapshotConfigUpdateButtonLabel());
updateCommand.setIsDefault(true);
volumeSnapshotConfigModel.getCommands().add(updateCommand);
// $NON-NLS-1$
UICommand cancelCommand = new UICommand("Cancel", this);
cancelCommand.setTitle(constants.cancel());
cancelCommand.setIsCancel(true);
volumeSnapshotConfigModel.getCommands().add(cancelCommand);
}
Aggregations