fix: ASW-132 application basic.json 更名为 meta.json

This commit is contained in:
shizhendong
2024-11-05 11:00:12 +08:00
parent a59b97557a
commit caf296f49e
2 changed files with 14 additions and 14 deletions

View File

@@ -60,8 +60,8 @@ public class GitServiceImpl implements IGitService {
@Value("${file.extensions.text:txt,csv,md,html,xml,json,log,bat,py,sh,ini,conf,yaml,yml,properties,toml,java,c,cpp,js,php,ts,go,rb,rtf,tex,rss,xhtml,sql}")
private String textExtensions;
@Value("${asw.application.template.basic.json}")
private String basicJsonTemplate;
@Value("${asw.application.template.meta.json}")
private String metaJsonTemplate;
@Value("${asw.application.template.signature.json}")
private String signatureJsonTemplate;
@@ -524,24 +524,24 @@ public class GitServiceImpl implements IGitService {
List<CompletableFuture<Map>> futureList = T.ListUtil.list(false);
while (treeWalk.next()) {
String fileName = treeWalk.getNameString();
if (T.StrUtil.equals("basic.json", fileName)) {
if (T.StrUtil.equals("meta.json", fileName)) {
ObjectLoader loader = repository.open(treeWalk.getObjectId(0));
String basicJsonStr = T.StrUtil.utf8Str(loader.getBytes());
basicJsonStr = T.StrUtil.emptyToDefault(basicJsonStr, T.StrUtil.EMPTY_JSON);
Map basicJsonMap = T.JSONUtil.toBean(basicJsonStr, Map.class);
String metaJsonStr = T.StrUtil.utf8Str(loader.getBytes());
metaJsonStr = T.StrUtil.emptyToDefault(metaJsonStr, T.StrUtil.EMPTY_JSON);
Map metaJsonMap = T.JSONUtil.toBean(metaJsonStr, Map.class);
// filter by name
if (T.StrUtil.isNotEmpty(q)) {
String appName = T.MapUtil.getStr(basicJsonMap, "name", "");
String appName = T.MapUtil.getStr(metaJsonMap, "name", "");
if (!T.StrUtil.containsIgnoreCase(appName, q)) {
continue;
}
}
Map<Object, Object> m = T.MapUtil.newHashMap(true);
m.putAll(basicJsonMap);
m.putAll(metaJsonMap);
String appId = T.MapUtil.getStr(basicJsonMap, "id", "");
String appId = T.MapUtil.getStr(metaJsonMap, "id", "");
String appDirPath = treeWalk.getPathString().replaceAll(fileName, "");
futureList.add(
CompletableFuture.supplyAsync(() -> {
@@ -658,12 +658,12 @@ public class GitServiceImpl implements IGitService {
Repository repository = git.getRepository();
Map<String, ObjectId> filePathAndBlobIdMap = T.MapUtil.newHashMap(true);
for (String str : T.ListUtil.of("README.md", "basic.json", "signature.json", "icon.png")) {
for (String str : T.ListUtil.of("README.md", "meta.json", "signature.json", "icon.png")) {
String savePath = T.StrUtil.concat(true, "applications/", applicationName, "/", str);
String fileContent = T.StrUtil.EMPTY;
if ("basic.json".equals(str)) {
JSONObject jsonObject = T.JSONUtil.parseObj(this.basicJsonTemplate);
if ("meta.json".equals(str)) {
JSONObject jsonObject = T.JSONUtil.parseObj(this.metaJsonTemplate);
jsonObject.set("id", T.StrUtil.uuid());
jsonObject.set("name", applicationName);
jsonObject.set("longName", applicationName);
@@ -888,7 +888,7 @@ public class GitServiceImpl implements IGitService {
@Override
public Map<Object, Object> infoApplicationFileContent(String workspaceId, String branch, String applicationName, String commitId, String file) {
// applications/qq/basic.json
// applications/qq/meta.json
String path = T.StrUtil.concat(true, "applications/", applicationName, "/", file);
Map<Object, Object> result = T.MapUtil.builder()

View File

@@ -80,7 +80,7 @@ logging:
asw:
application:
template:
basic.json: |- #配置JSON格式
meta.json: |- #配置JSON格式
{
"id": "{uuid}",
"name": "{application name}",