Menu

Customize Title & Color based on field value

2023-01-25
2023-01-27
  • Xavier Prieur

    Xavier Prieur - 2023-01-25

    Hi,

    je cherche un customiseur la couleur soit de la page, soit du titre d'un serveur en fonction de la valeur d'un champ précis. Auriez-vous une piste ?

    Regards,
    Xavier

     
  • Xavier Prieur

    Xavier Prieur - 2023-01-25

    I am looking to customize the color either of the page or of the title of a server according to the value of a specific field. Do you have a lead?

     
  • Jeffrey Bostoen

    Jeffrey Bostoen - 2023-01-26

    Where exactly? The object details page?

    Which iTop version are you using?

     
  • Guillaume Lajarige

    Hello Xavier,

    There is an API to change the class icon depending on a field value, it is typically what is used to a "fire flam" hint on the user requests icon when the reach a threshold. Would that be ok?

    Depending on the color / meaning that you want, you could also play with the "GetHighlightColor" API, which can highlight the object in lists by giving its whole row an orange or red color.

    Hope this helps,
    Guillaume

     
  • Xavier Prieur

    Xavier Prieur - 2023-01-26

    Hello Guillaume,
    My goal is, on the sheet of a server, to have a visual effect (color or icon) indicating if the server is Production to differentiate them from non-production quickly.

    I will look at GetHighlightColor()

    Thanks,
    Xavier

     
  • Guillaume Lajarige

    Which version of iTop are you using? If you have iTop 3.0, then you style the "status" attribute, the same way it is done for the status on UserRequest for example.

    There are different ways for you to choose from:
    - Style the status attribute (displayed both in lists and object sheet)
    - Style the icon (displayed only in object sheet)
    - Style the highlight color (displayed only in list)

    Guillaume

     
  • Xavier Prieur

    Xavier Prieur - 2023-01-26

    For status, it's allways done & working. Following your advice, I will therefore look at the icon part. Because it is on the object sheet, and not necessarily linked to the status but another field, its environment.

    Version is 3.0.2-1-9957 (and Datacenter view extended 1.7 :))

     
    ❤️
    1
  • Guillaume Lajarige

    I was about to point you to the application/applicationextension.inc.php file, especially the AbstractApplicationUIExtension::GetIcon() and AbstractApplicationUIExtension::GetHilightClass() methods; but it seems that this doesn't work with iTop 3.0 anymore... 😥

    The only way you can override the icon will be by overriding the Server::GetIcon() method in XML directly. Do you how to make an extension an alter the XML DataModel?

    Cheers,
    Guillaume

     
  • Xavier Prieur

    Xavier Prieur - 2023-01-26

    Yes, at a intermediate level (some basic function).
    First, i will check if "fields_semantic" can make the job. But don't find any documentation on this.
    I have this error in Toolkit : You may define its allowed_values property as [new ValueSetEnum('')

    Apreciate you help.

    Xavier

     
  • Xavier Prieur

    Xavier Prieur - 2023-01-26

    fields_semantic is working (some error on toolkit, You may define its allowed_values property as [new ValueSetEnum(''), but it's working)

     
  • Guillaume Lajarige

    Can you share the XML of your module?

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.