airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From scnakand...@apache.org
Subject [1/3] airavata-php-gateway git commit: implementing add storage resource preference
Date Mon, 14 Dec 2015 18:56:07 GMT
Repository: airavata-php-gateway
Updated Branches:
  refs/heads/master 0048a8cae -> 281591ebf


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/281591eb/app/libraries/Airavata/Model/Data/Resource/Types.php
----------------------------------------------------------------------
diff --git a/app/libraries/Airavata/Model/Data/Resource/Types.php b/app/libraries/Airavata/Model/Data/Resource/Types.php
index f0cf287..84e6c9c 100644
--- a/app/libraries/Airavata/Model/Data/Resource/Types.php
+++ b/app/libraries/Airavata/Model/Data/Resource/Types.php
@@ -17,6 +17,28 @@ use Thrift\Protocol\TBinaryProtocolAccelerated;
 use Thrift\Exception\TApplicationException;
 
 
+final class ReplicaLocationCategory {
+  const GATEWAY_DATA_STORE = 0;
+  const COMPUTE_RESOURCE = 1;
+  const LONG_TERM_STORAGE_RESOURCE = 2;
+  const OTHER = 3;
+  static public $__names = array(
+    0 => 'GATEWAY_DATA_STORE',
+    1 => 'COMPUTE_RESOURCE',
+    2 => 'LONG_TERM_STORAGE_RESOURCE',
+    3 => 'OTHER',
+  );
+}
+
+final class ReplicaPersistentType {
+  const TRANSIENT = 0;
+  const PERSISTENT = 1;
+  static public $__names = array(
+    0 => 'TRANSIENT',
+    1 => 'PERSISTENT',
+  );
+}
+
 class DataResourceModel {
   static $_TSPEC;
 
@@ -27,6 +49,10 @@ class DataResourceModel {
   /**
    * @var string
    */
+  public $gatewayId = null;
+  /**
+   * @var string
+   */
   public $resourceName = null;
   /**
    * @var string
@@ -48,6 +74,14 @@ class DataResourceModel {
    * @var int
    */
   public $lastModifiedTime = null;
+  /**
+   * @var array
+   */
+  public $resourceMetadata = null;
+  /**
+   * @var \Airavata\Model\Data\Resource\DataReplicaLocationModel[]
+   */
+  public $dataReplicaLocations = null;
 
   public function __construct($vals=null) {
     if (!isset(self::$_TSPEC)) {
@@ -57,35 +91,63 @@ class DataResourceModel {
           'type' => TType::STRING,
           ),
         2 => array(
-          'var' => 'resourceName',
+          'var' => 'gatewayId',
           'type' => TType::STRING,
           ),
         3 => array(
-          'var' => 'resourceDescription',
+          'var' => 'resourceName',
           'type' => TType::STRING,
           ),
         4 => array(
-          'var' => 'ownerName',
+          'var' => 'resourceDescription',
           'type' => TType::STRING,
           ),
         5 => array(
+          'var' => 'ownerName',
+          'type' => TType::STRING,
+          ),
+        6 => array(
           'var' => 'resourceSize',
           'type' => TType::I32,
           ),
-        6 => array(
+        7 => array(
           'var' => 'creationTime',
           'type' => TType::I64,
           ),
-        7 => array(
+        8 => array(
           'var' => 'lastModifiedTime',
           'type' => TType::I64,
           ),
+        9 => array(
+          'var' => 'resourceMetadata',
+          'type' => TType::MAP,
+          'ktype' => TType::STRING,
+          'vtype' => TType::STRING,
+          'key' => array(
+            'type' => TType::STRING,
+          ),
+          'val' => array(
+            'type' => TType::STRING,
+            ),
+          ),
+        10 => array(
+          'var' => 'dataReplicaLocations',
+          'type' => TType::LST,
+          'etype' => TType::STRUCT,
+          'elem' => array(
+            'type' => TType::STRUCT,
+            'class' => '\Airavata\Model\Data\Resource\DataReplicaLocationModel',
+            ),
+          ),
         );
     }
     if (is_array($vals)) {
       if (isset($vals['resourceId'])) {
         $this->resourceId = $vals['resourceId'];
       }
+      if (isset($vals['gatewayId'])) {
+        $this->gatewayId = $vals['gatewayId'];
+      }
       if (isset($vals['resourceName'])) {
         $this->resourceName = $vals['resourceName'];
       }
@@ -104,6 +166,12 @@ class DataResourceModel {
       if (isset($vals['lastModifiedTime'])) {
         $this->lastModifiedTime = $vals['lastModifiedTime'];
       }
+      if (isset($vals['resourceMetadata'])) {
+        $this->resourceMetadata = $vals['resourceMetadata'];
+      }
+      if (isset($vals['dataReplicaLocations'])) {
+        $this->dataReplicaLocations = $vals['dataReplicaLocations'];
+      }
     }
   }
 
@@ -135,46 +203,91 @@ class DataResourceModel {
           break;
         case 2:
           if ($ftype == TType::STRING) {
-            $xfer += $input->readString($this->resourceName);
+            $xfer += $input->readString($this->gatewayId);
           } else {
             $xfer += $input->skip($ftype);
           }
           break;
         case 3:
           if ($ftype == TType::STRING) {
-            $xfer += $input->readString($this->resourceDescription);
+            $xfer += $input->readString($this->resourceName);
           } else {
             $xfer += $input->skip($ftype);
           }
           break;
         case 4:
           if ($ftype == TType::STRING) {
-            $xfer += $input->readString($this->ownerName);
+            $xfer += $input->readString($this->resourceDescription);
           } else {
             $xfer += $input->skip($ftype);
           }
           break;
         case 5:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->ownerName);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 6:
           if ($ftype == TType::I32) {
             $xfer += $input->readI32($this->resourceSize);
           } else {
             $xfer += $input->skip($ftype);
           }
           break;
-        case 6:
+        case 7:
           if ($ftype == TType::I64) {
             $xfer += $input->readI64($this->creationTime);
           } else {
             $xfer += $input->skip($ftype);
           }
           break;
-        case 7:
+        case 8:
           if ($ftype == TType::I64) {
             $xfer += $input->readI64($this->lastModifiedTime);
           } else {
             $xfer += $input->skip($ftype);
           }
           break;
+        case 9:
+          if ($ftype == TType::MAP) {
+            $this->resourceMetadata = array();
+            $_size0 = 0;
+            $_ktype1 = 0;
+            $_vtype2 = 0;
+            $xfer += $input->readMapBegin($_ktype1, $_vtype2, $_size0);
+            for ($_i4 = 0; $_i4 < $_size0; ++$_i4)
+            {
+              $key5 = '';
+              $val6 = '';
+              $xfer += $input->readString($key5);
+              $xfer += $input->readString($val6);
+              $this->resourceMetadata[$key5] = $val6;
+            }
+            $xfer += $input->readMapEnd();
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 10:
+          if ($ftype == TType::LST) {
+            $this->dataReplicaLocations = array();
+            $_size7 = 0;
+            $_etype10 = 0;
+            $xfer += $input->readListBegin($_etype10, $_size7);
+            for ($_i11 = 0; $_i11 < $_size7; ++$_i11)
+            {
+              $elem12 = null;
+              $elem12 = new \Airavata\Model\Data\Resource\DataReplicaLocationModel();
+              $xfer += $elem12->read($input);
+              $this->dataReplicaLocations []= $elem12;
+            }
+            $xfer += $input->readListEnd();
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
         default:
           $xfer += $input->skip($ftype);
           break;
@@ -193,36 +306,76 @@ class DataResourceModel {
       $xfer += $output->writeString($this->resourceId);
       $xfer += $output->writeFieldEnd();
     }
+    if ($this->gatewayId !== null) {
+      $xfer += $output->writeFieldBegin('gatewayId', TType::STRING, 2);
+      $xfer += $output->writeString($this->gatewayId);
+      $xfer += $output->writeFieldEnd();
+    }
     if ($this->resourceName !== null) {
-      $xfer += $output->writeFieldBegin('resourceName', TType::STRING, 2);
+      $xfer += $output->writeFieldBegin('resourceName', TType::STRING, 3);
       $xfer += $output->writeString($this->resourceName);
       $xfer += $output->writeFieldEnd();
     }
     if ($this->resourceDescription !== null) {
-      $xfer += $output->writeFieldBegin('resourceDescription', TType::STRING, 3);
+      $xfer += $output->writeFieldBegin('resourceDescription', TType::STRING, 4);
       $xfer += $output->writeString($this->resourceDescription);
       $xfer += $output->writeFieldEnd();
     }
     if ($this->ownerName !== null) {
-      $xfer += $output->writeFieldBegin('ownerName', TType::STRING, 4);
+      $xfer += $output->writeFieldBegin('ownerName', TType::STRING, 5);
       $xfer += $output->writeString($this->ownerName);
       $xfer += $output->writeFieldEnd();
     }
     if ($this->resourceSize !== null) {
-      $xfer += $output->writeFieldBegin('resourceSize', TType::I32, 5);
+      $xfer += $output->writeFieldBegin('resourceSize', TType::I32, 6);
       $xfer += $output->writeI32($this->resourceSize);
       $xfer += $output->writeFieldEnd();
     }
     if ($this->creationTime !== null) {
-      $xfer += $output->writeFieldBegin('creationTime', TType::I64, 6);
+      $xfer += $output->writeFieldBegin('creationTime', TType::I64, 7);
       $xfer += $output->writeI64($this->creationTime);
       $xfer += $output->writeFieldEnd();
     }
     if ($this->lastModifiedTime !== null) {
-      $xfer += $output->writeFieldBegin('lastModifiedTime', TType::I64, 7);
+      $xfer += $output->writeFieldBegin('lastModifiedTime', TType::I64, 8);
       $xfer += $output->writeI64($this->lastModifiedTime);
       $xfer += $output->writeFieldEnd();
     }
+    if ($this->resourceMetadata !== null) {
+      if (!is_array($this->resourceMetadata)) {
+        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
+      }
+      $xfer += $output->writeFieldBegin('resourceMetadata', TType::MAP, 9);
+      {
+        $output->writeMapBegin(TType::STRING, TType::STRING, count($this->resourceMetadata));
+        {
+          foreach ($this->resourceMetadata as $kiter13 => $viter14)
+          {
+            $xfer += $output->writeString($kiter13);
+            $xfer += $output->writeString($viter14);
+          }
+        }
+        $output->writeMapEnd();
+      }
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->dataReplicaLocations !== null) {
+      if (!is_array($this->dataReplicaLocations)) {
+        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
+      }
+      $xfer += $output->writeFieldBegin('dataReplicaLocations', TType::LST, 10);
+      {
+        $output->writeListBegin(TType::STRUCT, count($this->dataReplicaLocations));
+        {
+          foreach ($this->dataReplicaLocations as $iter15)
+          {
+            $xfer += $iter15->write($output);
+          }
+        }
+        $output->writeListEnd();
+      }
+      $xfer += $output->writeFieldEnd();
+    }
     $xfer += $output->writeFieldStop();
     $xfer += $output->writeStructEnd();
     return $xfer;
@@ -258,9 +411,21 @@ class DataReplicaLocationModel {
    */
   public $lastModifiedTime = null;
   /**
+   * @var int
+   */
+  public $replicaLocationCategory = null;
+  /**
+   * @var int
+   */
+  public $replicaPersistentType = null;
+  /**
    * @var string[]
    */
   public $dataLocations = null;
+  /**
+   * @var array
+   */
+  public $replicaMetadata = null;
 
   public function __construct($vals=null) {
     if (!isset(self::$_TSPEC)) {
@@ -290,6 +455,14 @@ class DataReplicaLocationModel {
           'type' => TType::I64,
           ),
         7 => array(
+          'var' => 'replicaLocationCategory',
+          'type' => TType::I32,
+          ),
+        8 => array(
+          'var' => 'replicaPersistentType',
+          'type' => TType::I32,
+          ),
+        9 => array(
           'var' => 'dataLocations',
           'type' => TType::LST,
           'etype' => TType::STRING,
@@ -297,6 +470,18 @@ class DataReplicaLocationModel {
             'type' => TType::STRING,
             ),
           ),
+        10 => array(
+          'var' => 'replicaMetadata',
+          'type' => TType::MAP,
+          'ktype' => TType::STRING,
+          'vtype' => TType::STRING,
+          'key' => array(
+            'type' => TType::STRING,
+          ),
+          'val' => array(
+            'type' => TType::STRING,
+            ),
+          ),
         );
     }
     if (is_array($vals)) {
@@ -318,9 +503,18 @@ class DataReplicaLocationModel {
       if (isset($vals['lastModifiedTime'])) {
         $this->lastModifiedTime = $vals['lastModifiedTime'];
       }
+      if (isset($vals['replicaLocationCategory'])) {
+        $this->replicaLocationCategory = $vals['replicaLocationCategory'];
+      }
+      if (isset($vals['replicaPersistentType'])) {
+        $this->replicaPersistentType = $vals['replicaPersistentType'];
+      }
       if (isset($vals['dataLocations'])) {
         $this->dataLocations = $vals['dataLocations'];
       }
+      if (isset($vals['replicaMetadata'])) {
+        $this->replicaMetadata = $vals['replicaMetadata'];
+      }
     }
   }
 
@@ -386,22 +580,56 @@ class DataReplicaLocationModel {
           }
           break;
         case 7:
+          if ($ftype == TType::I32) {
+            $xfer += $input->readI32($this->replicaLocationCategory);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 8:
+          if ($ftype == TType::I32) {
+            $xfer += $input->readI32($this->replicaPersistentType);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 9:
           if ($ftype == TType::LST) {
             $this->dataLocations = array();
-            $_size0 = 0;
-            $_etype3 = 0;
-            $xfer += $input->readListBegin($_etype3, $_size0);
-            for ($_i4 = 0; $_i4 < $_size0; ++$_i4)
+            $_size16 = 0;
+            $_etype19 = 0;
+            $xfer += $input->readListBegin($_etype19, $_size16);
+            for ($_i20 = 0; $_i20 < $_size16; ++$_i20)
             {
-              $elem5 = null;
-              $xfer += $input->readString($elem5);
-              $this->dataLocations []= $elem5;
+              $elem21 = null;
+              $xfer += $input->readString($elem21);
+              $this->dataLocations []= $elem21;
             }
             $xfer += $input->readListEnd();
           } else {
             $xfer += $input->skip($ftype);
           }
           break;
+        case 10:
+          if ($ftype == TType::MAP) {
+            $this->replicaMetadata = array();
+            $_size22 = 0;
+            $_ktype23 = 0;
+            $_vtype24 = 0;
+            $xfer += $input->readMapBegin($_ktype23, $_vtype24, $_size22);
+            for ($_i26 = 0; $_i26 < $_size22; ++$_i26)
+            {
+              $key27 = '';
+              $val28 = '';
+              $xfer += $input->readString($key27);
+              $xfer += $input->readString($val28);
+              $this->replicaMetadata[$key27] = $val28;
+            }
+            $xfer += $input->readMapEnd();
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
         default:
           $xfer += $input->skip($ftype);
           break;
@@ -445,23 +673,51 @@ class DataReplicaLocationModel {
       $xfer += $output->writeI64($this->lastModifiedTime);
       $xfer += $output->writeFieldEnd();
     }
+    if ($this->replicaLocationCategory !== null) {
+      $xfer += $output->writeFieldBegin('replicaLocationCategory', TType::I32, 7);
+      $xfer += $output->writeI32($this->replicaLocationCategory);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->replicaPersistentType !== null) {
+      $xfer += $output->writeFieldBegin('replicaPersistentType', TType::I32, 8);
+      $xfer += $output->writeI32($this->replicaPersistentType);
+      $xfer += $output->writeFieldEnd();
+    }
     if ($this->dataLocations !== null) {
       if (!is_array($this->dataLocations)) {
         throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
       }
-      $xfer += $output->writeFieldBegin('dataLocations', TType::LST, 7);
+      $xfer += $output->writeFieldBegin('dataLocations', TType::LST, 9);
       {
         $output->writeListBegin(TType::STRING, count($this->dataLocations));
         {
-          foreach ($this->dataLocations as $iter6)
+          foreach ($this->dataLocations as $iter29)
           {
-            $xfer += $output->writeString($iter6);
+            $xfer += $output->writeString($iter29);
           }
         }
         $output->writeListEnd();
       }
       $xfer += $output->writeFieldEnd();
     }
+    if ($this->replicaMetadata !== null) {
+      if (!is_array($this->replicaMetadata)) {
+        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
+      }
+      $xfer += $output->writeFieldBegin('replicaMetadata', TType::MAP, 10);
+      {
+        $output->writeMapBegin(TType::STRING, TType::STRING, count($this->replicaMetadata));
+        {
+          foreach ($this->replicaMetadata as $kiter30 => $viter31)
+          {
+            $xfer += $output->writeString($kiter30);
+            $xfer += $output->writeString($viter31);
+          }
+        }
+        $output->writeMapEnd();
+      }
+      $xfer += $output->writeFieldEnd();
+    }
     $xfer += $output->writeFieldStop();
     $xfer += $output->writeStructEnd();
     return $xfer;

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/281591eb/app/libraries/SRUtilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/SRUtilities.php b/app/libraries/SRUtilities.php
index 6b8b1ad..a380026 100644
--- a/app/libraries/SRUtilities.php
+++ b/app/libraries/SRUtilities.php
@@ -5,7 +5,7 @@
 //Compute Resource classes
 use Airavata\Model\Data\Movement\DataMovementProtocol;
 use Airavata\Model\AppCatalog\StorageResource\StorageResourceDescription;
-use Airavata\Model\AppCatalog\GatewayProfile\ComputeResourcePreference;
+use Airavata\Model\AppCatalog\GatewayProfile\StoragePreference;
 use Airavata\Model\AppCatalog\GatewayProfile\GatewayResourceProfile;
 
 use Airavata\Model\AppCatalog\ComputeResource\GridFTPDataMovement;
@@ -274,18 +274,19 @@ class SRUtilities
         return Airavata::updateGatewayResourceProfile( Session::get('authz-token'), $data["gateway_id"],
$gatewayResourceProfile); 
     }
 
-    public static function add_or_update_CRP($inputs)
+    public static function add_or_update_DSP($inputs)
     {
-        $computeResourcePreferences = new computeResourcePreference($inputs);
+        $storagePreference = new StoragePreference($inputs);
 
         if (Config::get('pga_config.airavata')['enable-app-catalog-cache']) {
-            if (Cache::has('CR-' . $inputs["computeResourceId"])) {
-                Cache::forget('CR-' . $inputs["computeResourceId"]);
+            if (Cache::has('SR-' . $inputs["storageResourceId"])) {
+                Cache::forget('SR-' . $inputs["storageResourceId"]);
             }
         }
 
         //var_dump( $inputs); exit;
-        return Airavata::addGatewayComputeResourcePreference(Session::get('authz-token'),
$inputs["gatewayId"], $inputs["computeResourceId"], $computeResourcePreferences);
+        return Airavata::addGatewayStoragePreference(Session::get('authz-token'), $inputs["gatewayId"],
$inputs["storageResourceId"],
+            $storagePreference);
 
     }
 

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/281591eb/app/routes.php
----------------------------------------------------------------------
diff --git a/app/routes.php b/app/routes.php
index 474babb..988cd1c 100755
--- a/app/routes.php
+++ b/app/routes.php
@@ -188,6 +188,10 @@ Route::post("gp/add-crp", "GatewayprofileController@modifyCRP");
 
 Route::post("gp/update-crp", "GatewayprofileController@modifyCRP");
 
+Route::post("gp/add-dsp", "GatewayprofileController@modifyDSP");
+
+Route::post("gp/update-dsp", "GatewayprofileController@modifyDSP");
+
 Route::post("gp/credential-store-token-change", "GatewayprofileController@cstChange");
 
 //Management Dashboard

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/281591eb/app/views/admin/manage-gateway.blade.php
----------------------------------------------------------------------
diff --git a/app/views/admin/manage-gateway.blade.php b/app/views/admin/manage-gateway.blade.php
index 3ccc9b5..be36325 100644
--- a/app/views/admin/manage-gateway.blade.php
+++ b/app/views/admin/manage-gateway.blade.php
@@ -356,6 +356,24 @@
     </div>
 </div>
 
+<div class="add-data-storage-preference-block hide">
+    <div class="well">
+        <form action="{{URL::to('/')}}/gp/add-dsp" method="POST">
+            <input type="hidden" name="gatewayId" id="gatewayId" value="">
+
+            <div class="input-group">
+                <select name="storageResourceId" class="sr-select form-control">
+                    <option value="">Select a Data Storage Resource and set its preferences</option>
+                    @foreach( (array)$storageResources as $index => $sr)
+                        <option value="{{ $sr->storageResourceId}}">{{ $sr->hostName
}}</option>
+                    @endforeach
+                </select>
+                <span class="input-group-addon remove-cr" style="cursor:pointer;">x</span>
+            </div>
+            <div class="pref-space form-horizontal"></div>
+        </form>
+    </div>
+</div>
 
 <!-- Remove a Compute Resource from a Gateway -->
 <div class="modal fade" id="remove-resource-block" tabindex="-1" role="dialog" aria-labelledby="add-modal"
@@ -407,6 +425,10 @@
 @include('partials/compute-resource-preferences', array('computeResource' => $cr, 'crData'
=> $crData))
 @endforeach
 
+<!-- contains all storage resource choices that might get selected on adding a new one
to a gateway -->
+@foreach( (array)$storageResources as $index => $sr)
+    @include('partials/storage-resource-preferences', array('storageResource' => $sr,
'srData' => $srData))
+@endforeach
 
 @stop
 

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/281591eb/app/views/partials/storage-resource-preferences.blade.php
----------------------------------------------------------------------
diff --git a/app/views/partials/storage-resource-preferences.blade.php b/app/views/partials/storage-resource-preferences.blade.php
index 42b056b..9a18533 100644
--- a/app/views/partials/storage-resource-preferences.blade.php
+++ b/app/views/partials/storage-resource-preferences.blade.php
@@ -16,11 +16,11 @@ dmi preference might be needed in the future
 
     <div class="col-md-9">
         <select name="preferredDataMovementProtocol" class="form-control">
-            @foreach( (array)$computeResource->dataMovementInterfaces as $index =>
$dmi)
-            <option value="{{ $dmi->dataMovementProtocol}}"
-            @if( isset( $preferences) ) @if( $preferences->preferredDataMovementProtocol
== $dmi->dataMovementProtocol)
-            selected @endif @endif>{{ $crData["dataMovementProtocols"][$dmi->dataMovementProtocol]
}}</option>
-            @endforeach
+{{--            @foreach( (array)$computeResource->dataMovementInterfaces as $index =>
$dmi)--}}
+            {{--<option value="{{ $dmi->dataMovementProtocol}}"--}}
+{{--            @if( isset( $preferences) ) @if( $preferences->preferredDataMovementProtocol
== $dmi->dataMovementProtocol)--}}
+{{--            selected @endif @endif>{{ $crData["dataMovementProtocols"][$dmi->dataMovementProtocol]
}}</option>--}}
+            {{--@endforeach--}}
         </select>
     </div>
 </div>

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/281591eb/public/js/gateway.js
----------------------------------------------------------------------
diff --git a/public/js/gateway.js b/public/js/gateway.js
index 919efeb..b8876c6 100644
--- a/public/js/gateway.js
+++ b/public/js/gateway.js
@@ -39,6 +39,12 @@ $(document).ready(function () {
 			$(this).after( $(".add-compute-resource-block").html() );
 		});
 
+		$(".add-dsp").click( function(){
+
+			$(".add-data-storage-preference-block").find("#gatewayId").val( $(this).data("gpid"));
+			$(this).after( $(".add-data-storage-preference-block").html() );
+		});
+
 		$("body").on("change", ".cr-select", function(){
 			crId = $(this).val();
 			//This is done as Jquery creates problems when using period(.) in id or class.
@@ -46,6 +52,13 @@ $(document).ready(function () {
             $(".pref-space").html($("#cr-" + crId).html());
         });
 
+		$("body").on("change", ".sr-select", function(){
+			srId = $(this).val();
+			//This is done as Jquery creates problems when using period(.) in id or class.
+			srId = srId.replace(/\./g,"_");
+			$(".pref-space").html($("#sr-" + srId).html());
+		});
+
 		$(".edit-gateway").click( function(){
 			$(".edit-gp-name").val( $(this).data("gp-name") );
 			$(".edit-gp-desc").val( $(this).data("gp-desc") );


Mime
View raw message