use of org.ovirt.engine.core.common.businessentities.gluster.StorageSyncSchedule in project ovirt-engine by oVirt.
the class StorageDRListModel method onSave.
private void onSave() {
final StorageDRModel model = (StorageDRModel) getWindow();
if (!model.validate()) {
return;
}
StorageDomain storageDomain = getEntity();
final StorageSyncSchedule syncSchedule = new StorageSyncSchedule();
syncSchedule.setFrequency(model.getFrequency().getSelectedItem());
syncSchedule.setHour(model.getHour().getSelectedItem());
syncSchedule.setMins(model.getMins().getSelectedItem());
Guid georepId = model.getGeoRepSession().getSelectedItem() != null ? model.getGeoRepSession().getSelectedItem().getId() : null;
StorageSyncScheduleParameters parameter = new StorageSyncScheduleParameters(syncSchedule, storageDomain.getId(), georepId);
model.startProgress();
Frontend.getInstance().runAction(ActionType.ScheduleGlusterStorageSync, parameter, result -> {
StorageDRListModel localModel = (StorageDRListModel) result.getState();
model.stopProgress();
localModel.postSaveAction(result.getReturnValue());
}, this);
}
use of org.ovirt.engine.core.common.businessentities.gluster.StorageSyncSchedule in project ovirt-engine by oVirt.
the class SubTabStorageDRView method initTable.
void initTable() {
getTable().enableColumnResizing();
AbstractTextColumn<StorageDomainDR> sessionColumn = new AbstractTextColumn<StorageDomainDR>() {
@Override
public String getValue(StorageDomainDR storageDomainDR) {
GlusterGeoRepSession session = getDetailModel().getGeoRepSessionsMap().get(storageDomainDR.getGeoRepSessionId());
if (session == null) {
return storageDomainDR.getGeoRepSessionId().toString();
} else {
return messages.geoRepRemoteSessionName(session.getSlaveHostName(), session.getSlaveVolumeName());
}
}
};
// $NON-NLS-1$
getTable().addColumn(sessionColumn, constants.geoRepSlaveVolume(), "300px");
AbstractTextColumn<StorageDomainDR> scheduleColumn = new AbstractTextColumn<StorageDomainDR>() {
@Override
public String getValue(StorageDomainDR storageDomainDR) {
StorageSyncSchedule schedule = new StorageSyncSchedule(storageDomainDR.getScheduleCronExpression());
return schedule.toString();
}
};
// $NON-NLS-1$
getTable().addColumn(scheduleColumn, constants.scheduleLabel(), "300px");
}
use of org.ovirt.engine.core.common.businessentities.gluster.StorageSyncSchedule in project ovirt-engine by oVirt.
the class StorageDRListModel method editDR.
private void editDR() {
if (getWindow() != null) {
return;
}
final StorageDomain storageDomain = getEntity();
if (storageDomain == null) {
return;
}
final StorageDomainDR selectedDR = getSelectedItem();
StorageSyncSchedule schedule = new StorageSyncSchedule(selectedDR.getScheduleCronExpression());
final StorageDRModel model = new StorageDRModel();
model.setHelpTag(HelpTag.new_storage_dr);
model.setTitle(ConstantsManager.getInstance().getConstants().edit());
// $NON-NLS-1$
model.setHashName("edit_dr");
model.getStorageDomain().setEntity(storageDomain);
setWindow(model);
model.startProgress();
model.getFrequency().setSelectedItem(schedule.getFrequency());
model.getHour().setSelectedItem(schedule.getHour());
model.getMins().setSelectedItem(schedule.getMins());
AsyncDataProvider.getInstance().getGlusterGeoRepSessionsForStorageDomain(new AsyncQuery<>(geoRepSessions -> {
model.getGeoRepSession().setItems(geoRepSessions);
model.getGeoRepSession().setSelectedItem(Linq.firstOrNull(geoRepSessions, new Linq.IdPredicate<>(selectedDR.getGeoRepSessionId())));
model.stopProgress();
}), storageDomain.getId());
// $NON-NLS-1$
UICommand okCommand = UICommand.createDefaultOkUiCommand("OnSave", this);
model.getCommands().add(okCommand);
// $NON-NLS-1$
UICommand cancelCommand = UICommand.createCancelUiCommand("Cancel", this);
model.getCommands().add(cancelCommand);
}
Aggregations