diff --git a/backend/src/main/java/com/bakdata/conquery/io/freemarker/Freemarker.java b/backend/src/main/java/com/bakdata/conquery/io/freemarker/Freemarker.java index 66faafc905..7818c0c4bf 100644 --- a/backend/src/main/java/com/bakdata/conquery/io/freemarker/Freemarker.java +++ b/backend/src/main/java/com/bakdata/conquery/io/freemarker/Freemarker.java @@ -36,6 +36,7 @@ private static Map asMap() { .put(LOG_TEMPLATE_EXCEPTIONS_KEY_CAMEL_CASE, Boolean.FALSE.toString()) .put(NUMBER_FORMAT_KEY_CAMEL_CASE, "computer") .put(LOCALE_KEY, "") + .put(OUTPUT_ENCODING_KEY, "utf-8") .build(); } } diff --git a/backend/src/main/java/com/bakdata/conquery/resources/admin/AdminServlet.java b/backend/src/main/java/com/bakdata/conquery/resources/admin/AdminServlet.java index a41e6e8600..1e7a8774e4 100644 --- a/backend/src/main/java/com/bakdata/conquery/resources/admin/AdminServlet.java +++ b/backend/src/main/java/com/bakdata/conquery/resources/admin/AdminServlet.java @@ -19,10 +19,31 @@ import com.bakdata.conquery.models.config.ConqueryConfig; import com.bakdata.conquery.models.jobs.JobManager; import com.bakdata.conquery.models.worker.DatasetRegistry; -import com.bakdata.conquery.resources.admin.rest.*; -import com.bakdata.conquery.resources.admin.ui.*; +import com.bakdata.conquery.resources.admin.rest.AdminConceptsResource; +import com.bakdata.conquery.resources.admin.rest.AdminDatasetProcessor; +import com.bakdata.conquery.resources.admin.rest.AdminDatasetResource; +import com.bakdata.conquery.resources.admin.rest.AdminDatasetsResource; +import com.bakdata.conquery.resources.admin.rest.AdminProcessor; +import com.bakdata.conquery.resources.admin.rest.AdminResource; +import com.bakdata.conquery.resources.admin.rest.AdminTablesResource; +import com.bakdata.conquery.resources.admin.rest.AuthOverviewResource; +import com.bakdata.conquery.resources.admin.rest.GroupResource; +import com.bakdata.conquery.resources.admin.rest.PermissionResource; +import com.bakdata.conquery.resources.admin.rest.RoleResource; +import com.bakdata.conquery.resources.admin.rest.UIProcessor; +import com.bakdata.conquery.resources.admin.rest.UserResource; +import com.bakdata.conquery.resources.admin.ui.AdminUIResource; +import com.bakdata.conquery.resources.admin.ui.AuthOverviewUIResource; +import com.bakdata.conquery.resources.admin.ui.ConceptsUIResource; +import com.bakdata.conquery.resources.admin.ui.DatasetsUIResource; +import com.bakdata.conquery.resources.admin.ui.GroupUIResource; +import com.bakdata.conquery.resources.admin.ui.IndexServiceUIResource; +import com.bakdata.conquery.resources.admin.ui.RoleUIResource; +import com.bakdata.conquery.resources.admin.ui.TablesUIResource; +import com.bakdata.conquery.resources.admin.ui.UserUIResource; import com.bakdata.conquery.resources.admin.ui.model.ConnectorUIResource; import io.dropwizard.core.setup.AdminEnvironment; +import io.dropwizard.core.setup.Environment; import io.dropwizard.jersey.DropwizardResourceConfig; import io.dropwizard.jersey.jackson.JacksonMessageBodyProvider; import io.dropwizard.servlets.assets.AssetServlet; @@ -95,6 +116,7 @@ protected void configure() { bind(manager.getValidator()).to(Validator.class); bind(manager.getJobManager()).to(JobManager.class); bind(manager.getConfig()).to(ConqueryConfig.class); + bind(manager.getEnvironment()).to(Environment.class); bind(adminProcessor).to(AdminProcessor.class); bind(adminDatasetProcessor).to(AdminDatasetProcessor.class); } @@ -117,6 +139,7 @@ protected void configure() { bind(manager.getDatasetRegistry()).to(DatasetRegistry.class); bind(manager.getMetaStorage()).to(MetaStorage.class); bind(manager.getConfig()).to(ConqueryConfig.class); + bind(manager.getEnvironment()).to(Environment.class); } }) .register(AdminPermissionFilter.class) diff --git a/backend/src/main/java/com/bakdata/conquery/resources/admin/rest/UIProcessor.java b/backend/src/main/java/com/bakdata/conquery/resources/admin/rest/UIProcessor.java index 17c89ccdbf..5ee2aa9fe4 100644 --- a/backend/src/main/java/com/bakdata/conquery/resources/admin/rest/UIProcessor.java +++ b/backend/src/main/java/com/bakdata/conquery/resources/admin/rest/UIProcessor.java @@ -12,6 +12,7 @@ import java.util.TreeSet; import java.util.function.Predicate; import java.util.stream.Collectors; +import jakarta.inject.Inject; import com.bakdata.conquery.io.cps.CPSTypeIdResolver; import com.bakdata.conquery.io.storage.MetaStorage; @@ -43,7 +44,7 @@ import com.bakdata.conquery.resources.admin.ui.model.TableStatistics; import com.bakdata.conquery.resources.admin.ui.model.UIContext; import com.google.common.cache.CacheStats; -import jakarta.inject.Inject; +import io.dropwizard.core.setup.Environment; import lombok.Getter; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -60,6 +61,8 @@ public class UIProcessor { @Getter private final AdminProcessor adminProcessor; + private final Environment environment; + public DatasetRegistry getDatasetRegistry() { return adminProcessor.getDatasetRegistry(); } @@ -69,7 +72,10 @@ public MetaStorage getStorage() { } public UIContext getUIContext(String csrfToken) { - return new UIContext(adminProcessor.getNodeProvider(), csrfToken); + String adminContextPath = environment.getAdminContext().getContextPath(); + // If the context is just the root, we omit the slash as our path are absolute + adminContextPath = adminContextPath.equals("/")? "" : adminContextPath; + return new UIContext(adminProcessor.getNodeProvider(), csrfToken, adminContextPath); } public Set> getLoadedIndexes() { diff --git a/backend/src/main/java/com/bakdata/conquery/resources/admin/ui/model/UIContext.java b/backend/src/main/java/com/bakdata/conquery/resources/admin/ui/model/UIContext.java index ef6fe0ccd7..34db25d3dc 100644 --- a/backend/src/main/java/com/bakdata/conquery/resources/admin/ui/model/UIContext.java +++ b/backend/src/main/java/com/bakdata/conquery/resources/admin/ui/model/UIContext.java @@ -26,6 +26,9 @@ public class UIContext { @Getter public final String csrfToken; + @Getter + public final String adminContextPath; + public Map getShardNodes() { return shardNodeSupplier.get().stream().collect(Collectors.toMap( ShardNodeInformation::getRemoteAddress, diff --git a/backend/src/main/resources/assets/custom/js/script.js b/backend/src/main/resources/assets/custom/js/script.js index 325d59e9c6..4d45c5c6fa 100644 --- a/backend/src/main/resources/assets/custom/js/script.js +++ b/backend/src/main/resources/assets/custom/js/script.js @@ -25,7 +25,7 @@ function toForceURL(url) { async function rest(url, options) { var res = await fetch( - url, + `${adminContextPath}${url}`, { method: 'get', credentials: 'same-origin', diff --git a/backend/src/main/resources/com/bakdata/conquery/resources/admin/ui/datasets.html.ftl b/backend/src/main/resources/com/bakdata/conquery/resources/admin/ui/datasets.html.ftl index ae11931ea6..9c995ed8f5 100644 --- a/backend/src/main/resources/com/bakdata/conquery/resources/admin/ui/datasets.html.ftl +++ b/backend/src/main/resources/com/bakdata/conquery/resources/admin/ui/datasets.html.ftl @@ -27,7 +27,7 @@

All Datasets

- <@table.table columns=columns items=c?sort_by("name") link="/admin-ui/datasets/" deleteButton=deleteDatasetButton cypressId="datasets"/> + <@table.table columns=columns items=c?sort_by("name") link="${ctxPath}/admin-ui/datasets/" deleteButton=deleteDatasetButton cypressId="datasets"/>
diff --git a/backend/src/main/resources/com/bakdata/conquery/resources/admin/ui/templates/base.html.ftl b/backend/src/main/resources/com/bakdata/conquery/resources/admin/ui/templates/base.html.ftl index fc5435567b..d186a85660 100644 --- a/backend/src/main/resources/com/bakdata/conquery/resources/admin/ui/templates/base.html.ftl +++ b/backend/src/main/resources/com/bakdata/conquery/resources/admin/ui/templates/base.html.ftl @@ -1,3 +1,4 @@ +<#global ctxPath=ctx.adminContextPath?url_path> <#macro html title > @@ -7,20 +8,21 @@ - - - - + + + + - - - - + + + + ${title} diff --git a/backend/src/main/resources/com/bakdata/conquery/resources/admin/ui/templates/template.html.ftl b/backend/src/main/resources/com/bakdata/conquery/resources/admin/ui/templates/template.html.ftl index daebaf5424..10754ca550 100644 --- a/backend/src/main/resources/com/bakdata/conquery/resources/admin/ui/templates/template.html.ftl +++ b/backend/src/main/resources/com/bakdata/conquery/resources/admin/ui/templates/template.html.ftl @@ -3,7 +3,7 @@ <@base.html "Conquery Admin UI" >