Skip to content

Commit

Permalink
Merge pull request #5199 from jay-hodgson/SWC-6577
Browse files Browse the repository at this point in the history
SWC-6577: after a new website version is detected, automatically relo…
  • Loading branch information
jay-hodgson authored Oct 11, 2023
2 parents 38f7d12 + 3b63ce0 commit 14b2fa1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ public class DisplayConstants {
public static final String NEW_VERSION_AVAILABLE =
"New Version of Synapse Available. ";
public static final String NEW_VERSION_INSTRUCTIONS =
"A new version of Synapse is now available, please save your work and reload the page to ensure proper function.";
"A new version of Synapse is now available, please save your work. In a few minutes this page will automatically reload to ensure proper function.";
public static final String UPLOAD_DIALOG_TITLE = "Upload";
public static final String SHOW_ALL_RESULTS = "Show Results for All Types";
public static final String FORGOT_PASSWORD = "forgot password?";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,13 @@
import com.google.gwt.user.client.History;
import com.google.gwt.user.client.Timer;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Frame;
import com.google.gwt.user.client.ui.RootPanel;
import org.gwtbootstrap3.extras.bootbox.client.Bootbox;
import org.gwtbootstrap3.extras.bootbox.client.options.DialogOptions;

public class GlobalApplicationStateViewImpl
implements GlobalApplicationStateView {

private static final int UNLIMITED_TIME = 0;
Frame iframe;

@Override
public void showVersionOutOfDateGlobalMessage() {
Expand All @@ -23,7 +20,7 @@ public void showVersionOutOfDateGlobalMessage() {
DisplayConstants.NEW_VERSION_INSTRUCTIONS,
UNLIMITED_TIME
);
preloadNewVersion();
loadNewVersion();
}

@Override
Expand All @@ -33,7 +30,7 @@ public void showGetVersionError(String error) {
error,
5000
);
preloadNewVersion();
loadNewVersion();
}

@Override
Expand Down Expand Up @@ -62,22 +59,14 @@ private static final native void _initSRCEndpoints(
}
}-*/;

public void preloadNewVersion() {
// preload, after a (10 minute) delay
public void loadNewVersion() {
// reload, after a (30 minute) delay
Timer timer = new Timer() {
public void run() {
if (iframe != null) {
RootPanel.getBodyElement().removeChild(iframe.getElement());
}
String currentURL = Window.Location.getHref();
iframe = new Frame(currentURL);
iframe.setWidth("1px");
iframe.setHeight("1px");
RootPanel.getBodyElement().appendChild(iframe.getElement());
iframe.setVisible(false);
Window.Location.reload();
}
};
timer.schedule(1000 * 60 * 10);
timer.schedule(1000 * 60 * 30);
}

@Override
Expand Down

0 comments on commit 14b2fa1

Please sign in to comment.