Skip to content

Commit

Permalink
Fixes #274.
Browse files Browse the repository at this point in the history
  • Loading branch information
khituras committed Jul 15, 2024
1 parent 90990ee commit 9e7ab40
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@
import de.julielab.gepi.webapp.pages.Index;
import org.apache.tapestry5.BindingConstants;
import org.apache.tapestry5.ComponentResources;
import org.apache.tapestry5.SymbolConstants;
import org.apache.tapestry5.annotations.*;
import org.apache.tapestry5.corelib.components.Zone;
import org.apache.tapestry5.http.Link;
import org.apache.tapestry5.ioc.annotations.Inject;
import org.apache.tapestry5.ioc.annotations.Symbol;
import org.apache.tapestry5.json.JSONObject;
import org.apache.tapestry5.services.ajax.AjaxResponseRenderer;
import org.apache.tapestry5.services.javascript.JavaScriptSupport;
Expand Down Expand Up @@ -82,6 +84,9 @@ final public class GepiWidgetLayout {
private String viewMode;
@InjectPage
private Index index;
@Inject
@Symbol(SymbolConstants.PRODUCTION_MODE)
private boolean productionMode;

void setupRender() {
if (getEsResult() == null)
Expand Down Expand Up @@ -142,8 +147,8 @@ public JSONObject getWidgetSettings() {
widgetSettings.put("handleId", getResizeHandleId());
widgetSettings.put("widgetId", clientId);
widgetSettings.put("viewMode", "small");
widgetSettings.put("toggleViewModeUrl", toggleViewModeEventLink.toAbsoluteURI().replace(":80", ""));
widgetSettings.put("refreshContentsUrl", refreshContentEventLink.toAbsoluteURI().replace(":80", ""));
widgetSettings.put("toggleViewModeUrl", toggleViewModeEventLink.toAbsoluteURI(productionMode));
widgetSettings.put("refreshContentsUrl", refreshContentEventLink.toAbsoluteURI(productionMode));
widgetSettings.put("zoneElementId", widgetZone.getClientId());
widgetSettings.put("useTapestryZoneUpdates", useTapestryZoneUpdates);
widgetSettings.put("dataSessionId", requestData.getDataSessionId());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ public Future<EventRetrievalResult> getUnrolledResult4download() {

void afterRender() {
javaScriptSupport.require("gepi/base").invoke("setuptooltips");
javaScriptSupport.require("gepi/charts/data").invoke("setDataUrl").with(resources.createEventLink("loadDataToClient").toAbsoluteURI().replace(":80", ""));
javaScriptSupport.require("gepi/charts/data").invoke("setDataUrl").with(resources.createEventLink("loadDataToClient").toAbsoluteURI(productionMode));
javaScriptSupport.require("gepi/pages/index").invoke("setupDownloadUrlCopyButton");
if (isResultPresent()) {
// If there already is data at loading the page, the input panel is already hidden (see #getShowInputClass)
Expand Down Expand Up @@ -466,12 +466,14 @@ private boolean isBList() {
return requestData.getInputMode().contains(InputMode.AB);
}


@Inject
@Symbol(SymbolConstants.PRODUCTION_MODE)
private boolean productionMode;
@Inject
private PageRenderLinkSource pageRenderLS;

public String getResultFileDownloadLink() {
return pageRenderLS.createPageRenderLinkWithContext(ResultDownload.class, dataSessionId).toAbsoluteURI().replace(":80", "");
return pageRenderLS.createPageRenderLinkWithContext(ResultDownload.class, dataSessionId).toAbsoluteURI(productionMode);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,7 @@ public static void contributeFactoryDefaults(

// This is something that should be removed when going to production, but is useful
// in the early stages of development.
configuration.override(SymbolConstants.PRODUCTION_MODE, true);

// configuration.override(SymbolConstants.CORS_ENABLED, true);
// configuration.override(SymbolConstants.CORS_ALLOWED_ORIGINS, "*");
configuration.add(SymbolConstants.CORS_MAX_AGE, "5");
configuration.override(SymbolConstants.PRODUCTION_MODE, false);
}

public static void contributeApplicationDefaults(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ define(['jquery', 't5/core/zone', 'gepi/pages/index'], function($, zoneManager,

Widget.prototype.ajaxRefresh = function() {
console.log('[trace] Issueing update of zone with ID ' + this.zoneElementId);
index.getReadySemaphor().done(() => zoneManager.deferredZoneUpdate(this.zoneElementId, this.refreshContentsUrl.replace(":80", "")));
index.getReadySemaphor().done(() => zoneManager.deferredZoneUpdate(this.zoneElementId, this.refreshContentsUrl));
console.log('[trace] Returned from update of zone with ID ' + this.zoneElementId);
};

Expand Down

0 comments on commit 9e7ab40

Please sign in to comment.