-
Notifications
You must be signed in to change notification settings - Fork 685
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Render components to HTML #10709
Render components to HTML #10709
Conversation
Skipping CI for Draft Pull Request. |
1cf2bf0
to
0952cbc
Compare
I have rebased this PR on the top of the latest upstream master branch. I have some additional thoughts:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR please take look at my comments.
<h3>Relevant packages:</h3> | ||
{{% if component.packages %}} | ||
<ul> | ||
{{% for p in component.packages %}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I should suggest spelling out package vs using p
for clarity.
<h3>Relevant groups:</h3> | ||
{{% if component.groups %}} | ||
<ul> | ||
{{% for g in component.groups %}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to use group
here for clarity?
<h3>Changelog:</h3> | ||
{{% if component.changelog %}} | ||
<ul> | ||
{{% for chg in component.changelog %}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I might recommend renaming chg
to entry
or changelog_entry
.
@@ -10,3 +10,5 @@ rules: | |||
- service_fapolicyd_enabled | |||
templates: | |||
- file_policy_blocked | |||
changelog: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have this schema documented anywhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utils/render_components.py
Outdated
|
||
def create_index_html(output_dir, product_components): | ||
index_path = os.path.join(output_dir, "index.html") | ||
title = "List of components" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
title = "List of components" | |
title = "List of Components" |
Title case
I have created a wrapper function to avoid using the private method, I have used long variable names, changed to use the |
This commit unifies code from multiple similar functions to a single function `render_template`. This function can be used to render different Jinja templates. The change prevents code duplication and allows reusing the code in future.
This change will make the build system actually read the `changelog` key in component YAML files. The values will be stored in the Component object, so that it can be read later in application.
This commit adds a script `render_components.py` that renders mappings from components to rules in HTML format. It's also added to the pages that we publish online. The goal is to enable easy sharing of component mappings outside of the team and simplify the review of component rules for content developers.
This function is created to avoid referencing the private function _get_jinja_environment outside of the module where it is defined.
This unifies the command line interface with other similar scripts, eg. rule_dir_json.py.
Code Climate has analyzed commit 1ef8e08 and detected 0 issues on this pull request. The test coverage on the diff in this pull request is 23.0% (50% is the threshold). This pull request will bring the total coverage in the repository to 52.8% (-0.1% change). View more on Code Climate. |
Description:
This commit adds a script
render_components.py
that rendersmappings from components to rules in HTML format. It's also
added to the pages that we publish online.
Rationale:
The goal is to enable easy sharing of component mappings
outside of the team and simplify the review of component rules
for content developers.
Review Hints:
build the content, and then run
python3 utils/render_components.py $(pwd) /tmp/components
firefox /tmp/components/index.html