mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-31 01:35:36 +02:00
Service tree view with local scope parents
This commit is contained in:
parent
b2ea3d1d7a
commit
2ab1aa601c
@ -954,7 +954,7 @@ echo sprintf('<div id="header_table" class="header_table_%s">', $menuTypeClass);
|
|||||||
|
|
||||||
$("a.autorefresh").click (function () {
|
$("a.autorefresh").click (function () {
|
||||||
$("a.autorefresh_txt").toggle ();
|
$("a.autorefresh_txt").toggle ();
|
||||||
$("#combo_refr").toggle ();
|
$("#combo_refr").toggle();
|
||||||
$("select#ref").change (function () {
|
$("select#ref").change (function () {
|
||||||
href = $("a.autorefresh").attr ("href");
|
href = $("a.autorefresh").attr ("href");
|
||||||
|
|
||||||
|
@ -523,6 +523,8 @@ class TreeService extends Tree
|
|||||||
continue 2;
|
continue 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$tmp['parents'] = $item->service()->getAncestors();
|
||||||
|
$tmp['title'] = join('/', $tmp['parents']);
|
||||||
$tmp['id'] = (int) $item->service()->id();
|
$tmp['id'] = (int) $item->service()->id();
|
||||||
$tmp['name'] = $item->service()->name();
|
$tmp['name'] = $item->service()->name();
|
||||||
$tmp['alias'] = $item->service()->name();
|
$tmp['alias'] = $item->service()->name();
|
||||||
|
@ -5986,6 +5986,56 @@ function send_test_email(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return array of ancestors of item, given array.
|
||||||
|
*
|
||||||
|
* @param integer $item From index.
|
||||||
|
* @param array $data Array data.
|
||||||
|
* @param string $key Pivot key (identifies the parent).
|
||||||
|
* @param string|null $extract Extract certain column or index.
|
||||||
|
* @param array $visited Cycle detection.
|
||||||
|
*
|
||||||
|
* @return array Array of ancestors.
|
||||||
|
*/
|
||||||
|
function get_ancestors(
|
||||||
|
int $item,
|
||||||
|
array $data,
|
||||||
|
string $key,
|
||||||
|
?string $extract=null,
|
||||||
|
array &$visited=[]
|
||||||
|
) :array {
|
||||||
|
if (isset($visited[$item]) === true) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
$visited[$item] = 1;
|
||||||
|
|
||||||
|
if (isset($data[$item]) === false) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($data[$item][$key]) === false) {
|
||||||
|
if ($extract !== null) {
|
||||||
|
return [$data[$item][$extract]];
|
||||||
|
}
|
||||||
|
|
||||||
|
return [$item];
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($extract !== null) {
|
||||||
|
return array_merge(
|
||||||
|
get_ancestors($data[$item][$key], $data, $key, $extract, $visited),
|
||||||
|
[$data[$item][$extract]]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return array_merge(
|
||||||
|
get_ancestors($data[$item][$key], $data, $key, $extract, $visited),
|
||||||
|
[$item]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (function_exists('str_contains') === false) {
|
if (function_exists('str_contains') === false) {
|
||||||
|
|
||||||
|
|
||||||
|
@ -848,6 +848,7 @@ var TreeController = {
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
case "services":
|
case "services":
|
||||||
|
console.log(element);
|
||||||
if (
|
if (
|
||||||
typeof element.statusImageHTML != "undefined" &&
|
typeof element.statusImageHTML != "undefined" &&
|
||||||
element.statusImageHTML.length > 0
|
element.statusImageHTML.length > 0
|
||||||
@ -861,7 +862,7 @@ var TreeController = {
|
|||||||
'<span><img class="invert_filter" src="' +
|
'<span><img class="invert_filter" src="' +
|
||||||
(controller.baseURL.length > 0 ? controller.baseURL : "") +
|
(controller.baseURL.length > 0 ? controller.baseURL : "") +
|
||||||
'images/help.png" class="img_help" title="' +
|
'images/help.png" class="img_help" title="' +
|
||||||
element.name +
|
(element.title ? element.title : element.name) +
|
||||||
'" alt="' +
|
'" alt="' +
|
||||||
element.name +
|
element.name +
|
||||||
'"/></span> ';
|
'"/></span> ';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user