glpi icon indicating copy to clipboard operation
glpi copied to clipboard

feat(license/ui): Display available license count

Open MyvTsv opened this issue 9 months ago • 3 comments

  • [x] I have read the CONTRIBUTING document.
  • [x] I have performed a self-review of my code.
  • [x] I have added tests that prove my fix is effective or that my feature works.
  • [ ] This change requires a documentation update.

Description

  • It fixes !36843
  • Adds a license counter that tells the user how many licenses are left and how many have been allocated.

Screenshots (if appropriate):

Afftected Items Search Option:

Unlimited image

Valid image

Full image

Overflow image

Tab:

Unlimited image

Valid image

Full image

Overflow image

Form

Unlimited image

Valid image

Full image

Overflow image

MyvTsv avatar May 13 '25 14:05 MyvTsv

for elements with background color cna you use boostrap badge ?

https://getbootstrap.com/docs/4.0/components/badge/

stonebuzz avatar May 21 '25 13:05 stonebuzz

Quick design done IRL photo_2025-06-05_16-29-10

  • Use progress bars
  • If overconsumption -> make the progress bar to 100% and use iconography, colors to alert the user*
  • re-use the same design in both form and searchoption
  • don't forget the csv export case, where we make a simple text "used/total"

orthagh avatar Jun 05 '25 14:06 orthagh

for elements with background color cna you use boostrap badge ?

https://getbootstrap.com/docs/4.0/components/badge/

The current badges don't look good and would fail an accessibility check for color contrast. Using the regular info/success and danger badges would be better.

cconard96 avatar Jun 07 '25 15:06 cconard96

On this subject, I was already OK with the UI changes But I remember there was still the CSS export to do. Is it possible, or is there any technical issue blocking the thing?

I think that it is not possible because the data from the export in CSV and the display in the search options is the result of the giveItem function. However, there is no way to know if the action that the user wants to do is a CSV export or just a display of the Search options

MyvTsv avatar Jul 03 '25 15:07 MyvTsv

As far as I see, getSpecificValueToDisplay() implementations are never adapting the output to the context. Also, the html option is always set to true, see

There are things that need fixed/improved, but the default handling for HTML content in a non-HTML output is handled in the various Glpi\Search\Output\* classes. The NameListSearchOutput uses html_entity_decode and strip_tags to remove everything except the item link text. Outputs extending Spreadsheet output (PDF, ODS, CSV, XLSX) all use the DataExport class to normalize the content which uses RichText::getTextFromHtml.

In this specific case, there isn't really a textual representation that can be found by stripping the HTML tags. I am not sure this is a widespread issue though.

cconard96 avatar Jul 05 '25 00:07 cconard96