Private GIT

Skip to content
Snippets Groups Projects
Commit f0510b54 authored by Maximilien Bersoult's avatar Maximilien Bersoult
Browse files

* Filter the list of service template when add a graph template

parent bb31802d
No related merge requests found
......@@ -162,4 +162,30 @@ class ConfigGraphTemplateController extends FormController
{
parent::getSimpleRelation('svc_tmpl_id', '\CentreonConfiguration\Models\Servicetemplate');
}
/**
* Get the list of service template without graph template
*
* @method get
* @route /configuration/servicetemplate/withoutgraphtemplate
*/
public function getServiceTemplateWithoutGraphtemplateAction()
{
$dbconn = Di::getDefault()->get('db_centreon');
$router = Di::getDefault()->get('router');
$query = "SELECT service_id, service_description
FROM cfg_services
WHERE service_register = '0'
AND service_id NOT IN (SELECT svc_tmpl_id FROM cfg_graph_template)";
$stmt = $dbconn->prepare($query);
$stmt->execute();
$list = array();
while ($row = $stmt->fetch()) {
$list[] = array(
'id' => $row['service_id'],
'text' => $row['service_description']
);
}
$router->response()->json($list);
}
}
......@@ -9,7 +9,7 @@
<field name="svc_tmpl_id" label="Service Template" default_value="" advanced="0" type="select" parent_field="" mandatory="1">
<attributes>
<object_type>object</object_type>
<defaultValuesRoute>/centreon-configuration/servicetemplate/formlist</defaultValuesRoute>
<defaultValuesRoute>/centreon-performance/configuration/servicetemplate/withoutgraphtemplate</defaultValuesRoute>
<listValuesRoute>/centreon-performance/configuration/graphtemplate/[i:id]/servicetemplate</listValuesRoute>
<multiple>false</multiple>
</attributes>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment