Ghostwriter icon indicating copy to clipboard operation
Ghostwriter copied to clipboard

Report fields not available for output reports filename

Open felix-caboff opened this issue 1 year ago • 5 comments

Is your feature request related to a problem? Please describe. I am required to format the filename of the output reports in a particular way and this includes the project name. At the moment this field is not available. Instead only the following are:

image

Describe the solution you'd like It would be ideal if all the variables that are available in the report are also available in the filename within the global report options. This gives the greatest level of flexibility. There may also be mileage is attempting to rationalise the naming convention too.

felix-caboff avatar Oct 12 '23 08:10 felix-caboff

Hey @felix-caboff, the project name displayed by Ghostwriter is the client name + the assessment type so you can assemble that in the report title configuration. Do you mean you want to include the codename?

When you say you want all variables available, do you mean the values under the project key available in the templates?

image

chrismaddalena avatar Nov 02 '23 22:11 chrismaddalena

Yes please on the whole of the project key.

felix-caboff avatar Nov 03 '23 15:11 felix-caboff

I second @felix-caboff. Having access to the reporting context when constructing the filename would be very helpful.

One thing I have wondered though is whether it would be better located with the template (if only as an optional field that can be used to override the global) as opposed to the overall installation. In the end the filename is something that mostly affects the report as a final product so one could argue that the structure of the filename would better be placed with the other information that shapes the report (i.e., the template).

Let me give you one more peculiar example where this has become relevant to us:

  • we've recently rebranded as a company so in theory I should change all the attributes for{{company}}
  • unfortunately there are still some client's that need their to get their reports in the old branding until end of year
  • So if I change company to the new one, it messes up the old filenames. If I leave it as is it messes up the new reports.
  • If the pattern for the filename were located with the report template, I could set the filename for the old report template to be "report_something_oldname" and in the new template use "report_something_newname"

Actually this has given me an even wilder idea: having the ability to overwrite system globals in the template (e.g. redefining variables per template) might be a rather handy feature.

Sorry, for hijacking your issue @felix-caboff . It felt on topic :)

er4z0r avatar Nov 07 '23 14:11 er4z0r

@er4z0r That's something that may be possible with via the new custom fields feature coming in v4.1 (See PR #346). We're looking at reports now, but we could potentially extend custom fields to templates too. Then a check like "if a field named report_filename exists, use that instead of the global value" could be a thing.

Allowing global options to be overridden by templates has been in the backlog for a long time.

I don't know if all report context can be made accessible as a filename, especially once custom fields are in the mix, but we'll see about expanding what is available. Many of the values from the project key are very doable.

chrismaddalena avatar Nov 09 '23 20:11 chrismaddalena

This looks like this may have been completed in recent release: https://github.com/GhostManager/Ghostwriter/releases/tag/v4.2.0

felix-caboff avatar Jun 17 '24 08:06 felix-caboff

This issue has been labeled as stale because it has been open for 30 days with no activity.

github-actions[bot] avatar Jul 17 '24 09:07 github-actions[bot]

We have not yet upgraded (busy couple of months!). Can anyone confirm that the above is now resolved in the above release. I read the release note of "Added support for using Jinja2 in the report filename template configured under the Global Report Configuration inside the admin panel" as being exactly what this issue requested.

felix-caboff avatar Jul 17 '24 09:07 felix-caboff

Yes, report filename templates have full use of Jinja2 templating now. This applies to the global report filenames and the newer filename overrides for individual templates.

chrismaddalena avatar Jul 17 '24 21:07 chrismaddalena

Awesome! Closing...

felix-caboff avatar Jul 18 '24 07:07 felix-caboff