Menu

Display Functional CI on User Portal

2023-06-19
2023-06-22
  • Davide Nardo

    Davide Nardo - 2023-06-19

    Hi,

    I have implemented a custom class of Functional CI in my ITop and i would like to show a complete list of this CI in the user portal.

    I have tryed both "manage" and "browse" bricks but I keep encountering the message "No Items" with the first approach and "No levels to display" with the second approach.

    Here is my latest XML with the browse brick:

    <?xml version="1.0" encoding="UTF-8"?>
    <itop_design xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0">
      <module_designs>
        <module_design id="itop-portal" xsi:type="portal">
          <bricks>
            <brick id="ongoing-tickets-for-portal-user-ext" xsi:type="Combodo\iTop\Portal\Brick\BrowseBrick" _delta="define">
              <levels>
                <level id="CSGxP" xsi:type="Combodo\iTop\Portal\Brick\Browse\Level">
                    <oql><![CDATA[SELECT CS_GxP WHERE status = "Production"]]></oql>
                  <actions>
                    <action id="CSGxP" xsi:type="Combodo\iTop\Portal\Brick\Browse\Action\View"/>
                  </actions>
                </level>
              </levels>
              <browse_modes>
                <availables>
                  <mode id="list"/>
                </availables>
                <default>list</default>
                <data_loading>full</data_loading>
              </browse_modes>
            </brick>
          </bricks>
        </module_design>
      </module_designs>
    </itop_design>
    

    With the managed brick, I have tried different OQL queries, and it appears to work when displaying a list of user accounts, so it seems the issue is with the visualization of FunctionalCI.

    Did someone manage to show a list of FunctionalCI on the user portal?

     
  • Jeffrey Bostoen

    Jeffrey Bostoen - 2023-06-19

    You might be missing the definition of explicit "scopes" for your new class who can see it?

     
  • Davide Nardo

    Davide Nardo - 2023-06-19

    Ok so i was missing scopes in my new class, now i'm trying to play around with it, but it still seems i can't get the funcional ci to show. Following my class code:

    <?xml version="1.0" encoding="UTF-8"?>
    <itop_design xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0">
      <classes>
        <class id="CS_GxP" _delta="define">
          <parent>PhysicalDevice</parent>
            <scopes>
                <scope id="all">
                    <oql_view><![CDATA[SELECT CS_GxP AS CSGxP]]></oql_view>
                </scope>
            </scopes>
          <properties>
            <category>bizmodel,searchable</category>
            <abstract>false</abstract>
            <key_type>autoincrement</key_type>
            <db_table>cs_gxp</db_table>
            <db_key_field>id</db_key_field>
            <db_final_class_field/>
            <naming>
              <format>%1$s</format>
              <attributes>
                <attribute id="name"/>
              </attributes>
            </naming>
            <display_template/>
            <icon>images/monitor.png</icon>
            <reconciliation>
              <attributes>
                <attribute id="name"/>
                <attribute id="org_id"/>
                <attribute id="organization_name"/>
              </attributes>
            </reconciliation>
          </properties>
          <fields>
            <field id="dashboard" xsi:type="AttributeDashboard" _delta="define">
              <is_user_editable>true</is_user_editable>
              <!-- Use this default definition for creating a new dashboard -->
              <definition>
                <!-- Later replace the whole definition with the XML export -->
                <layout>DashboardLayoutOneCol</layout>
                <title/>
                <auto_reload>
                  <enabled>false</enabled>
                  <interval>300</interval>
                </auto_reload>
                <cells>
                  <cell id="0">
                    <rank>0</rank>
                    <dashlets>
                      <dashlet id="0" xsi:type="DashletEmptyCell">
                        <rank>0</rank>
                      </dashlet>
                    </dashlets>
                  </cell>
                </cells>
              </definition>
            </field>
    
            <field id="DIRA" xsi:type="AttributeEnum">
              <values>
                <value></value>
                <value>No</value>
                <value>On Going</value>
              </values>
              <sql>DIRA</sql>
              <default_value/>
              <is_null_allowed>false</is_null_allowed>
              <display_style>list</display_style>
            </field>
    
            <field id="GxP" xsi:type="AttributeEnum">
              <values>
                <value></value>
                <value>No</value>
                <value>On Going</value>
              </values>
              <sql>gxp</sql>
              <default_value/>
              <is_null_allowed>false</is_null_allowed>
              <display_style>list</display_style>
            </field>
    
            <field id="criticality" xsi:type="AttributeString">
              <sql>criticality</sql>
              <default_value/>
              <is_null_allowed>false</is_null_allowed>
            </field>
    
            <field id="motivo" xsi:type="AttributeString">
              <sql>motivo</sql>
              <default_value/>
              <is_null_allowed>false</is_null_allowed>
            </field>
    
             <field id="techplat" xsi:type="AttributeString">
              <sql>techplat</sql>
              <default_value/>
              <is_null_allowed>false</is_null_allowed>
            </field>
    
             <field id="OS" xsi:type="AttributeString">
              <sql>os</sql>
              <default_value/>
              <is_null_allowed>false</is_null_allowed>
            </field>
    
             <field id="shortdesc" xsi:type="AttributeString">
              <sql>shortdesc</sql>
              <default_value/>
              <is_null_allowed>false</is_null_allowed>
            </field>
    
             <field id="int_name" xsi:type="AttributeString">
              <sql>int_name</sql>
              <default_value/>
              <is_null_allowed>false</is_null_allowed>
            </field>
    
             <field id="int_vers" xsi:type="AttributeString">
              <sql>int_vers</sql>
              <default_value/>
              <is_null_allowed>false</is_null_allowed>
            </field>
    
             <field id="ext_name" xsi:type="AttributeString">
              <sql>ext_name_name</sql>
              <default_value/>
              <is_null_allowed>false</is_null_allowed>
            </field>
    
             <field id="ext_vers" xsi:type="AttributeString">
              <sql>ext_vers</sql>
              <default_value/>
              <is_null_allowed>false</is_null_allowed>
            </field>
    
             <field id="kt" xsi:type="AttributeString">
              <sql>kt</sql>
              <default_value/>
              <is_null_allowed>false</is_null_allowed>
            </field>
    
            <field id="pr_freq" xsi:type="AttributeEnum">
              <values>
                <value>On Going</value>
                <value>Sei Mesi</value>
                <value>Annuale</value>
                <value>Biennale</value>
                <value>Triennale</value>
              </values>
              <sql>pr_freq</sql>
              <default_value/>
              <is_null_allowed>false</is_null_allowed>
              <display_style>list</display_style>
            </field>
    
             <field id="pr_lastdate" xsi:type="AttributeDate">
              <sql>pr_lastdate</sql>
              <default_value/>
              <is_null_allowed>true</is_null_allowed>
            </field>
    
             <field id="loc_doc" xsi:type="AttributeString">
              <sql>loc_doc</sql>
              <default_value/>
              <is_null_allowed>false</is_null_allowed>
            </field>
    
             <field id="proc_own" xsi:type="AttributeString">
              <sql>proc_own</sql>
              <default_value/>
              <is_null_allowed>false</is_null_allowed>
            </field>
    
             <field id="cs_own" xsi:type="AttributeString">
              <sql>cs_own</sql>
              <default_value/>
              <is_null_allowed>false</is_null_allowed>
            </field>
    
             <field id="qa_ref" xsi:type="AttributeString">
              <sql>qa_ref</sql>
              <default_value/>
              <is_null_allowed>false</is_null_allowed>
            </field>
    
             <field id="ass_tech" xsi:type="AttributeString">
              <sql>ass_tech</sql>
              <default_value/>
              <is_null_allowed>false</is_null_allowed>
            </field>
    
             <field id="reg_date" xsi:type="AttributeDate">
              <sql>reg_date</sql>
              <default_value/>
              <is_null_allowed>false</is_null_allowed>
            </field>
          </fields>
          <methods/>
          <presentation>
            <details>
              <items>
                <item id="org_id">
                  <rank>10</rank>
                </item>
                <item id="name">
                  <rank>20</rank>
                </item>
                <item id="reg_date">
                  <rank>30</rank>
                </item>
                <item id="int_name">
                  <rank>40</rank>
                </item>
                <item id="int_vers">
                  <rank>50</rank>
                </item>
                <item id="brand_id">
                  <rank>60</rank>
                </item>
                <item id="ext_name">
                  <rank>70</rank>
                </item>
                <item id="ext_vers">
                  <rank>75</rank>
                </item>
                <item id="DIRA">
                  <rank>80</rank>
                </item>
                <item id="GxP">
                  <rank>90</rank>
                </item>
                <item id="criticality">
                  <rank>100</rank>
                </item>
                <item id="motivo">
                  <rank>110</rank>
                </item>
                <item id="shortdesc">
                  <rank>120</rank>
                </item>
                <item id="techplat">
                  <rank>130</rank>
                </item>
                <item id="OS">
                  <rank>140</rank>
                </item>
                <item id="location_id">
                  <rank>150</rank>
                </item>
                <item id="status">
                  <rank>160</rank>
                </item>
                <item id="kt">
                  <rank>170</rank>
                </item>
                <item id="pr_freq">
                  <rank>180</rank>
                </item>
                <item id="pr_lastdate">
                  <rank>190</rank>
                </item>
                <item id="loc_doc">
                  <rank>200</rank>
                </item>
                <item id="proc_own">
                  <rank>210</rank>
                </item>
                <item id="cs_own">
                  <rank>220</rank>
                </item>
                <item id="qa_ref">
                  <rank>230</rank>
                </item>
                <item id="ass_tech">
                  <rank>240</rank>
                </item>
              </items>
            </details>
            <search>
              <items>
                <item id="org_id">
                  <rank>10</rank>
                </item>
                <item id="name">
                  <rank>20</rank>
                </item>
                <item id="reg_date">
                  <rank>30</rank>
                </item>
                <item id="int_name">
                  <rank>40</rank>
                </item>
                <item id="int_vers">
                  <rank>50</rank>
                </item>
                <item id="brand_id">
                  <rank>60</rank>
                </item>
                <item id="ext_name">
                  <rank>70</rank>
                </item>
                <item id="ext_vers">
                  <rank>75</rank>
                </item>
                <item id="DIRA">
                  <rank>80</rank>
                </item>
                <item id="GxP">
                  <rank>90</rank>
                </item>
                <item id="criticality">
                  <rank>100</rank>
                </item>
                <item id="motivo">
                  <rank>110</rank>
                </item>
                <item id="shortdesc">
                  <rank>120</rank>
                </item>
                <item id="techplat">
                  <rank>130</rank>
                </item>
                <item id="OS">
                  <rank>140</rank>
                </item>
                <item id="location_id">
                  <rank>150</rank>
                </item>
                <item id="status">
                  <rank>160</rank>
                </item>
                <item id="kt">
                  <rank>170</rank>
                </item>
                <item id="pr_freq">
                  <rank>180</rank>
                </item>
                <item id="pr_lastdate">
                  <rank>190</rank>
                </item>
                <item id="loc_doc">
                  <rank>200</rank>
                </item>
                <item id="proc_own">
                  <rank>210</rank>
                </item>
                <item id="cs_own">
                  <rank>220</rank>
                </item>
                <item id="qa_ref">
                  <rank>230</rank>
                </item>
                <item id="ass_tech">
                  <rank>240</rank>
                </item>
              </items>
            </search>
            <list>
              <items>
                <item id="org_id">
                  <rank>10</rank>
                </item>
                <item id="name">
                  <rank>20</rank>
                </item>
                <item id="reg_date">
                  <rank>30</rank>
                </item>
                <item id="int_name">
                  <rank>40</rank>
                </item>
                <item id="int_vers">
                  <rank>50</rank>
                </item>
                <item id="brand_id">
                  <rank>60</rank>
                </item>
                <item id="ext_name">
                  <rank>70</rank>
                </item>
                <item id="ext_vers">
                  <rank>75</rank>
                </item>
                <item id="DIRA">
                  <rank>80</rank>
                </item>
                <item id="GxP">
                  <rank>90</rank>
                </item>
                <item id="criticality">
                  <rank>100</rank>
                </item>
                <item id="motivo">
                  <rank>110</rank>
                </item>
                <item id="shortdesc">
                  <rank>120</rank>
                </item>
                <item id="techplat">
                  <rank>130</rank>
                </item>
                <item id="OS">
                  <rank>140</rank>
                </item>
                <item id="location_id">
                  <rank>150</rank>
                </item>
                <item id="status">
                  <rank>160</rank>
                </item>
                <item id="kt">
                  <rank>170</rank>
                </item>
                <item id="pr_freq">
                  <rank>180</rank>
                </item>
                <item id="pr_lastdate">
                  <rank>190</rank>
                </item>
                <item id="loc_doc">
                  <rank>200</rank>
                </item>
                <item id="proc_own">
                  <rank>210</rank>
                </item>
                <item id="cs_own">
                  <rank>220</rank>
                </item>
                <item id="qa_ref">
                  <rank>230</rank>
                </item>
                <item id="ass_tech">
                  <rank>240</rank>
                </item>
              </items>
            </list>
          </presentation>
        </class>
      </classes>
    <menus>
    </menus>
    </itop_design>
    

    Maybe i'm missing something on the scope lines, idk, i let you know if i can make it work

     
  • Jeffrey Bostoen

    Jeffrey Bostoen - 2023-06-19

    Seems like you're defining the scopes in the wrong XML node.

    Check https://www.itophub.io/wiki/page?id=latest:customization:portal_xml

     
    • Davide Nardo

      Davide Nardo - 2023-06-20

      I have edited the first code i posted into a "Manage Brick", and i have added a scope, but it still doesn't seem to work:

      <?xml version="1.0" encoding="UTF-8"?>
      <itop_design xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  version="1.0">
        <module_designs>
          <module_design id="itop-portal" xsi:type="portal">
              <class id="CS_GxP">
              <scopes>
                  <scope id="all">
                      <oql_view><![CDATA[SELECT CS_GxP WHERE org_id = :current_contact->org_id]]></oql_view>
                      <ignore_silos>true</ignore_silos>
                  </scope>
                  <allowed_profiles>
                      <allowed_profile id ="Portal User"/>
                  </allowed_profiles>
              </scopes>
          </class>
            <bricks>
              <brick id="CS_GxP" xsi:type="Combodo\iTop\Portal\Brick\ManageBrick" _delta="define">
              <active>true</active>
              <rank>
                <default>20</default>
              </rank>
              <width>6</width>
              <title>
                <default>CS GxP</default>
              </title>
              <description>Inventario dei sistemi computerizzati GxP</description>
              <decoration_class>
                <default>fa fa-etsy fa-2x</default>
              </decoration_class>
              <oql><![CDATA[SELECT CS_GxP]]></oql>
              <!-- Optional tag to define if the action should be done in a modal window ("modal"), a new window ("new") or the current window ("self") -->
              <!--<opening_target>modal</opening_target>-->
              <!-- Optional tag to define the how the objects should be opened. Values can be edit|view. Note that even if this is set to edit, objects not allowed in edition mode for the user (cf. scopes and security layers) will open in view mode -->
              <!-- <opening_mode>edit</opening_mode> -->
              <!-- Can be either a class tag with the class name or an oql tag with the query -->
              <!-- <class>Ticket</class> -->
              <!-- Optional tag to add attributes to the table by their code -->
              <!-- Optional: display type can be 'pie-chart', 'bar-chart', 'list' -->
              <display_modes>
                <!-- How the data can be displayed in the ManageBrick -->
                <availables>
                  <mode id="list"/>
                  <mode id="pie-chart"/>
                  <mode id="bar-chart"/>
                </availables>
                <!-- How the ManageBrick get displayed by default when open -->
                <default>list</default>
                <!-- How the ManageBrick is displayed in the Homepage and in an AggregatePageBrick -->
                <!-- Possible values are text|badge|pie-chart|bar-chart|top-list -->
                <tile>badge</tile>
              </display_modes>
              <!-- Optional: way to define the export to Excel -->
              <export>
                <!-- Optional tag to export attributes by their code -->
                <!-- Optional way to tell that the export uses default fields -->
                <!-- <export_default_fields>true</export_default_fields> -->
              </export>
              <grouping>
                <!-- Mandatory -->
                <tabs>
                  <!-- Optional. Show object count for each tabs. Available values are true|false. Default is false. -->
                  <show_tab_counts>true</show_tab_counts>
                  <!-- Mandatory. Grouping by tabs -->
                  <attribute>org_id</attribute>
                  <!-- attribute xor groups tag -->
                  <!-- Optional way to limit the number of groups when grouping with attribute -->
                  <limit>5</limit>
                  <!-- Optional when limit given, display the aggregation of the remaining groups -->
                  <!-- <show_others>true</show_others> -->
                </tabs>
                <!-- Implicit grouping on y axis by finalclass -->
              </grouping>
              <data_loading>full</data_loading>
            </brick>
            </bricks>
          </module_design>
        </module_designs>
      </itop_design>
      

      Any new hint?

       
  • Davide Nardo

    Davide Nardo - 2023-06-22

    Ok i have managed to do it, i have deleted the extension and addedd all the code for the brick and the scope directly in the itop-portal datamodel

     
    • Jeffrey Bostoen

      Jeffrey Bostoen - 2023-06-22

      Bad idea. Not future proof, as you'll need to do it each time there's an iTop update.

      As for the hint: you're missing a _delta="define" again for your class/scopes.

       
      👍
      1

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.