mirror of
https://gitee.com/huoyo/ko-time.git
synced 2025-12-06 16:58:26 +08:00
add dynamic properties
This commit is contained in:
parent
1d81178589
commit
ed2c9977b4
2
pom.xml
2
pom.xml
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<groupId>cn.langpy</groupId>
|
<groupId>cn.langpy</groupId>
|
||||||
<artifactId>ko-time</artifactId>
|
<artifactId>ko-time</artifactId>
|
||||||
<version>2.4.0</version>
|
<version>2.4.1</version>
|
||||||
<name>KoTime</name>
|
<name>KoTime</name>
|
||||||
<description>A springboot tool for tracking the paths of the methods,which can help you find method's performances easily.</description>
|
<description>A springboot tool for tracking the paths of the methods,which can help you find method's performances easily.</description>
|
||||||
<licenses>
|
<licenses>
|
||||||
|
|||||||
@ -45,6 +45,15 @@ public class DefaultConfig {
|
|||||||
private String mailReceivers;
|
private String mailReceivers;
|
||||||
private Integer mailThreshold;
|
private Integer mailThreshold;
|
||||||
private String mailScope;
|
private String mailScope;
|
||||||
|
private String propertyFile;
|
||||||
|
|
||||||
|
public String getPropertyFile() {
|
||||||
|
return propertyFile;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPropertyFile(String propertyFile) {
|
||||||
|
this.propertyFile = propertyFile;
|
||||||
|
}
|
||||||
|
|
||||||
public Boolean getMailEnable() {
|
public Boolean getMailEnable() {
|
||||||
return mailEnable;
|
return mailEnable;
|
||||||
|
|||||||
@ -3,7 +3,6 @@ package cn.langpy.kotime.config;
|
|||||||
import cn.langpy.kotime.annotation.KoListener;
|
import cn.langpy.kotime.annotation.KoListener;
|
||||||
import cn.langpy.kotime.handler.RunTimeHandler;
|
import cn.langpy.kotime.handler.RunTimeHandler;
|
||||||
import cn.langpy.kotime.handler.InvokedHandler;
|
import cn.langpy.kotime.handler.InvokedHandler;
|
||||||
import cn.langpy.kotime.service.EmailSendService;
|
|
||||||
import cn.langpy.kotime.service.GraphService;
|
import cn.langpy.kotime.service.GraphService;
|
||||||
import cn.langpy.kotime.service.InvokedQueue;
|
import cn.langpy.kotime.service.InvokedQueue;
|
||||||
import cn.langpy.kotime.util.Common;
|
import cn.langpy.kotime.util.Common;
|
||||||
@ -17,7 +16,7 @@ import org.springframework.context.ApplicationContext;
|
|||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.ComponentScan;
|
import org.springframework.context.annotation.ComponentScan;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.context.annotation.Lazy;
|
import org.springframework.core.io.ClassPathResource;
|
||||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
@ -25,6 +24,7 @@ import org.springframework.util.StringUtils;
|
|||||||
import javax.annotation.PostConstruct;
|
import javax.annotation.PostConstruct;
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.sql.DataSource;
|
import javax.sql.DataSource;
|
||||||
|
import java.io.*;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@ -68,6 +68,38 @@ public class LoadConfig {
|
|||||||
|
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
public void initConfig() {
|
public void initConfig() {
|
||||||
|
DefaultConfig config = improveConfig();
|
||||||
|
|
||||||
|
configDataSource(config);
|
||||||
|
configRedisTemplate(config);
|
||||||
|
Context.setConfig(config);
|
||||||
|
String[] names = applicationContext.getBeanNamesForType(GraphService.class);
|
||||||
|
for (String name : names) {
|
||||||
|
GraphService bean = (GraphService) applicationContext.getBean(name);
|
||||||
|
if (null != bean) {
|
||||||
|
Component annotation = bean.getClass().getAnnotation(Component.class);
|
||||||
|
if (config.getSaver().equals(annotation.value())) {
|
||||||
|
Context.setSaver(bean);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (null == Context.getSaver()) {
|
||||||
|
throw new DataBaseException("error `ko-time.saver=" + config.getSaver() + "`, and you can only choose an option in {memory,database,redis} for `ko-time.saver=`!");
|
||||||
|
}
|
||||||
|
log.info("kotime=>loading config");
|
||||||
|
|
||||||
|
if (StringUtils.hasText(config.getContextPath())) {
|
||||||
|
log.info("kotime=>view:" + Context.getConfig().getContextPath() + "/koTime");
|
||||||
|
} else {
|
||||||
|
log.info("kotime=>view:http://localhost:" + serverPort + serverContext + "/koTime");
|
||||||
|
}
|
||||||
|
initMethodHandlers();
|
||||||
|
|
||||||
|
loadPropertyFile();
|
||||||
|
}
|
||||||
|
|
||||||
|
public DefaultConfig improveConfig() {
|
||||||
DefaultConfig config = new DefaultConfig();
|
DefaultConfig config = new DefaultConfig();
|
||||||
config.setLogEnable(defaultConfig.getLogEnable() == null ? logEnable : defaultConfig.getLogEnable());
|
config.setLogEnable(defaultConfig.getLogEnable() == null ? logEnable : defaultConfig.getLogEnable());
|
||||||
config.setLogLanguage(defaultConfig.getLogLanguage() == null ? logLanguage : defaultConfig.getLogLanguage());
|
config.setLogLanguage(defaultConfig.getLogLanguage() == null ? logLanguage : defaultConfig.getLogLanguage());
|
||||||
@ -97,34 +129,37 @@ public class LoadConfig {
|
|||||||
config.setMailUser(defaultConfig.getMailUser());
|
config.setMailUser(defaultConfig.getMailUser());
|
||||||
config.setMailCode(defaultConfig.getMailCode());
|
config.setMailCode(defaultConfig.getMailCode());
|
||||||
config.setMailReceivers(defaultConfig.getMailReceivers());
|
config.setMailReceivers(defaultConfig.getMailReceivers());
|
||||||
|
config.setPropertyFile(defaultConfig.getPropertyFile() == null ? "dynamic.properties" : defaultConfig.getPropertyFile());
|
||||||
configDataSource(config);
|
return config;
|
||||||
configRedisTemplate(config);
|
|
||||||
Context.setConfig(config);
|
|
||||||
String[] names = applicationContext.getBeanNamesForType(GraphService.class);
|
|
||||||
for (String name : names) {
|
|
||||||
GraphService bean = (GraphService) applicationContext.getBean(name);
|
|
||||||
if (null != bean) {
|
|
||||||
Component annotation = bean.getClass().getAnnotation(Component.class);
|
|
||||||
if (config.getSaver().equals(annotation.value())) {
|
|
||||||
Context.setSaver(bean);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (null == Context.getSaver()) {
|
|
||||||
throw new DataBaseException("error `ko-time.saver=" + config.getSaver() + "`, and you can only choose an option in {memory,database,redis} for `ko-time.saver=`!");
|
|
||||||
}
|
|
||||||
log.info("kotime=>loading config");
|
|
||||||
|
|
||||||
if (StringUtils.hasText(config.getContextPath())) {
|
|
||||||
log.info("kotime=>view:" + Context.getConfig().getContextPath() + "/koTime");
|
|
||||||
} else {
|
|
||||||
log.info("kotime=>view:http://localhost:" + serverPort + serverContext + "/koTime");
|
|
||||||
}
|
|
||||||
initMethodHandlers();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void loadPropertyFile() {
|
||||||
|
ClassPathResource classPathResource = new ClassPathResource(Context.getConfig().getPropertyFile());
|
||||||
|
try (
|
||||||
|
InputStream inputStream = classPathResource.getInputStream();
|
||||||
|
InputStreamReader streamReader = new InputStreamReader(inputStream, "utf-8");
|
||||||
|
BufferedReader reader = new BufferedReader(streamReader)) {
|
||||||
|
String line = "";
|
||||||
|
Map<String, String> dynamicProperties = Context.getDynamicProperties();
|
||||||
|
while ((line = reader.readLine()) != null) {
|
||||||
|
line = line.trim();
|
||||||
|
int i = line.indexOf("=");
|
||||||
|
if (i<1) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
String propertyStr = line.substring(0, i).trim();
|
||||||
|
String valueStr = line.substring(i+1).trim();
|
||||||
|
dynamicProperties.put(propertyStr,valueStr);
|
||||||
|
}
|
||||||
|
} catch (UnsupportedEncodingException e) {
|
||||||
|
log.severe("kotime=>dynamic.properties requires utf-8");
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (FileNotFoundException e){
|
||||||
|
log.warning("kotime=>No dynamic.properties found so that you can not use dynamic properties to set.");
|
||||||
|
}catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public void configDataSource(DefaultConfig config) {
|
public void configDataSource(DefaultConfig config) {
|
||||||
|
|||||||
@ -385,4 +385,47 @@ public class KoTimeController {
|
|||||||
map.put("threads", threads);
|
map.put("threads", threads);
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/updateDynamicProperties")
|
||||||
|
@ResponseBody
|
||||||
|
@Auth
|
||||||
|
public boolean updateDynamicProperties(@RequestBody TextParam textParam) {
|
||||||
|
if (!StringUtils.hasText(textParam.getText())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
String[] textSplit = textParam.getText().trim().split("\n");
|
||||||
|
Map<String, String> dynamicProperties = Context.getDynamicProperties();
|
||||||
|
for (String line : textSplit) {
|
||||||
|
line = line.trim();
|
||||||
|
int i = line.indexOf("=");
|
||||||
|
if (i<1) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
String propertyStr = line.substring(0, i).trim();
|
||||||
|
String valueStr = line.substring(i+1).trim();
|
||||||
|
log.info("updated property: "+propertyStr+"=("+dynamicProperties.get(propertyStr)+"->"+valueStr+")");
|
||||||
|
dynamicProperties.put(propertyStr,valueStr);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/getDynamicProperties")
|
||||||
|
@ResponseBody
|
||||||
|
@Auth
|
||||||
|
public Map getDynamicProperties() {
|
||||||
|
Map map = new HashMap();
|
||||||
|
map.put("state", 0);
|
||||||
|
map.put("message", "文件不能为空");
|
||||||
|
Map<String, String> dynamicProperties = Context.getDynamicProperties();
|
||||||
|
StringBuilder stringBuilder = new StringBuilder();
|
||||||
|
for (String key : dynamicProperties.keySet()) {
|
||||||
|
String value = dynamicProperties.get(key);
|
||||||
|
if (value!=null) {
|
||||||
|
stringBuilder.append(key+"="+value+"\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
map.put("data", stringBuilder.toString());
|
||||||
|
return map;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
13
src/main/java/cn/langpy/kotime/model/TextParam.java
Normal file
13
src/main/java/cn/langpy/kotime/model/TextParam.java
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
package cn.langpy.kotime.model;
|
||||||
|
|
||||||
|
public class TextParam {
|
||||||
|
private String text;
|
||||||
|
|
||||||
|
public String getText() {
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setText(String text) {
|
||||||
|
this.text = text;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -9,6 +9,8 @@ import javax.sql.DataSource;
|
|||||||
import java.lang.management.ManagementFactory;
|
import java.lang.management.ManagementFactory;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* zhangchang
|
* zhangchang
|
||||||
@ -20,6 +22,7 @@ public class Context {
|
|||||||
private static DataSource dataSource;
|
private static DataSource dataSource;
|
||||||
private static StringRedisTemplate stringRedisTemplate;
|
private static StringRedisTemplate stringRedisTemplate;
|
||||||
private static GraphService saver;
|
private static GraphService saver;
|
||||||
|
private static Map<String,String> dynamicProperties;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
config = new DefaultConfig();
|
config = new DefaultConfig();
|
||||||
@ -27,6 +30,7 @@ public class Context {
|
|||||||
config.setEnable(true);
|
config.setEnable(true);
|
||||||
config.setLogLanguage("chinese");
|
config.setLogLanguage("chinese");
|
||||||
invokedHandlers = new ArrayList<>();
|
invokedHandlers = new ArrayList<>();
|
||||||
|
dynamicProperties = new ConcurrentHashMap<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -77,4 +81,12 @@ public class Context {
|
|||||||
public static void setSaver(GraphService saver) {
|
public static void setSaver(GraphService saver) {
|
||||||
Context.saver = saver;
|
Context.saver = saver;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Map<String, String> getDynamicProperties() {
|
||||||
|
return dynamicProperties;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setDynamicProperties(Map<String, String> dynamicProperties) {
|
||||||
|
Context.dynamicProperties = dynamicProperties;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,6 +10,7 @@ import org.springframework.data.redis.core.StringRedisTemplate;
|
|||||||
|
|
||||||
import javax.sql.DataSource;
|
import javax.sql.DataSource;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class KoUtil {
|
public class KoUtil {
|
||||||
private final static String koTimeSecret = UUID.randomUUID().toString().replace("-", "");
|
private final static String koTimeSecret = UUID.randomUUID().toString().replace("-", "");
|
||||||
@ -104,6 +105,7 @@ public class KoUtil {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* get the current method
|
* get the current method
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static MethodNode getCurrentMethodInfo() {
|
public static MethodNode getCurrentMethodInfo() {
|
||||||
@ -172,4 +174,46 @@ public class KoUtil {
|
|||||||
return decodeStr;
|
return decodeStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void setProperty(String propertyName, String propertyValue) {
|
||||||
|
Context.getDynamicProperties().put(propertyName, propertyValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getProperty(String propertyName) {
|
||||||
|
String value = Context.getDynamicProperties().get(propertyName);
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int getPropertyAsInteger(String propertyName) {
|
||||||
|
String value = getProperty(propertyName);
|
||||||
|
return Integer.valueOf(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static double getPropertyAsDouble(String propertyName) {
|
||||||
|
String value = getProperty(propertyName);
|
||||||
|
return Double.valueOf(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static double getPropertyAsFloat(String propertyName) {
|
||||||
|
String value = getProperty(propertyName);
|
||||||
|
return Float.valueOf(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean getPropertyAsBoolean(String propertyName) {
|
||||||
|
String value = getProperty(propertyName);
|
||||||
|
if ("true".equals(value) || "false".equals(value)) {
|
||||||
|
return Boolean.valueOf(value);
|
||||||
|
}
|
||||||
|
throw new RuntimeException("can not convert null value to boolean value.");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<String> getPropertyAsList(String propertyName, String split) {
|
||||||
|
String value = getProperty(propertyName);
|
||||||
|
if (value == null) {
|
||||||
|
throw new RuntimeException("can not convert null value to list values.");
|
||||||
|
}
|
||||||
|
String[] split1 = value.split(split);
|
||||||
|
return Arrays.stream(split1).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -260,6 +260,40 @@
|
|||||||
complete: function () {}
|
complete: function () {}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function updateDynamicProperties(){
|
||||||
|
let propertiesDom = document.querySelector("#dynamicText");
|
||||||
|
let propertiesText = propertiesDom.value;
|
||||||
|
if (propertiesText && propertiesText.indexOf("=")>0) {
|
||||||
|
$.ajax({
|
||||||
|
type:'POST',
|
||||||
|
url:concatToken('contextPath/koTime/updateDynamicProperties'),
|
||||||
|
data:JSON.stringify({
|
||||||
|
text:propertiesText
|
||||||
|
}),
|
||||||
|
dataType:'json',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
success:function (re) {
|
||||||
|
UIkit.notification.closeAll();
|
||||||
|
UIkit.notification("<font color='green'>更新成功</font>",{});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}else {
|
||||||
|
UIkit.notification.closeAll();
|
||||||
|
UIkit.notification("<font color='red'>更新失败,请正确编写配置!</font>",{});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function loadDynamicProperties() {
|
||||||
|
$.get(concatToken('contextPath/koTime/getDynamicProperties'), function (data) {
|
||||||
|
let text = data['data'];
|
||||||
|
document.querySelector("#dynamicText").value = text;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function loadLatestVersion(){
|
function loadLatestVersion(){
|
||||||
/*get the latest version so that you can update kotime immediately*/
|
/*get the latest version so that you can update kotime immediately*/
|
||||||
$.ajax({
|
$.ajax({
|
||||||
@ -515,6 +549,7 @@
|
|||||||
loadHeapMemoryInfo();
|
loadHeapMemoryInfo();
|
||||||
loadPhysicalMemoryInfo();
|
loadPhysicalMemoryInfo();
|
||||||
loadThreadsInfo();
|
loadThreadsInfo();
|
||||||
|
loadDynamicProperties();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -778,6 +813,13 @@
|
|||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
<li style="margin-left: 30%;margin-right: 30%;">
|
<li style="margin-left: 30%;margin-right: 30%;">
|
||||||
|
<ul class="uk-flex-left" uk-tab>
|
||||||
|
<li class="uk-active"><a href="#" style="text-transform: unset">KoTime Configuration</a></li>
|
||||||
|
<li class=""><a href="#" style="text-transform: unset">dynamic.properties Configuration</a></li>
|
||||||
|
</ul>
|
||||||
|
<ul class="uk-switcher uk-margin">
|
||||||
|
<li>
|
||||||
|
<div style="margin-top: 20px;" class="uk-grid-small uk-child-width-expand@s uk-text-left uk-card uk-card-default uk-card-body" style="border-radius: 5px" uk-grid>
|
||||||
<div class="layui-tab-item">
|
<div class="layui-tab-item">
|
||||||
<label >KoTime switch:</label> <input id='kotimeEnable' type="checkbox" checked>
|
<label >KoTime switch:</label> <input id='kotimeEnable' type="checkbox" checked>
|
||||||
<br>
|
<br>
|
||||||
@ -804,6 +846,18 @@
|
|||||||
<p>Please refresh this page after updating configurations</p>
|
<p>Please refresh this page after updating configurations</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<div class="uk-card uk-card-default uk-card-body" style="border-radius: 5px">
|
||||||
|
<textarea id="dynamicText" class="uk-textarea" placeholder="" style="overflow-y: auto;height: 65%;resize: none"></textarea>
|
||||||
|
<br>
|
||||||
|
<br>
|
||||||
|
<button type="button" onclick="updateDynamicProperties();" style="width: 100%;background-color: #19985d;border-radius: 5px" class="uk-button uk-button-primary uk-width-1-1 uk-margin-small-bottom">OK</button>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
</li>
|
</li>
|
||||||
<li style="margin-left: 30%;margin-right: 30%;">
|
<li style="margin-left: 30%;margin-right: 30%;">
|
||||||
<script src='https://gitee.com/huoyo/ko-time/widget_preview' async defer></script>
|
<script src='https://gitee.com/huoyo/ko-time/widget_preview' async defer></script>
|
||||||
|
|||||||
@ -50,6 +50,7 @@
|
|||||||
loadHeapMemoryInfo();
|
loadHeapMemoryInfo();
|
||||||
loadPhysicalMemoryInfo();
|
loadPhysicalMemoryInfo();
|
||||||
loadThreadsInfo();
|
loadThreadsInfo();
|
||||||
|
loadDynamicProperties();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -438,6 +439,39 @@
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function updateDynamicProperties(){
|
||||||
|
let propertiesDom = document.querySelector("#dynamicText");
|
||||||
|
let propertiesText = propertiesDom.value;
|
||||||
|
if (propertiesText && propertiesText.indexOf("=")>0) {
|
||||||
|
$.ajax({
|
||||||
|
type:'POST',
|
||||||
|
url:concatToken('contextPath/koTime/updateDynamicProperties'),
|
||||||
|
data:JSON.stringify({
|
||||||
|
text:propertiesText
|
||||||
|
}),
|
||||||
|
dataType:'json',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
success:function (re) {
|
||||||
|
UIkit.notification.closeAll();
|
||||||
|
UIkit.notification("<font color='green'>更新成功</font>",{});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}else {
|
||||||
|
UIkit.notification.closeAll();
|
||||||
|
UIkit.notification("<font color='red'>更新失败,请正确编写配置!</font>",{});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function loadDynamicProperties() {
|
||||||
|
$.get(concatToken('contextPath/koTime/getDynamicProperties'), function (data) {
|
||||||
|
let text = data['data'];
|
||||||
|
document.querySelector("#dynamicText").value = text;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function loadLatestVersion(){
|
function loadLatestVersion(){
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: 'http://www.kotime.cn/common/latestVersion?version=2.3.8',
|
url: 'http://www.kotime.cn/common/latestVersion?version=2.3.8',
|
||||||
@ -771,6 +805,13 @@
|
|||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
<li style="margin-left: 30%;margin-right: 30%;">
|
<li style="margin-left: 30%;margin-right: 30%;">
|
||||||
|
<ul class="uk-flex-left" uk-tab>
|
||||||
|
<li class="uk-active"><a href="#" style="text-transform: unset">KoTime配置</a></li>
|
||||||
|
<li class=""><a href="#" style="text-transform: unset">dynamic.properties配置</a></li>
|
||||||
|
</ul>
|
||||||
|
<ul class="uk-switcher uk-margin">
|
||||||
|
<li>
|
||||||
|
<div style="margin-top: 20px;" class="uk-grid-small uk-child-width-expand@s uk-text-left uk-card uk-card-default uk-card-body" style="border-radius: 5px" uk-grid>
|
||||||
<div class="layui-tab-item">
|
<div class="layui-tab-item">
|
||||||
<label >开启koTime:</label> <input id='kotimeEnable' type="checkbox" checked>
|
<label >开启koTime:</label> <input id='kotimeEnable' type="checkbox" checked>
|
||||||
<br>
|
<br>
|
||||||
@ -796,6 +837,18 @@
|
|||||||
<p>变更配置以后请重新刷新页面</p>
|
<p>变更配置以后请重新刷新页面</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<div class="uk-card uk-card-default uk-card-body" style="border-radius: 5px">
|
||||||
|
<textarea id="dynamicText" class="uk-textarea" placeholder="" style="overflow-y: auto;height: 65%;resize: none"></textarea>
|
||||||
|
<br>
|
||||||
|
<br>
|
||||||
|
<button type="button" onclick="updateDynamicProperties();" style="width: 100%;background-color: #19985d;border-radius: 5px" class="uk-button uk-button-primary uk-width-1-1 uk-margin-small-bottom">更新</button>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
</li>
|
</li>
|
||||||
<li style="margin-left: 30%;margin-right: 30%;">
|
<li style="margin-left: 30%;margin-right: 30%;">
|
||||||
<script src='https://gitee.com/huoyo/ko-time/widget_preview' async defer></script>
|
<script src='https://gitee.com/huoyo/ko-time/widget_preview' async defer></script>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user