mirror of
https://gitee.com/devlive-community/datacap.git
synced 2024-11-29 18:48:23 +08:00
feat(plugin): fix the problem of accidentally deleting configuration in the development environment
This commit is contained in:
parent
ff23e4a67f
commit
5583aae80c
@ -126,6 +126,11 @@ class JsonConvertService : ConvertService
|
||||
val factory = JsonFactory()
|
||||
factory.createGenerator(file, JsonEncoding.UTF8)
|
||||
.use { generator ->
|
||||
// 创建一个新的 ObjectMapper 实例并设置给 generator
|
||||
// Create a new ObjectMapper instance and set it to generator
|
||||
val objectMapper = ObjectMapper()
|
||||
generator.codec = objectMapper.findAndRegisterModules()
|
||||
|
||||
generator.writeStartArray()
|
||||
request.columns
|
||||
.forEach { column ->
|
||||
@ -137,9 +142,11 @@ class JsonConvertService : ConvertService
|
||||
is List<*> -> generator.writeObjectField(request.headers[headerIndex] as String, column[headerIndex])
|
||||
is ObjectNode ->
|
||||
{
|
||||
generator.codec = ObjectMapper()
|
||||
val header = request.headers[headerIndex] as String
|
||||
generator.writeObjectField(header, column.get(header))
|
||||
// 将 ObjectNode 转换为 Map 再写入
|
||||
// Convert ObjectNode to Map before writing
|
||||
val value = objectMapper.convertValue(column.get(header), Map::class.java)
|
||||
generator.writeObjectField(header, value)
|
||||
}
|
||||
|
||||
else -> generator.writeObjectField(request.headers[headerIndex] as String, column)
|
||||
|
@ -5,10 +5,12 @@ import com.google.inject.Guice;
|
||||
import com.google.inject.Injector;
|
||||
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||
import io.edurt.datacap.common.utils.DateUtils;
|
||||
import io.edurt.datacap.common.utils.EnvironmentUtils;
|
||||
import io.edurt.datacap.plugin.loader.PluginClassLoader;
|
||||
import io.edurt.datacap.plugin.loader.PluginLoaderFactory;
|
||||
import io.edurt.datacap.plugin.loader.TarPluginLoader;
|
||||
import io.edurt.datacap.plugin.utils.PluginClassLoaderUtils;
|
||||
import io.edurt.datacap.plugin.utils.PluginPathUtils;
|
||||
import io.edurt.datacap.plugin.utils.VersionUtils;
|
||||
import lombok.Getter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@ -162,6 +164,12 @@ public class PluginManager
|
||||
boolean installed;
|
||||
|
||||
try {
|
||||
// 如果是IDE环境,或者插件目录是文件,则使用默认目录
|
||||
// Use default directory for IDE environment or if plugins directory is a file
|
||||
if (EnvironmentUtils.isIdeEnvironment() || Files.isRegularFile(config.getPluginsDir())) {
|
||||
config.setPluginsDir(PluginPathUtils.appendPath("plugins"));
|
||||
}
|
||||
|
||||
// 创建临时目录
|
||||
// Create temporary directory
|
||||
tempDir = Files.createTempDirectory(config.getPluginsDir(), TEMP_DIR_PREFIX);
|
||||
@ -879,7 +887,11 @@ public class PluginManager
|
||||
deleteDirectory(pluginLocation);
|
||||
}
|
||||
else {
|
||||
Files.delete(pluginLocation);
|
||||
// 如果非IDE环境,或者插件目录是文件,才进行删除
|
||||
// Delete only if not in IDE environment, or if the plugin directory is a file
|
||||
if (!EnvironmentUtils.isIdeEnvironment() || !Files.isRegularFile(config.getPluginsDir())) {
|
||||
Files.delete(pluginLocation);
|
||||
}
|
||||
}
|
||||
|
||||
// 删除备份文件
|
||||
|
@ -70,18 +70,6 @@
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.edurt.datacap</groupId>
|
||||
<artifactId>datacap-shaded-pinot</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.suteren.jdbc.influxdb</groupId>
|
||||
<artifactId>influxdb-jdbc</artifactId>
|
||||
<version>${datacap.influxdb.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.edurt.datacap</groupId>
|
||||
<artifactId>datacap-convert-spi</artifactId>
|
||||
|
@ -1,5 +1,5 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100">
|
||||
<text x="50" y="60"
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
|
||||
<text x="32" y="45"
|
||||
font-family="Arial, sans-serif"
|
||||
font-size="30"
|
||||
font-weight="bold"
|
||||
|
Before Width: | Height: | Size: 271 B After Width: | Height: | Size: 269 B |
@ -1,5 +1,5 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100">
|
||||
<text x="50" y="60"
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 80 80">
|
||||
<text x="40" y="50"
|
||||
font-family="Arial, sans-serif"
|
||||
font-size="30"
|
||||
font-weight="bold"
|
||||
|
Before Width: | Height: | Size: 272 B After Width: | Height: | Size: 270 B |
10
logo/convert/txt.svg
Normal file
10
logo/convert/txt.svg
Normal file
@ -0,0 +1,10 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
|
||||
<text x="30" y="45"
|
||||
font-family="Arial, sans-serif"
|
||||
font-size="30"
|
||||
font-weight="bold"
|
||||
text-anchor="middle"
|
||||
fill="#000000">
|
||||
Txt
|
||||
</text>
|
||||
</svg>
|
After Width: | Height: | Size: 269 B |
Loading…
Reference in New Issue
Block a user