Skip to content
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

Add template-summary and template-description fields to the Template Unit (New) #985

Merged
merged 4 commits into from
Feb 19, 2024

Conversation

pieqq
Copy link
Collaborator

@pieqq pieqq commented Feb 13, 2024

Description

Add two fields to Template Units:

  • template-summary
  • template-description

These fields mimick the summary and description fields of the Job Unit to provide a quick explanation and a longer form one about what a template unit does.

Both of these fields are translatable, and validation is added for the template-summary field to make sure if a value is provided, it is one line only and less than 80 characters.

Resolved issues

https://warthogs.atlassian.net/browse/CHECKBOX-1239

Documentation

Template Unit reference page is updated to mention both fields.

Tests

  • Unit tests have been added (you can run them with pytest checkbox-ng/plainbox/impl/unit/test_template.py)
  • Validators are present, so if you create a template with a template-summary field of more than 80 characters, or if the value for this field has more than one line, you will see warnings when running validation for the provider.

For instance, if I add the following template-summary to an existing xxx template unit in the base provider:

template-summary:
 This is a veeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeery long summary!
 and it's more than one line anyway...

and then run ./manage.py validate for the base provider, I will see three warnings:

warning: units/.../jobs.pxu:69: template 'xxx', field 'template-summary', field should be marked as translatable
warning: units/.../jobs.pxu:69: template 'xxx', field 'template-summary', please use only one line
warning: units/.../jobs.pxu:69: template 'xxx', field 'template-summary', please stay under 80 characters

Add two fields for the Template Unit:

- template-summary
- template-description

These fields mimick the summary and description fields of the Job Unit
to provide a quick explanation and a longer form one about what a
template unit does.

Both these fields are translatable, and validation is added for the
template-summary field to make sure if a value is provided, it is one
line only and is less than 80 characters.
Copy link

codecov bot commented Feb 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (3e6c0e1) 38.81% compared to head (989c0f6) 38.84%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #985      +/-   ##
==========================================
+ Coverage   38.81%   38.84%   +0.02%     
==========================================
  Files         333      333              
  Lines       37029    37046      +17     
  Branches     6321     6321              
==========================================
+ Hits        14374    14391      +17     
  Misses      22022    22022              
  Partials      633      633              
Flag Coverage Δ
checkbox-ng 65.50% <100.00%> (+0.04%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@pieqq pieqq changed the title Add template-summary and template-description fields to the Template Unit (New) Add template-summary and template-description fields to the Template Unit (New) Feb 13, 2024
Copy link
Contributor

@kissiel kissiel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good stuff! +1

@kissiel kissiel merged commit dffecdc into main Feb 19, 2024
14 checks passed
@kissiel kissiel deleted the add-template-fields branch February 19, 2024 07:34
LiaoU3 pushed a commit to LiaoU3/checkbox that referenced this pull request Mar 20, 2024
…Unit (New) (canonical#985)

* Add template-summary and template-description fields and validators

Add two fields for the Template Unit:

- template-summary
- template-description

These fields mimick the summary and description fields of the Job Unit
to provide a quick explanation and a longer form one about what a
template unit does.

Both these fields are translatable, and validation is added for the
template-summary field to make sure if a value is provided, it is one
line only and is less than 80 characters.

* Add unit tests for the new Template Unit fields

* Update Template Unit documentation

* Add unit tests for the translation methods of the new fields
binli pushed a commit to binli/checkbox that referenced this pull request Mar 22, 2024
…Unit (New) (canonical#985)

* Add template-summary and template-description fields and validators

Add two fields for the Template Unit:

- template-summary
- template-description

These fields mimick the summary and description fields of the Job Unit
to provide a quick explanation and a longer form one about what a
template unit does.

Both these fields are translatable, and validation is added for the
template-summary field to make sure if a value is provided, it is one
line only and is less than 80 characters.

* Add unit tests for the new Template Unit fields

* Update Template Unit documentation

* Add unit tests for the translation methods of the new fields
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants