Merge branch 'ent-5886-Vista-para-mostrar-modulos-agentes-en-paradas-planificadas' into 'develop'
clean file planned_downtime pandora_enterprise#5886 See merge request artica/pandorafms!4688
This commit is contained in:
commit
09ba16c593
|
@ -1,27 +1,53 @@
|
|||
<?php
|
||||
/**
|
||||
* Planned downtimes list.
|
||||
*
|
||||
* @category Planned downtimes
|
||||
* @package Pandora FMS
|
||||
* @subpackage Community
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2005-2022 Artica Soluciones Tecnologicas
|
||||
* Please see http://pandorafms.org for full contribution list
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation for version 2.
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2021 Artica Soluciones Tecnologicas
|
||||
// Please see http://pandorafms.org for full contribution list
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation for version 2.
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
// Load global vars
|
||||
// Load global vars.
|
||||
global $config;
|
||||
|
||||
check_login();
|
||||
|
||||
$read_permisson = check_acl($config['id_user'], 0, 'AR');
|
||||
$write_permisson = check_acl($config['id_user'], 0, 'AD');
|
||||
$manage_permisson = check_acl($config['id_user'], 0, 'AW');
|
||||
$access = ($read_permisson == true) ? 'AR' : (($write_permisson == true) ? 'AD' : (($manage_permisson == true) ? 'AW' : 'AR'));
|
||||
$read_permisson = (bool) check_acl($config['id_user'], 0, 'AR');
|
||||
$write_permisson = (bool) check_acl($config['id_user'], 0, 'AD');
|
||||
$manage_permisson = (bool) check_acl($config['id_user'], 0, 'AW');
|
||||
$access = null;
|
||||
if ($read_permisson === true) {
|
||||
$access = 'AR';
|
||||
}
|
||||
|
||||
if (! $read_permisson && !$manage_permisson) {
|
||||
if ($write_permisson === true) {
|
||||
$access = 'AD';
|
||||
}
|
||||
|
||||
if ($manage_permisson === true) {
|
||||
$access = 'AW';
|
||||
}
|
||||
|
||||
if ($read_permisson === false && $manage_permisson === false) {
|
||||
db_pandora_audit(
|
||||
AUDIT_LOG_ACL_VIOLATION,
|
||||
'Trying to access downtime scheduler'
|
||||
|
@ -35,16 +61,109 @@ require_once 'include/functions_events.php';
|
|||
require_once 'include/functions_planned_downtimes.php';
|
||||
require_once 'include/functions_reporting.php';
|
||||
|
||||
$malformed_downtimes = planned_downtimes_get_malformed();
|
||||
$malformed_downtimes_exist = !empty($malformed_downtimes) ? true : false;
|
||||
if (is_ajax() === true) {
|
||||
$show_info_agents_modules_affected = (bool) get_parameter(
|
||||
'show_info_agents_modules_affected',
|
||||
false
|
||||
);
|
||||
|
||||
$get_info_agents_modules_affected = (bool) get_parameter(
|
||||
'get_info_agents_modules_affected',
|
||||
false
|
||||
);
|
||||
|
||||
if ($show_info_agents_modules_affected === true) {
|
||||
$id = (int) get_parameter('id', 0);
|
||||
|
||||
$columns = [
|
||||
'agent_name',
|
||||
'module_name',
|
||||
];
|
||||
|
||||
$column_names = [
|
||||
__('Agents'),
|
||||
__('Modules'),
|
||||
];
|
||||
|
||||
ui_print_datatable(
|
||||
[
|
||||
'id' => 'agent_modules_affected_planned_downtime',
|
||||
'class' => 'info_table',
|
||||
'style' => 'width: 100%',
|
||||
'columns' => $columns,
|
||||
'column_names' => $column_names,
|
||||
'ajax_url' => 'godmode/agentes/planned_downtime.list',
|
||||
'ajax_data' => [
|
||||
'get_info_agents_modules_affected' => 1,
|
||||
'id' => $id,
|
||||
],
|
||||
'order' => [
|
||||
'field' => 'agent_name',
|
||||
'direction' => 'asc',
|
||||
],
|
||||
'search_button_class' => 'sub filter float-right',
|
||||
'form' => [
|
||||
'inputs' => [
|
||||
[
|
||||
'label' => __('Agents'),
|
||||
'type' => 'text',
|
||||
'class' => 'w200px',
|
||||
'id' => 'filter_agents',
|
||||
'name' => 'filter_agents',
|
||||
],
|
||||
[
|
||||
'label' => __('Modules'),
|
||||
'type' => 'text',
|
||||
'class' => 'w200px',
|
||||
'id' => 'filter_modules',
|
||||
'name' => 'filter_modules',
|
||||
],
|
||||
],
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if ($get_info_agents_modules_affected === true) {
|
||||
$id = (int) get_parameter('id', 0);
|
||||
|
||||
// Catch post parameters.
|
||||
$options = [
|
||||
'limit' => get_parameter('start', 0),
|
||||
'offset' => get_parameter('length', $config['block_size']),
|
||||
'order' => get_datatable_order(),
|
||||
'filters' => get_parameter('filter', []),
|
||||
];
|
||||
|
||||
$modules = get_agents_modules_planned_dowtime($id, $options);
|
||||
$count = get_agents_modules_planned_dowtime($id, $options, $count);
|
||||
|
||||
echo json_encode(
|
||||
[
|
||||
'data' => $modules,
|
||||
'recordsTotal' => $count[0]['total'],
|
||||
'recordsFiltered' => $count[0]['total'],
|
||||
]
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$malformed_downtimes = planned_downtimes_get_malformed();
|
||||
$malformed_downtimes_exist = (empty($malformed_downtimes) === false) ? true : false;
|
||||
$migrate_malformed = (bool) get_parameter('migrate_malformed');
|
||||
if ($migrate_malformed) {
|
||||
if ($migrate_malformed === true) {
|
||||
$migration_result = planned_downtimes_migrate_malformed_downtimes();
|
||||
|
||||
if ($migration_result['status'] == false) {
|
||||
$str = 'An error occurred while migrating the malformed scheduled downtimes';
|
||||
$str2 = 'Please run the migration again or contact with the administrator';
|
||||
if ((bool) $migration_result['status'] === false) {
|
||||
ui_print_error_message(
|
||||
__('An error occurred while migrating the malformed scheduled downtimes').'. '.__('Please run the migration again or contact with the administrator')
|
||||
__($str).'. '.__($str2)
|
||||
);
|
||||
echo '<br>';
|
||||
}
|
||||
|
@ -63,12 +182,15 @@ ui_print_page_header(
|
|||
$id_downtime = (int) get_parameter('id_downtime', 0);
|
||||
|
||||
$stop_downtime = (bool) get_parameter('stop_downtime');
|
||||
// STOP DOWNTIME
|
||||
if ($stop_downtime) {
|
||||
// STOP DOWNTIME.
|
||||
if ($stop_downtime === true) {
|
||||
$downtime = db_get_row('tplanned_downtime', 'id', $id_downtime);
|
||||
|
||||
// Check AD permission on the downtime
|
||||
if (empty($downtime) || (! check_acl($config['id_user'], $downtime['id_group'], 'AD') && ! check_acl($config['id_user'], $downtime['id_group'], 'AW'))) {
|
||||
// Check AD permission on the downtime.
|
||||
if (empty($downtime) === true
|
||||
|| ((bool) check_acl($config['id_user'], $downtime['id_group'], 'AD') === false
|
||||
&& (bool) check_acl($config['id_user'], $downtime['id_group'], 'AW') === false)
|
||||
) {
|
||||
db_pandora_audit(
|
||||
AUDIT_LOG_ACL_VIOLATION,
|
||||
'Trying to access downtime scheduler'
|
||||
|
@ -80,7 +202,9 @@ if ($stop_downtime) {
|
|||
$result = planned_downtimes_stop($downtime);
|
||||
|
||||
if ($result === false) {
|
||||
ui_print_error_message(__('An error occurred stopping the scheduled downtime'));
|
||||
ui_print_error_message(
|
||||
__('An error occurred stopping the scheduled downtime')
|
||||
);
|
||||
} else {
|
||||
echo $result['message'];
|
||||
}
|
||||
|
@ -88,11 +212,14 @@ if ($stop_downtime) {
|
|||
|
||||
$delete_downtime = (int) get_parameter('delete_downtime');
|
||||
// DELETE WHOLE DOWNTIME!
|
||||
if ($delete_downtime) {
|
||||
if (empty($delete_downtime) === false) {
|
||||
$downtime = db_get_row('tplanned_downtime', 'id', $id_downtime);
|
||||
|
||||
// Check AD permission on the downtime
|
||||
if (empty($downtime) || (! check_acl($config['id_user'], $downtime['id_group'], 'AD') && ! check_acl($config['id_user'], $downtime['id_group'], 'AW'))) {
|
||||
// Check AD permission on the downtime.
|
||||
if (empty($downtime) === true
|
||||
|| ((bool) check_acl($config['id_user'], $downtime['id_group'], 'AD') === false
|
||||
&& (bool) check_acl($config['id_user'], $downtime['id_group'], 'AW') === false)
|
||||
) {
|
||||
db_pandora_audit(
|
||||
AUDIT_LOG_ACL_VIOLATION,
|
||||
'Trying to access downtime scheduler'
|
||||
|
@ -102,10 +229,13 @@ if ($delete_downtime) {
|
|||
}
|
||||
|
||||
// The downtime shouldn't be running!!
|
||||
if ($downtime['executed']) {
|
||||
if ((bool) $downtime['executed'] === true) {
|
||||
ui_print_error_message(__('This scheduled downtime is running'));
|
||||
} else {
|
||||
$result = db_process_sql_delete('tplanned_downtime', ['id' => $id_downtime]);
|
||||
$result = db_process_sql_delete(
|
||||
'tplanned_downtime',
|
||||
['id' => $id_downtime]
|
||||
);
|
||||
|
||||
ui_print_result_message(
|
||||
$result,
|
||||
|
@ -119,15 +249,25 @@ if ($delete_downtime) {
|
|||
$offset = (int) get_parameter('offset');
|
||||
$filter_params = [];
|
||||
|
||||
$search_text = $filter_params['search_text'] = (string) get_parameter('search_text');
|
||||
$date_from = $filter_params['date_from'] = (string) get_parameter('date_from');
|
||||
$date_to = $filter_params['date_to'] = (string) get_parameter('date_to');
|
||||
$execution_type = $filter_params['execution_type'] = (string) get_parameter('execution_type');
|
||||
$show_archived = $filter_params['archived'] = (bool) get_parameter('archived');
|
||||
$agent_id = $filter_params['agent_id'] = (int) get_parameter('agent_id');
|
||||
$agent_name = $filter_params['agent_name'] = (string) (!empty($agent_id) ? get_parameter('agent_name') : '');
|
||||
$module_id = $filter_params['module_id'] = (int) get_parameter('module_name_hidden');
|
||||
$module_name = $filter_params['module_name'] = (string) (!empty($module_id) ? get_parameter('module_name') : '');
|
||||
$search_text = (string) get_parameter('search_text');
|
||||
$date_from = (string) get_parameter('date_from');
|
||||
$date_to = (string) get_parameter('date_to');
|
||||
$execution_type = (string) get_parameter('execution_type');
|
||||
$show_archived = (bool) get_parameter('archived');
|
||||
$agent_id = (int) get_parameter('agent_id');
|
||||
$agent_name = (string) ((empty($agent_id) === false) ? get_parameter('agent_name') : '');
|
||||
$module_id = (int) get_parameter('module_name_hidden');
|
||||
$module_name = (string) ((empty($module_id) === false) ? get_parameter('module_name') : '');
|
||||
|
||||
$filter_params['search_text'] = $search_text;
|
||||
$filter_params['date_from'] = $date_from;
|
||||
$filter_params['date_to'] = $date_to;
|
||||
$filter_params['execution_type'] = $execution_type;
|
||||
$filter_params['archived'] = $show_archived;
|
||||
$filter_params['agent_id'] = $agent_id;
|
||||
$filter_params['agent_name'] = $agent_name;
|
||||
$filter_params['module_id'] = $module_id;
|
||||
$filter_params['module_name'] = $module_name;
|
||||
|
||||
$filter_params_str = http_build_query($filter_params);
|
||||
|
||||
|
@ -141,11 +281,32 @@ $table_form->data = [];
|
|||
$row = [];
|
||||
|
||||
// Search text.
|
||||
$row[] = __('Search').' '.html_print_input_text('search_text', $search_text, '', 50, 250, true);
|
||||
$row[] = __('Search').' '.html_print_input_text(
|
||||
'search_text',
|
||||
$search_text,
|
||||
'',
|
||||
50,
|
||||
250,
|
||||
true
|
||||
);
|
||||
// Dates.
|
||||
$date_inputs = __('From').' '.html_print_input_text('date_from', $date_from, '', 10, 10, true);
|
||||
$date_inputs = __('From').' '.html_print_input_text(
|
||||
'date_from',
|
||||
$date_from,
|
||||
'',
|
||||
10,
|
||||
10,
|
||||
true
|
||||
);
|
||||
$date_inputs .= ' ';
|
||||
$date_inputs .= __('To').' '.html_print_input_text('date_to', $date_to, '', 10, 10, true);
|
||||
$date_inputs .= __('To').' '.html_print_input_text(
|
||||
'date_to',
|
||||
$date_to,
|
||||
'',
|
||||
10,
|
||||
10,
|
||||
true
|
||||
);
|
||||
$row[] = $date_inputs;
|
||||
|
||||
$table_form->data[] = $row;
|
||||
|
@ -157,9 +318,24 @@ $execution_type_fields = [
|
|||
'once' => __('Once'),
|
||||
'periodically' => __('Periodically'),
|
||||
];
|
||||
$row[] = __('Execution type').' '.html_print_select($execution_type_fields, 'execution_type', $execution_type, '', __('Any'), '', true, false, false);
|
||||
$row[] = __('Execution type').' '.html_print_select(
|
||||
$execution_type_fields,
|
||||
'execution_type',
|
||||
$execution_type,
|
||||
'',
|
||||
__('Any'),
|
||||
'',
|
||||
true,
|
||||
false,
|
||||
false
|
||||
);
|
||||
// Show past downtimes.
|
||||
$row[] = __('Show past downtimes').' '.html_print_checkbox('archived', 1, $show_archived, true);
|
||||
$row[] = __('Show past downtimes').' '.html_print_checkbox(
|
||||
'archived',
|
||||
1,
|
||||
$show_archived,
|
||||
true
|
||||
);
|
||||
|
||||
$table_form->data[] = $row;
|
||||
|
||||
|
@ -178,48 +354,84 @@ $agent_input = __('Agent').' '.ui_print_agent_autocomplete_input($params);
|
|||
$row[] = $agent_input;
|
||||
|
||||
// Module.
|
||||
$row[] = __('Module').' '.html_print_autocomplete_modules('module_name', $module_name, false, true, '', [], true);
|
||||
$row[] = __('Module').' '.html_print_autocomplete_modules(
|
||||
'module_name',
|
||||
$module_name,
|
||||
false,
|
||||
true,
|
||||
'',
|
||||
[],
|
||||
true
|
||||
);
|
||||
|
||||
$row[] = html_print_submit_button(__('Search'), 'search', false, 'class="sub search"', true);
|
||||
$row[] = html_print_submit_button(
|
||||
__('Search'),
|
||||
'search',
|
||||
false,
|
||||
'class="sub search"',
|
||||
true
|
||||
);
|
||||
|
||||
$table_form->data[] = $row;
|
||||
// End of table filter.
|
||||
// Useful to know if the user has done a form filtering.
|
||||
$filter_performed = false;
|
||||
|
||||
$downtimes = [];
|
||||
$groups = users_get_groups(false, $access);
|
||||
if (!empty($groups)) {
|
||||
if (empty($groups) === false) {
|
||||
$where_values = '1=1';
|
||||
|
||||
$groups_string = implode(',', array_keys($groups));
|
||||
$where_values .= " AND id_group IN ($groups_string)";
|
||||
$where_values .= sprintf(' AND id_group IN (%s)', $groups_string);
|
||||
|
||||
// WARNING: add $filter_performed = true; to any future filter.
|
||||
if (!empty($search_text)) {
|
||||
if (empty($search_text) === false) {
|
||||
$filter_performed = true;
|
||||
|
||||
$where_values .= " AND (name LIKE '%$search_text%' OR description LIKE '%$search_text%')";
|
||||
$where_values .= sprintf(
|
||||
' AND (name LIKE "%%%s%%" OR description LIKE "%%%s%%")',
|
||||
$search_text,
|
||||
$search_text
|
||||
);
|
||||
}
|
||||
|
||||
if (!empty($execution_type)) {
|
||||
if (empty($execution_type) === false) {
|
||||
$filter_performed = true;
|
||||
|
||||
$where_values .= " AND type_execution = '$execution_type'";
|
||||
$where_values .= sprintf(' AND type_execution = "%s"', $execution_type);
|
||||
}
|
||||
|
||||
if (!empty($date_from)) {
|
||||
if (empty($date_from) === false) {
|
||||
$filter_performed = true;
|
||||
|
||||
$where_values .= " AND (type_execution = 'periodically' OR (type_execution = 'once' AND date_from >= '".strtotime("$date_from 00:00:00")."'))";
|
||||
$where_values .= sprintf(
|
||||
' AND (type_execution = "periodically"
|
||||
OR (type_execution = "once"
|
||||
AND date_from >= "%s")
|
||||
)',
|
||||
strtotime($date_from.' 00:00:00')
|
||||
);
|
||||
}
|
||||
|
||||
if (!empty($date_to)) {
|
||||
if (empty($date_to) === false) {
|
||||
$filter_performed = true;
|
||||
|
||||
$periodically_monthly_w = "type_periodicity = 'monthly'
|
||||
AND ((periodically_day_from <= '".date('d', strtotime($date_from))."' AND periodically_day_to >= '".date('d', strtotime($date_to))."')
|
||||
OR (periodically_day_from > periodically_day_to
|
||||
AND (periodically_day_from <= '".date('d', strtotime($date_from))."' OR periodically_day_to >= '".date('d', strtotime($date_to))."')))";
|
||||
$periodically_monthly_w = sprintf(
|
||||
'type_periodicity = "monthly" AND (
|
||||
(
|
||||
periodically_day_from <= "%s"
|
||||
AND periodically_day_to >= "%s"
|
||||
)
|
||||
OR (
|
||||
periodically_day_from > periodically_day_to
|
||||
AND (
|
||||
periodically_day_from <= "%s"
|
||||
OR periodically_day_to >= "%s"
|
||||
)
|
||||
)
|
||||
)',
|
||||
date('d', strtotime($date_from)),
|
||||
date('d', strtotime($date_to)),
|
||||
date('d', strtotime($date_from)),
|
||||
date('d', strtotime($date_to))
|
||||
);
|
||||
|
||||
$periodically_weekly_days = [];
|
||||
$date_from_aux = strtotime($date_from);
|
||||
|
@ -229,7 +441,7 @@ if (!empty($groups)) {
|
|||
while ($date_from_aux <= $date_end && $days_number < 7) {
|
||||
$weekday_actual = strtolower(date('l', $date_from_aux));
|
||||
|
||||
$periodically_weekly_days[] = "$weekday_actual = 1";
|
||||
$periodically_weekly_days[] = $weekday_actual.' = 1';
|
||||
|
||||
$date_from_aux = ($date_from_aux + SECONDS_1DAY);
|
||||
$days_number++;
|
||||
|
@ -237,36 +449,60 @@ if (!empty($groups)) {
|
|||
|
||||
$periodically_weekly_w = "type_periodicity = 'weekly' AND (".implode(' OR ', $periodically_weekly_days).')';
|
||||
|
||||
$periodically_w = "type_execution = 'periodically' AND (($periodically_monthly_w) OR ($periodically_weekly_w))";
|
||||
$periodically_w = sprintf(
|
||||
'type_execution = "periodically" AND ((%s) OR (%s))',
|
||||
$periodically_monthly_w,
|
||||
$periodically_weekly_w
|
||||
);
|
||||
|
||||
$once_w = "type_execution = 'once' AND date_to <= '".strtotime("$date_to 23:59:59")."'";
|
||||
$once_w = sprintf(
|
||||
'type_execution = "once" AND date_to <= "%s"',
|
||||
strtotime($date_to.' 23:59:59')
|
||||
);
|
||||
|
||||
$where_values .= " AND (($periodically_w) OR ($once_w))";
|
||||
$where_values .= sprintf(
|
||||
' AND ((%s) OR (%s))',
|
||||
$periodically_w,
|
||||
$once_w
|
||||
);
|
||||
}
|
||||
|
||||
if (!$show_archived) {
|
||||
if ($show_archived === false) {
|
||||
$filter_performed = true;
|
||||
|
||||
$where_values .= " AND (type_execution = 'periodically' OR (type_execution = 'once' AND date_to >= '".time()."'))";
|
||||
$where_values .= sprintf(
|
||||
' AND (type_execution = "periodically"
|
||||
OR (type_execution = "once"
|
||||
AND date_to >= "%s"))',
|
||||
time()
|
||||
);
|
||||
}
|
||||
|
||||
if (!empty($agent_id)) {
|
||||
if (empty($agent_id) === false) {
|
||||
$filter_performed = true;
|
||||
|
||||
$where_values .= " AND id IN (SELECT id_downtime FROM tplanned_downtime_agents WHERE id_agent = $agent_id)";
|
||||
$where_values .= sprintf(
|
||||
' AND id IN (SELECT id_downtime FROM tplanned_downtime_agents WHERE id_agent = %d)',
|
||||
$agent_id
|
||||
);
|
||||
}
|
||||
|
||||
if (!empty($module_id)) {
|
||||
if (empty($module_id) === false) {
|
||||
$filter_performed = true;
|
||||
|
||||
$where_values .= " AND (id IN (SELECT id_downtime
|
||||
FROM tplanned_downtime_modules
|
||||
WHERE id_agent_module = $module_id)
|
||||
OR id IN (SELECT id_downtime
|
||||
FROM tplanned_downtime_agents tpda, tagente_modulo tam
|
||||
WHERE tpda.id_agent = tam.id_agente
|
||||
AND tam.id_agente_modulo = $module_id
|
||||
AND tpda.all_modules = 1))";
|
||||
$where_values .= sprintf(
|
||||
' AND (id IN (
|
||||
SELECT id_downtime
|
||||
FROM tplanned_downtime_modules
|
||||
WHERE id_agent_module = %d)
|
||||
OR id IN (
|
||||
SELECT id_downtime
|
||||
FROM tplanned_downtime_agents tpda, tagente_modulo tam
|
||||
WHERE tpda.id_agent = tam.id_agente
|
||||
AND tam.id_agente_modulo = %d
|
||||
AND tpda.all_modules = 1
|
||||
)
|
||||
)',
|
||||
$module_id,
|
||||
$module_id
|
||||
);
|
||||
}
|
||||
|
||||
// Columns of the table tplanned_downtime.
|
||||
|
@ -296,68 +532,41 @@ if (!empty($groups)) {
|
|||
'id_user',
|
||||
];
|
||||
|
||||
switch ($config['dbtype']) {
|
||||
case 'mysql':
|
||||
case 'postgresql':
|
||||
$columns_str = implode(',', $columns);
|
||||
$sql = "SELECT $columns_str
|
||||
FROM tplanned_downtime
|
||||
WHERE $where_values
|
||||
ORDER BY type_execution DESC, date_from DESC
|
||||
LIMIT ".$config['block_size']."
|
||||
OFFSET $offset";
|
||||
break;
|
||||
$columns_str = implode(',', $columns);
|
||||
$sql = sprintf(
|
||||
'SELECT %s
|
||||
FROM tplanned_downtime
|
||||
WHERE %s
|
||||
ORDER BY type_execution DESC, date_from DESC
|
||||
LIMIT %d
|
||||
OFFSET %d',
|
||||
$columns_str,
|
||||
$where_values,
|
||||
$config['block_size'],
|
||||
$offset
|
||||
);
|
||||
|
||||
case 'oracle':
|
||||
// Oracle doesn't have TIME type, so we should transform the DATE value
|
||||
$new_time_from = "TO_CHAR(periodically_time_from, 'HH24:MI:SS') AS periodically_time_from";
|
||||
$new_time_to = "TO_CHAR(periodically_time_to, 'HH24:MI:SS') AS periodically_time_to";
|
||||
|
||||
$time_from_key = array_search('periodically_time_from', $columns);
|
||||
$time_to_key = array_search('periodically_time_to', $columns);
|
||||
|
||||
if ($time_from_key !== false) {
|
||||
$columns[$time_from_key] = $new_time_from;
|
||||
}
|
||||
|
||||
if ($time_to_key !== false) {
|
||||
$columns[$time_to_key] = $new_time_to;
|
||||
}
|
||||
|
||||
$columns_str = implode(',', $columns);
|
||||
|
||||
$set = [];
|
||||
$set['limit'] = $config['block_size'];
|
||||
$set['offset'] = $offset;
|
||||
|
||||
$sql = "SELECT $columns_str
|
||||
FROM tplanned_downtime
|
||||
WHERE $where_values
|
||||
ORDER BY type_execution DESC, date_from DESC";
|
||||
|
||||
$sql = oracle_recode_query($sql, $set);
|
||||
break;
|
||||
}
|
||||
|
||||
$sql_count = "SELECT COUNT(id) AS num
|
||||
FROM tplanned_downtime
|
||||
WHERE $where_values";
|
||||
$sql_count = sprintf(
|
||||
'SELECT COUNT(id) AS num
|
||||
FROM tplanned_downtime
|
||||
WHERE %s',
|
||||
$where_values
|
||||
);
|
||||
|
||||
$downtimes = db_get_all_rows_sql($sql);
|
||||
$downtimes_number_res = db_get_all_rows_sql($sql_count);
|
||||
$downtimes_number = $downtimes_number_res != false ? $downtimes_number_res[0]['num'] : 0;
|
||||
} else {
|
||||
$downtimes = [];
|
||||
$downtimes_number = ($downtimes_number_res !== false) ? $downtimes_number_res[0]['num'] : 0;
|
||||
}
|
||||
|
||||
$url_list = 'index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.list';
|
||||
$url_editor = 'index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.editor';
|
||||
// No downtimes cause the user has not anyone.
|
||||
if (!$downtimes && !$filter_performed) {
|
||||
if ($downtimes === false && $filter_performed === false) {
|
||||
include_once $config['homedir'].'/general/first_task/planned_downtime.php';
|
||||
}
|
||||
// No downtimes cause the user performed a search.
|
||||
else if (!$downtimes) {
|
||||
} else if ($downtimes === false) {
|
||||
// No downtimes cause the user performed a search.
|
||||
// Filter form.
|
||||
echo "<form method='post' action='index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.list'>";
|
||||
echo '<form method="post" action="'.$url_list.'">';
|
||||
html_print_table($table_form);
|
||||
echo '</form>';
|
||||
|
||||
|
@ -367,22 +576,25 @@ else if (!$downtimes) {
|
|||
echo '<div class="action-buttons w100p" >';
|
||||
|
||||
// Create button.
|
||||
if ($write_permisson) {
|
||||
if ($write_permisson === true) {
|
||||
echo ' ';
|
||||
echo '<form method="post" class="display_in" action="index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.editor">';
|
||||
echo '<form method="post" class="display_in" action="'.$url_editor.'">';
|
||||
html_print_submit_button(__('Create'), 'create', false, 'class="sub next"');
|
||||
echo '</form>';
|
||||
}
|
||||
|
||||
echo '</div>';
|
||||
}
|
||||
// Has downtimes.
|
||||
else {
|
||||
echo "<form method='post' action='index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.list'>";
|
||||
} else {
|
||||
// Has downtimes.
|
||||
echo '<form method="post" action="'.$url_list.'">';
|
||||
html_print_table($table_form);
|
||||
echo '</form>';
|
||||
|
||||
ui_pagination($downtimes_number, "index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.list&$filter_params_str", $offset);
|
||||
ui_pagination(
|
||||
$downtimes_number,
|
||||
$url_list.'&'.$filter_params_str,
|
||||
$offset
|
||||
);
|
||||
|
||||
// User groups with AR, AD or AW permission.
|
||||
$groupsAD = users_get_groups($config['id_user'], $access);
|
||||
|
@ -402,8 +614,11 @@ else {
|
|||
$table->head['execution'] = __('Execution');
|
||||
$table->head['configuration'] = __('Configuration');
|
||||
$table->head['running'] = __('Running');
|
||||
$table->head['agents_modules'] = __('Affected');
|
||||
|
||||
if ($write_permisson || $manage_permisson) {
|
||||
if ($write_permisson === true
|
||||
|| $manage_permisson === true
|
||||
) {
|
||||
$table->head['stop'] = __('Stop downtime');
|
||||
$table->head['copy'] = __('Copy');
|
||||
$table->head['edit'] = __('Edit');
|
||||
|
@ -414,7 +629,9 @@ else {
|
|||
$table->align['group'] = 'center';
|
||||
$table->align['running'] = 'center';
|
||||
|
||||
if ($write_permisson || $manage_permisson) {
|
||||
if ($write_permisson === true
|
||||
|| $manage_permisson === true
|
||||
) {
|
||||
$table->align['stop'] = 'center';
|
||||
$table->align['edit'] = 'center';
|
||||
$table->align['delete'] = 'center';
|
||||
|
@ -430,7 +647,7 @@ else {
|
|||
WHERE id_downtime = '.$downtime['id']
|
||||
);
|
||||
|
||||
$data['name'] = $downtime['name']." ($total)";
|
||||
$data['name'] = $downtime['name'].' ('.$total.')';
|
||||
$data['description'] = $downtime['description'];
|
||||
$data['group'] = ui_print_group_icon($downtime['id_group'], true);
|
||||
|
||||
|
@ -451,7 +668,7 @@ else {
|
|||
|
||||
$data['configuration'] = reporting_format_planned_downtime_dates($downtime);
|
||||
|
||||
if ($downtime['executed'] == 0) {
|
||||
if ((int) $downtime['executed'] === 0) {
|
||||
$data['running'] = html_print_image(
|
||||
'images/pixel_red.png',
|
||||
true,
|
||||
|
@ -473,44 +690,124 @@ else {
|
|||
);
|
||||
}
|
||||
|
||||
$settings = [
|
||||
'url' => ui_get_full_url('ajax.php', false, false, false),
|
||||
'loadingText' => __('Loading, this operation might take several minutes...'),
|
||||
'title' => __('Agents / Modules affected'),
|
||||
'id' => $downtime['id'],
|
||||
];
|
||||
|
||||
$data['agents_modules'] = '<a href="#" onclick=\'dialogAgentModulesAffected('.json_encode($settings).')\'>';
|
||||
$data['agents_modules'] .= html_print_image(
|
||||
'images/search_big.png',
|
||||
true,
|
||||
[
|
||||
'title' => __('Agents and modules affected'),
|
||||
'style' => 'width:22px; height: 22px;',
|
||||
]
|
||||
);
|
||||
$data['agents_modules'] .= '</a>';
|
||||
|
||||
// If user have writting permissions.
|
||||
if (in_array($downtime['id_group'], $groupsAD)) {
|
||||
// Stop button
|
||||
if ($downtime['type_execution'] == 'once' && $downtime['executed'] == 1) {
|
||||
if (check_acl_restricted_all($config['id_user'], $downtime['id_group'], 'AW')
|
||||
|| check_acl_restricted_all($config['id_user'], $downtime['id_group'], 'AD')
|
||||
if (in_array($downtime['id_group'], $groupsAD) === true) {
|
||||
// Stop button.
|
||||
if ($downtime['type_execution'] === 'once'
|
||||
&& (int) $downtime['executed'] === 1
|
||||
) {
|
||||
if ((bool) check_acl_restricted_all($config['id_user'], $downtime['id_group'], 'AW') === true
|
||||
|| (bool) check_acl_restricted_all($config['id_user'], $downtime['id_group'], 'AD') === true
|
||||
) {
|
||||
$data['stop'] = '<a href="index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.list'.'&stop_downtime=1&id_downtime='.$downtime['id'].'&'.$filter_params_str.'">'.html_print_image('images/cancel.png', true, ['title' => __('Stop downtime')]);
|
||||
$url_list_params = $url_list.'&stop_downtime=1&id_downtime='.$downtime['id'].'&'.$filter_params_str;
|
||||
$data['stop'] = '<a href="'.$url_list_params.'">';
|
||||
$data['stop'] .= html_print_image(
|
||||
'images/cancel.png',
|
||||
true,
|
||||
['title' => __('Stop downtime')]
|
||||
);
|
||||
} else {
|
||||
$data['stop'] = html_print_image('images/cancel.png', true, ['title' => __('Stop downtime')]);
|
||||
$data['stop'] = html_print_image(
|
||||
'images/cancel.png',
|
||||
true,
|
||||
['title' => __('Stop downtime')]
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$data['stop'] = '';
|
||||
}
|
||||
|
||||
// Edit & delete buttons.
|
||||
if ($downtime['executed'] == 0) {
|
||||
if (check_acl_restricted_all($config['id_user'], $downtime['id_group'], 'AW')
|
||||
|| check_acl_restricted_all($config['id_user'], $downtime['id_group'], 'AD')
|
||||
if ((int) $downtime['executed'] === 0) {
|
||||
if ((bool) check_acl_restricted_all($config['id_user'], $downtime['id_group'], 'AW') === true
|
||||
|| (bool) check_acl_restricted_all($config['id_user'], $downtime['id_group'], 'AD') === true
|
||||
) {
|
||||
// Copy.
|
||||
$data['copy'] = '<a href="index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.editor&downtime_copy=1&id_downtime='.$downtime['id'].'">'.html_print_image('images/copy.png', true, ['title' => __('Copy'), 'class' => 'invert_filter']).'</a>';
|
||||
$data['copy'] = '<a href="'.$url_editor.'&downtime_copy=1&id_downtime='.$downtime['id'].'">';
|
||||
$data['copy'] .= html_print_image(
|
||||
'images/copy.png',
|
||||
true,
|
||||
[
|
||||
'title' => __('Copy'),
|
||||
'class' => 'invert_filter',
|
||||
]
|
||||
);
|
||||
$data['copy'] .= '</a>';
|
||||
|
||||
// Edit.
|
||||
$data['edit'] = '<a href="index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.editor&edit_downtime=1&id_downtime='.$downtime['id'].'">'.html_print_image('images/config.png', true, ['title' => __('Update'), 'class' => 'invert_filter']).'</a>';
|
||||
$data['edit'] = '<a href="'.$url_editor.'&edit_downtime=1&id_downtime='.$downtime['id'].'">';
|
||||
$data['edit'] .= html_print_image(
|
||||
'images/config.png',
|
||||
true,
|
||||
[
|
||||
'title' => __('Update'),
|
||||
'class' => 'invert_filter',
|
||||
]
|
||||
);
|
||||
$data['edit'] .= '</a>';
|
||||
|
||||
// Delete.
|
||||
$data['delete'] = '<a id="delete_downtime" href="index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.list'.'&delete_downtime=1&id_downtime='.$downtime['id'].'&'.$filter_params_str.'">'.html_print_image('images/cross.png', true, ['title' => __('Delete'), 'class' => 'invert_filter']);
|
||||
$url_delete = $url_list.'&delete_downtime=1&id_downtime='.$downtime['id'].'&'.$filter_params_str;
|
||||
$data['delete'] = '<a id="delete_downtime" href="'.$url_delete.'">';
|
||||
$data['delete'] .= html_print_image(
|
||||
'images/cross.png',
|
||||
true,
|
||||
[
|
||||
'title' => __('Delete'),
|
||||
'class' => 'invert_filter',
|
||||
]
|
||||
);
|
||||
$data['delete'] .= '</a>';
|
||||
} else {
|
||||
$data['edit'] = '';
|
||||
$data['delete'] = '';
|
||||
}
|
||||
} else if ($downtime['executed'] == 1 && $downtime['type_execution'] == 'once') {
|
||||
if (check_acl_restricted_all($config['id_user'], $downtime['id_group'], 'AW')
|
||||
|| check_acl_restricted_all($config['id_user'], $downtime['id_group'], 'AD')
|
||||
} else if ((int) $downtime['executed'] === 1
|
||||
&& $downtime['type_execution'] === 'once'
|
||||
) {
|
||||
if ((bool) check_acl_restricted_all($config['id_user'], $downtime['id_group'], 'AW') === true
|
||||
|| (bool) check_acl_restricted_all($config['id_user'], $downtime['id_group'], 'AD') === true
|
||||
) {
|
||||
// Copy.
|
||||
$data['copy'] = '<a href="index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.editor&downtime_copy=1&id_downtime='.$downtime['id'].'">'.html_print_image('images/copy.png', true, ['title' => __('Copy'), 'class' => 'invert_filter']).'</a>';
|
||||
$data['copy'] = '<a href="'.$url_editor.'&downtime_copy=1&id_downtime='.$downtime['id'].'">';
|
||||
$data['copy'] .= html_print_image(
|
||||
'images/copy.png',
|
||||
true,
|
||||
[
|
||||
'title' => __('Copy'),
|
||||
'class' => 'invert_filter',
|
||||
]
|
||||
);
|
||||
$data['copy'] .= '</a>';
|
||||
// Edit.
|
||||
$data['edit'] = '<a href="index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.editor&edit_downtime=1&id_downtime='.$downtime['id'].'">'.html_print_image('images/config.png', true, ['title' => __('Update'), 'class' => 'invert_filter']).'</a>';
|
||||
$data['edit'] = '<a href="'.$url_editor.'&edit_downtime=1&id_downtime='.$downtime['id'].'">';
|
||||
$data['edit'] .= html_print_image(
|
||||
'images/config.png',
|
||||
true,
|
||||
[
|
||||
'title' => __('Update'),
|
||||
'class' => 'invert_filter',
|
||||
]
|
||||
);
|
||||
$data['edit'] .= '</a>';
|
||||
// Delete.
|
||||
$data['delete'] = __('N/A');
|
||||
} else {
|
||||
|
@ -529,7 +826,9 @@ else {
|
|||
$data['delete'] = '';
|
||||
}
|
||||
|
||||
if (!empty($malformed_downtimes_exist) && isset($malformed_downtimes[$downtime['id']])) {
|
||||
if (empty($malformed_downtimes_exist) === false
|
||||
&& isset($malformed_downtimes[$downtime['id']]) === true
|
||||
) {
|
||||
$next_row_num = count($table->data);
|
||||
$table->cellstyle[$next_row_num][0] = 'color: red';
|
||||
$table->cellstyle[$next_row_num][1] = 'color: red';
|
||||
|
@ -542,7 +841,17 @@ else {
|
|||
}
|
||||
|
||||
html_print_table($table);
|
||||
ui_pagination($downtimes_number, "index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.list&$filter_params_str", $offset, 0, false, 'offset', true, 'pagination-bottom');
|
||||
ui_pagination(
|
||||
$downtimes_number,
|
||||
$url_list.'&'.$filter_params_str,
|
||||
$offset,
|
||||
0,
|
||||
false,
|
||||
'offset',
|
||||
true,
|
||||
'pagination-bottom'
|
||||
);
|
||||
|
||||
echo '<div class="action-buttons" style="width: '.$table->width.'">';
|
||||
|
||||
// CSV export button.
|
||||
|
@ -551,32 +860,44 @@ else {
|
|||
__('Export to CSV'),
|
||||
'csv_export',
|
||||
false,
|
||||
"location.href='godmode/agentes/planned_downtime.export_csv.php?$filter_params_str'",
|
||||
'location.href="godmode/agentes/planned_downtime.export_csv.php?'.$filter_params_str.'"',
|
||||
'class="sub next"'
|
||||
);
|
||||
echo '</div>';
|
||||
|
||||
// Create button.
|
||||
if ($write_permisson) {
|
||||
if ($write_permisson === true) {
|
||||
echo ' ';
|
||||
echo '<form method="post" action="index.php?sec=extensions&sec2=godmode/agentes/planned_downtime.editor" class="display_in" >';
|
||||
html_print_submit_button(__('Create'), 'create', false, 'class="sub next"');
|
||||
echo '<form method="post" action="'.$url_editor.'" class="display_in" >';
|
||||
html_print_submit_button(
|
||||
__('Create'),
|
||||
'create',
|
||||
false,
|
||||
'class="sub next"'
|
||||
);
|
||||
echo '</form>';
|
||||
}
|
||||
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
ui_require_jquery_file('ui.datepicker-'.get_user_language(), 'include/javascript/i18n/');
|
||||
ui_require_jquery_file(
|
||||
'ui.datepicker-'.get_user_language(),
|
||||
'include/javascript/i18n/'
|
||||
);
|
||||
|
||||
ui_require_javascript_file('pandora_planned_downtimes');
|
||||
?>
|
||||
<script language="javascript" type="text/javascript">
|
||||
|
||||
$("input[name=module_name_hidden]").val(<?php echo (int) $module_id; ?>);
|
||||
|
||||
$(document).ready (function () {
|
||||
$("#text-date_from, #text-date_to").datepicker({dateFormat: "<?php echo DATE_FORMAT_JS; ?>"});
|
||||
$.datepicker.setDefaults($.datepicker.regional[ "<?php echo get_user_language(); ?>"]);
|
||||
$("#text-date_from, #text-date_to")
|
||||
.datepicker({dateFormat: "<?php echo DATE_FORMAT_JS; ?>"});
|
||||
|
||||
$.datepicker
|
||||
.setDefaults($.datepicker.regional[ "<?php echo get_user_language(); ?>"]);
|
||||
|
||||
$("a#delete_downtime").click(function (e) {
|
||||
if (!confirm("<?php echo __('WARNING: If you delete this scheduled downtime, it will not be taken into account in future SLA reports'); ?>")) {
|
||||
|
|
|
@ -989,7 +989,7 @@ function planned_downtimes_copy($id_downtime)
|
|||
foreach ($planned_modules as $planned_module) {
|
||||
// Unset id.
|
||||
unset($planned_module['id']);
|
||||
// Set id_planned downtime
|
||||
// Set id_planned downtime.
|
||||
$planned_module['id_downtime'] = $result['id_downtime'];
|
||||
$result['id_modules'][] = db_process_sql_insert(
|
||||
'tplanned_downtime_moduless',
|
||||
|
@ -1004,3 +1004,82 @@ function planned_downtimes_copy($id_downtime)
|
|||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get agentts and modules for planned_downtime.
|
||||
*
|
||||
* @param [type] $id Id planned.
|
||||
*
|
||||
* @return array Result array data.
|
||||
*/
|
||||
function get_agents_modules_planned_dowtime($id, $options, $count=false)
|
||||
{
|
||||
$result = [];
|
||||
|
||||
$filters_agent = '';
|
||||
if (isset($options['filters']['filter_agents']) === true
|
||||
&& empty($options['filters']['filter_agents']) === false
|
||||
) {
|
||||
$filters_agent = sprintf(
|
||||
' AND (tagente.alias LIKE "%%%s%%")',
|
||||
$options['filters']['filter_agents']
|
||||
);
|
||||
}
|
||||
|
||||
$filters_module = '';
|
||||
if (isset($options['filters']['filter_modules']) === true
|
||||
&& empty($options['filters']['filter_modules']) === false
|
||||
) {
|
||||
$filters_module = sprintf(
|
||||
' AND (tagente_modulo.nombre LIKE "%%%s%%")',
|
||||
$options['filters']['filter_modules']
|
||||
);
|
||||
}
|
||||
|
||||
if ($count === false) {
|
||||
$query = sprintf(
|
||||
'SELECT tplanned_downtime_modules.*,
|
||||
tagente.alias as agent_name,
|
||||
tagente_modulo.nombre as module_name
|
||||
FROM tplanned_downtime_modules
|
||||
INNER JOIN tagente
|
||||
ON tplanned_downtime_modules.id_agent = tagente.id_agente
|
||||
INNER JOIN tagente_modulo
|
||||
ON tplanned_downtime_modules.id_agent_module = tagente_modulo.id_agente_modulo
|
||||
WHERE id_downtime = %d
|
||||
%s
|
||||
%s
|
||||
ORDER BY %s
|
||||
LIMIT %d, %d',
|
||||
$id,
|
||||
$filters_agent,
|
||||
$filters_module,
|
||||
$options['order'],
|
||||
$options['limit'],
|
||||
$options['offset']
|
||||
);
|
||||
} else {
|
||||
$query = sprintf(
|
||||
'SELECT count(tplanned_downtime_modules.id) as total
|
||||
FROM tplanned_downtime_modules
|
||||
INNER JOIN tagente
|
||||
ON tplanned_downtime_modules.id_agent = tagente.id_agente
|
||||
INNER JOIN tagente_modulo
|
||||
ON tplanned_downtime_modules.id_agent_module = tagente_modulo.id_agente_modulo
|
||||
WHERE id_downtime = %d
|
||||
%s
|
||||
%s',
|
||||
$id,
|
||||
$filters_agent,
|
||||
$filters_module
|
||||
);
|
||||
}
|
||||
|
||||
$result = db_get_all_rows_sql($query);
|
||||
if ($result === false) {
|
||||
$result = [];
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
|
|
@ -3618,6 +3618,15 @@ function ui_print_datatable(array $parameters)
|
|||
ui_require_javascript_file('buttons.html5.min');
|
||||
ui_require_javascript_file('buttons.print.min');
|
||||
} else {
|
||||
// Load datatable.min.css.
|
||||
$output .= '<link rel="stylesheet" href="';
|
||||
$output .= ui_get_full_url(
|
||||
'include/styles/js/datatables.min.css',
|
||||
false,
|
||||
false,
|
||||
false
|
||||
);
|
||||
$output .= '"/>';
|
||||
// Load tables.css.
|
||||
$output .= '<link rel="stylesheet" href="';
|
||||
$output .= ui_get_full_url(
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
/* globals $, uniqId, confirmDialog*/
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
function dialogAgentModulesAffected(settings) {
|
||||
confirmDialog({
|
||||
title: settings.title,
|
||||
size: 500,
|
||||
message: function() {
|
||||
var id = "div-" + uniqId();
|
||||
var loading = settings.loadingText;
|
||||
$.ajax({
|
||||
method: "post",
|
||||
url: settings.url,
|
||||
data: {
|
||||
page: "godmode/agentes/planned_downtime.list",
|
||||
show_info_agents_modules_affected: 1,
|
||||
id: settings.id
|
||||
},
|
||||
dataType: "html",
|
||||
success: function(data) {
|
||||
$("#" + id)
|
||||
.empty()
|
||||
.append(data);
|
||||
},
|
||||
error: function(error) {
|
||||
console.error(error);
|
||||
}
|
||||
});
|
||||
|
||||
return "<div id ='" + id + "'>" + loading + "</div>";
|
||||
}
|
||||
});
|
||||
}
|
Loading…
Reference in New Issue