Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Addition of the new Data Movement protocol (WebDAV) for the Nextcloud integration with Airavata. #83

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions app/libraries/CRUtilities.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
use Airavata\Model\Data\Movement\SecurityProtocol;
use Airavata\Model\AppCatalog\ComputeResource\SSHJobSubmission;
use Airavata\Model\Data\Movement\UnicoreDataMovement;
use Airavata\Model\Data\Movement\WebDAVDataMovement;
use Airavata\Model\AppCatalog\ComputeResource\UnicoreJobSubmission;
use Airavata\Model\AppCatalog\ComputeResource\CloudJobSubmission;
use Airavata\Model\AppCatalog\ComputeResource\ProviderName;
Expand Down Expand Up @@ -353,6 +354,18 @@ public static function create_or_update_DMIObject($inputs, $update = false)
$unicoredmp = Airavata::updateUnicoreDataMovementDetails(Session::get('authz-token'), $inputs["dmiId"], $unicoreDataMovement);
else
$unicoredmp = Airavata::addUnicoreDataMovementDetails(Session::get('authz-token'), $computeResource->computeResourceId, DMType::COMPUTE_RESOURCE, 0, $unicoreDataMovement);
} else if ($inputs["dataMovementProtocol"] == DataMovementProtocol::WebDAV) /* WebDAV */ {
//var_dump( $inputs); exit;
$davDataMovement = new WebDAVDataMovement(array(
"securityProtocol" => intval($inputs["securityProtocol"]),
"webDavHostName" => $inputs["webDavHostName"],
"port" => intval($inputs["port"])
)
);
if ($update)
$davdmp = Airavata::updateWebDAVDataMovementDetails(Session::get('authz-token'), $inputs["dmiId"], $davDataMovement);
else
$davdmp = Airavata::addWebDAVDataMovementDetails(Session::get('authz-token'), $computeResource->computeResourceId, DMType::COMPUTE_RESOURCE, 0, $davDataMovement);
} else /* other data movement protocols */ {
print_r("Whoops! We haven't coded for this Data Movement Protocol yet. Still working on it. Please click <a href='" . URL::to('/') . "/cr/edit'>here</a> to go back to edit page for compute resource.");
}
Expand Down Expand Up @@ -408,6 +421,8 @@ public static function getDataMovementDetails($dataMovementInterfaceId, $dmi)
return Airavata::getGridFTPDataMovement(Session::get('authz-token'), $dataMovementInterfaceId);
else if ($dmi == DataMovementProtocol::UNICORE_STORAGE_SERVICE)
return Airavata::getUnicoreDataMovement(Session::get('authz-token'), $dataMovementInterfaceId);
else if ($dmi == DataMovementProtocol::WebDAV)
return Airavata::getWebDAVDataMovement(Session::get('authz-token'), $dataMovementInterfaceId);
/*
else if( $dmi == JobSubmissionProtocol::CLOUD)
return $airavataclient->getCloudJobSubmission( $dataMovementInterfaceId);
Expand Down
14 changes: 14 additions & 0 deletions app/libraries/SRUtilities.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
use Airavata\Model\Data\Movement\SCPDataMovement;
use Airavata\Model\Data\Movement\SecurityProtocol;
use Airavata\Model\Data\Movement\UnicoreDataMovement;
use Airavata\Model\Data\Movement\WebDAVDataMovement;
//Gateway Classes


Expand Down Expand Up @@ -119,6 +120,17 @@ public static function create_or_update_DMIObject($inputs, $update = false)
$unicoredmp = Airavata::updateUnicoreDataMovementDetails(Session::get('authz-token'), $inputs["dmiId"], $unicoreDataMovement);
else
$unicoredmp = Airavata::addUnicoreDataMovementDetails(Session::get('authz-token'), $storageResource->storageResourceId, DMType::STORAGE_RESOURCE, 0, $unicoreDataMovement);
} else if ($inputs["dataMovementProtocol"] == DataMovementProtocol::WebDAV) /* WebDAV */ {
$davDataMovement = new WebDAVDataMovement(array(
"securityProtocol" => intval($inputs["securityProtocol"]),
"webDavHostName" => $inputs["webDavHostName"],
"port" => intval($inputs["port"])
)
);
if ($update)
$davdmp = Airavata::updateWebDAVDataMovementDetails(Session::get('authz-token'), $inputs["dmiId"], $davDataMovement);
else
$davdmp = Airavata::addWebDAVDataMovementDetails(Session::get('authz-token'), $storageResource->storageResourceId, DMType::STORAGE_RESOURCE, 0, $davDataMovement);
} else /* other data movement protocols */ {
print_r("Whoops! We haven't coded for this Data Movement Protocol yet. Still working on it. Please click <a href='" . URL::to('/') . "/cr/edit'>here</a> to go back to edit page for compute resource.");
}
Expand Down Expand Up @@ -173,6 +185,8 @@ public static function getDataMovementDetails($dataMovementInterfaceId, $dmi)
return Airavata::getGridFTPDataMovement(Session::get('authz-token'), $dataMovementInterfaceId);
else if ($dmi == DataMovementProtocol::UNICORE_STORAGE_SERVICE)
return Airavata::getUnicoreDataMovement(Session::get('authz-token'), $dataMovementInterfaceId);
else if ($dmi == DataMovementProtocol::WebDAV)
return Airavata::getWebDAVDataMovement(Session::get('authz-token'), $dataMovementInterfaceId);
/*
else if( $dmi == JobSubmissionProtocol::CLOUD)
return $airavataclient->getCloudJobSubmission( $dataMovementInterfaceId);
Expand Down
31 changes: 31 additions & 0 deletions app/views/resource/edit.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,29 @@
<div class="form-group">
<button type="submit" class="btn">Update</button>
</div>
@elseif( $selectedDMIIndex == $dataMovementProtocolsObject::WebDAV)
<div class="form-group">
<label class="control-label">Select Security Protocol</label>
<select name="securityProtocol">
@foreach( $securityProtocols as $index => $sp)
<option value="{{ $index }}"
@if( $DMI->securityProtocol == $index ) selected @endif>{{ $sp }}</option>
@endforeach
</select>
</div>

<div class="form-group">
<label class="control-label">WebDAV Host Name</label>
<input class='form-control' name='webDavHostName'
value="{{ $DMI->webDavHostName }}"/>
</div>
<div class="form-group">
<label class="control-label">Port</label>
<input class='form-control' name='port' value="{{ $DMI->port }}"/>
</div>
<div class="form-group">
<button type="submit" class="btn">Update</button>
</div>
@endif
</form>
</div>
Expand Down Expand Up @@ -588,6 +611,14 @@
<label class="control-label">SSH Port</label>
<input class='form-control' name='sshPort'/>
</div>
<div class="form-group addedWebDavValue hide">
<label class="control-label">WebDAV Host Name</label>
<input class='form-control' name='webDavHostName'/>
</div>
<div class="form-group addedWebDavValue hide">
<label class="control-label">Port</label>
<input class='form-control' name='port'/>
</div>
</div>

<div class="cloud-block hide">
Expand Down
31 changes: 31 additions & 0 deletions app/views/storage-resource/edit.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,29 @@
<div class="form-group">
<button type="submit" class="btn">Update</button>
</div>
@elseif( $selectedDMIIndex == $dataMovementProtocolsObject::WebDAV)
<div class="form-group">
<label class="control-label">Select Security Protocol</label>
<select name="securityProtocol">
@foreach( $securityProtocols as $index => $sp)
<option value="{{ $index }}"
@if( $DMI->securityProtocol == $index ) selected @endif>{{ $sp }}</option>
@endforeach
</select>
</div>

<div class="form-group">
<label class="control-label">WebDAV Host Name</label>
<input class='form-control' name='webDavHostName'
value="{{ $DMI->webDavHostName }}"/>
</div>
<div class="form-group">
<label class="control-label">Port</label>
<input class='form-control' name='port' value="{{ $DMI->port }}"/>
</div>
<div class="form-group">
<button type="submit" class="btn">Update</button>
</div>
@endif
</form>
</div>
Expand Down Expand Up @@ -272,6 +295,14 @@
<label class="control-label">SSH Port</label>
<input class='form-control' name='sshPort'/>
</div>
<div class="form-group addedWebDavValue hide">
<label class="control-label">WebDAV Host Name</label>
<input class='form-control' name='webDavHostName'/>
</div>
<div class="form-group addedWebDavValue hide">
<label class="control-label">Port</label>
<input class='form-control' name='port'/>
</div>
</div>

<div class="cloud-block hide">
Expand Down
23 changes: 23 additions & 0 deletions app/views/storage-resource/view.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,29 @@ class="form-control selected-resource-manager"
</div>
</div>
</div>
@elseif( $selectedDMIIndex == $dataMovementProtocolsObject::WebDAV)
<div class="form-group">
<label class="control-label">Select Security Protocol</label>
<select name="securityProtocol">
@foreach( $securityProtocols as $index => $sp)
<option value="{{ $index }}"
@if( $DMI->securityProtocol == $index ) selected @endif>{{ $sp }}</option>
@endforeach
</select>
</div>

<div class="form-group">
<label class="control-label">WebDAV Host Name</label>
<input class='form-control' name='webDavHostName'
value="{{ $DMI->webDavHostName }}"/>
</div>
<div class="form-group">
<label class="control-label">Port</label>
<input class='form-control' name='port' value="{{ $DMI->port }}"/>
</div>
<div class="form-group">
<button type="submit" class="btn">Update</button>
</div>
@endif
</form>
</div>
Expand Down
7 changes: 7 additions & 0 deletions public/js/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,13 @@ $(document).ready( function(){
+ "<input class='form-control' name='unicoreEndPointURL'/>"
+ "</div>" );
}
else if( selectedVal == "webdav" )
{
$(this).after( parentDataDiv
+ $(".ssh-block").html()
+ "</div>" );
$(this).parent().find(".addedWebDavValue").removeClass("hide");
}
else{
alert("Something went wrong. Please try again");
$(".dmpSubmit").addClass("hide");
Expand Down