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

Reports Feature Refactor + UI #17069

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

cconard96
Copy link
Contributor

@cconard96 cconard96 commented May 5, 2024

Q A
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets -

This wasn't meant to be a rewrite of the report feature, but the required refactoring is extensive.

  1. Removal of data retrieval and UI from front files.
  2. Separation of data retrieval and UI (Prerequisite for HL API).
  3. Twig templates for UI.
  4. Addition of some generic report rendering methods for the various types of reports.
  5. Cleanup of the display of some reports.
    • Default report had counts with potentially confusing labels. It would list all assets by type, OS by name and then asset types (ComputerType, etc) by the itemtype name (Computer) in the same list. Now, the labels are like "Assets > Computers", "Operating Systems > Fedora Linux 38", "Types > Computers > QEMU", etc.
  6. Conversion of forms to use GET instead of POST (both were used in different reports).
  7. Unification of the report and its criteria (some reports have a URL just for the criteria and another just for the result).

@cconard96 cconard96 self-assigned this May 5, 2024
@cconard96 cconard96 force-pushed the ui/reports branch 2 times, most recently from ea7de06 to 5c7aa92 Compare May 8, 2024 01:39
@cconard96 cconard96 added help wanted and removed wip labels May 11, 2024
@cconard96
Copy link
Contributor Author

Some help is needed regarding the graphs that are supposed to show for the two Infocom reports.

@cconard96 cconard96 marked this pull request as ready for review May 13, 2024 02:11
@cconard96 cconard96 changed the title [WIP] Reports Feature Refactor + UI Reports Feature Refactor + UI May 13, 2024
@@ -76,9 +76,9 @@
{% set super_header_label = super_header is array ? super_header['label'] : super_header %}
{% set super_header_raw = super_header is array ? super_header['is_raw'] : false %}
<tr>
<th colspan="{{ total_cols }}">
{% if super_header_raw != 'th_elements' %}<th colspan="{{ total_cols }}">{% endif %}
Copy link
Contributor

Choose a reason for hiding this comment

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

It sound strange to provide th elements as raw html here.

Copy link
Contributor Author

@cconard96 cconard96 May 16, 2024

Choose a reason for hiding this comment

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

The alternative is changing the datatable template to allow a lot more customization for edge-cases.
I suppose it needs done eventually if we want to get rid of the HTMLTable* classes.

@trasher
Copy link
Contributor

trasher commented May 16, 2024

When trying to change report from the dropdown, it seems to rely on configured URI instead of current one (as it's done in master).
My GLPI URI is http://glpi.loclahost, changing report goes to http://localhost/glpi

@trasher
Copy link
Contributor

trasher commented May 16, 2024

I think I've never used that part before; I really do not know how it should work.

On default report, I have quite a different result:
on current main:
image

On your PR:
image

Event if the new display may be correct (as I do not understand the old one at all); at least the last line seems strange.

Also, please rebase, I had to switch between main and your branch, and I had to rerun dependencies install each time.

@cconard96
Copy link
Contributor Author

cconard96 commented May 16, 2024

Event if the new display may be correct (as I do not understand the old one at all); at least the last line seems strange.

Also, please rebase, I had to switch between main and your branch, and I had to rerun dependencies install each time.

The new format still isn't great, but better. The last line indicates that it is the count for Computers with no type (----- being the display value for an empty selection). In the old report, it is the ----- on its own under the "Computer" line which is supposed to be a section heading, but there is 0 indication of that in the old report.

All the lines without a count that were in the old report are skipped in the new one to reduce noise.

@trasher
Copy link
Contributor

trasher commented May 16, 2024

"----" is the empty default for dropdowns, I'm really not sure that make sense for anyone outside this context -but I understand it was present before.
Maybe it's the good time to change for something more explicit?

@cconard96
Copy link
Contributor Author

cconard96 commented May 16, 2024

"----" is the empty default for dropdowns, I'm really not sure that make sense for anyone outside this context -but I understand it was present before. Maybe it's the good time to change for something more explicit?

N/A is used in other places. Perhaps that but also in italics?

@trasher
Copy link
Contributor

trasher commented May 16, 2024

"----" is the empty default for dropdowns, I'm really not sure that make sense for anyone outside this context -but I understand it was present before. Maybe it's the good time to change for something more explicit?

N/A is used in other places. Perhaps that but also in italics?

It seems more easy to understand to me, yes

@trasher
Copy link
Contributor

trasher commented May 16, 2024

On report.infocom.php, I have the following error:

[2024-05-16 12:58:34] glpiphplog.CRITICAL:   *** Uncaught Exception TypeError: Unsupported operand types: int + string in /var/www/html/private/glpi/src/Report.php at line 1652

@trasher
Copy link
Contributor

trasher commented May 16, 2024

On report.infocom.php, I have the following error:

[2024-05-16 12:58:34] glpiphplog.CRITICAL:   *** Uncaught Exception TypeError: Unsupported operand types: int + string in /var/www/html/private/glpi/src/Report.php at line 1652

Problem is $item['anv'] can be '-'

@cconard96
Copy link
Contributor Author

On report.infocom.php, I have the following error:

[2024-05-16 12:58:34] glpiphplog.CRITICAL:   *** Uncaught Exception TypeError: Unsupported operand types: int + string in /var/www/html/private/glpi/src/Report.php at line 1652

Problem is $item['anv'] can be '-'

Ah. The phpdoc for Infocom::Amort is wrong.

@trasher
Copy link
Contributor

trasher commented May 16, 2024

Ah. The phpdoc for Infocom::Amort is wrong.

Well.. Most of "amort" part is wrong :D

What I do not understand is I have not that issue on main, but I also do not have the "ANV" column displayed:
image

@cconard96
Copy link
Contributor Author

What I do not understand is I have not that issue on main, but I also do not have the "ANV" column displayed

In French the label is VNC.

@trasher
Copy link
Contributor

trasher commented May 16, 2024

In French the label is VNC.

Indeed, I did not pay attention lang has switched (I usually work in english :D).

Another issue: I do not have the search form (Start/End date) with "Other financial and ..." (no error in logs).

@trasher
Copy link
Contributor

trasher commented May 16, 2024

On network report:

There is no "Network socket":
image

image

I have no location in my test DB, so no idea if anything wrong in this part, I only can use "By hardware". On main branch, I have data in the table for all equipements I can choose, but on your PR, I always have "No data".

Once search has been done, on main, dropdowns are no longer displayed. They are in your PR (good point I think), but current entry is not selected (maybe it's related to previous point).

@trasher
Copy link
Contributor

trasher commented May 16, 2024

End of my tests:

  • Loan report: seems I do not have any data, and I do no know what's it's related to,
  • Status report: OK!

@cconard96
Copy link
Contributor Author

On network report:

There is no "Network socket"

I have no location in my test DB, so no idea if anything wrong in this part, I only can use "By hardware". On main branch, I have data in the table for all equipements I can choose, but on your PR, I always have "No data".

Once search has been done, on main, dropdowns are no longer displayed. They are in your PR (good point I think), but current entry is not selected (maybe it's related to previous point).

Old report hid criteria if there were no items. Seemed confusing and an extra check that wasn't needed, so criteria is always visible now. All reports now have a single page for the search and display, so no more of the criteria going away and making it difficult to generate new reports.

Loan report is related to reservations (bad name).

@trasher
Copy link
Contributor

trasher commented May 16, 2024

Loan report is related to reservations (bad name).

OK, I have an SQL error (empty in are not allowed) trying to add a new reservation :/ I'll try that later

@trasher
Copy link
Contributor

trasher commented May 16, 2024

Loan report is related to reservations (bad name).

OK, I have an SQL error (empty in are not allowed) trying to add a new reservation :/ I'll try that later

ON another DB, I do not have the problem. Loan report is OK too.

@trasher
Copy link
Contributor

trasher commented May 16, 2024

So, remaining issues:

  • I do not have the search form (Start/End date) with "Other financial and ..." (no error in logs).
  • Network report, "By hardware" I have data in the table for all equipements I can choose, but on your PR, I always have "No data".
  • Network report, "By hardware" searched entry is not selected
  • when changing report from the dropdown, we should not rely on configured URL

@cconard96
Copy link
Contributor Author

So, remaining issues:

* [ ]  I do not have the search form (Start/End date) with "Other financial and ..." (no error in logs).

Report not implemented at all because it had no tabular data. The only thing it showed are the graphs which already seemed broken and I have no idea how they are supposed to work.

* [ ]  Network report, "By hardware" I have data in the table for all equipements I can choose, but on your PR, I always have "No data".
* [ ]  Network report, "By hardware" searched entry is not selected

Maybe fixed.

* [ ]  when changing report from the dropdown, we should not rely on configured URL

Fixed

@trasher
Copy link
Contributor

trasher commented May 20, 2024

So, remaining issues:

* [ ]  I do not have the search form (Start/End date) with "Other financial and ..." (no error in logs).

Report not implemented at all because it had no tabular data. The only thing it showed are the graphs which already seemed broken and I have no idea how they are supposed to work.

Unfortunately, I cannot help :/

All other issues are fixed; LGTM.

@cedric-anne cedric-anne requested a review from orthagh May 21, 2024 14:01
@trasher
Copy link
Contributor

trasher commented May 24, 2024

If the "Other financial and ..." report is broken; I propose to just drop it. ping @orthagh?

@orthagh
Copy link
Contributor

orthagh commented May 24, 2024

If the thing is broken since a long time, you may remove it.
I would want a bit more investigation on the history of the report

@trasher
Copy link
Contributor

trasher commented May 24, 2024

I'll take an eye

@trasher
Copy link
Contributor

trasher commented May 24, 2024

OK, it seems my first tests were wrong. I've just tested again on a 10.0/bf fresh install; and graphs are working

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants