GhostManager / Ghostwriter

The SpecterOps project management and reporting engine
https://ghostwriter.wiki
BSD 3-Clause "New" or "Revised" License
1.33k stars 182 forks source link

Add report version #531

Open mynoc96 opened 2 weeks ago

mynoc96 commented 2 weeks ago

Is your feature request related to a problem? Please describe.

You can track project notes, but there doesn't appear to be a way to track report versions.

Describe the solution you'd like

Ideally a versions or revisions list under reports to track the user, date, version/revision number, and a note.

Describe alternatives you've considered

Adding notes to the report and parsing the text there (that would probably require a split jinja filter).

Additional context

None

chrismaddalena commented 1 week ago

We could consider making this a default value, but you can get what you want with more flexibility via a custom field. I explained this in your related issue, #532.

The custom field allows you to pick the field type: string, integer (whole numbers), or number (allows for decimal values). The best choice for you will depend on what you want a report version to look like.

mynoc96 commented 1 week ago

I think I described it badly when I said version. What I was trying to say was "version history". The use case case here would be for tracking changes over the course of the engagement, so would probably need to use some kind of a list of tuples like:[revision1: ((user: string, date: string, revision/version: string, note: string)), revision2, revision3, etc. ] to be able to create a templated table like:

Author Date Revision Description
Somebody Some date Some arbitrary revision number Some description
Somebody else Some other date Some other arbitrary revision number Some other description

The user could be whoever creates the record.

Tracking the history, though would require multiple records to create a table. That is why I created the other issue. I went to parse an existing field (I was going to use the project note table), but there was no "split" filter to break out thew newlines. I was going to enter some notes in the following form, parse them out, and if the record was in the right form, throw them into a revision table. Basically, I was going to create a note (which is an rt field by default) like:

revision
1.0
September 22, 2024
Initial release

Then I could take the note and do the following:

{% if note|strip_html|split|get_item(0) == "revision" %}, which I expected to convert rich text with html to plain text with newlines, use the newlines to create a list of strings, and get the first string to check if the string contains "revision", then build a table like:

Author Date Revision Description
{%tr for note in project.notes %}
note.user note strip_html split get_item(2) note strip_html split get_item(1) note strip_html split get_item(3)
%{tr endfor %}

That's when I realized "split" wasn't implemented.

chrismaddalena commented 3 days ago

You can call Python's split like this: https://github.com/GhostManager/Ghostwriter/issues/532#issuecomment-2386431709

You might be better off making your custom field a formatted text field with a table for your specific use case. As changes are made, the user can add their change notes to the table like a CHANGELOG. Have you tried that?

It would remove the need for the user to update a string with specific requirements and to split and loop over the results in a template.

We could still consider adding some sort of custom split filter.