mirror of
https://github.com/dalbodeule/snap-admin.git
synced 2025-12-16 05:12:00 +09:00
Renamed dbadmin references to snapadmin (#29)
This commit is contained in:
@@ -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");
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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"
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user