Conversation
# Conflicts: # src/web/src/views/cli/CLIModGeneratorProfileCommandTree.tsx # src/web/src/views/cli/CLIModGeneratorProfileTabs.tsx # src/web/src/views/cli/CLIModuleGenerator.tsx
kairu-ms
reviewed
Nov 18, 2024
kairu-ms
reviewed
Nov 18, 2024
kairu-ms
reviewed
Nov 18, 2024
kairu-ms
reviewed
Nov 18, 2024
kairu-ms
reviewed
Nov 18, 2024
Co-authored-by: kai ru <69238381+kairu-ms@users.noreply.github.com>
kairu-ms
reviewed
Dec 5, 2024
Comment on lines
572
to
606
| def patch_partial_items(self, aaz_command_tree: CMDSpecsCommandTree): | ||
| aaz_command_tree = CMDSpecsPartialCommandTree(self.aaz_path, aaz_command_tree.root) | ||
| nodes = [self.root] | ||
| i = 0 | ||
| while i < len(nodes): | ||
| command_group = nodes[i] | ||
| if isinstance(command_group, CMDSpecsCommandGroup): | ||
| if isinstance(command_group.command_groups, CMDSpecsCommandGroupDict): | ||
| for key in command_group.command_groups.keys(): | ||
| raw_cg = command_group.command_groups.get_raw_item(key) | ||
| if isinstance(raw_cg, CMDSpecsCommandGroup): | ||
| nodes.append(raw_cg) | ||
| elif isinstance(raw_cg, CMDSpecsPartialCommandGroup): | ||
| command_group.command_groups[key] = aaz_command_tree.find_command_group(*raw_cg.names) | ||
| elif isinstance(command_group.command_groups, dict): | ||
| for cg in command_group.command_groups.values(): | ||
| nodes.append(cg) | ||
| if isinstance(command_group.commands, CMDSpecsCommandDict): | ||
| for key in command_group.commands.keys(): | ||
| raw_command = command_group.commands.get_raw_item(key) | ||
| if isinstance(raw_command, CMDSpecsPartialCommand): | ||
| command_group.commands[key] = aaz_command_tree.find_command(*raw_command.names) | ||
| i += 1 | ||
|
|
||
| def patch(self): | ||
| tree_path = os.path.join(self.aaz_path, "Commands", "tree.json") | ||
| if not (os.path.exists(tree_path) and os.path.isfile(tree_path)): | ||
| return | ||
| try: | ||
| with open(tree_path, 'r', encoding="utf-8") as f: | ||
| data = json.load(f) | ||
| aaz_command_tree = CMDSpecsCommandTree(data) | ||
| self.patch_partial_items(aaz_command_tree) | ||
| except json.decoder.JSONDecodeError as e: | ||
| raise ValueError(f"Invalid Command Tree file: {tree_path}") from e |
Collaborator
There was a problem hiding this comment.
Do we still need those functions as we decided drop the tree.json directly
Member
Member
Author
@necusjz The {%- if command.help.lines is not none and command.help.lines|length %}
{{ command.help.lines|join('\\\n')}}
{%- endif %} |
kairu-ms
approved these changes
Dec 9, 2024
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Description
The tree.json file is growing bigger and will cause problem for git command one day. So it is required to drop tree.json file in git repo and generate it only in local cache.
The PR dropping
tree.jsonin aaz model: Azure/aaz#615Backend
CMDSpecsPartialCommandTreeto support partial commands and command groups management.__getitem__method ofCMDSpecsCommandDictandCMDSpecsCommandGroupDict, support similar interface of PartialCommandTree and a full CommandTree./AAZ/Specs/CommandTree/Simpleto get a simplified tree from folder structure./AAZ/Specs/CommandTree/Nodes/Leavesto batched get command leaves.Frontend
CLIModGeneratorProfileCommandTree. Change it from class component to function component.ModGenerator.selectedtoProfileCTCommandandProfileCTCommandGroupto mark selection state no matter it is loaded or not.ProfileCommandTreeto object instead of list.