Skip to content

Commit a74d855

Browse files
committed
opt(flow): 完善ActionJsonToGraphviz(),使之能显示vars的内容
1 parent a6cf4c5 commit a74d855

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

modules/flow/to_graphviz.cpp

+12-1
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,23 @@ int ActionJsonToGraphviz(const Json &js, std::ostringstream &oss)
7676
auto &key = js_item.key();
7777
if (key == "id" || key == "type" || key == "label" ||
7878
key == "child" || key == "children" ||
79-
key == "state" || key == "result")
79+
key == "state" || key == "result" || key == "vars")
8080
continue;
81+
8182
std::string value_str = js_item.value().dump();
8283
util::string::Replace(value_str, R"(")", R"(\")");
8384
oss << R"(\n)" << key << " = " << value_str;
8485
}
86+
87+
if (util::json::HasObjectField(js, "vars")) {
88+
auto &js_vars = js["vars"];
89+
for (auto &js_item : js_vars.items()) {
90+
auto &key = js_item.key();
91+
std::string value_str = js_item.value().dump();
92+
util::string::Replace(value_str, R"(")", R"(\")");
93+
oss << R"(\n)" << key << " : " << value_str;
94+
}
95+
}
8596
}
8697
oss << R"(")";
8798
oss << "];" << std::endl;

0 commit comments

Comments
 (0)