From 84db3b67036385ecb83d8ff01479f61b87499779 Mon Sep 17 00:00:00 2001 From: Nathanaƫl Jourdane Date: Wed, 7 Mar 2018 18:19:48 +0100 Subject: [PATCH] Improve job tooltip for getTree --- php/classes/AmdaAction.php | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/php/classes/AmdaAction.php b/php/classes/AmdaAction.php index cc0d8c5..a025dac 100644 --- a/php/classes/AmdaAction.php +++ b/php/classes/AmdaAction.php @@ -102,6 +102,7 @@ class AmdaAction $xmlName = SHAREDPATH.'/SharedObjectTree.xml'; break; case 'bkgWorks': + // data//JOBS/jobs.xml $xmlName = USERJOBDIR.$this->xmlFiles[$nodeType]; break; case 'source': @@ -157,12 +158,34 @@ class AmdaAction switch ($nodeType) { case 'bkgWorks': +// $fileSize = get USERJOBDIR. result_J9ixT5 $specialNode = true; $status = $child->getAttribute('status'); // if ($status == 'done') continue; - $childrenToReturn[] = array('text' => $name, 'id' => $id,'nodeType' => $nodeType, 'leaf' => $isLeaf, - 'pid' => $child->getAttribute('pid'), 'status' => $status, - 'jobType' => $child->getAttribute('jobType'), 'info' => $child->getAttribute('info')); + $res_dir = USERWORKINGDIR . $child->getAttribute('folder') . '/'; + $fileSize = filesize ( $res_dir . $child->getAttribute('result') . '.xml'); + $req = new DomDocument("1.0"); + $req->load($res_dir . 'request_0.xml'); + $ddStart = $req->getElementsByTagName('startTime')->item(0)->nodeValue; + $ddInterval = $req->getElementsByTagName('timeInterval')->item(0)->nodeValue; + $startTime = CommonClass::DDTimeToIso($ddStart); + $stopTime = CommonClass::DDStartIntervalToStopIso($ddStart, $ddInterval); + + $info = 'condition: ' . $child->getAttribute('info') . '
' . + 'start time: ' . $startTime . '
' . + 'stop time: ' . $stopTime . '
' . + 'file size: ' . number_format(intval($fileSize)/1024, 1, '.', ' ') . 'kb'; + + $childrenToReturn[] = [ + 'text' => $name, + 'id' => $id, + 'nodeType' => $nodeType, + 'leaf' => $isLeaf, + 'pid' => $child->getAttribute('pid'), + 'status' => $status, + 'jobType' => $child->getAttribute('jobType'), + 'info' => $info + ]; break; case 'condition': @@ -568,6 +591,8 @@ class AmdaAction { $childrenToReturn = array('nodeType' => $nodeType, 'text' => null); } + +// $childrenToReturn[count($childrenToReturn) - 1]['info'] = 'yolo'; } return $childrenToReturn; } -- libgit2 0.21.2