Commit 38170a0a0339b255c673547af28a716755f3f62d

Authored by Myriam Bouchemit
2 parents 4a6532e3 c1b60a07

Merge branch 'master' of https://gitlab.irap.omp.eu/CDPP/AMDA_IHM

js/app/views/TableDefPlugUI.js
... ... @@ -30,6 +30,8 @@ Ext.define('amdaUI.TableDefPlugUI', {
30 30  
31 31 tableDefTypeCombo: null,
32 32 channelsDefTypeCombo: null,
  33 + nameField: null,
  34 + unitsField: null,
33 35 defMainPanel: null,
34 36  
35 37 manualDefGrid: null,
... ... @@ -102,6 +104,16 @@ Ext.define('amdaUI.TableDefPlugUI', {
102 104 }
103 105 }
104 106 });
  107 +
  108 + this.nameField = Ext.create('Ext.form.field.Text',{
  109 + fieldLabel: 'Table name',
  110 + name: 'name'
  111 + });
  112 +
  113 + this.unitsField = Ext.create('Ext.form.field.Text',{
  114 + fieldLabel: 'Table units',
  115 + name: 'units'
  116 + });
105 117  
106 118 this.defMainPanel = Ext.create('Ext.form.Panel', {
107 119 border: false, frame: true, plain: true,
... ... @@ -177,6 +189,8 @@ Ext.define('amdaUI.TableDefPlugUI', {
177 189 items: [
178 190 this.tableDefTypeCombo,
179 191 this.channelsDefTypeCombo,
  192 + this.nameField,
  193 + this.unitsField,
180 194 this.defMainPanel
181 195 ]
182 196 };
... ... @@ -420,6 +434,8 @@ Ext.define('amdaUI.TableDefPlugUI', {
420 434 var obj = {
421 435 'tableDefType' : this.tableDefTypeCombo.getValue(),
422 436 'channelsDefType' : this.channelsDefTypeCombo.getValue(),
  437 + 'tableName' : this.nameField.getValue(),
  438 + 'tableUnits' : this.unitsField.getValue(),
423 439 'data' : {}
424 440 };
425 441  
... ... @@ -458,6 +474,8 @@ Ext.define('amdaUI.TableDefPlugUI', {
458 474 {
459 475 this.tableDefTypeCombo.setValue(tableDef['tableDefType']);
460 476 this.channelsDefTypeCombo.setValue(tableDef['channelsDefType']);
  477 + this.nameField.setValue(tableDef['tableName']);
  478 + this.unitsField.setValue(tableDef['tableUnits']);
461 479 this.selectTableDefType(tableDef['tableDefType']);
462 480 this.loadManualGridData(tableDef['channelsDefType'], tableDef['data']);
463 481 this.loadSelectData(tableDef['data']);
... ...
php/classes/AmdaAction.php
... ... @@ -892,8 +892,12 @@ class AmdaAction
892 892 }
893 893 else {
894 894 // check disk space
895   - if ($dd->getWsSize() > DISK_QUOTA)
896   - return array('success' => false, 'message' => 'Please clean up your workspace.<br/>No more space is available');
  895 + if ($dd->getWsSize() > DISK_QUOTA) {
  896 + //Try to delete log files - cf. #6245
  897 + if ($dd->getWsSize(TRUE) > DISK_QUOTA) {
  898 + return array('success' => false, 'message' => 'Please clean up your workspace.<br/>No more space is available');
  899 + }
  900 + }
897 901 }
898 902  
899 903 $this->user = $dd->user;
... ...
php/classes/DerivedParamMgr.php
... ... @@ -203,6 +203,8 @@ class DerivedParamMgr extends AmdaObjectMgr
203 203 //add definition
204 204 $tableNode->setAttribute('tableDefType', $p->tableDef->tableDefType);
205 205 $tableNode->setAttribute('channelsDefType', $p->tableDef->channelsDefType);
  206 + $tableNode->setAttribute('tableName', $p->tableDef->tableName);
  207 + $tableNode->setAttribute('tableUnits', $p->tableDef->tableUnits);
206 208 if (isset($p->tableDef->data))
207 209 {
208 210 foreach ($p->tableDef->data as $key => $value)
... ... @@ -329,13 +331,15 @@ class DerivedParamMgr extends AmdaObjectMgr
329 331 //load table definition
330 332 $tableDefType = $attribute->getAttribute('tableDefType');
331 333 $channelsDefType = $attribute->getAttribute('channelsDefType');
  334 + $tableName = $attribute->getAttribute('tableName');
  335 + $tableUnits = $attribute->getAttribute('tableUnits');
332 336 $tableData = array();
333 337 foreach ($attribute->childNodes as $tableDataNode)
334 338 {
335 339 if ($tableDataNode->nodeType != XML_ELEMENT_NODE) continue;
336 340 $tableData[$tableDataNode->tagName] = $tableDataNode->nodeValue;
337 341 }
338   - $attributesToReturn[$attribute->tagName] = array('tableDefType' => $tableDefType, 'channelsDefType' => $channelsDefType, 'data' => $tableData);
  342 + $attributesToReturn[$attribute->tagName] = array('tableDefType' => $tableDefType, 'channelsDefType' => $channelsDefType, 'tableName' => $tableName, 'tableUnits' => $tableUnits, 'data' => $tableData);
339 343 }
340 344 else $attributesToReturn[$attribute->tagName] = $attribute->nodeValue;
341 345 }
... ...
php/classes/UserMgr.php
... ... @@ -661,28 +661,41 @@ class UserMgr
661 661 return $xml->save($file);
662 662 }
663 663  
664   - public function dirSize($dir)
  664 + public function dirSize($dir, $files_to_delete = array())
665 665 {
666 666 $handle = opendir($dir);
667 667  
668 668 $mas = 0;
669 669 while ($file = readdir($handle)) {
670 670 if ($file != '..' && $file != '.' && !is_dir($dir.'/'.$file)) {
  671 + if (in_array($file, $files_to_delete)) {
  672 + unlink($dir.'/'.$file);
  673 + continue;
  674 + }
671 675 $mas += filesize($dir.'/'.$file);
672 676 }
673 677 else if (is_dir($dir.'/'.$file) && $file != '..' && $file != '.') {
674   - $mas += $this->dirSize($dir.'/'.$file);
  678 + $mas += $this->dirSize($dir.'/'.$file, $files_to_delete);
675 679 }
676 680 }
677 681 return $mas;
678 682 }
679 683  
680   - public function getWsSize()
  684 + public function getWsSize($delete_log_files = FALSE)
681 685 {
682 686 $dirsToCheck = array(USERDATADIR, USERTTDIR, USERWORKINGDIR);
683 687 $wsSize = 0;
  688 + if ($delete_log_files) {
  689 + $files_to_delete = array(
  690 + 'example.log',
  691 + 'cmd_output',
  692 + );
  693 + }
  694 + else {
  695 + $files_to_delete = array();
  696 + }
684 697 foreach ($dirsToCheck as $dir)
685   - if (is_dir($dir)) $wsSize += $this->dirSize($dir);
  698 + if (is_dir($dir)) $wsSize += $this->dirSize($dir, $files_to_delete);
686 699  
687 700 return $wsSize;
688 701 }
... ...
php/my_config.template.php
... ... @@ -15,7 +15,7 @@ define(&#39;DDSERVICE&#39;, &#39;{:DDSERVICE:}&#39;);
15 15 // User apache
16 16 define('APACHE_USER', '{:APACHE_USER:}');
17 17 // Alias for name of AMDA
18   -define('APACHE_ALIAS', '{:APACHE_ALIAS:}');
  18 +define('APACHE_ALIAS', '{:APACHE_ALIAS:}'); // APACHE_ALIAS with TWO slashes "/AMDA/" or ONE slash "/"
19 19 //email to send errors from AmdaUpdate/AmdaInstall
20 20 define('email', '{:email:}');
21 21 //IHM title
... ...