Here is an example to specify the default filter for Visualizer on CI detail screen.
1.
Open cmdb_launch_visualizer.htmpl on WSP and find the following lines:
<PDM_LIST PREFIX="filter" FACTORY=vis_object_store_master
WHERE="(inactive=0) AND ((object_sub_type=0 OR object_sub_type=3) OR (object_sub_type=1 AND creation_user.userid IN '$cst.userid'))"
ORDER_BY="id ASC">
<option value="$filter.id">$filter.object_name</option>
</PDM_LIST>
</select>
<script type="text/javascript">
2. after the last line of above source code, add the following script.
function setdefault(fid)
{
for (i = 0; i < document.getElementById("CmdbVizLaunchFilterSelect").length; i++) {
filterId = document.getElementById("CmdbVizLaunchFilterSelect").options[i].value;
if (filterId == fid){ //find the Filter
document.getElementById("CmdbVizLaunchFilterSelect").selectedIndex = i;
break;
}
}
}
//set the default filter as Browse Filter
setdefault(1011);
3. Save and publish
To find the filterid for the filters, run the SQL below:
select id, object_name from vis_object_store_master;
By default, it should be:
1010 | Cause and Effect CIs |
1011 | Browse Filter |
1012 | Root Cause Analysis |
1013 | Impact Analysis |
1014 | Trace relation |
1015 | Shortest Path |