Renamed dbadmin references to snapadmin (#29)

This commit is contained in:
Francesco
2023-11-03 20:00:12 +01:00
parent e57bd8a220
commit e51f37595e
36 changed files with 137 additions and 146 deletions

View File

@@ -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");

View File

@@ -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.

View File

@@ -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);

View File

@@ -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"
);
}

View File

@@ -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;

View File

@@ -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<String, String[]> 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;
}

View File

@@ -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;

View File

@@ -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 {