Skip to content

Commit

Permalink
fix owner user validate
Browse files Browse the repository at this point in the history
  • Loading branch information
ponfee committed Mar 30, 2024
1 parent 4a623e9 commit 35b9f35
Show file tree
Hide file tree
Showing 14 changed files with 63 additions and 76 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,13 @@ $(document).ready(function(){
return false;
}
});
jQuery.validator.addMethod(
"regex",
function(value, element, regexp) {
return this.optional(element) || new RegExp(regexp).test(value);
},
"格式错误"
);
// 校验基础信息表单
$("#basicInfoForm").validate({
errorElement:'span',
Expand Down
34 changes: 5 additions & 29 deletions disjob-admin/ruoyi-disjob/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,49 +58,25 @@
<dependency>
<groupId>cn.ponfee</groupId>
<artifactId>disjob-registry-redis</artifactId>
</dependency>
<!--
<dependency>
<groupId>cn.ponfee</groupId>
<!--
<artifactId>disjob-registry-database</artifactId>
<artifactId>disjob-registry-redis</artifactId>
</dependency>
<dependency>
<groupId>cn.ponfee</groupId>
<artifactId>disjob-registry-consul</artifactId>
</dependency>
<dependency>
<groupId>cn.ponfee</groupId>
<artifactId>disjob-registry-nacos</artifactId>
</dependency>
<dependency>
<groupId>cn.ponfee</groupId>
<artifactId>disjob-registry-zookeeper</artifactId>
</dependency>
<dependency>
<groupId>cn.ponfee</groupId>
<artifactId>disjob-registry-etcd</artifactId>
-->
</dependency>
<dependency>
<groupId>cn.ponfee</groupId>
<artifactId>disjob-registry-database</artifactId>
</dependency>
-->

<!-- Dispatching: select one implementation for task dispatching -->
<dependency>
<groupId>cn.ponfee</groupId>
<artifactId>disjob-dispatch-http</artifactId>
</dependency>
<!--
<dependency>
<groupId>cn.ponfee</groupId>
<!--
<artifactId>disjob-dispatch-redis</artifactId>
</dependency>
<dependency>
<groupId>cn.ponfee</groupId>
<artifactId>disjob-dispatch-http</artifactId>
-->
</dependency>
-->
</dependencies>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -207,10 +207,16 @@

function updateOwnUser(field, row, rowIndex, oldValue) {
if (field !== "ownUser") {
row[field] = oldValue;
$.modal.msgError("只能更新['ownUser']字段");
return;
}
const newValue = row[field].trim();
if (newValue.includes(",")) {
row[field] = oldValue;
$.modal.msgError("cannot contains char ','");
return;
}
if (oldValue === newValue) {
// reset to oldValue(none left or right blank)
row[field] = oldValue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,20 @@
const prefix = ctx + "disjob/mygroup";

$("#form-mygroup-edit").validate({
focusCleanup: true
focusCleanup: true,
onkeyup: false,
rules: {
ownUser: {
required: true,
regex: /^(?!.*,).*/ // /^[^,]*$/
}
},
messages: {
ownUser: {
required: "Own user cannot empty",
regex: "Own user cannot contains char ','"
}
}
});

function submitHandler() {
Expand All @@ -84,6 +97,7 @@

if (![(${isOwnUser})]) {
$("input[name='ownUser']").attr("readonly", "true")
$("input[name='workerContextPath']").attr("readonly", "true")
}
});
</script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@

function modifyOneWorkerMaximumPoolSize(field, row, rowIndex, oldValue) {
if (field !== "maximumPoolSize") {
row[field] = oldValue;
$.modal.msgError("只能更新['maximumPoolSize']字段");
return;
}
Expand Down
12 changes: 7 additions & 5 deletions disjob-samples/disjob-samples-frameless-worker/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,18 @@
<artifactId>vertx-web</artifactId>
<version>4.5.5</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-resolver-dns-native-macos</artifactId>
<classifier>osx-aarch_64</classifier>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<scope>provided</scope>
</dependency>

<!-- 解决启动中的WARN日志:DnsServerAddressStreamProviders >>>> Can not find io.netty.resolver.dns.macos.MacOSDnsServerAddressStreamProvider in the classpath, fallback to system defaults. This may result in incorrect DNS resolutions on MacOS. Check whether you have a dependency on 'io.netty:netty-resolver-dns-native-macos' -->
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-resolver-dns-native-macos</artifactId>
<classifier>osx-aarch_64</classifier>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ public final void deploy() {
// here super.vertx is null

vertx0.deployVerticle(this);
assert super.vertx == vertx0;
if (super.vertx != vertx0) {
throw new Error("Not a same vertx object: " + vertx + " != " + vertx0);
}
}

public final void close() {
Expand Down
4 changes: 2 additions & 2 deletions disjob-samples/disjob-samples-springboot-merged/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@
<artifactId>disjob-worker</artifactId>
</dependency>

<dependency>
<!--<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-starter-server</artifactId>
<version>${spring-boot-admin.version}</version>
</dependency>
</dependency>-->
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import cn.ponfee.disjob.samples.common.AbstractSamplesApplication;
import cn.ponfee.disjob.supervisor.configuration.EnableSupervisor;
import cn.ponfee.disjob.worker.configuration.EnableWorker;
import de.codecentric.boot.admin.server.config.EnableAdminServer;
//import de.codecentric.boot.admin.server.config.EnableAdminServer;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
Expand All @@ -40,7 +40,7 @@
*/
@EnableSupervisor
@EnableWorker
@EnableAdminServer
//@EnableAdminServer
public class MergedApplication extends AbstractSamplesApplication {

static {
Expand Down
4 changes: 2 additions & 2 deletions disjob-samples/disjob-samples-springboot-worker/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@
<artifactId>disjob-worker</artifactId>
</dependency>

<dependency>
<!--<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-starter-client</artifactId>
<version>${spring-boot-admin.version}</version>
</dependency>
</dependency>-->
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
server.port: 8083
spring.profiles.include: web,worker,redis

spring.boot.admin.client:
url: http://localhost:8081
instance:
service-host-type: IP
#spring.boot.admin.client:
# url: http://localhost:8081
# instance:
# service-host-type: IP
36 changes: 6 additions & 30 deletions disjob-samples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<maven.compiler.compilerVersion>${java.version}</maven.compiler.compilerVersion>

<spring-boot.version>2.7.18</spring-boot.version>
<spring-boot-admin.version>2.7.15</spring-boot-admin.version>
<!--<spring-boot-admin.version>2.7.15</spring-boot-admin.version>-->

<maven-compiler-plugin.version>3.10.1</maven-compiler-plugin.version>
<flatten-maven-plugin.version>1.6.0</flatten-maven-plugin.version>
Expand Down Expand Up @@ -71,49 +71,25 @@
<dependency>
<groupId>cn.ponfee</groupId>
<artifactId>disjob-registry-redis</artifactId>
</dependency>
<!--
<dependency>
<groupId>cn.ponfee</groupId>
<!--
<artifactId>disjob-registry-database</artifactId>
<artifactId>disjob-registry-redis</artifactId>
</dependency>
<dependency>
<groupId>cn.ponfee</groupId>
<artifactId>disjob-registry-consul</artifactId>
</dependency>
<dependency>
<groupId>cn.ponfee</groupId>
<artifactId>disjob-registry-nacos</artifactId>
</dependency>
<dependency>
<groupId>cn.ponfee</groupId>
<artifactId>disjob-registry-zookeeper</artifactId>
</dependency>
<dependency>
<groupId>cn.ponfee</groupId>
<artifactId>disjob-registry-etcd</artifactId>
-->
</dependency>
<dependency>
<groupId>cn.ponfee</groupId>
<artifactId>disjob-registry-database</artifactId>
</dependency>
-->

<!-- Dispatching: select one implementation for task dispatching -->
<dependency>
<groupId>cn.ponfee</groupId>
<artifactId>disjob-dispatch-http</artifactId>
</dependency>
<!--
<dependency>
<groupId>cn.ponfee</groupId>
<!--
<artifactId>disjob-dispatch-redis</artifactId>
</dependency>
<dependency>
<groupId>cn.ponfee</groupId>
<artifactId>disjob-dispatch-http</artifactId>
-->
</dependency>
-->
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package cn.ponfee.disjob.supervisor.application.request;

import cn.ponfee.disjob.common.base.Symbol.Str;
import cn.ponfee.disjob.common.base.ToJsonString;
import cn.ponfee.disjob.core.model.SchedGroup;
import cn.ponfee.disjob.supervisor.application.converter.SchedGroupConverter;
Expand Down Expand Up @@ -46,6 +47,7 @@ public SchedGroup toSchedGroup() {
public void checkAndTrim() {
Assert.hasText(group, "Group cannot be blank.");
Assert.hasText(ownUser, "Own user cannot be blank.");
Assert.isTrue(!ownUser.contains(Str.COMMA), "Own user cannot contains ','");
Assert.hasText(createdBy, "Created by cannot be blank.");

group = group.trim();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public SchedGroup toSchedGroup() {

public void checkAndTrim() {
Assert.hasText(ownUser, "Own user cannot be blank.");
Assert.isTrue(!ownUser.contains(Str.COMMA), "Own user cannot contains ','");
Assert.hasText(updatedBy, "Updated by cannot be blank.");
this.ownUser = StringUtils.trim(ownUser);
this.devUsers = prune(devUsers);
Expand Down

0 comments on commit 35b9f35

Please sign in to comment.