bug5807: introduced confirmation dialog when loading report while queries exist in result presenter

This commit is contained in:
Axel Uhl committed 2023-02-16 12:49:44 +01:00
1 parent d7a0fc7628
commit 6e791640f5
4 files changed
+26 -20

No files matched your search

@@ -178,24 +178,27 @@ public class DataMiningReportStoreControls extends Composite {
}
private StoredDataMiningReportDTO applyReport(StoredDataMiningReportDTO storedReport) {
showBusyIndicator(true);
final DataMiningReportDTO report = storedReport.getReport();
reportProvider.setCurrentReport(storedReport);
final Iterable<StatisticQueryDefinitionDTO> reportQueries = report.getQueryDefinitions();
final SequentialQueryExecutor executor = new SequentialQueryExecutor(reportQueries);
executor.run(results -> {
resultsPresenter.showResults(results);
showBusyIndicator(false);
if (!executor.hasErrorOccurred()) {
Notification.notify(
StringMessages.INSTANCE.dataMiningStoredReportLoadedSuccessful(storedReport.getName()),
NotificationType.SUCCESS);
} else {
Notification.notify(
StringMessages.INSTANCE.dataMiningStoredReportLoadedWithErrors(storedReport.getName()),
NotificationType.WARNING);
}
});
if (!Util.stream(resultsPresenter.getPresenterIds()).map(presenterId->resultsPresenter.getQueryDefinition(presenterId)).anyMatch(queryDefinition->queryDefinition != null) ||
Window.confirm(StringMessages.INSTANCE.isItOkToReplaceAllTabsWithQueriesByReport())) {
showBusyIndicator(true);
final DataMiningReportDTO report = storedReport.getReport();
reportProvider.setCurrentReport(storedReport);
final Iterable<StatisticQueryDefinitionDTO> reportQueries = report.getQueryDefinitions();
final SequentialQueryExecutor executor = new SequentialQueryExecutor(reportQueries);
executor.run(results -> {
resultsPresenter.showResults(results);
showBusyIndicator(false);
if (!executor.hasErrorOccurred()) {
Notification.notify(
StringMessages.INSTANCE.dataMiningStoredReportLoadedSuccessful(storedReport.getName()),
NotificationType.SUCCESS);
} else {
Notification.notify(
StringMessages.INSTANCE.dataMiningStoredReportLoadedWithErrors(storedReport.getName()),
NotificationType.WARNING);
}
});
}
return storedReport;
}
@@ -112,4 +112,5 @@ public interface StringMessages extends com.sap.sse.gwt.client.StringMessages {
String newParameterName();
String parameterNameMustNotBeEmpty();
String overwriteExistingReportBySameName(String name);
String isItOkToReplaceAllTabsWithQueriesByReport();
}
@@ -95,4 +95,5 @@ pickOrCreateReportParameterMessage=Pick one of the existing report parameters or
parameterNamesMustBeUniqueInReport=Parameter name {0} of parameter with type {1} is not unique within report.
newParameterName=Name for New Parameter
parameterNameMustNotBeEmpty=Parameter name must not be empty.
overwriteExistingReportBySameName=Overwrite existing report by same name "{0}"?
overwriteExistingReportBySameName=Overwrite existing report by same name "{0}"?
isItOkToReplaceAllTabsWithQueriesByReport=Is it OK to replace all tabs with their queries with the report?
@@ -84,4 +84,5 @@ pickOrCreateReportParameterMessage=Bestehenden Parameter auswählen oder einen n
parameterNamesMustBeUniqueInReport=Parameter-Name {0} des Parameters mit Typ {1} existiert bereits innerhalb des Berichts.
newParameterName=Name des neuen Parameters
parameterNameMustNotBeEmpty=Leere Parameternamen sind nicht erlaubt.
overwriteExistingReportBySameName=Bestehenden Bericht "{0}" überschreiben?
overwriteExistingReportBySameName=Bestehenden Bericht "{0}" überschreiben?
isItOkToReplaceAllTabsWithQueriesByReport=Sollen alle bisherigen Ergebnisse und Anfragen durch den Bericht ersetzt werden?