Skip to content

Commit

Permalink
Merge pull request #5404 from yongyiduan/issue_5402
Browse files Browse the repository at this point in the history
feat: 研发商店插件的YAML展示 兼容插件配置错误展示 #5402
  • Loading branch information
irwinsun authored Oct 26, 2021
2 parents 140adf6 + f011d22 commit d33960f
Showing 1 changed file with 61 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -964,7 +964,8 @@ abstract class MarketAtomServiceImpl @Autowired constructor() : MarketAtomServic
var value = it
val atom = getMap[it.atomCode]
if (atom?.contains("*") == true &&
!it.version.startsWith(atom.replace("*", ""))) {
!it.version.startsWith(atom.replace("*", ""))
) {
value = atomDao.getPipelineAtom(dslContext, it.atomCode, atom) ?: return@lit
}
val itemMap = mutableMapOf<String, Any>()
Expand Down Expand Up @@ -1032,7 +1033,8 @@ abstract class MarketAtomServiceImpl @Autowired constructor() : MarketAtomServic
val requiredName = MessageCodeUtil.getCodeLanMessage(REQUIRED)
val defaultName = MessageCodeUtil.getCodeLanMessage(DEFAULT)
if ((type == "selector" && multiple) ||
type in listOf("atom-checkbox-list", "staff-input", "company-staff-input", "parameter")) {
type in listOf("atom-checkbox-list", "staff-input", "company-staff-input", "parameter")
) {
sb.append(" $paramKey: ")
sb.append("\t\t# $description")
if (null != required && "true".equals(required.toString(), true)) {
Expand Down Expand Up @@ -1124,45 +1126,50 @@ abstract class MarketAtomServiceImpl @Autowired constructor() : MarketAtomServic
val optionsName = MessageCodeUtil.getCodeLanMessage(OPTIONS)
val multipleName = MessageCodeUtil.getCodeLanMessage(MULTIPLE_SELECTOR)
val singleName = MessageCodeUtil.getCodeLanMessage(SINGLE_SELECTOR)
if ((type == "selector" && multiple) ||
type in listOf("atom-checkbox-list", "staff-input", "company-staff-input", "parameter")) {
addParamComment(
builder = sb,
description = description,
paramKey = paramKey,
required = required,
optionsName = optionsName,
selectorTypeName = multipleName,
paramValueMap = paramValueMap,
requiredName = requiredName,
defaultValue = defaultValue,
defaultName = defaultName
)
sb.append("\r\n")
sb.append(" $paramKey:\r\n")
sb.append(" - string\r\n")
sb.append(" - string\r\n")
} else {
addParamComment(
builder = sb,
description = description,
paramKey = paramKey,
required = required,
optionsName = optionsName,
selectorTypeName = singleName,
paramValueMap = paramValueMap,
requiredName = requiredName,
defaultValue = defaultValue,
defaultName = defaultName
)
sb.append("\r\n")
sb.append(" $paramKey: ")
if (type == "atom-checkbox") {
sb.append("boolean")
try {
if ((type == "selector" && multiple) ||
type in listOf("atom-checkbox-list", "staff-input", "company-staff-input", "parameter")
) {
addParamComment(
builder = sb,
description = description,
paramKey = paramKey,
required = required,
optionsName = optionsName,
selectorTypeName = multipleName,
paramValueMap = paramValueMap,
requiredName = requiredName,
defaultValue = defaultValue,
defaultName = defaultName
)
sb.append("\r\n")
sb.append(" $paramKey:\r\n")
sb.append(" - string\r\n")
sb.append(" - string\r\n")
} else {
sb.append("string")
addParamComment(
builder = sb,
description = description,
paramKey = paramKey,
required = required,
optionsName = optionsName,
selectorTypeName = singleName,
paramValueMap = paramValueMap,
requiredName = requiredName,
defaultValue = defaultValue,
defaultName = defaultName
)
sb.append("\r\n")
sb.append(" $paramKey: ")
if (type == "atom-checkbox") {
sb.append("boolean")
} else {
sb.append("string")
}
sb.append("\r\n")
}
sb.append("\r\n")
} catch (ignored: Throwable) {
sb.insert(0, "# 参数[$paramKey] 的${ignored.message} ,请检查task.json配置格式是否正确 \n")
}
}
}
Expand Down Expand Up @@ -1230,18 +1237,30 @@ abstract class MarketAtomServiceImpl @Autowired constructor() : MarketAtomServic
}
val rely = paramValueMap["rely"]
if (null != rely) {
parseRely(builder, rely as Map<String, Any>)
try {
parseRely(builder, rely as Map<String, Any>)
} catch (e: Exception) {
throw Exception("rely 配置解析错误")
}
}
val options = paramValueMap["options"]
if (null != options) {
builder.append(", $selectorTypeName")
builder.append(", $optionsName:")
parseOptions(builder, options as List<Map<String, Any>>)
try {
parseOptions(builder, options as List<Map<String, Any>>)
} catch (e: Exception) {
throw Exception("options 配置解析错误")
}
}
val list = paramValueMap["list"]
if (null != list) {
builder.append(", $optionsName:")
parseList(builder, list as List<Map<String, Any>>)
try {
parseList(builder, list as List<Map<String, Any>>)
} catch (e: Exception) {
throw Exception("list 配置解析错误")
}
}
}

Expand Down

0 comments on commit d33960f

Please sign in to comment.