mirror of
https://github.com/alibaba/canal.git
synced 2026-11-04 00:30:15 +08:00
modify
This commit is contained in:
@@ -1,12 +1,10 @@
|
|||||||
package com.alibaba.otter.canal.admin.config;
|
package com.alibaba.otter.canal.admin.config;
|
||||||
|
|
||||||
|
import java.io.PrintWriter;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import com.alibaba.otter.canal.admin.controller.UserController;
|
|
||||||
import com.alibaba.otter.canal.admin.model.BaseModel;
|
|
||||||
import com.alibaba.otter.canal.admin.model.User;
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.http.HttpMethod;
|
import org.springframework.http.HttpMethod;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
@@ -14,7 +12,10 @@ import org.springframework.web.servlet.HandlerInterceptor;
|
|||||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||||
|
|
||||||
import java.io.PrintWriter;
|
import com.alibaba.otter.canal.admin.controller.UserController;
|
||||||
|
import com.alibaba.otter.canal.admin.model.BaseModel;
|
||||||
|
import com.alibaba.otter.canal.admin.model.User;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
public class WebConfig implements WebMvcConfigurer {
|
public class WebConfig implements WebMvcConfigurer {
|
||||||
@@ -75,42 +76,4 @@ public class WebConfig implements WebMvcConfigurer {
|
|||||||
}
|
}
|
||||||
}).addPathPatterns("/api/**").excludePathPatterns("/api/**/user/**");
|
}).addPathPatterns("/api/**").excludePathPatterns("/api/**/user/**");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 跨域支持
|
|
||||||
*
|
|
||||||
* @param registry
|
|
||||||
*/
|
|
||||||
// @Override
|
|
||||||
// public void addCorsMappings(CorsRegistry registry) {
|
|
||||||
// registry.addMapping("/api")
|
|
||||||
// .allowedOrigins("http://127.0.0.1")
|
|
||||||
// .allowCredentials(true)
|
|
||||||
// .allowedMethods("*")
|
|
||||||
// .allowedHeaders("Origin, X-Requested-With, Content-Type, Accept,
|
|
||||||
// Authorization")
|
|
||||||
// .maxAge(3600 * 24);
|
|
||||||
// }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 添加静态资源--过滤swagger-api (开源的在线API文档)
|
|
||||||
*
|
|
||||||
* @param registry
|
|
||||||
*/
|
|
||||||
// @Override
|
|
||||||
// public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
|
||||||
// // 过滤swagger
|
|
||||||
// registry.addResourceHandler("swagger-ui.html").addResourceLocations("classpath:/META-INF/resources/");
|
|
||||||
//
|
|
||||||
// registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");
|
|
||||||
//
|
|
||||||
// registry.addResourceHandler("/swagger-resources/**")
|
|
||||||
// .addResourceLocations("classpath:/META-INF/resources/swagger-resources/");
|
|
||||||
//
|
|
||||||
// registry.addResourceHandler("/swagger/**").addResourceLocations("classpath:/META-INF/resources/swagger*");
|
|
||||||
//
|
|
||||||
// registry.addResourceHandler("/v2/api-docs/**")
|
|
||||||
// .addResourceLocations("classpath:/META-INF/resources/v2/api-docs/");
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,12 +14,12 @@ public class CanalConfigController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
CanalConfigService canalConfigService;
|
CanalConfigService canalConfigService;
|
||||||
|
|
||||||
@RequestMapping(value = "/config", method = RequestMethod.GET)
|
@GetMapping(value = "/config")
|
||||||
public BaseModel<CanalConfig> canalConfig(@PathVariable String env) {
|
public BaseModel<CanalConfig> canalConfig(@PathVariable String env) {
|
||||||
return BaseModel.getInstance(canalConfigService.getCanalConfig());
|
return BaseModel.getInstance(canalConfigService.getCanalConfig());
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = "/config", method = RequestMethod.PUT)
|
@PutMapping(value = "/config")
|
||||||
public BaseModel<String> updateConfig(@RequestBody CanalConfig canalConfig, @PathVariable String env) {
|
public BaseModel<String> updateConfig(@RequestBody CanalConfig canalConfig, @PathVariable String env) {
|
||||||
canalConfigService.updateContent(canalConfig);
|
canalConfigService.updateContent(canalConfig);
|
||||||
return BaseModel.getInstance("success");
|
return BaseModel.getInstance("success");
|
||||||
|
|||||||
@@ -24,8 +24,8 @@ export default {
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
title: 'Vue Admin Template',
|
title: '',
|
||||||
logo: 'https://wpimg.wallstcn.com/69a1c46c-eb1c-4b46-8bd4-e9e686ef5251.png'
|
logo: './logo.png'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -55,8 +55,8 @@ export default {
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
||||||
& .sidebar-logo {
|
& .sidebar-logo {
|
||||||
width: 32px;
|
width: 55px;
|
||||||
height: 32px;
|
// height: 32px;
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
margin-right: 12px;
|
margin-right: 12px;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,8 +44,8 @@
|
|||||||
<el-button :loading="loading" type="primary" style="width:100%;margin-bottom:30px;" @click.native.prevent="handleLogin">Login</el-button>
|
<el-button :loading="loading" type="primary" style="width:100%;margin-bottom:30px;" @click.native.prevent="handleLogin">Login</el-button>
|
||||||
|
|
||||||
<div class="tips">
|
<div class="tips">
|
||||||
<span style="margin-right:20px;">username: admin</span>
|
<!-- <span style="margin-right:20px;">username: admin</span>
|
||||||
<span> password: any</span>
|
<span> password: any</span> -->
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</el-form>
|
</el-form>
|
||||||
@@ -74,8 +74,8 @@ export default {
|
|||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
loginForm: {
|
loginForm: {
|
||||||
username: 'admin',
|
username: '',
|
||||||
password: '111111'
|
password: ''
|
||||||
},
|
},
|
||||||
loginRules: {
|
loginRules: {
|
||||||
username: [{ required: true, trigger: 'blur', validator: validateUsername }],
|
username: [{ required: true, trigger: 'blur', validator: validateUsername }],
|
||||||
|
|||||||
Reference in New Issue
Block a user