Add downtime flag into export results (#286)

This commit is contained in:
Kotove 2020-10-23 03:22:55 -04:00 committed by GitHub
parent 0ce7f2460f
commit 3cd3427e74
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View file

@ -562,7 +562,7 @@ class ProcessController extends Controller
case 'csv':
$csv = fopen('php://temp', 'w');
fputcsv($csv, ['Path', 'Name', 'State', 'Since']);
fputcsv($csv, ['Path', 'Name', 'State', 'Since', 'In_Downtime']);
foreach ($node !== null ? $node->toArray(null, true) : $bp->toArray(true) as $node) {
$data = [$node['path'], $node['name']];
@ -574,6 +574,10 @@ class ProcessController extends Controller
if (isset($node['since'])) {
$data[] = DateFormatter::formatDateTime($node['since']);
}
if (isset($node['in_downtime'])) {
$data[] = $node['in_downtime'];
}
fputcsv($csv, $data);
}

View file

@ -511,7 +511,8 @@ abstract class Node
$data = [
'name' => $this->getAlias(),
'state' => $this->getStateName(),
'since' => $this->getLastStateChange()
'since' => $this->getLastStateChange(),
'in_downtime' => $this->isInDowntime() ? true : false
];
if ($parent !== null) {