perf(X-Pack): 优化插件操作

This commit is contained in:
fit2cloud-chenyw 2024-06-19 19:40:32 +08:00
parent 9a19c7efa5
commit c43233cce8
4 changed files with 16 additions and 4 deletions

@ -1 +1 @@
Subproject commit 0bfb0e20ead5a4711cb54957003b63388067eb8b Subproject commit c5a84a840c83af6083d4e846d9e160b45d6df8b2

View File

@ -19,12 +19,13 @@ public interface PluginApi {
@GetMapping("/query") @GetMapping("/query")
List<PluginVO> query(); List<PluginVO> query();
@PostMapping("/install") @PostMapping(value = "/install", consumes = {"multipart/form-data"})
void install(@RequestPart(value = "file") MultipartFile file); void install(@RequestPart(value = "file") MultipartFile file);
@PostMapping("/uninstall/{id}") @PostMapping("/uninstall/{id}")
void uninstall(@PathVariable("id") String id); void uninstall(@PathVariable("id") String id);
@PostMapping(value = "/update", consumes = {"multipart/form-data"})
void update(@RequestPart("request") PluginEditor request, @RequestPart(value = "file") MultipartFile file); void update(@RequestPart("request") PluginEditor request, @RequestPart(value = "file") MultipartFile file);
} }

View File

@ -1,5 +1,7 @@
package io.dataease.api.xpack.plugin.vo; package io.dataease.api.xpack.plugin.vo;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
@ -14,6 +16,7 @@ public class PluginVO implements Serializable {
@Serial @Serial
private static final long serialVersionUID = -3889122930435272191L; private static final long serialVersionUID = -3889122930435272191L;
@JsonSerialize(using= ToStringSerializer.class)
private Long id; private Long id;
private String name; private String name;

View File

@ -1,5 +1,6 @@
package io.dataease.extensions.view.template; package io.dataease.extensions.view.template;
import io.dataease.exception.DEException;
import io.dataease.extensions.view.dto.ChartViewDTO; import io.dataease.extensions.view.dto.ChartViewDTO;
import io.dataease.extensions.view.dto.ChartViewFieldDTO; import io.dataease.extensions.view.dto.ChartViewFieldDTO;
import io.dataease.extensions.view.dto.DatasetTableFieldDTO; import io.dataease.extensions.view.dto.DatasetTableFieldDTO;
@ -23,9 +24,16 @@ public abstract class PluginsChartTemplate implements DataEasePlugin {
public XpackPluginsViewVO getConfig() { public XpackPluginsViewVO getConfig() {
DataEasePluginVO pluginInfo = getPluginInfo(); DataEasePluginVO pluginInfo = null;
try {
pluginInfo = getPluginInfo();
} catch (Exception e) {
DEException.throwException(e);
}
String config = pluginInfo.getConfig(); String config = pluginInfo.getConfig();
return JsonUtil.parseObject(config, XpackPluginsViewVO.class); XpackPluginsViewVO vo = JsonUtil.parseObject(config, XpackPluginsViewVO.class);
vo.setIcon(pluginInfo.getIcon());
return vo;
} }