Menu

Add new attribute to physical divices

2022-01-31
2022-04-06
  • Nikola Milanov

    Nikola Milanov - 2022-01-31

    Hi there,
    I'm using iTop 3.0 and I have a problem visualizing new added attribute to Physical devices.
    I'm adding new statuses and two new attributes (floor and room). Now I can see the new statuses, but can not see the new fields. I've checked the database - the columns are there, check the templates (for example PC) and the 2 attributes are there also.
    Can you tell me where I'm getting wrong?

    Thanks in advance

     
  • Jeffrey Bostoen

    Jeffrey Bostoen - 2022-01-31

    Do you mind sharing the XML file here or on GitHub?

     
  • Nikola Milanov

    Nikola Milanov - 2022-01-31

    Here is the XML file:

    <?xml version="1.0" encoding="UTF-8"?>
    <itop_design xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0">
      <classes>
        <class id="PhysicalDevice" _delta="if_exists">
          <fields>
            <field id="status" xsi:type="AttributeEnum" _delta="force">
              <values>
                <value id="production">production</value>
                <value id="stock">stock</value>
                <value id="obsolete">obsolete</value>
                <value id="not_used">not_used</value>
                <value id="on_repair">on_repair</value>
                <value id="common_use">common_use</value>
                <value id="loaned">loaned</value>
                <value id="external">external</value>
               </values>
              <sql>status</sql>
            </field>
            <field id="floor" xsi:type="AttributeString" _delta="force">
              <sql>floor</sql>
              <default_value/>
              <is_null_allowed>true</is_null_allowed>
            </field>
            <field id="room" xsi:type="AttributeString" _delta="force">
              <sql>room</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="floor"><rank>52</rank></item>
                <item id="room"><rank>53</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="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>
    
     

    Last edit: Pierre Goiffon 2022-02-21
  • Jeffrey Bostoen

    Jeffrey Bostoen - 2022-01-31

    In the presentation node: add the _delta="define" attribute for each new element (item id)

     

    Last edit: Jeffrey Bostoen 2022-01-31
  • Nikola Milanov

    Nikola Milanov - 2022-01-31

    But there are listed in the presentation node with rank 52 and 53?
    Or I miss something?

     
  • Jeffrey Bostoen

    Jeffrey Bostoen - 2022-01-31

    You are missing the _delta="define" attribute on both those items. This is necessary to make them known to iTop. Actually all the rest in the "details" node can be deleted, as it should already be defined by default. You only need to specify the new or changed parts; in this case the two "item" nodes.

     
  • Nikola Milanov

    Nikola Milanov - 2022-01-31

    Thank you for your patience,
    But still don't see the new items. I add delta="define" on each row of the new items, run toolkit and still no luck.

     
  • Pierre Goiffon

    Pierre Goiffon - 2022-02-21

    Hello,

    I've edited your message with the XML so that the code would be easier to read.

    I would recommend changing your XML a bit, so that only new nodes are present :

    <?xml version="1.0" encoding="UTF-8"?>
    <itop_design xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.7">
      <classes>
        <class id="PhysicalDevice" _delta="must_exist">
          <fields>
            <field id="status" xsi:type="AttributeEnum">
              <values>
                <value id="not_used" _delta="define">not_used</value>
                <value id="on_repair" _delta="define">on_repair</value>
                <value id="common_use" _delta="define">common_use</value>
                <value id="loaned" _delta="define">loaned</value>
                <value id="external" _delta="define">external</value>
              </values>
            </field>
            <field id="floor" xsi:type="AttributeString" _delta="define">
              <sql>floor</sql>
              <default_value/>
              <is_null_allowed>true</is_null_allowed>
            </field>
            <field id="room" xsi:type="AttributeString" _delta="define">
              <sql>room</sql>
              <default_value/>
              <is_null_allowed>true</is_null_allowed>
            </field>
          </fields>
          <presentation>
            <details>
              <items>
                <item id="floor" _delta="define"><rank>52</rank></item>
                <item id="room" _delta="define"><rank>53</rank></item>
              </items>
            </details>
          </presentation>
        </class>
      </classes>
    </itop_design>
    

    You added a _delta="if_exists" to the class node : what might happening is that your module descriptor file doesn't have the proper dependencies set ? If so, this _delta won't throw any error and your XML will produce nothing. In my suggested XML I used _delta="must_exist" that would make an error in such case.

    The PhysicalDevice class is defined in itop-config-mgmt (/datamodels/2.x/itop-config-mgmt), so your module must have this one as a dependency.

     
  • Nikola Milanov

    Nikola Milanov - 2022-04-06

    Hello Pierre,
    Still have no luck see these items.
    Do you have any other suggestion where to seek for error?

    Thanks

     
  • Jeffrey Bostoen

    Jeffrey Bostoen - 2022-04-06

    Have you also updated the presentations for the child classes if you want to see room and floor?

     

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.