fix: 集群设置

This commit is contained in:
taojinlong 2022-04-05 17:54:47 +08:00
parent 9a9a1a1c0f
commit 8c0d7ae0ad
5 changed files with 23 additions and 10 deletions

View File

@ -43,8 +43,8 @@ public class KettleController {
@ApiIgnore
@PostMapping("validate")
public void validate(@RequestBody KettleDTO kettleDTO) throws Exception{
kettleService.validate(kettleDTO);
public ResultHolder validate(@RequestBody KettleDTO kettleDTO) throws Exception{
return kettleService.validate(kettleDTO);
}
@RequiresPermissions("sysparam:read")

View File

@ -60,12 +60,18 @@ public class KettleService {
deEngineMapper.deleteByPrimaryKey(id);
}
public void validate(KettleDTO kettleDTO) throws Exception {
public ResultHolder validate(KettleDTO kettleDTO) throws Exception {
HttpClientConfig httpClientConfig = new HttpClientConfig();
String authValue = "Basic " + Base64.getUrlEncoder().encodeToString((kettleDTO.getUser()
+ ":" + kettleDTO.getPasswd()).getBytes());
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) {
@ -116,7 +122,7 @@ public class KettleService {
remoteSlaveServer.setHostname(kettleDTO.getCarte());
remoteSlaveServer.setPort(kettleDTO.getPort());
remoteSlaveServer.setUsername(kettleDTO.getUser());
remoteSlaveServer.setPort(kettleDTO.getPasswd());
remoteSlaveServer.setPassword(kettleDTO.getPasswd());
}
return remoteSlaveServer;
}

View File

@ -31,7 +31,7 @@ export function save(data) {
export function deleteKettle(id) {
return request({
url: '/delete/' + id,
url: '/kettle/delete/' + id,
method: 'delete',
loading: true
})

View File

@ -46,7 +46,7 @@
</el-row>
<el-row>
<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-form-item>
</el-col>
@ -156,6 +156,13 @@ export default {
trigger: ['change', 'blur']
}
],
'configuration.httpPort': [
{
required: true,
message: this.$t('datasource.please_input_port'),
trigger: ['change', 'blur']
}
],
'configuration.dataBase': [
{
required: true,
@ -212,7 +219,7 @@ export default {
this.show = false
},
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'))
return
}
@ -256,7 +263,7 @@ export default {
this.$message.error(i18n.t('datasource.please_choose_schema'))
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'))
return
}

View File

@ -118,7 +118,7 @@ export default {
}],
'configuration.passwd': [{
required: true,
message: this.$t('dcommons.required'),
message: this.$t('commons.required'),
trigger: 'blur'
}]
}