Explorar o código

# 新版本 V1.3.x,新特性
1、遗弃“本地任务”开发模式,推荐使用“远程任务”,易于系统解耦;
2、遗弃“servlet”方式底层系统通讯,推荐使用JETTY方式,重构通讯逻辑;
3、【重要】“远程任务”细分为:BEAN、GLUE两种开发模式,其中GLUE方式“远程任务”的逻辑代码托管至云端,动态编译生效,详情请前往博客查看;
4、UI交互优化:左侧菜单展开状态优化,菜单项选中状态优化,任务列表打开表格有压缩优化;

xueli.xue %!s(int64=8) %!d(string=hai) anos
pai
achega
e6c239eca0

+ 2 - 1
README.md

@@ -43,7 +43,8 @@ git.osc地址:http://git.oschina.net/xuxueli0323/xxl-job
 # 新版本 V1.3.x,新特性
 	1、遗弃“本地任务”开发模式,推荐使用“远程任务”,易于系统解耦;
 	2、遗弃“servlet”方式底层系统通讯,推荐使用JETTY方式,重构通讯逻辑;
-	3、【重要】“远程任务”细分为:BEAN、GLUE两种开发模式,其中GLUE方式“远程任务”的逻辑代码托管至云端,详情请前往博客查看;
+	3、【重要】“远程任务”细分为:BEAN、GLUE两种开发模式,其中GLUE方式“远程任务”的逻辑代码托管至云端,动态编译生效,详情请前往博客查看;
+	4、UI交互优化:左侧菜单展开状态优化,菜单项选中状态优化,任务列表打开表格有压缩优化;
 		
 	
 # 其他说明

+ 1 - 1
pom.xml

@@ -3,7 +3,7 @@
 	<modelVersion>4.0.0</modelVersion>
 	<groupId>com.xxl</groupId>
 	<artifactId>xxl-job</artifactId>
-	<version>1.2.0-SNAPSHOT</version>
+	<version>1.3.0-SNAPSHOT</version>
 	<packaging>pom</packaging>
 	<modules>
 		<module>xxl-job-admin</module>

+ 3 - 3
xxl-job-admin/pom.xml

@@ -4,10 +4,10 @@
 	<parent>
 		<groupId>com.xxl</groupId>
 		<artifactId>xxl-job</artifactId>
-		<version>1.2.0-SNAPSHOT</version>
+		<version>1.3.0-SNAPSHOT</version>
 	</parent>
 	<artifactId>xxl-job-admin</artifactId>
-	<version>1.2.1-SNAPSHOT</version>
+	<version>1.3.1-SNAPSHOT</version>
 	<packaging>war</packaging>
 
 	<properties>
@@ -148,7 +148,7 @@
 		<dependency>
 			<groupId>com.xxl</groupId>
 			<artifactId>xxl-job-client</artifactId>
-			<version>1.2.1-SNAPSHOT</version>
+			<version>1.3.1</version>
 		</dependency>
 
 	</dependencies>

+ 1 - 1
xxl-job-admin/src/main/java/com/xxl/job/controller/IndexController.java

@@ -69,7 +69,7 @@ public class IndexController {
 	}
 	
 	@RequestMapping("/help")
-	public String help(Model model) {
+	public String help() {
 		return "help";
 	}
 	

+ 34 - 0
xxl-job-admin/src/main/java/com/xxl/job/controller/interceptor/CookieInterceptor.java

@@ -0,0 +1,34 @@
+package com.xxl.job.controller.interceptor;
+
+import java.util.HashMap;
+
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.lang.ArrayUtils;
+import org.springframework.web.servlet.ModelAndView;
+import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
+
+/**
+ * push cookies to model as cookieMap
+ * @author xuxueli 2015-12-12 18:09:04
+ */
+public class CookieInterceptor extends HandlerInterceptorAdapter {
+
+	@Override
+	public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler,
+			ModelAndView modelAndView) throws Exception {
+		
+		if (modelAndView!=null && ArrayUtils.isNotEmpty(request.getCookies())) {
+			HashMap<String, Cookie> cookieMap = new HashMap<String, Cookie>();
+			for (Cookie ck : request.getCookies()) {
+				cookieMap.put(ck.getName(), ck);
+			}
+			modelAndView.addObject("cookieMap", cookieMap);
+		}
+		
+		super.postHandle(request, response, handler, modelAndView);
+	}
+	
+}

+ 4 - 0
xxl-job-admin/src/main/resources/springmvc-context.xml

@@ -43,6 +43,10 @@
 			<mvc:mapping path="/**"/>
 			<bean class="com.xxl.job.controller.interceptor.PermissionInterceptor"/>
 		</mvc:interceptor>
+		<mvc:interceptor>
+			<mvc:mapping path="/**"/>
+			<bean class="com.xxl.job.controller.interceptor.CookieInterceptor"/>
+		</mvc:interceptor>
 	</mvc:interceptors>
 	<bean id="exceptionResolver" class="com.xxl.job.controller.resolver.WebExceptionResolver" />
 	

+ 1 - 1
xxl-job-admin/src/main/webapp/WEB-INF/template/help.ftl

@@ -5,7 +5,7 @@
   	<#import "/common/common.macro.ftl" as netCommon>
 	<@netCommon.commonStyle />
 </head>
-<body class="hold-transition skin-blue sidebar-mini">
+<body class="hold-transition skin-blue sidebar-mini <#if cookieMap?exists && "off" == cookieMap["adminlte_settings"].value >sidebar-collapse</#if> ">
 <div class="wrapper">
 	<!-- header -->
 	<@netCommon.commonHeader />

+ 2 - 3
xxl-job-admin/src/main/webapp/WEB-INF/template/jobcode/index.ftl

@@ -10,8 +10,7 @@
 		.CodeMirror {
       		border: 0px solid black;
       		font-size:16px;
-      		height: 95%;
-      		row:200;
+      		height: 100%;
 		}
     </style>
 </head>
@@ -71,7 +70,7 @@
 	<@netCommon.commonFooter />
 </div>
 
-<textarea id="demoCode" >
+<textarea id="demoCode" style="display:none;" >
 package com.xxl.job.service.handler;
 
 import org.slf4j.Logger;

+ 1 - 1
xxl-job-admin/src/main/webapp/WEB-INF/template/jobinfo/index.ftl

@@ -8,7 +8,7 @@
   	<link rel="stylesheet" href="${request.contextPath}/static/adminlte/plugins/datatables/dataTables.bootstrap.css">
   
 </head>
-<body class="hold-transition skin-blue sidebar-mini">
+<body class="hold-transition skin-blue sidebar-mini <#if cookieMap?exists && "off" == cookieMap["adminlte_settings"].value >sidebar-collapse</#if>">
 <div class="wrapper">
 	<!-- header -->
 	<@netCommon.commonHeader />

+ 1 - 1
xxl-job-admin/src/main/webapp/WEB-INF/template/joblog/index.ftl

@@ -9,7 +9,7 @@
   	<!-- daterangepicker -->
   	<link rel="stylesheet" href="${request.contextPath}/static/adminlte/plugins/daterangepicker/daterangepicker-bs3.css">
 </head>
-<body class="hold-transition skin-blue sidebar-mini">
+<body class="hold-transition skin-blue sidebar-mini <#if cookieMap?exists && "off" == cookieMap["adminlte_settings"].value >sidebar-collapse</#if> ">
 <div class="wrapper">
 	<!-- header -->
 	<@netCommon.commonHeader />

+ 7 - 3
xxl-job-admin/src/main/webapp/static/js/common.1.js

@@ -1,6 +1,6 @@
 $(function(){
 	
-	// 导航栏,选中样式处理
+	// 导航栏,选中样式处理,js遍历匹配url(遗弃)
 	$(".nav-click").removeClass("active");
 	$(".nav-click").each(function(){
 		if( window.location.href.indexOf( $(this).find("a").attr("href") ) > -1){
@@ -30,9 +30,9 @@ $(function(){
 		});
 	});
 	
-	// adminlte_settings
+	// 左侧菜单状态,js + 后端 + cookie方式(新)
 	$('.sidebar-toggle').click(function(){
-		var adminlte_settings = $.cookie('adminlte_settings');
+		var adminlte_settings = $.cookie('adminlte_settings');	// 左侧菜单展开状态[adminlte_settings]:on=展开,off=折叠
 		if ('off' == adminlte_settings) {
 			adminlte_settings = 'on';
 		} else {
@@ -40,8 +40,12 @@ $(function(){
 		}
 		$.cookie('adminlte_settings', adminlte_settings, { expires: 7 });	//$.cookie('the_cookie', '', { expires: -1 });
 	});
+	// 左侧菜单状态,js + cookie方式(遗弃)
+	/*
 	var adminlte_settings = $.cookie('adminlte_settings');
 	if (adminlte_settings == 'off') {
 		$('body').addClass('sidebar-collapse');
 	}
+	*/
+	
 });

+ 6 - 3
xxl-job-admin/src/main/webapp/static/js/jobcode.index.1.js

@@ -8,17 +8,20 @@ $(function() {
 	});
 	codeEditor.setValue( $("#demoCode").val() );
 	
+	var height = Math.max(document.documentElement.clientHeight, document.body.offsetHeight);
+	$(".CodeMirror").attr('style', 'height:'+ height +'px');
+	
 	
 	$("#save").click(function() {
 		var codeSource = codeEditor.getValue();
 		var codeRemark = $("#codeRemark").val();
 		
 		if (!codeRemark) {
-			ComAlert.show(1, "请输入备注");
+			ComAlert.show(2, "请输入备注");
 			return;
 		}
 		if (codeRemark.length < 6|| codeRemark.length > 100) {
-			ComAlert.show(1, "备注长度应该在6至100之间");
+			ComAlert.show(2, "备注长度应该在6至100之间");
 			return;
 		}
 		
@@ -34,7 +37,7 @@ $(function() {
 				dataType : "json",
 				success : function(data){
 					if (data.code == 200) {
-						ComAlert.show(1, '提交成功', function(){
+						ComAlert.show(1, '保存成功', function(){
 							//$(window).unbind('beforeunload');
 							window.location.reload();
 						});

+ 3 - 3
xxl-job-client-demo/pom.xml

@@ -4,10 +4,10 @@
 	<parent>
 		<groupId>com.xxl</groupId>
 		<artifactId>xxl-job</artifactId>
-		<version>1.2.0-SNAPSHOT</version>
+		<version>1.3.0-SNAPSHOT</version>
 	</parent>
 	<artifactId>xxl-job-client-demo</artifactId>
-	<version>1.2.1-SNAPSHOT</version>
+	<version>1.3.1-SNAPSHOT</version>
 	<packaging>war</packaging>
 
 	<properties>
@@ -55,7 +55,7 @@
 		<dependency>
 			<groupId>com.xxl</groupId>
 			<artifactId>xxl-job-client</artifactId>
-			<version>1.2.1-SNAPSHOT</version>
+			<version>1.3.1</version>
 		</dependency>
 		
 	</dependencies>

+ 2 - 2
xxl-job-client/pom.xml

@@ -4,10 +4,10 @@
 	<parent>
 		<groupId>com.xxl</groupId>
 		<artifactId>xxl-job</artifactId>
-		<version>1.2.0-SNAPSHOT</version>
+		<version>1.3.0-SNAPSHOT</version>
 	</parent>
 	<artifactId>xxl-job-client</artifactId>
-	<version>1.2.1-SNAPSHOT</version>
+	<version>1.3.1</version>
 
 	<dependencies>