Menu

Add a new tab for change request that has similar appearance to the "Properties" tab

ray
2020-11-13
2020-11-30
  • ray

    ray - 2020-11-13

    Hi All,

    I hope all of you are safe and well.

    I'm just wondering if someone could advise on how to create a new tab that looks similar to "Properties" tab for change request (please refer to attached image). I would be very grateful if you could share a simple public extension or sample code regarding this functionality.

    Thank you very much in advance!

    Regards,
    Ray

     

    Last edit: ray 2020-11-13
  • Guillaume Lajarige

    Hello Ray,

    Do you want to put some of the class fields in a second tab or do you want to manually create fields from something else ?

    First case
    In the XML "details" presentation section, you can define a tab just like you define a fieldset, just make sure the "item" ID is "tab:XXX", XXX being the code for the tab.

    ...
    <details>
      <items>
        <item id="tab:secondtab">
          <rank>10</rank>
          <items>
            <item id="fieldset:firstfieldset">
              ...
            </item>
          </items>
        </item>
      </items>
    </details>
    ...
    

    Second case
    To add a new tab and make whatever you want in it, you have to overload the "DisplayBareRelations()" method in your object class (through XML), you can check here for more information.

    But the main problem will be that there is no official API for you to display fieldsets and fields. So you will probably mimic that done today, but it might not be compatible with futur upgrades.

    Hope this helps,
    Guillaume

     
    • Jeffrey Bostoen

      Jeffrey Bostoen - 2020-11-13

      Interesting, I didn't know about the solution for the first case.

       
      • Guillaume Lajarige

        It's not documented and unofficial for now 😁

         
    • ray

      ray - 2020-11-14

      Hi Guillaume,

      Thank you very much for your help and example code guide. In my case, it would be case #2. I will have a look at overloading the method "DisplayBareRelations()" and get back if there's any issues.

      Have a good one!

      Regards,
      Ray

       
      • Guillaume Lajarige

        Great! Feel free to reply if you need more information. Have a nice WE :)

        Guillaume

         
        ❤️
        1
        • ray

          ray - 2020-11-17

          Hi Guillaume,

          Thank you very much for your help and guidance. I ended up going forward with the case #1 solution. It's working on my side but I have a few questions:

          1. It seems that the new tab is always placed next to the "Properties" tab even though I have adjusted the rank attribute value. Is there any way to change the order of this new tab? Please refer to attached image
          <details _delta="redefine">
                      <items>
                          <item id="functionalcis_list">
                              <rank>10</rank>
                          </item>
                          <item id="contacts_list">
                              <rank>20</rank>
                          </item>
                          <item id="workorders_list">
                              <rank>30</rank>
                          </item>
                          <item id="related_request_list">
                              <rank>40</rank>
                          </item>
                          <item id="related_incident_list">
                              <rank>50</rank>
                          </item>
                          <item id="related_problems_list">
                              <rank>60</rank>
                          </item>
                          <item id="child_changes_list">
                              <rank>70</rank>
                          </item>
          
                          <!-- Rank is 25, should be between contacts and work orders tab -->
                          <item id="tab:Change:cab">
                              <rank>25</rank>
                              <items>
                                  <item id="fieldset:Change:cab_chair">
                                      <rank>10</rank>
                                      <items>
                                          <item id="cab_chair">
                                              <rank>10</rank>
                                          </item>
                                      </items>
                                  </item> 
                              </items>
                          </item>
                          ...
              </items>
           </details>
          

          2.Unrelated to this topic, however, is there a way to force an optional field to be mandatory (perhaps using JavaScript (i.e. add certain class or attribute to the field))? I understand that in the change lifecycle I could specify field as mandatory for certain state.

          However, if I set that field as mandatory in "Planned" state for change request, this field will be automatically prompted when transitioning from "Assigned" to "Planned" state. However, this information is not available when transitioning. It will be available later in the "Planned" state but not when transitioning to "Planned". When it's available, user will simply edit the change which is in "Planned" state and the field should display as mandatory (not optional).

          Thank you very much in advance and would be really grateful if someone could share some insights.

          Regards,
          Ray

           

          Last edit: ray 2020-11-17
          • Pierre Goiffon

            Pierre Goiffon - 2020-11-24

            Hello,

            It seems that the new tab is always placed next to the "Properties" tab even though I have adjusted the rank attribute value

            I don't think this can be changed...

            Unrelated to this topic, however, is there a way to force an optional field to be mandatory

            There are nice tutorials on this in the "customize iTop" section of the documentation : Force a field to be mandatory [iTop Documentation]

             
            • ray

              ray - 2020-11-30

              Hi Pierre,

              Thank you very much for the advise!

               

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.