Skip to content
This repository has been archived by the owner on Dec 13, 2022. It is now read-only.

Commit

Permalink
enh(config): add checkbox to display/hide locked objects
Browse files Browse the repository at this point in the history
  • Loading branch information
cgagnaire authored and kduret committed Oct 3, 2019
1 parent 50c6b89 commit 425ebda
Show file tree
Hide file tree
Showing 13 changed files with 79 additions and 12 deletions.
5 changes: 4 additions & 1 deletion doc/en/configuration_guide/commands.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ All the commands can be configured in the menu: **Configuration > Commands**.
.. image :: /images/user/configuration/04commandlist.png
:align: center
.. note::
By default, locked commands are hidden. Check the "Display locked" box to list all commands.

****************
Adding a command
Expand Down Expand Up @@ -48,11 +50,12 @@ Configuration fields
* The **Command Type** field allows us to choose the type of command.
* The **Command Line** field indicates the application or the script use with the command.
* The **Enable shell** box allows us to enable functions that are specific to a shell such as the pipe, etc.
* The **Argument Example** and **$HOSTADDRESS$** fields define examples of arguments (each argument starts with a ”!”) and a test IP address respectively.
* The **Argument Example** and **$HOSTADDRESS$** fields define examples of arguments (each argument starts with a ”!”) and a test IP address respectively.
These fields serve to execute the command line defined above via the web interface by clicking on the blue arrow : |bluearrow|.
* The **Describe arguments** button serves to add a description to arguments of the “$ARGn$” type. This description will be visible when using the command in a host or service form.
* The **Clear arguments** button deletes the description of arguments defined
* The **Describe macros** button serves to add a description to all macros. This description will be visible when using the command in a host or service form.

* The **Connectors** field serves to link a Connector to the command. For more information on Connectors refer to the chapter entitled: `Perl Connector's documentation <http://documentation.centreon.com/docs/centreon-perl-connector/en/latest/>`_ and `SSH Connector's documentation <http://documentation.centreon.com/docs/centreon-ssh-connector/en/latest/>`_.
* The **Graph template** field serves to link the command to a graphic model.
* The **Comment** field can be used to make a comment on the command.
Expand Down
6 changes: 6 additions & 0 deletions doc/en/configuration_guide/models.rst
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ To add a host template:
.. note::
Refer to the chapter covering configuration of :ref:`hosts<hostconfiguration>` to configure a template because the form is identical.

.. note::
By default, locked host templates are hidden. Check the "Display locked" box to list all templates.

******************
Services Templates
******************
Expand All @@ -93,6 +96,9 @@ To add a Service Template:
.. note::
Refer to the chapter covering configuration of :ref:`services<serviceconfiguration>` to configure a template because the form is identical.

.. note::
By default, locked service templates are hidden. Check the "Display locked" box to list all templates.

*************
Best practice
*************
Expand Down
Binary file modified doc/en/images/user/configuration/04commandlist.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 9 additions & 3 deletions doc/fr/configuration_guide/commands.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,20 @@ Il est possible d'exécuter cette commande en précisant des arguments.

Il existe trois types de commandes :

* Les commandes de **vérification** sont utilisées par les ordonnanceurs afin de vérifier le statut d'un hôte ou d'un service.
* Les commandes de **vérification** sont utilisées par les ordonnanceurs afin de vérifier le statut d'un hôte ou d'un
service.
* Les commandes de **notification** sont utilisées par les ordonnanceurs pour alerter les contacts (via mail, SMS...).
* Des commandes **diverses** sont utilisées par les modules complémentaires (pour effectuer certaines actions), par l'ordonnanceur pour le traitement des données...
* Les commandes de **découverte** sont utilisées par les règles de découverte de services.
* Des commandes **diverses** sont utilisées par les modules complémentaires (pour effectuer certaines actions), par
l'ordonnanceur pour le traitement des données...

Toutes les commandes peuvent être configurées au sein du menu **Configuration > Commandes**.

.. image :: /images/guide_utilisateur/configuration/04commandlist.png
:align: center
:align: center
.. note::
Par défaut, les commandes verrouillées sont masquées. Cocher la case "Afficher verrouillé" pour les afficher toutes.

********************
Ajouter une commande
Expand Down
6 changes: 6 additions & 0 deletions doc/fr/configuration_guide/models.rst
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ Pour ajouter un modèle d'hôtes :
.. note::
Se rapporter au chapitre de configuration des :ref:`hôtes<hostconfiguration>` pour configurer un modèle car le formulaire est identique.

.. note::
Par défaut, les modèles d'hôte verrouillés sont masqués. Cocher la case "Afficher verrouillé" pour les afficher tous.

***********************
Les modèles de services
***********************
Expand Down Expand Up @@ -128,6 +131,9 @@ Configuration

La liaison des modèles de services avec les modèles d'hôtes a lieu dans l'onglet **Relations** des modèles de services ou des modèles d'hôtes.

.. note::
Par défaut, les modèles de service verrouillés sont masqués. Cocher la case "Afficher verrouillé" pour les afficher tous.

***********************
Les modèles de contacts
***********************
Expand Down
Binary file modified doc/fr/images/guide_utilisateur/configuration/04commandlist.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions lang/fr_FR.UTF-8/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -14798,3 +14798,6 @@ msgstr "Filtrer par groupe de services"

msgid "Chart"
msgstr "Graphiques"

msgid "Display locked"
msgstr "Afficher verrouillé"
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
</tr>
<tr>
<td><input type="text" name="searchC" value="{$searchC}"></td>
<td>{$form.Search.html}</td>
<td class="checkbox"><input type='checkbox' name='displayLocked' {$displayLockedChecked}/> <h4>{$displayLocked}</h4></td>
<td><input type="submit" value="{t}Search{/t}" class="btc bt_success"></td>
</tr>
</tbody>
</table>
Expand Down
19 changes: 16 additions & 3 deletions www/include/configuration/configObject/command/listCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,20 @@
// the four pages have the same $url, so we need to distinguish each page using its $type,
// and to save the four search filters.
$centreon->historySearch[$url]['search' . $type] = $search;
isset($_POST["displayLocked"]) ? $displayLocked = 1 : $displayLocked = 0;
$centreon->historySearch[$url]["displayLocked" . $type] = $displayLocked;
} else {
//restoring user's search field value
$search = $centreon->historySearch[$url]['search' . $type] ?? null;
$displayLocked = $centreon->historySearch[$url]["displayLocked" . $type] ?? 0;
}

// Locked Filter
$displayLockedChecked = "";
$sqlFilter = "AND command_locked = '0'";
if ($displayLocked == 1) {
$displayLockedChecked = "checked";
$sqlFilter = "";
}


Expand All @@ -84,11 +95,11 @@
if (isset($search) && $search) {
$rq = "SELECT SQL_CALC_FOUND_ROWS `command_id`, `command_name`, `command_line`, `command_type`, " .
"`command_activate` FROM `command` WHERE `command_name` LIKE '%" . $search . "%' " .
$type_str . " ORDER BY `command_name` LIMIT " . $num * $limit . ", " . $limit;
$type_str . " " . $sqlFilter . " ORDER BY `command_name` LIMIT " . $num * $limit . ", " . $limit;
} elseif ($type) {
$rq = "SELECT SQL_CALC_FOUND_ROWS `command_id`, `command_name`, `command_line`, `command_type`, " .
"`command_activate` FROM `command` WHERE `command_type` = '" . $type .
"' ORDER BY command_name LIMIT " . $num * $limit . ", " . $limit;
"`command_activate` FROM `command` WHERE `command_type` = '" . $type . "' " . $sqlFilter .
" ORDER BY command_name LIMIT " . $num * $limit . ", " . $limit;
} else {
$rq = "SELECT SQL_CALC_FOUND_ROWS `command_id`, `command_name`, `command_line`, `command_type`, " .
"`command_activate` FROM `command` ORDER BY `command_name` LIMIT " . $num * $limit . ", " . $limit;
Expand Down Expand Up @@ -253,5 +264,7 @@ function setO(_i) {
$tpl->assign('limit', $limit);
$tpl->assign('type', $type);
$tpl->assign('searchC', $search);
$tpl->assign("displayLockedChecked", $displayLockedChecked);
$tpl->assign('displayLocked', _("Display locked"));

$tpl->display("listCommand.ihtml");
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
</tr>
<tr>
<td><input type="text" name="searchHT" value="{$searchHT}"></td>
<td>{$form.Search.html}</td>
<td class="checkbox"><input type='checkbox' name='displayLocked' {$displayLockedChecked}/> <h4>{$displayLocked}</h4></td>
<td><input type='submit' value='{t}Search{/t}' class="btc bt_success"/></td>
</tr>
</tbody>
</table>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,27 @@
//saving filters values
$centreon->historySearch[$url] = array();
$centreon->historySearch[$url]['search'] = $search;
isset($_POST["displayLocked"]) ? $displayLocked = 1 : $displayLocked = 0;
$centreon->historySearch[$url]["displayLocked"] = $displayLocked;
} else {
//restoring saved values
$search = $centreon->historySearch[$url]['search'] ?? null;
$displayLocked = $centreon->historySearch[$url]["displayLocked"] ?? 0;
}

// Locked Filter
$displayLockedChecked = "";
$sqlFilter = "AND host_locked = '0'";
if ($displayLocked == 1) {
$displayLockedChecked = "checked";
$sqlFilter = "";
}

// Host Template list

$rq = "SELECT SQL_CALC_FOUND_ROWS host_id, host_name, host_alias, host_activate, host_template_model_htm_id " .
"FROM host" .
" WHERE host_register = '0' ";
" WHERE host_register = '0' " . $sqlFilter . " ";
if ($search) {
$rq .= "AND (host_name LIKE '%" . CentreonDB::escape($search) . "%' OR host_alias LIKE '%" .
CentreonDB::escape($search) . "%')";
Expand Down Expand Up @@ -252,4 +263,6 @@ function setO(_i) {
$form->accept($renderer);
$tpl->assign('form', $renderer->toArray());
$tpl->assign('searchHT', $search);
$tpl->assign("displayLockedChecked", $displayLockedChecked);
$tpl->assign('displayLocked', _("Display locked"));
$tpl->display("listHostTemplateModel.ihtml");
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
</tr>
<tr>
<td><input type="text" name="searchST" value="{$searchST}"></td>
<td>{$form.Search.html}</td>
<td class="checkbox"><input type='checkbox' name='displayLocked' {$displayLockedChecked}/> <h4>
{$displayLocked}</h4></td>
<td><input type="submit" value="{t}Search{/t}" class="btc bt_success"></td>
</tr>
</tbody>
</table>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,20 @@
//saving filters values
$centreon->historySearch[$url] = array();
$centreon->historySearch[$url]["search"] = $search;
isset($_POST["displayLocked"]) ? $displayLocked = 1 : $displayLocked = 0;
$centreon->historySearch[$url]["displayLocked"] = $displayLocked;
} else {
//restoring saved values
$search = $centreon->historySearch[$url]["search"] ?? null;
$displayLocked = $centreon->historySearch[$url]["displayLocked"] ?? 0;
}

// Locked Filter
$displayLockedChecked = "";
$sqlFilter = "AND sv.service_locked = '0'";
if ($displayLocked == 1) {
$displayLockedChecked = "checked";
$sqlFilter = "";
}

//Service Template Model list
Expand All @@ -68,7 +79,7 @@
"sv.service_activate, sv.service_template_model_stm_id " .
"FROM service sv " .
"WHERE (sv.service_description LIKE '%" . $search . "%' OR sv.service_alias LIKE '%" . $search . "%') " .
"AND sv.service_register = '0' " .
"AND sv.service_register = '0' " . $sqlFilter . " " .
"ORDER BY service_description LIMIT " . $num * $limit . ", " . $limit;
} else {
$query = "SELECT SQL_CALC_FOUND_ROWS sv.service_id, sv.service_description, sv.service_alias, " .
Expand Down Expand Up @@ -319,6 +330,8 @@ function setO(_i) {

$tpl->assign('limit', $limit);
$tpl->assign('searchST', $search);
$tpl->assign("displayLockedChecked", $displayLockedChecked);
$tpl->assign('displayLocked', _("Display locked"));

// Apply a template definition
$renderer = new HTML_QuickForm_Renderer_ArraySmarty($tpl);
Expand Down

0 comments on commit 425ebda

Please sign in to comment.