From b5f2c2429bd852c3df78ddd52520bb0feb23b2c5 Mon Sep 17 00:00:00 2001 From: Charles Givre Date: Tue, 26 Apr 2022 09:25:02 -0400 Subject: [PATCH] WIP --- .../src/main/resources}/storage_logos/Http.png | Bin .../drill/exec/server/rest/StorageResources.java | 14 ++++++++++++++ .../src/main/resources/rest/storage/list.ftl | 1 + 3 files changed, 15 insertions(+) rename {exec/java-exec/src/main/resources/rest/static/img => contrib/storage-http/src/main/resources}/storage_logos/Http.png (100%) diff --git a/exec/java-exec/src/main/resources/rest/static/img/storage_logos/Http.png b/contrib/storage-http/src/main/resources/storage_logos/Http.png similarity index 100% rename from exec/java-exec/src/main/resources/rest/static/img/storage_logos/Http.png rename to contrib/storage-http/src/main/resources/storage_logos/Http.png diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/StorageResources.java b/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/StorageResources.java index c110084189d..1ea86383543 100644 --- a/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/StorageResources.java +++ b/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/StorageResources.java @@ -573,6 +573,20 @@ public StoragePluginModel(PluginConfigWrapper plugin, HttpServletRequest request csrfToken = WebUtils.getCsrfTokenFromHttpRequest(request); } + /** + * Returns the path for the image used in the list view. + * @return + */ + public String getImagePath() { + if (getCleanType().contentEquals("FileSystem")) { + return "/static/img/storage_logos/FileSystem.png"; + } + + // If the plugin is in contrib, get the full path + String path = plugin.getConfig().getClass().getResource("/storage_logos/" + getCleanType() + ".png").getPath(); + return path; + } + public String getCleanType() { String pluginName = type.replace("Config", ""); pluginName = pluginName.replace("Plugin", ""); diff --git a/exec/java-exec/src/main/resources/rest/storage/list.ftl b/exec/java-exec/src/main/resources/rest/storage/list.ftl index fbfe1d4aef6..b9a29514e83 100644 --- a/exec/java-exec/src/main/resources/rest/storage/list.ftl +++ b/exec/java-exec/src/main/resources/rest/storage/list.ftl @@ -61,6 +61,7 @@ ${pluginModel.getCleanType()} + ${pluginModel.getImagePath()} ${pluginModel.getPlugin().getName()}