diff --git a/README.md b/README.md index 1cc012d..d583331 100644 --- a/README.md +++ b/README.md @@ -65,26 +65,26 @@ Otherwise, go ahead and add these to your `application.properties` file: ```properties ## The first-level part of the URL path: http://localhost:8080/${baseUrl}/ -dbadmin.baseUrl=admin +snapadmin.baseUrl=admin ## The package(s) that contain your @Entity classes ## accepts multiple comma separated values -dbadmin.modelsPackage=your.models.package,your.second.models.package +snapadmin.modelsPackage=your.models.package,your.second.models.package ## At the moment, it's required to have open-in-view set to true. # spring.jpa.open-in-view=true ## OPTIONAL PARAMETERS ## Whether to enable SnapAdmin -# dbadmin.enabled=true +# snapadmin.enabled=true # # ## Set to true if you need to run the tests, as it will customize ## the database configuration for the internal DataSource -# dbadmin.testMode=false +# snapadmin.testMode=false # ## SQL console enable/disable (true by default) -# dbadmin.sqlConsoleEnabled=false +# snapadmin.sqlConsoleEnabled=false ``` **IMPORTANT**: The configuration prefix `dbadmin.` will change to `snapadmin.` starting from version 0.2.0, as part of the project being renamed. Remember to update your configuration files accordingly. @@ -97,7 +97,7 @@ Now annotate your `@SpringBootApplication` class containing the `main` method wi This will autoconfigure SnapAdmin when your application starts. You are good to go! -3. At this point, when you run your application, you should be able to visit `http://localhost:${port}/${dbadmin.baseUrl}` and see the web interface. +3. At this point, when you run your application, you should be able to visit `http://localhost:${port}/${snapadmin.baseUrl}` and see the web interface. ## Documentation diff --git a/docs/docs/index.html b/docs/docs/index.html index 696c4bf..d846192 100644 --- a/docs/docs/index.html +++ b/docs/docs/index.html @@ -96,25 +96,25 @@
 ## The first-level part of the URL path: http://localhost:8080/${baseUrl}/
-dbadmin.baseUrl=admin
+snapadmin.baseUrl=admin
 
 ## The package(s) that contain your @Entity classes
 ## accepts multiple comma separated values
-dbadmin.modelsPackage=your.models.package,your.second.models.package
+snapadmin.modelsPackage=your.models.package,your.second.models.package
 
 ## At the moment, it's required to have open-in-view set to true.
 # spring.jpa.open-in-view=true
 
 ## OPTIONAL PARAMETERS
 ## Whether to enable SnapAdmin
-# dbadmin.enabled=true
+# snapadmin.enabled=true
 #
 ## Set to true if you need to run the tests, as it will customize
 ## the database configuration for the internal DataSource
-# dbadmin.testMode=false
+# snapadmin.testMode=false
 #
 ## SQL console enable/disable (true by default)
-# dbadmin.sqlConsoleEnabled=false
+# snapadmin.sqlConsoleEnabled=false
 
 
@@ -344,11 +344,11 @@ public class Payment { ... }

3.2 The Settings panel

-

As mentioned earlier, the Settings panel primarily provides options to customize the branding/appearance of the web interface. These settings are persistent across restarts and are stored in an embedded H2 database (file named dbadmin_internal), along with other data required by SnapAdmin.

+

As mentioned earlier, the Settings panel primarily provides options to customize the branding/appearance of the web interface. These settings are persistent across restarts and are stored in an embedded H2 database (file named snapadmin_internal), along with other data required by SnapAdmin.

4. Security

SnapAdmin does not implement authentication and/or authorization mechanisms. However, you can use a standard Spring security configuration in order to limit access to the web UI or specific parts of it.

-

All SnapAdmin routes start with the value of dbadmin.baseUrl property, and all write operations (edit, create, delete) are implemented as POST calls. The following code provides an example security configuration (assuming SnapAdmin runs at /admin):

+

All SnapAdmin routes start with the value of snapadmin.baseUrl property, and all write operations (edit, create, delete) are implemented as POST calls. The following code provides an example security configuration (assuming SnapAdmin runs at /admin):

diff --git a/docs/index.html b/docs/index.html
index 5eb0d46..3d28cf3 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -110,10 +110,10 @@
                     

Add the minimum required properties to your application.properties file.

 # the root path of all SnapAdmin routes
-dbadmin.baseUrl=admin
+snapadmin.baseUrl=admin
 
 # comma-separated list of packages to scan for @Entity classes
-dbadmin.modelsPackage=your.models.package
+snapadmin.modelsPackage=your.models.package
 
 
diff --git a/src/main/java/tech/ailef/snapadmin/external/SnapAdminAutoConfiguration.java b/src/main/java/tech/ailef/snapadmin/external/SnapAdminAutoConfiguration.java index f25da93..02f75e1 100644 --- a/src/main/java/tech/ailef/snapadmin/external/SnapAdminAutoConfiguration.java +++ b/src/main/java/tech/ailef/snapadmin/external/SnapAdminAutoConfiguration.java @@ -46,7 +46,7 @@ import tech.ailef.snapadmin.internal.InternalDbAdminConfiguration; * H2 database which is used by SnapAdmin to store user * settings and other information like operations history. */ -@ConditionalOnProperty(name = "dbadmin.enabled", matchIfMissing = true) +@ConditionalOnProperty(name = "snapadmin.enabled", matchIfMissing = true) @ComponentScan @EnableConfigurationProperties(SnapAdminProperties.class) @Configuration @@ -72,7 +72,7 @@ public class SnapAdminAutoConfiguration { if (props.isTestMode()) { dataSourceBuilder.url("jdbc:h2:mem:test"); } else { - dataSourceBuilder.url("jdbc:h2:file:./dbadmin_internal"); + dataSourceBuilder.url("jdbc:h2:file:./snapadmin_internal"); } dataSourceBuilder.username("sa"); diff --git a/src/main/java/tech/ailef/snapadmin/external/SnapAdminProperties.java b/src/main/java/tech/ailef/snapadmin/external/SnapAdminProperties.java index 1ed29df..b977b7d 100644 --- a/src/main/java/tech/ailef/snapadmin/external/SnapAdminProperties.java +++ b/src/main/java/tech/ailef/snapadmin/external/SnapAdminProperties.java @@ -22,10 +22,10 @@ package tech.ailef.snapadmin.external; import org.springframework.boot.context.properties.ConfigurationProperties; /** - * The 'dbadmin.*' properties that can be set in the properties file + * The 'snapadmin.*' properties that can be set in the properties file * to configure the behaviour of Spring Boot Admin Panel. */ -@ConfigurationProperties("dbadmin") +@ConfigurationProperties("snapadmin") public class SnapAdminProperties { /** * Whether SnapAdmin is enabled. diff --git a/src/main/java/tech/ailef/snapadmin/external/controller/DataExportController.java b/src/main/java/tech/ailef/snapadmin/external/controller/DataExportController.java index 2607cf6..31916c0 100644 --- a/src/main/java/tech/ailef/snapadmin/external/controller/DataExportController.java +++ b/src/main/java/tech/ailef/snapadmin/external/controller/DataExportController.java @@ -71,7 +71,7 @@ import tech.ailef.snapadmin.internal.model.ConsoleQuery; import tech.ailef.snapadmin.internal.repository.ConsoleQueryRepository; @Controller -@RequestMapping(value = { "/${dbadmin.baseUrl}/", "/${dbadmin.baseUrl}" }) +@RequestMapping(value = { "/${snapadmin.baseUrl}/", "/${snapadmin.baseUrl}" }) public class DataExportController { private static final Logger logger = LoggerFactory.getLogger(DataExportFormat.class); diff --git a/src/main/java/tech/ailef/snapadmin/external/controller/DefaultDbAdminController.java b/src/main/java/tech/ailef/snapadmin/external/controller/DefaultDbAdminController.java index 0cb5652..bd28c80 100644 --- a/src/main/java/tech/ailef/snapadmin/external/controller/DefaultDbAdminController.java +++ b/src/main/java/tech/ailef/snapadmin/external/controller/DefaultDbAdminController.java @@ -83,7 +83,7 @@ import tech.ailef.snapadmin.internal.service.UserSettingsService; * The main DbAdmin controller that register most of the routes of the web interface. */ @Controller -@RequestMapping(value= {"/${dbadmin.baseUrl}", "/${dbadmin.baseUrl}/"}) +@RequestMapping(value= {"/${snapadmin.baseUrl}", "/${snapadmin.baseUrl}/"}) public class DefaultDbAdminController { private static final Logger logger = LoggerFactory.getLogger(DefaultDbAdminController.class); @@ -439,10 +439,10 @@ public class DefaultDbAdminController { } } - String c = params.get("__dbadmin_create"); + String c = params.get("__snapadmin_create"); if (c == null) { throw new ResponseStatusException( - HttpStatus.BAD_REQUEST, "Missing required param __dbadmin_create" + HttpStatus.BAD_REQUEST, "Missing required param __snapadmin_create" ); } diff --git a/src/main/java/tech/ailef/snapadmin/external/controller/FileDownloadController.java b/src/main/java/tech/ailef/snapadmin/external/controller/FileDownloadController.java index 012a002..98de410 100644 --- a/src/main/java/tech/ailef/snapadmin/external/controller/FileDownloadController.java +++ b/src/main/java/tech/ailef/snapadmin/external/controller/FileDownloadController.java @@ -47,7 +47,7 @@ import tech.ailef.snapadmin.external.exceptions.DbAdminException; * Controller to serve file or images (`@DisplayImage`) */ @Controller -@RequestMapping(value = {"/${dbadmin.baseUrl}/download", "/${dbadmin.baseUrl}/download/"}) +@RequestMapping(value = {"/${snapadmin.baseUrl}/download", "/${snapadmin.baseUrl}/download/"}) public class FileDownloadController { @Autowired private DbAdminRepository repository; diff --git a/src/main/java/tech/ailef/snapadmin/external/controller/GlobalController.java b/src/main/java/tech/ailef/snapadmin/external/controller/GlobalController.java index bb50be4..f63357b 100644 --- a/src/main/java/tech/ailef/snapadmin/external/controller/GlobalController.java +++ b/src/main/java/tech/ailef/snapadmin/external/controller/GlobalController.java @@ -56,10 +56,10 @@ public class GlobalController { model.addAttribute("status", ""); model.addAttribute("error", "Error"); model.addAttribute("message", e.getMessage()); - model.addAttribute("dbadmin_userConf", userConf); - model.addAttribute("dbadmin_baseUrl", getBaseUrl()); - model.addAttribute("dbadmin_version", dbAdmin.getVersion()); - model.addAttribute("dbadmin_properties", props); + model.addAttribute("snapadmin_userConf", userConf); + model.addAttribute("snapadmin_baseUrl", getBaseUrl()); + model.addAttribute("snapadmin_version", dbAdmin.getVersion()); + model.addAttribute("snapadmin_properties", props); return "other/error"; } @@ -68,15 +68,15 @@ public class GlobalController { model.addAttribute("status", "404"); model.addAttribute("error", "Error"); model.addAttribute("message", e.getMessage()); - model.addAttribute("dbadmin_userConf", userConf); - model.addAttribute("dbadmin_baseUrl", getBaseUrl()); - model.addAttribute("dbadmin_version", dbAdmin.getVersion()); - model.addAttribute("dbadmin_properties", props); + model.addAttribute("snapadmin_userConf", userConf); + model.addAttribute("snapadmin_baseUrl", getBaseUrl()); + model.addAttribute("snapadmin_version", dbAdmin.getVersion()); + model.addAttribute("snapadmin_properties", props); response.setStatus(404); return "other/error"; } - @ModelAttribute("dbadmin_version") + @ModelAttribute("snapadmin_version") public String getVersion() { return dbAdmin.getVersion(); } @@ -87,7 +87,7 @@ public class GlobalController { * @param request the incoming request * @return multi valued map of request parameters */ - @ModelAttribute("dbadmin_queryParams") + @ModelAttribute("snapadmin_queryParams") public Map getQueryParams(HttpServletRequest request) { return request.getParameterMap(); } @@ -96,7 +96,7 @@ public class GlobalController { * The baseUrl as specified in the properties file by the user * @return */ - @ModelAttribute("dbadmin_baseUrl") + @ModelAttribute("snapadmin_baseUrl") public String getBaseUrl() { return props.getBaseUrl(); } @@ -106,7 +106,7 @@ public class GlobalController { * @param request * @return */ - @ModelAttribute("dbadmin_requestUrl") + @ModelAttribute("snapadmin_requestUrl") public String getRequestUrl(HttpServletRequest request) { return request.getRequestURI(); } @@ -116,12 +116,12 @@ public class GlobalController { * in the settings table. * @return */ - @ModelAttribute("dbadmin_userConf") + @ModelAttribute("snapadmin_userConf") public UserConfiguration getUserConf() { return userConf; } - @ModelAttribute("dbadmin_properties") + @ModelAttribute("snapadmin_properties") public SnapAdminProperties getProps() { return props; } diff --git a/src/main/java/tech/ailef/snapadmin/external/controller/rest/AutocompleteController.java b/src/main/java/tech/ailef/snapadmin/external/controller/rest/AutocompleteController.java index 6a61d87..a70c7c8 100644 --- a/src/main/java/tech/ailef/snapadmin/external/controller/rest/AutocompleteController.java +++ b/src/main/java/tech/ailef/snapadmin/external/controller/rest/AutocompleteController.java @@ -39,7 +39,7 @@ import tech.ailef.snapadmin.external.dto.AutocompleteSearchResult; * API controller for autocomplete results */ @RestController -@RequestMapping(value= {"/${dbadmin.baseUrl}/api/autocomplete", "/${dbadmin.baseUrl}/api/autocomplete/"}) +@RequestMapping(value= {"/${snapadmin.baseUrl}/api/autocomplete", "/${snapadmin.baseUrl}/api/autocomplete/"}) public class AutocompleteController { @Autowired private SnapAdmin dbAdmin; diff --git a/src/main/java/tech/ailef/snapadmin/internal/InternalDbAdminConfiguration.java b/src/main/java/tech/ailef/snapadmin/internal/InternalDbAdminConfiguration.java index 281e2f4..77fa533 100644 --- a/src/main/java/tech/ailef/snapadmin/internal/InternalDbAdminConfiguration.java +++ b/src/main/java/tech/ailef/snapadmin/internal/InternalDbAdminConfiguration.java @@ -27,7 +27,7 @@ import org.springframework.context.annotation.Configuration; * Configuration class for the "internal" data source. This is place in the root "internal" * package, so as to allow component scanning and detection of models and repositories. */ -@ConditionalOnProperty(name = "dbadmin.enabled", matchIfMissing = true) +@ConditionalOnProperty(name = "snapadmin.enabled", matchIfMissing = true) @ComponentScan @Configuration public class InternalDbAdminConfiguration { diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 894fc89..e69de29 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1,9 +0,0 @@ -#spring.jpa.hibernate.ddl-auto=create - -#spring.datasource.dbadmin.url=jdbc:h2:file:./database -#spring.datasource.dbadmin.username=sa -#spring.datasource.dbadmin.password=password -#spring.h2.console.enabled=true - -#spring.jpa.show-sql=true - diff --git a/src/main/resources/static/css/dbadmin.css b/src/main/resources/static/snapadmin/css/snapadmin.css similarity index 100% rename from src/main/resources/static/css/dbadmin.css rename to src/main/resources/static/snapadmin/css/snapadmin.css diff --git a/src/main/resources/static/css/style.css b/src/main/resources/static/snapadmin/css/style.css similarity index 100% rename from src/main/resources/static/css/style.css rename to src/main/resources/static/snapadmin/css/style.css diff --git a/src/main/resources/static/js/autocomplete-multi.js b/src/main/resources/static/snapadmin/js/autocomplete-multi.js similarity index 100% rename from src/main/resources/static/js/autocomplete-multi.js rename to src/main/resources/static/snapadmin/js/autocomplete-multi.js diff --git a/src/main/resources/static/js/autocomplete.js b/src/main/resources/static/snapadmin/js/autocomplete.js similarity index 100% rename from src/main/resources/static/js/autocomplete.js rename to src/main/resources/static/snapadmin/js/autocomplete.js diff --git a/src/main/resources/static/js/console.js b/src/main/resources/static/snapadmin/js/console.js similarity index 100% rename from src/main/resources/static/js/console.js rename to src/main/resources/static/snapadmin/js/console.js diff --git a/src/main/resources/static/js/create.js b/src/main/resources/static/snapadmin/js/create.js similarity index 100% rename from src/main/resources/static/js/create.js rename to src/main/resources/static/snapadmin/js/create.js diff --git a/src/main/resources/static/js/filters.js b/src/main/resources/static/snapadmin/js/filters.js similarity index 100% rename from src/main/resources/static/js/filters.js rename to src/main/resources/static/snapadmin/js/filters.js diff --git a/src/main/resources/static/js/logs.js b/src/main/resources/static/snapadmin/js/logs.js similarity index 100% rename from src/main/resources/static/js/logs.js rename to src/main/resources/static/snapadmin/js/logs.js diff --git a/src/main/resources/static/js/table.js b/src/main/resources/static/snapadmin/js/table.js similarity index 100% rename from src/main/resources/static/js/table.js rename to src/main/resources/static/snapadmin/js/table.js diff --git a/src/main/resources/templates/console.html b/src/main/resources/templates/console.html index d0b6251..3e5b1d7 100644 --- a/src/main/resources/templates/console.html +++ b/src/main/resources/templates/console.html @@ -6,7 +6,7 @@