Commit 84db3b67036385ecb83d8ff01479f61b87499779

Authored by Nathanael Jourdane
1 parent 3c093c1c

Improve job tooltip for getTree

Showing 1 changed file with 28 additions and 3 deletions   Show diff stats
php/classes/AmdaAction.php
... ... @@ -102,6 +102,7 @@ class AmdaAction
102 102 $xmlName = SHAREDPATH.'/SharedObjectTree.xml';
103 103 break;
104 104 case 'bkgWorks':
  105 + // data/<user>/JOBS/jobs.xml
105 106 $xmlName = USERJOBDIR.$this->xmlFiles[$nodeType];
106 107 break;
107 108 case 'source':
... ... @@ -157,12 +158,34 @@ class AmdaAction
157 158 switch ($nodeType)
158 159 {
159 160 case 'bkgWorks':
  161 +// $fileSize = get USERJOBDIR. result_J9ixT5
160 162 $specialNode = true;
161 163 $status = $child->getAttribute('status');
162 164 // if ($status == 'done') continue;
163   - $childrenToReturn[] = array('text' => $name, 'id' => $id,'nodeType' => $nodeType, 'leaf' => $isLeaf,
164   - 'pid' => $child->getAttribute('pid'), 'status' => $status,
165   - 'jobType' => $child->getAttribute('jobType'), 'info' => $child->getAttribute('info'));
  165 + $res_dir = USERWORKINGDIR . $child->getAttribute('folder') . '/';
  166 + $fileSize = filesize ( $res_dir . $child->getAttribute('result') . '.xml');
  167 + $req = new DomDocument("1.0");
  168 + $req->load($res_dir . 'request_0.xml');
  169 + $ddStart = $req->getElementsByTagName('startTime')->item(0)->nodeValue;
  170 + $ddInterval = $req->getElementsByTagName('timeInterval')->item(0)->nodeValue;
  171 + $startTime = CommonClass::DDTimeToIso($ddStart);
  172 + $stopTime = CommonClass::DDStartIntervalToStopIso($ddStart, $ddInterval);
  173 +
  174 + $info = '<b>condition</b>: ' . $child->getAttribute('info') . '<br/>' .
  175 + '<b>start time</b>: ' . $startTime . '<br/>' .
  176 + '<b>stop time</b>: ' . $stopTime . '<br/>' .
  177 + '<b>file size</b>: ' . number_format(intval($fileSize)/1024, 1, '.', ' ') . 'kb';
  178 +
  179 + $childrenToReturn[] = [
  180 + 'text' => $name,
  181 + 'id' => $id,
  182 + 'nodeType' => $nodeType,
  183 + 'leaf' => $isLeaf,
  184 + 'pid' => $child->getAttribute('pid'),
  185 + 'status' => $status,
  186 + 'jobType' => $child->getAttribute('jobType'),
  187 + 'info' => $info
  188 + ];
166 189 break;
167 190  
168 191 case 'condition':
... ... @@ -568,6 +591,8 @@ class AmdaAction
568 591 {
569 592 $childrenToReturn = array('nodeType' => $nodeType, 'text' => null);
570 593 }
  594 +
  595 +// $childrenToReturn[count($childrenToReturn) - 1]['info'] = 'yolo';
571 596 }
572 597 return $childrenToReturn;
573 598 }
... ...