Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
def7 2021-12-14 18:23:48 +08:00
commit 0c98c64709
5 changed files with 22 additions and 38 deletions

View File

@ -63,19 +63,14 @@ public class IndexController extends BaseAgentController {
@RequestMapping(value = "info", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
public String info() {
int code;
if (whitelistDirectoryService.isInstalled()) {
code = 200;
} else {
code = 201;
}
JpomManifest instance = JpomManifest.getInstance();
RemoteVersion remoteVersion = RemoteVersion.cacheInfo();
//
JSONObject jsonObject = new JSONObject();
jsonObject.put("manifest", instance);
jsonObject.put("remoteVersion", remoteVersion);
return JsonMessage.getString(code, "", jsonObject);
return JsonMessage.getString(200, "", jsonObject);
}
/**

View File

@ -68,6 +68,8 @@ public class CheckMonitor {
// 加载构建定时器
BuildInfoService buildInfoService = SpringUtil.getBean(BuildInfoService.class);
buildInfoService.startCron();
//
RemoteVersion.loadRemoteInfo();
});
// 开启版本检测调度
CronUtils.upsert("system_monitor", "0 0 0,12 * * ?", () -> {

View File

@ -158,13 +158,15 @@ public class InitDb implements DisposableBean, InitializingBean {
LoadBuildJsonToDB.getInstance().doJsonToSql();
// @author bwcx_jzy @date 2021-12-02
LoadJsonConfigToDb instance = LoadJsonConfigToDb.getInstance();
instance.loadIpConfig();
instance.loadMailConfig();
instance.loadOutGivingWhitelistConfig();
// init workspace
WorkspaceService workspaceService = SpringUtil.getBean(WorkspaceService.class);
try {
BaseServerController.resetInfo(UserModel.EMPTY);
//
instance.loadIpConfig();
instance.loadMailConfig();
instance.loadOutGivingWhitelistConfig();
//
instance.loadUserInfo();
workspaceService.checkInitDefault();
//

View File

@ -33,7 +33,6 @@ import cn.jiangzeyin.common.spring.SpringUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import io.jpom.common.BaseServerController;
import io.jpom.model.data.*;
import io.jpom.model.log.MonitorNotifyLog;
import io.jpom.service.dblog.DbMonitorNotifyLogService;
@ -151,7 +150,6 @@ public class LoadJsonConfigToDb {
return;
}
try {
BaseServerController.resetInfo(UserModel.EMPTY);
JSON json = JsonFileUtil.readJson(file.getAbsolutePath());
JSONArray jsonArray = JsonFileUtil.formatToArray((JSONObject) json);
List<UserModel> userModels = jsonArray.toJavaList(UserModel.class);
@ -174,8 +172,6 @@ public class LoadJsonConfigToDb {
DefaultSystemLog.getLog().info("{} mv to {}", FileUtil.getAbsolutePath(file), FileUtil.getAbsolutePath(backupOldData));
} catch (Exception e) {
DefaultSystemLog.getLog().error("load user info error ", e);
} finally {
BaseServerController.remove();
}
}
@ -197,7 +193,7 @@ public class LoadJsonConfigToDb {
//
nodeModel.setProtocol(StrUtil.emptyToDefault(nodeModel.getProtocol(), "http"));
}).collect(Collectors.toList());
BaseServerController.resetInfo(UserModel.EMPTY);
NodeService nodeService = SpringUtil.getBean(NodeService.class);
nodeService.insert(nodeModels);
// json 文件转移到备份目录
@ -205,8 +201,6 @@ public class LoadJsonConfigToDb {
DefaultSystemLog.getLog().info("{} mv to {}", FileUtil.getAbsolutePath(file), FileUtil.getAbsolutePath(backupOldData));
} catch (Exception e) {
DefaultSystemLog.getLog().error("load node error ", e);
} finally {
BaseServerController.remove();
}
}
@ -224,7 +218,6 @@ public class LoadJsonConfigToDb {
if (sshModels == null) {
return;
}
BaseServerController.resetInfo(UserModel.EMPTY);
SshService sshService = SpringUtil.getBean(SshService.class);
sshService.insert(sshModels);
// json 文件转移到备份目录
@ -232,8 +225,6 @@ public class LoadJsonConfigToDb {
DefaultSystemLog.getLog().info("{} mv to {}", FileUtil.getAbsolutePath(file), FileUtil.getAbsolutePath(backupOldData));
} catch (Exception e) {
DefaultSystemLog.getLog().error("load ssh error ", e);
} finally {
BaseServerController.remove();
}
}
@ -251,7 +242,7 @@ public class LoadJsonConfigToDb {
if (monitorModels == null) {
return;
}
BaseServerController.resetInfo(UserModel.EMPTY);
MonitorService monitorService = SpringUtil.getBean(MonitorService.class);
monitorService.insert(monitorModels);
// json 文件转移到备份目录
@ -259,8 +250,6 @@ public class LoadJsonConfigToDb {
DefaultSystemLog.getLog().info("{} mv to {}", FileUtil.getAbsolutePath(file), FileUtil.getAbsolutePath(backupOldData));
} catch (Exception e) {
DefaultSystemLog.getLog().error("load monitor error ", e);
} finally {
BaseServerController.remove();
}
}
@ -279,7 +268,7 @@ public class LoadJsonConfigToDb {
if (outGivingModels == null) {
return;
}
BaseServerController.resetInfo(UserModel.EMPTY);
OutGivingServer outGivingServer = SpringUtil.getBean(OutGivingServer.class);
outGivingServer.insert(outGivingModels);
// json 文件转移到备份目录
@ -287,8 +276,6 @@ public class LoadJsonConfigToDb {
DefaultSystemLog.getLog().info("{} mv to {}", FileUtil.getAbsolutePath(file), FileUtil.getAbsolutePath(backupOldData));
} catch (Exception e) {
DefaultSystemLog.getLog().error("load OUTGIVING error ", e);
} finally {
BaseServerController.remove();
}
}

View File

@ -94,19 +94,17 @@ export default {
//
loadData() {
systemInfo(this.nodeId).then((res) => {
if (res.code === 200) {
this.temp = res.data?.manifest;
this.temp = res.data?.manifest;
//
// vueTimeStamp
this.temp = { ...this.temp, vueTimeStamp: parseTime(this.getMeta("build-time")) };
//
changelog(this.nodeId).then((resLog) => {
this.changelog = resLog.data;
//
// vueTimeStamp
this.temp.vueTimeStamp = parseTime(this.getMeta("build-time"));
//
changelog(this.nodeId).then((resLog) => {
this.changelog = resLog.data;
//
// res.data.
this.showVersion(false, res.data?.remoteVersion);
});
}
// res.data.
this.showVersion(false, res.data?.remoteVersion);
});
});
},
getMeta(metaName) {