use of org.ovirt.engine.ui.uicompat.UIConstants in project ovirt-engine by oVirt.
the class VolumeListModel method configureClusterSnapshotOptions.
/**
* This action is handled here in VolumeLisModel only, because there is a use case where no volume would be selected
* for setting the configuration. And in this scenario the GlusrerVolumeSnapshotListModel would not be initialized.
*/
public void configureClusterSnapshotOptions() {
if (getWindow() != null) {
return;
}
final UIConstants constants = ConstantsManager.getInstance().getConstants();
final GlusterClusterSnapshotConfigModel clusterSnapshotConfigModel = new GlusterClusterSnapshotConfigModel();
clusterSnapshotConfigModel.setHelpTag(HelpTag.configure_volume_snapshot);
// $NON-NLS-1$
clusterSnapshotConfigModel.setHashName("configure_volume_snapshot");
clusterSnapshotConfigModel.setTitle(ConstantsManager.getInstance().getConstants().configureClusterSnapshotOptionsTitle());
setWindow(clusterSnapshotConfigModel);
AsyncDataProvider.getInstance().getClustersHavingHosts(new AsyncQuery<>(returnValue -> {
if (getSelectedItems() != null) {
GlusterVolumeEntity volumeEntity = getSelectedItems().get(0);
if (volumeEntity != null) {
AsyncDataProvider.getInstance().getClusterById(new AsyncQuery<>(cluster -> clusterSnapshotConfigModel.getClusters().setItems(returnValue, cluster)), volumeEntity.getClusterId());
}
} else {
clusterSnapshotConfigModel.getClusters().setItems(returnValue);
}
}));
clusterSnapshotConfigModel.getClusterConfigOptions().setTitle(ConstantsManager.getInstance().getConstants().configureClusterSnapshotOptionsTitle());
// $NON-NLS-1$
UICommand updateCommand = new UICommand("confirmConfigureClusterSnapshotOptions", this);
updateCommand.setTitle(constants.snapshotConfigUpdateButtonLabel());
updateCommand.setIsDefault(true);
clusterSnapshotConfigModel.getCommands().add(updateCommand);
// $NON-NLS-1$
UICommand cancelCommand = new UICommand("Cancel", this);
cancelCommand.setTitle(constants.cancel());
cancelCommand.setIsCancel(true);
clusterSnapshotConfigModel.getCommands().add(cancelCommand);
}
use of org.ovirt.engine.ui.uicompat.UIConstants in project ovirt-engine by oVirt.
the class SanStorageModelBase method updateGrayedOut.
private void updateGrayedOut(boolean isInMaintenance, Set<String> metadataDevices, LunModel lunModel) {
UIConstants constants = ConstantsManager.getInstance().getConstants();
UIMessages messages = ConstantsManager.getInstance().getMessages();
LUNs lun = lunModel.getEntity();
boolean nonEmpty = lun.getStorageDomainId() != null || lun.getDiskId() != null || lun.getStatus() == LunStatus.Unusable;
// Graying out LUNs
lunModel.setIsGrayedOut(isIgnoreGrayedOut() ? lun.getDiskId() != null : nonEmpty);
// Adding 'GrayedOutReasons'
if (lun.getDiskId() != null) {
lunModel.getGrayedOutReasons().add(messages.lunUsedByDiskWarning(lun.getDiskAlias()));
} else if (lun.getStorageDomainId() != null && !isInMaintenance) {
lunModel.getGrayedOutReasons().add(messages.lunAlreadyPartOfStorageDomainWarning(lun.getStorageDomainName()));
} else if (isInMaintenance && metadataDevices.contains(lun.getId())) {
lunModel.getGrayedOutReasons().add(messages.lunIsMetadataDevice(lun.getStorageDomainName()));
} else if (lun.getStatus() == LunStatus.Unusable) {
lunModel.getGrayedOutReasons().add(constants.lunUnusable());
}
}
use of org.ovirt.engine.ui.uicompat.UIConstants in project ovirt-engine by oVirt.
the class ImportTemplateModel method init.
public void init(final Collection<VmTemplate> externalTemplates, final Guid storageDomainId) {
Frontend.getInstance().runQuery(QueryType.Search, new SearchParameters(createSearchPattern(externalTemplates), SearchType.VmTemplate), new AsyncQuery<>(new AsyncCallback<QueryReturnValue>() {
@Override
public void onSuccess(QueryReturnValue returnValue) {
UIConstants constants = ConstantsManager.getInstance().getConstants();
List<VmTemplate> vmtList = returnValue.getReturnValue();
List<ImportTemplateData> templateDataList = new ArrayList<>();
for (VmTemplate template : externalTemplates) {
ImportTemplateData templateData = new ImportTemplateData(template);
boolean templateExistsInSystem = vmtList.contains(template);
templateData.setExistsInSystem(templateExistsInSystem);
if (templateExistsInSystem) {
templateData.enforceClone(constants.importTemplateThatExistsInSystemMustClone());
} else if (!template.isBaseTemplate() && findAnyVmTemplateById(vmtList, template.getBaseTemplateId()) == null) {
templateData.enforceClone(constants.importTemplateWithoutBaseMustClone());
}
templateDataList.add(templateData);
}
setItems(templateDataList);
withDataCenterLoaded(storageDomainId, r -> doInit());
}
private VmTemplate findAnyVmTemplateById(List<VmTemplate> vmtList, Guid templateId) {
for (VmTemplate vmt : vmtList) {
if (templateId.equals(vmt.getId())) {
return vmt;
}
}
return null;
}
}));
}
use of org.ovirt.engine.ui.uicompat.UIConstants in project ovirt-engine by oVirt.
the class DataCenterListModel method edit.
public void edit() {
StoragePool dataCenter = getSelectedItem();
final UIConstants constants = ConstantsManager.getInstance().getConstants();
if (getWindow() != null) {
return;
}
final DataCenterModel model = new DataCenterModel();
setWindow(model);
model.setEntity(dataCenter);
model.setDataCenterId(dataCenter.getId());
model.setTitle(constants.editDataCenterTitle());
model.setHelpTag(HelpTag.edit_data_center);
// $NON-NLS-1$
model.setHashName("edit_data_center");
model.getName().setEntity(dataCenter.getName());
model.getDescription().setEntity(dataCenter.getdescription());
model.getComment().setEntity(dataCenter.getComment());
model.setOriginalName(dataCenter.getName());
model.getStoragePoolType().setSelectedItem(dataCenter.isLocal());
model.getQuotaEnforceTypeListModel().setSelectedItem(dataCenter.getQuotaEnforcementType());
// $NON-NLS-1$
UICommand tempVar = UICommand.createDefaultOkUiCommand("OnSave", this);
model.getCommands().add(tempVar);
// $NON-NLS-1$
UICommand tempVar2 = UICommand.createCancelUiCommand("Cancel", this);
model.getCommands().add(tempVar2);
}
use of org.ovirt.engine.ui.uicompat.UIConstants in project ovirt-engine by oVirt.
the class VolumeGeoRepListModel method showGeoRepSessionDetails.
public void showGeoRepSessionDetails(GlusterGeoRepSession session) {
ArrayList<GlusterGeoRepSessionDetails> details = session.getSessionDetails();
if (getWindow() != null) {
return;
}
if (details == null || details.size() == 0) {
final UIConstants constants = ConstantsManager.getInstance().getConstants();
final ConfirmationModel cModel = new ConfirmationModel();
cModel.setTitle(constants.geoReplicationSessionDetailsTitle());
// $NON-NLS-1$
UICommand okCommand = new UICommand("closeConfirmWindow", this);
okCommand.setTitle(constants.ok());
okCommand.setIsCancel(true);
cModel.getCommands().add(okCommand);
setConfirmWindow(cModel);
cModel.setMessage(constants.geoRepSessionStatusDetailFetchFailed());
} else {
populateStatus(details);
}
}
Aggregations