Skip to content

Commit

Permalink
fix go back after saving changes on resource object type basic settin…
Browse files Browse the repository at this point in the history
…gs wizard panel
  • Loading branch information
skublik committed Apr 29, 2024
1 parent f1ee7cf commit 554542c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -259,10 +259,23 @@ protected boolean isSaveButtonVisible() {
}

public boolean hasUnsavedChanges(AjaxRequestTarget target) {
return hasUnsavedChanges(false, target);
}

public boolean hasUnsavedChangesInWizard(AjaxRequestTarget target) {
return hasUnsavedChanges(true, target);
}

private boolean hasUnsavedChanges(boolean inWizard, AjaxRequestTarget target) {
OperationResult result = new OperationResult(OPERATION_SAVE);

try {
Collection<ObjectDelta<? extends ObjectType>> deltas = getObjectDetailsModels().collectDeltas(result);
Collection<ObjectDelta<? extends ObjectType>> deltas;
if (inWizard) {
deltas = getObjectDetailsModels().collectDeltaWithoutSavedDeltas(result);
} else {
deltas = getObjectDetailsModels().collectDeltas(result);
}

return !deltas.isEmpty();
} catch (Throwable ex) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ protected void exitFromWizard() {

protected void checkDeltasExitPerformed(SerializableConsumer<AjaxRequestTarget> consumer, AjaxRequestTarget target) {

if (!hasUnsavedChanges(target)) {
if (!hasUnsavedChangesInWizard(target)) {
consumer.accept(target);
return;
}
Expand Down

0 comments on commit 554542c

Please sign in to comment.