forked from github/dataease
fix: 集群设置
This commit is contained in:
parent
9a9a1a1c0f
commit
8c0d7ae0ad
@ -43,8 +43,8 @@ public class KettleController {
|
|||||||
|
|
||||||
@ApiIgnore
|
@ApiIgnore
|
||||||
@PostMapping("validate")
|
@PostMapping("validate")
|
||||||
public void validate(@RequestBody KettleDTO kettleDTO) throws Exception{
|
public ResultHolder validate(@RequestBody KettleDTO kettleDTO) throws Exception{
|
||||||
kettleService.validate(kettleDTO);
|
return kettleService.validate(kettleDTO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequiresPermissions("sysparam:read")
|
@RequiresPermissions("sysparam:read")
|
||||||
|
@ -60,12 +60,18 @@ public class KettleService {
|
|||||||
deEngineMapper.deleteByPrimaryKey(id);
|
deEngineMapper.deleteByPrimaryKey(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void validate(KettleDTO kettleDTO) throws Exception {
|
public ResultHolder validate(KettleDTO kettleDTO) throws Exception {
|
||||||
HttpClientConfig httpClientConfig = new HttpClientConfig();
|
HttpClientConfig httpClientConfig = new HttpClientConfig();
|
||||||
String authValue = "Basic " + Base64.getUrlEncoder().encodeToString((kettleDTO.getUser()
|
String authValue = "Basic " + Base64.getUrlEncoder().encodeToString((kettleDTO.getUser()
|
||||||
+ ":" + kettleDTO.getPasswd()).getBytes());
|
+ ":" + kettleDTO.getPasswd()).getBytes());
|
||||||
httpClientConfig.addHeader("Authorization", authValue);
|
httpClientConfig.addHeader("Authorization", authValue);
|
||||||
String response = HttpClientUtil.get("http://" + kettleDTO.getCarte() + ":" + kettleDTO.getPort() + "/kettle/status/", httpClientConfig);
|
try {
|
||||||
|
String response = HttpClientUtil.get("http://" + kettleDTO.getCarte() + ":" + kettleDTO.getPort() + "/kettle/status/", httpClientConfig);
|
||||||
|
|
||||||
|
return ResultHolder.error("Kettle is valid.");
|
||||||
|
}catch (Exception e){
|
||||||
|
return ResultHolder.error("Kettle is invalid: " + e.getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ResultHolder validate(String id) {
|
public ResultHolder validate(String id) {
|
||||||
@ -116,7 +122,7 @@ public class KettleService {
|
|||||||
remoteSlaveServer.setHostname(kettleDTO.getCarte());
|
remoteSlaveServer.setHostname(kettleDTO.getCarte());
|
||||||
remoteSlaveServer.setPort(kettleDTO.getPort());
|
remoteSlaveServer.setPort(kettleDTO.getPort());
|
||||||
remoteSlaveServer.setUsername(kettleDTO.getUser());
|
remoteSlaveServer.setUsername(kettleDTO.getUser());
|
||||||
remoteSlaveServer.setPort(kettleDTO.getPasswd());
|
remoteSlaveServer.setPassword(kettleDTO.getPasswd());
|
||||||
}
|
}
|
||||||
return remoteSlaveServer;
|
return remoteSlaveServer;
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ export function save(data) {
|
|||||||
|
|
||||||
export function deleteKettle(id) {
|
export function deleteKettle(id) {
|
||||||
return request({
|
return request({
|
||||||
url: '/delete/' + id,
|
url: '/kettle/delete/' + id,
|
||||||
method: 'delete',
|
method: 'delete',
|
||||||
loading: true
|
loading: true
|
||||||
})
|
})
|
||||||
|
@ -46,7 +46,7 @@
|
|||||||
</el-row>
|
</el-row>
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col>
|
<el-col>
|
||||||
<el-form-item :label="$t('datasource.http_port')" prop="configuration.port">
|
<el-form-item :label="$t('datasource.http_port')" prop="configuration.httpPort">
|
||||||
<el-input v-model="form.configuration.httpPort" autocomplete="off" type="number" min="0"/>
|
<el-input v-model="form.configuration.httpPort" autocomplete="off" type="number" min="0"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
@ -156,6 +156,13 @@ export default {
|
|||||||
trigger: ['change', 'blur']
|
trigger: ['change', 'blur']
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
'configuration.httpPort': [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: this.$t('datasource.please_input_port'),
|
||||||
|
trigger: ['change', 'blur']
|
||||||
|
}
|
||||||
|
],
|
||||||
'configuration.dataBase': [
|
'configuration.dataBase': [
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
@ -212,7 +219,7 @@ export default {
|
|||||||
this.show = false
|
this.show = false
|
||||||
},
|
},
|
||||||
save() {
|
save() {
|
||||||
if (this.form.configuration.dataSourceType === 'jdbc' && this.form.configuration.port <= 0) {
|
if (this.form.configuration.dataSourceType === 'jdbc' && (this.form.configuration.port <= 0 || this.form.configuration.httpPort <= 0)) {
|
||||||
this.$message.error(i18n.t('datasource.port_no_less_then_0'))
|
this.$message.error(i18n.t('datasource.port_no_less_then_0'))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -256,7 +263,7 @@ export default {
|
|||||||
this.$message.error(i18n.t('datasource.please_choose_schema'))
|
this.$message.error(i18n.t('datasource.please_choose_schema'))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (this.form.configuration.dataSourceType === 'jdbc' && this.form.configuration.port <= 0) {
|
if (this.form.configuration.dataSourceType === 'jdbc' && (this.form.configuration.port <= 0 || this.form.configuration.httpPort <= 0)) {
|
||||||
this.$message.error(i18n.t('datasource.port_no_less_then_0'))
|
this.$message.error(i18n.t('datasource.port_no_less_then_0'))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -118,7 +118,7 @@ export default {
|
|||||||
}],
|
}],
|
||||||
'configuration.passwd': [{
|
'configuration.passwd': [{
|
||||||
required: true,
|
required: true,
|
||||||
message: this.$t('dcommons.required'),
|
message: this.$t('commons.required'),
|
||||||
trigger: 'blur'
|
trigger: 'blur'
|
||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user