<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<template match-pattern="icinga-(service-template|.+-service-problems)">
    <option>
            <parameter name="rowEvents">
                <parameter>
                    <parameter name="title">PNP4Nagios</parameter>
                    <parameter name="menuid">pnp4nagios</parameter>
                    <parameter name="items">
                        <parameter>
                            <parameter name="target">sub</parameter>

                            <parameter name="handler">
                                <parameter name="click">Cronk.grid.handler.URL.imagePanel</parameter>
                            </parameter>

                            <parameter name="handlerArguments">
                                <!-- Special params -->
                                <parameter name="src"><![CDATA[/pnp4nagios/image?host={host_name}&srv={service_name}&view=0]]></parameter>
                                <parameter name="iconCls">icinga-icon-image-arrow</parameter>
                                
                                <!-- All other are html attributes for the
                                image tag -->
                                <parameter name="width">400</parameter>
                                <parameter name="title">Servicegraph for {service_name}</parameter>
                            </parameter>
                            
                            <parameter name="conditions">
                                <parameter>
                                    <!-- Also possible: activation -->
                                    <parameter name="condition">show</parameter>
                                    <parameter name="fn"><![CDATA[
                                        function() {
                                            if (this.getRecord().get("process_performance_data") == "1") {
                                                return true;
                                            } else {
                                                return false;
                                            }
                                        }
                                    ]]></parameter>
                                </parameter>
                            </parameter>
                            
                            <parameter name="model"></parameter>

                            <parameter name="xtype">grideventbutton</parameter>
                            <parameter name="menuid">pnp4nagios_service_image_hover</parameter>
                            <parameter name="iconCls">icinga-icon-image-arrow</parameter>
                            <parameter name="tooltip">Service performance chart</parameter>
                            <parameter name="text">Graph</parameter>
                        </parameter>
                        
                        <parameter>
                            <parameter name="target">sub</parameter>

                            <parameter name="handler">
                                <parameter name="click">Cronk.grid.handler.URL.open</parameter>
                            </parameter>

                            <parameter name="handlerArguments">
                                <parameter name="cronkTitle">Chart for {host_name}/{service_name}</parameter>
                                <parameter name="url"><![CDATA[/pnp4nagios/index.php/graph?host={host_name}&srv={service_name}]]></parameter>
                                <parameter name="activateOnClick">true</parameter>
                            </parameter>
                            
                            <parameter name="conditions">
                                <parameter>
                                    <!-- Also possible: activation -->
                                    <parameter name="condition">show</parameter>
                                    <parameter name="fn"><![CDATA[
                                        function() {
                                            if (this.getRecord().get("process_performance_data") == "1") {
                                                return true;
                                            } else {
                                                return false;
                                            }
                                        }
                                    ]]></parameter>
                                </parameter>
                            </parameter>

                            <parameter name="model"></parameter>

                            <parameter name="xtype">grideventbutton</parameter>
                            <parameter name="menuid">pnp4nagios_service_detail</parameter>
                            <parameter name="iconCls">icinga-icon-hostlightning</parameter>
                            <parameter name="tooltip">Chart Detail for this service</parameter>
                            <parameter name="text">Detail</parameter>
                        </parameter>
                    </parameter>
                </parameter>
            </parameter>
    </option>
    <fields>
        <field name="process_performance_data">
            <datasource>
                <parameter name="field">SERVICE_PROCESS_PERFORMANCE_DATA</parameter>
            </datasource>
            <display>
                <parameter name="visible">false</parameter>
                <parameter name="label"></parameter>
            </display>

            <filter>
                <parameter name="enabled">false</parameter>
            </filter>

            <order>
                <parameter name="enabled">false</parameter>
                <parameter name="default">false</parameter>
            </order>
        </field>
    </fields>
</template>

