Menu

Custom field in Tablet CI

BJ F
2018-12-11
2018-12-12
  • BJ  F

    BJ F - 2018-12-11

    Hi All,

    I installed a custom extension which adds mac address on Tablet CI by following the guide. I'm just wondering if there is something that I missed or something that I need to be wary about in future upgrades. It seems to work as intended but I just want to make sure. Please see my datamodel xml below.

    <?xml version="1.0" encoding="UTF-8"?>
    <itop_design xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0">
      <classes>
        <class id="Tablet">
          <fields>
            <field id="macaddress" xsi:type="AttributeString" _delta="define">
              <sql>macaddress</sql>
              <default_value/>
              <is_null_allowed>true</is_null_allowed>
            </field>
          </fields>
            <presentation>
            <details _delta="redefine">
              <items>
                <item id="name">
                  <rank>10</rank>
                </item>
                <item id="org_id">
                  <rank>20</rank>
                </item>
                <item id="status">
                  <rank>30</rank>
                </item>
                <item id="business_criticity">
                  <rank>40</rank>
                </item>
                <item id="location_id">
                  <rank>50</rank>
                </item>
                <item id="brand_id">
                  <rank>60</rank>
                </item>
                <item id="model_id">
                  <rank>70</rank>
                </item>
                <item id="serialnumber">
                  <rank>80</rank>
                </item>
                <item id="macaddress">
                  <rank>85</rank>
                </item>
                <item id="asset_number">
                  <rank>90</rank>
                </item>
                <item id="move2production">
                  <rank>100</rank>
                </item>
                <item id="purchase_date">
                  <rank>110</rank>
                </item>
                <item id="end_of_warranty">
                  <rank>120</rank>
                </item>
                <item id="description">
                  <rank>130</rank>
                </item>
                <item id="contacts_list">
                  <rank>140</rank>
                </item>
                <item id="documents_list">
                  <rank>150</rank>
                </item>
              </items>
            </details>
            </presentation>
         </class>
      </classes>
    </itop_design>
    
     
  • Guillaume Lajarige

    Hi BJ F,

    You could adjust the presentation part to define only your item instead of the whole presentation list, this way if the presentation evolves in the futures releases you will be compliant otherwise your extension will overwrite it.

    To do so:
    - Remove _delta from the details tag
    - Put a _delta="define" on your item tag
    - Remove all others item tags from your XML as they are not needed anymore, they will come from the iTop core modules

    Hope it helps 😊

     
  • BJ  F

    BJ F - 2018-12-12

    Thank you so much for your assistance Guillaume. That definitely helped a lot. Here is my final xml.

    <?xml version="1.0" encoding="UTF-8"?>
    <itop_design xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0">
      <classes>
        <class id="Tablet">
          <fields>
            <field id="macaddress" xsi:type="AttributeString" _delta="define">
              <sql>macaddress</sql>
              <default_value/>
              <is_null_allowed>true</is_null_allowed>
            </field>
          </fields>
            <presentation>
            <details>
              <items>
                <item id="macaddress" _delta="define">
                  <rank>85</rank>
                </item>
              </items>
            </details>
            </presentation>
         </class>
      </classes>
    </itop_design>
    
     

    Last edit: BJ F 2018-12-12
  • Guillaume Lajarige

    This looks great! Glad it helped 😊

    Thanks for sharing with the community!

    Have a nice day,
    Guillaume

     

    Last edit: Guillaume Lajarige 2018-12-12

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.