glpi-project / glpi-inventory-plugin

GLPI Inventory plugin
GNU Affero General Public License v3.0
43 stars 24 forks source link

Deployment Task Message is Garbled on Client #493

Closed cautiouscoyote closed 1 month ago

cautiouscoyote commented 3 months ago

Describe the bug

When using the GLPI Inventory plugin to deploy a task on a client, and display a message afterwards, the formatting of this message is being screwed up: carriage return and line feed characters are being displayed instead of the proper new lines and what-not; see attached pictures.

To reproduce

  1. In the GLPI Inventory plugin, compose a deployment task with a package deployment action doing something whatever (can be some simple command).
  2. Make sure to add a Message under User Interactions "after actions".
  3. Let the client/agent do a run where it should pick up the deployment task.
  4. Behold the garbled message being displayed on the client screen.

Expected behavior

The message should be displayed on the client in the same markup with new lines as composed in the User Interactions field.

Operating system

Windows

GLPI Agent version

Other (See additional context below)

GLPI version

10.0.11

GLPIInventory plugin

1.3.5

Additional context

GLPI Agent version = 1.7.1.

Composed package action message: image

Actual message as displayed on client: image

trasher commented 2 months ago

This looks like an agent issue rather than a plugin one, please report bug or open a discussion on agent repository.

g-bougard commented 1 month ago

Okay, after some tests, I noticed @cautiouscoyote didn't select a "User Interaction Template". This parameter is required. In his case, the simplest one requiring only "OK" from the user is sufficient.

On my side, if I don't select a template, I obtain the same output. If I select a template, the output is correct.

The problem here seems to be the plugin as there's a red asterisk on the UI Template but the form permits the user to leave it empty.

trasher commented 1 month ago

Problem is there is absolutely no checks for input on that part. There is just the mandatory mark on the label; but no way to know what is required in this whole "generic" code... Adding HTML required attribute would be the simplest solution but would already been quite complex, really checking for value presence seems a quite huge job (honestly, I have no idea how to proceed, all that stuff relies on plugin specific code outside GLPI framework)..

Not sure we'll spend time on that, will be fixed in replacement plugin I guess.

trasher commented 1 month ago

Also, I'm not able to understand how a missing entry in that form can lend to character display issues.

g-bougard commented 1 month ago

If I remember well, this is just a matter of EOL encoding an we had a consensus to encode them in some way. Don't remember why exactly. And maybe this should be changed in the replacement plugin.

Anyway I think I should handle more nicely the case where "User Interaction Template" is missing on agent side.

Maybe we can close this issue with "wontfix" as we will provide an alternative in replacement plugin in the future.

cautiouscoyote commented 1 month ago

To me, as a user first exploring this GLPI universe and fiddling around with these plugins, the workflow is not always too clear. Specifically for this inventory plugin, the flow to get a deployment task out there, is not all that intuitive. Afterwards, yeah, there is some logic to it, but the interface and user experience could benefit from some more love, I think.

Also, the red asterix is cute and all, but there is no indication whatsover what that would mean. A foot note on every page where such asterix is displayed, indicating that these options are mandatory, would have helped. Here I didn't pay much attention to it. And since nothing popped up pointing to the missing input, surely it will be ignored.

Anyway, I think I can work with it knowing this now. You devs may figure out what to do with it improving the whole package :-) There is already a replacement plugin in the works, yeah?

g-bougard commented 1 month ago

Yes, the team is working on a replacement plugin dedicated to Deploy task. I don't have more details to share, but we have the same user experience difficulties in mind.

If that can help you or people sticking around, there's an official KB with an article detected to Deploy task: https://faq.teclib.com/03_knowledgebase/inventory/glpiinventory_deploy

g-bougard commented 1 month ago

Just proposed a PR which fixes the message. It doesn't fix the template requirement. And indeed if no template is selected, the agent will still show a default combo with just the OK button. But the text will be correct with #512.