diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ea7990..9422f39 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,2 +1,6 @@ +# 0.2.1 - 2022-02-27 +* disable a group if all its skills are new or not specified +# 0.2.0 - 2022-02-27 +* add more themes # 0.1.0 - 2022-02-26 * initial version, generating skill map from toml file to mermaid \ No newline at end of file diff --git a/skillmap/skillmap_visitor.py b/skillmap/skillmap_visitor.py index 54d26ec..f0987a1 100644 --- a/skillmap/skillmap_visitor.py +++ b/skillmap/skillmap_visitor.py @@ -60,24 +60,37 @@ def _required_node_edges(qualified_node_id, required_node_ids): return "\n".join(node_requires) +def get_group_skills_list(qualified_group_id, group_skills): + group_skills = [ + skill_node(_qualified_skill_id(qualified_group_id, skill_id), skill_value) + for skill_id, skill_value in group_skills.items() + ] + return "\n".join(group_skills) + + +def get_group_status(group_skills): + for _, skill_value in group_skills.items(): + skill_status = skill_value.get("status", "") + if skill_status not in ("new", ""): + return "normal" + return "new" + + def group_subgraph(group_id, group_value): qualified_group_id = _qualify(group_id) group_name = group_value.get("name", "") group_icon = get_icon(group_value) - group_skills_list = "" - if "skills" in group_value: - group_skills = [ - skill_node(_qualified_skill_id(qualified_group_id, skill_id), skill_value) - for skill_id, skill_value in group_value["skills"].items() - ] - group_skills_list = "\n".join(group_skills) + group_skills_list = get_group_skills_list( + qualified_group_id, group_value.get("skills", {}) + ) + group_status = get_group_status(group_value.get("skills", {})) group_requires_list = _required_node_edges( qualified_group_id, group_value.get("requires", []) ) group_id_and_name = f"subgraph {qualified_group_id}[{group_icon} {group_name}]" - group_style = f"class {qualified_group_id} skillGroup;" + group_style = f"class {qualified_group_id} {group_status}SkillGroup;" group_subgraph_end = "end" sections = [ SECTION_SEPARATOR, @@ -110,7 +123,7 @@ def skill_map_graph(skill_map): map_group_subgraphs = group_subgraphs(skill_map.get("groups", {})) skill_map_node = f"{map_name}({map_icon}
{map_name})" - skill_map_node_style = f"class {map_name} skillGroup;" + skill_map_node_style = f"class {map_name} normalSkillGroup;" sections = [ "flowchart TD", skill_map_node, diff --git a/tests/skillmap_visitor_test.py b/tests/skillmap_visitor_test.py index 4cae81c..2fc55b9 100644 --- a/tests/skillmap_visitor_test.py +++ b/tests/skillmap_visitor_test.py @@ -53,7 +53,7 @@ def test_visit_group_without_skill(): "subgraph groups.g1[fa:fa-anchor web ui]", "", # skill list is skipped "end", - "class groups.g1 skillGroup;", + "class groups.g1 newSkillGroup;", "" ] assert group_graph.split("\n") == sections @@ -81,7 +81,7 @@ def test_visit_group(): "class groups.g1.skills.s2 newSkill;", "", "end", - "class groups.g1 skillGroup;", + "class groups.g1 newSkillGroup;", "" ] assert group_graph.split("\n") == sections @@ -100,7 +100,7 @@ def test_visit_group_with_requires(): "subgraph groups.g1[fa:fa-anchor web ui]", "", # skill list is skipped "end", - "class groups.g1 skillGroup;", + "class groups.g1 newSkillGroup;", "groups.g2.skills.s1-->groups.g1", ] assert group_graph.split("\n") == sections diff --git a/tests/urlshortener.toml b/tests/urlshortener.toml index 9de9efe..9f175ca 100644 --- a/tests/urlshortener.toml +++ b/tests/urlshortener.toml @@ -11,7 +11,7 @@ requires = ["groups.backend.skills.restapi"] requires = ["groups.webui.skills.react"] [groups.webui.skills.react] name = "react" - icon = "html5" + icon = "list" status = "beingLearned" [groups.backend]