You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by nd...@apache.org on 2015/11/17 21:06:31 UTC
[2/2] airavata-php-gateway git commit: DataStorage implementation in
progress
DataStorage implementation in progress
Project: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/commit/7dcf7f98
Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/7dcf7f98
Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/7dcf7f98
Branch: refs/heads/develop
Commit: 7dcf7f98a8c75c16f93e2b69d344f059e45097e0
Parents: 81cceeb
Author: Nipurn Doshi <Nipurn Doshi>
Authored: Tue Nov 17 14:02:51 2015 -0500
Committer: Nipurn Doshi <Nipurn Doshi>
Committed: Tue Nov 17 14:02:51 2015 -0500
----------------------------------------------------------------------
app/controllers/DatastorageController.php | 251 ++++++++
app/libraries/DSUtilities.php | 600 ++++++++++++++++++
app/routes.php | 27 +
app/views/data-storage/browse.blade.php | 213 +++++++
app/views/data-storage/create.blade.php | 53 ++
app/views/data-storage/edit.blade.php | 836 +++++++++++++++++++++++++
app/views/data-storage/view.blade.php | 379 +++++++++++
app/views/resource/browse.blade.php | 106 +---
8 files changed, 2387 insertions(+), 78 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/7dcf7f98/app/controllers/DatastorageController.php
----------------------------------------------------------------------
diff --git a/app/controllers/DatastorageController.php b/app/controllers/DatastorageController.php
new file mode 100644
index 0000000..80778d6
--- /dev/null
+++ b/app/controllers/DatastorageController.php
@@ -0,0 +1,251 @@
+<?php
+
+class DatastorageController extends BaseController
+{
+
+ /**
+ * Instantiate a new Compute Resource Controller Instance
+ **/
+
+ public function __construct()
+ {
+ $this->beforeFilter('verifyadmin');
+ Session::put("nav-active", "data-storage");
+
+ }
+
+ public function createView()
+ {
+ $this->beforeFilter('verifyeditadmin');
+ Session::put("admin-nav", "ds-create");
+ return View::make("data-storage/create");
+ }
+
+ public function createSubmit()
+ {
+ $this->beforeFilter('verifyeditadmin');
+ $hostAliases = Input::get("hostaliases");
+ $ips = Input::get("ips");
+ //Compute resource is by default enabled
+ $computeDescription = array(
+ "hostName" => trim(Input::get("hostname")),
+ "hostAliases" => array_unique(array_filter($hostAliases)),
+ "ipAddresses" => array_unique(array_filter($ips)),
+ "resourceDescription" => Input::get("description"),
+ "enabled" => true
+ );
+ $computeResource = DSUtilities::register_or_update_compute_resource($computeDescription);
+
+ return Redirect::to("ds/edit?dsId=" . $computeResource->computeResourceId);
+ }
+
+ public function editView()
+ {
+ $this->beforeFilter('verifyeditadmin');
+ $data = DSUtilities::getEditDSData();
+ $computeResourceId = "";
+ if (Input::has("dsId"))
+ $computeResourceId = Input::get("dsId");
+ else if (Session::has("dataStorage")) {
+ $computeResource = Session::get("dataStorage");
+ $computeResourceId = $computeResource->computeResourceId;
+ }
+
+ if ($computeResourceId != "") {
+ $computeResource = DSUtilities::get_compute_resource($computeResourceId);
+ $jobSubmissionInterfaces = array();
+ $dataMovementInterfaces = array();
+ $addedJSP = array();
+ $addedDMI = array();
+ //var_dump( $computeResource->jobSubmissionInterfaces); exit;
+ if (count($computeResource->jobSubmissionInterfaces)) {
+ foreach ($computeResource->jobSubmissionInterfaces as $JSI) {
+ $jobSubmissionInterfaces[] = DSUtilities::getJobSubmissionDetails($JSI->jobSubmissionInterfaceId, $JSI->jobSubmissionProtocol);
+ $addedJSP[] = $JSI->jobSubmissionProtocol;
+ }
+ }
+ //var_dump( CRUtilities::getJobSubmissionDetails( $data["computeResource"]->jobSubmissionInterfaces[0]->jobSubmissionInterfaceId, 1) ); exit;
+ if (count($computeResource->dataMovementInterfaces)) {
+ foreach ($computeResource->dataMovementInterfaces as $DMI) {
+ $dataMovementInterfaces[] = CRUtilities::getDataMovementDetails($DMI->dataMovementInterfaceId, $DMI->dataMovementProtocol);
+ $addedDMI[] = $DMI->dataMovementProtocol;
+ }
+ }
+
+ $data["computeResource"] = $computeResource;
+ $data["jobSubmissionInterfaces"] = $jobSubmissionInterfaces;
+ $data["dataMovementInterfaces"] = $dataMovementInterfaces;
+ $data["addedJSP"] = $addedJSP;
+ $data["addedDMI"] = $addedDMI;
+ //var_dump($data["jobSubmissionInterfaces"]); exit;
+ return View::make("resource/edit", $data);
+ } else
+ return View::make("resource/browse")->with("login-alert", "Unable to retrieve this Compute Resource. Please report this error to devs.");
+
+ }
+
+ public function editSubmit()
+ {
+ $this->beforeFilter('verifyeditadmin');
+ $tabName = "";
+ if (Input::get("cr-edit") == "resDesc") /* Modify compute Resource description */ {
+ $computeDescription = CRUtilities::get_compute_resource(Input::get("crId"));
+ $computeDescription->hostName = trim(Input::get("hostname"));
+ $computeDescription->hostAliases = array_unique(array_filter(Input::get("hostaliases")));
+ $computeDescription->ipAddresses = array_unique(array_filter(Input::get("ips")));
+ $computeDescription->resourceDescription = Input::get("description");
+ $computeDescription->maxMemoryPerNode = Input::get("maxMemoryPerNode");
+ //var_dump( $computeDescription); exit;
+
+ $computeResource = CRUtilities::register_or_update_compute_resource($computeDescription, true);
+
+ $tabName = "#tab-desc";
+ }
+ if (Input::get("cr-edit") == "queue") /* Add / Modify a Queue */ {
+ $queue = array("queueName" => Input::get("qname"),
+ "queueDescription" => Input::get("qdesc"),
+ "maxRunTime" => Input::get("qmaxruntime"),
+ "maxNodes" => Input::get("qmaxnodes"),
+ "maxProcessors" => Input::get("qmaxprocessors"),
+ "maxJobsInQueue" => Input::get("qmaxjobsinqueue"),
+ "maxMemory" => Input::get("qmaxmemoryinqueue")
+ );
+
+ $computeDescription = CRUtilities::get_compute_resource(Input::get("crId"));
+ $computeDescription->batchQueues[] = CRUtilities::createQueueObject($queue);
+ $computeResource = CRUtilities::register_or_update_compute_resource($computeDescription, true);
+ //var_dump( $computeResource); exit;
+ $tabName = "#tab-queues";
+ } else if (Input::get("cr-edit") == "delete-queue") {
+ CRUtilities::deleteQueue(Input::get("crId"), Input::get("queueName"));
+ $tabName = "#tab-queues";
+ } else if (Input::get("cr-edit") == "fileSystems") {
+ $computeDescription = CRUtilities::get_compute_resource(Input::get("crId"));
+ $computeDescription->fileSystems = array_filter(Input::get("fileSystems"), "trim");
+ $computeResource = CRUtilities::register_or_update_compute_resource($computeDescription, true);
+
+ $tabName = "#tab-filesystem";
+ } else if (Input::get("cr-edit") == "jsp" || Input::get("cr-edit") == "edit-jsp") /* Add / Modify a Job Submission Interface */ {
+ $update = false;
+ if (Input::get("cr-edit") == "edit-jsp")
+ $update = true;
+
+ $jobSubmissionInterface = CRUtilities::create_or_update_JSIObject(Input::all(), $update);
+
+ $tabName = "#tab-jobSubmission";
+ } else if (Input::get("cr-edit") == "jsi-priority") {
+ $inputs = Input::all();
+ $computeDescription = CRUtilities::get_compute_resource(Input::get("crId"));
+ foreach ($computeDescription->jobSubmissionInterfaces as $index => $jsi) {
+ foreach ($inputs["jsi-id"] as $idIndex => $jsiId) {
+ if ($jsiId == $jsi->jobSubmissionInterfaceId) {
+ $computeDescription->jobSubmissionInterfaces[$index]->priorityOrder = $inputs["jsi-priority"][$idIndex];
+ break;
+ }
+ }
+ }
+ $computeResource = CRUtilities::register_or_update_compute_resource($computeDescription, true);
+
+ return 1; //currently done by ajax.
+ } else if (Input::get("cr-edit") == "dmp" || Input::get("cr-edit") == "edit-dmi") /* Add / Modify a Data Movement Interface */ {
+ $update = false;
+ if (Input::get("cr-edit") == "edit-dmi")
+ $update = true;
+ $dataMovementInterface = CRUtilities::create_or_update_DMIObject(Input::all(), $update);
+
+ $tabName = "#tab-dataMovement";
+ } else if (Input::get("cr-edit") == "dmi-priority") {
+ $inputs = Input::all();
+ $computeDescription = CRUtilities::get_compute_resource(Input::get("crId"));
+ foreach ($computeDescription->dataMovementInterfaces as $index => $dmi) {
+ foreach ($inputs["dmi-id"] as $idIndex => $dmiId) {
+ if ($dmiId == $dmi->dataMovementInterfaceId) {
+ $computeDescription->dataMovementInterfaces[$index]->priorityOrder = $inputs["dmi-priority"][$idIndex];
+ break;
+ }
+ }
+ }
+ $computeResource = CRUtilities::register_or_update_compute_resource($computeDescription, true);
+
+ return 1; //currently done by ajax.
+ }
+
+ return Redirect::to("cr/edit?crId=" . Input::get("crId") . $tabName);
+ }
+
+ public function viewView()
+ {
+ $data = CRUtilities::getEditCRData();
+ $computeResourceId = "";
+ if (Input::has("crId"))
+ $computeResourceId = Input::get("crId");
+ else if (Session::has("computeResource")) {
+ $computeResource = Session::get("computeResource");
+ $computeResourceId = $computeResource->computeResourceId;
+ }
+
+ if ($computeResourceId != "") {
+ $computeResource = CRUtilities::get_compute_resource($computeResourceId);
+ $jobSubmissionInterfaces = array();
+ $dataMovementInterfaces = array();
+ $addedJSP = array();
+ $addedDMI = array();
+ //var_dump( $computeResource->jobSubmissionInterfaces); exit;
+ if (count($computeResource->jobSubmissionInterfaces)) {
+ foreach ($computeResource->jobSubmissionInterfaces as $JSI) {
+ $jobSubmissionInterfaces[] = CRUtilities::getJobSubmissionDetails($JSI->jobSubmissionInterfaceId, $JSI->jobSubmissionProtocol);
+ $addedJSP[] = $JSI->jobSubmissionProtocol;
+ }
+ }
+ //var_dump( CRUtilities::getJobSubmissionDetails( $data["computeResource"]->jobSubmissionInterfaces[0]->jobSubmissionInterfaceId, 1) ); exit;
+ if (count($computeResource->dataMovementInterfaces)) {
+ foreach ($computeResource->dataMovementInterfaces as $DMI) {
+ $dataMovementInterfaces[] = CRUtilities::getDataMovementDetails($DMI->dataMovementInterfaceId, $DMI->dataMovementProtocol);
+ $addedDMI[] = $DMI->dataMovementProtocol;
+ }
+ }
+
+ $data["computeResource"] = $computeResource;
+ $data["jobSubmissionInterfaces"] = $jobSubmissionInterfaces;
+ $data["dataMovementInterfaces"] = $dataMovementInterfaces;
+ $data["addedJSP"] = $addedJSP;
+ $data["addedDMI"] = $addedDMI;
+ //var_dump($data["jobSubmissionInterfaces"]); exit;
+ return View::make("resource/view", $data);
+ } else
+ return View::make("resource/browse")->with("login-alert", "Unable to retrieve this Compute Resource. Please report this error to devs.");
+
+ }
+
+ public function deleteActions()
+ {
+ $this->beforeFilter('verifyeditadmin');
+ $result = CRUtilities::deleteActions(Input::all());
+ if (Input::has("jsiId")) {
+ return Redirect::to("cr/edit?crId=" . Input::get("crId") . "#tab-jobSubmission")
+ ->with("message", "Job Submission Interface was deleted successfully");
+ }
+ if (Input::has("dmiId")) {
+ return Redirect::to("cr/edit?crId=" . Input::get("crId") . "#tab-dataMovement")
+ ->with("message", "Data Movement Protocol was deleted successfully");
+ } elseif (Input::has("del-crId")) {
+ return Redirect::to("cr/browse")->with("message", "The Compute Resource has been successfully deleted.");
+ } else
+ return $result;
+ }
+
+ public function browseView()
+ {
+ $data = DSUtilities::getBrowseDSData(false);
+ var_dump( $data); exit;
+ $allDSRs = $data["dsObjects"];
+
+ Session::put("admin-nav", "cr-browse");
+ return View::make("resource/browse", array(
+ "allDSRs" => $allDSRs
+ ));
+
+ }
+}
+
+?>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/7dcf7f98/app/libraries/DSUtilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/DSUtilities.php b/app/libraries/DSUtilities.php
new file mode 100644
index 0000000..aff29a1
--- /dev/null
+++ b/app/libraries/DSUtilities.php
@@ -0,0 +1,600 @@
+<?php
+
+
+//Airavata classes - loaded from app/libraries/Airavata
+//Compute Resource classes
+use Airavata\Model\AppCatalog\ComputeResource\BatchQueue;
+use Airavata\Model\AppCatalog\ComputeResource\ComputeResourceDescription;
+use Airavata\Model\AppCatalog\ComputeResource\DataMovementProtocol;
+use Airavata\Model\AppCatalog\ComputeResource\FileSystems;
+use Airavata\Model\AppCatalog\ComputeResource\GridFTPDataMovement;
+use Airavata\Model\AppCatalog\ComputeResource\JobManagerCommand;
+use Airavata\Model\AppCatalog\ComputeResource\JobSubmissionProtocol;
+use Airavata\Model\AppCatalog\ComputeResource\LOCALDataMovement;
+use Airavata\Model\AppCatalog\ComputeResource\LOCALSubmission;
+use Airavata\Model\AppCatalog\ComputeResource\MonitorMode;
+use Airavata\Model\AppCatalog\ComputeResource\ResourceJobManager;
+use Airavata\Model\AppCatalog\ComputeResource\ResourceJobManagerType;
+use Airavata\Model\AppCatalog\ComputeResource\SCPDataMovement;
+use Airavata\Model\AppCatalog\ComputeResource\SecurityProtocol;
+use Airavata\Model\AppCatalog\ComputeResource\SSHJobSubmission;
+use Airavata\Model\AppCatalog\ComputeResource\UnicoreDataMovement;
+use Airavata\Model\AppCatalog\ComputeResource\UnicoreJobSubmission;
+use Airavata\Model\AppCatalog\GatewayProfile\ComputeResourcePreference;
+use Airavata\Model\AppCatalog\GatewayProfile\GatewayResourceProfile;
+
+//Gateway Classes
+
+
+class DSUtilities
+{
+ /**
+ * Basic utility functions
+ */
+
+//define('ROOT_DIR', __DIR__);
+
+ /**
+ * Define configuration constants
+ */
+ public static function register_or_update_compute_resource($computeDescription, $update = false)
+ {
+ if ($update) {
+ $computeResourceId = $computeDescription->computeResourceId;
+ if (Config::get('pga_config.airavata')['enable-app-catalog-cache']) {
+ if (Cache::has('CR-' . $computeResourceId)) {
+ Cache::forget('CR-' . $computeResourceId);
+ }
+ }
+
+ if (Airavata::updateComputeResource(Session::get('authz-token'), $computeResourceId, $computeDescription)) {
+ $computeResource = Airavata::getComputeResource(Session::get('authz-token'), $computeResourceId);
+ return $computeResource;
+ } else
+ print_r("Something went wrong while updating!");
+ exit;
+ } else {
+ /*
+ $fileSystems = new FileSystems();
+ foreach( $fileSystems as $fileSystem)
+ $computeDescription["fileSystems"][$fileSystem] = "";
+ */
+ $cd = new ComputeResourceDescription($computeDescription);
+ $computeResourceId = Airavata::registerComputeResource(Session::get('authz-token'), $cd);
+ }
+
+ $computeResource = Airavata::getComputeResource(Session::get('authz-token'), $computeResourceId);
+ return $computeResource;
+
+ }
+
+ /*
+ * Getting data for Compute resource inputs
+ */
+
+ public static function getEditCRData()
+ {
+ $files = new FileSystems();
+ $jsp = new JobSubmissionProtocol();
+ $rjmt = new ResourceJobManagerType();
+ $sp = new SecurityProtocol();
+ $dmp = new DataMovementProtocol();
+ $jmc = new JobManagerCommand();
+ $mm = new MonitorMode();
+ return array(
+ "fileSystemsObject" => $files,
+ "fileSystems" => $files::$__names,
+ "jobSubmissionProtocolsObject" => $jsp,
+ "jobSubmissionProtocols" => $jsp::$__names,
+ "resourceJobManagerTypesObject" => $rjmt,
+ "resourceJobManagerTypes" => $rjmt::$__names,
+ "securityProtocolsObject" => $sp,
+ "securityProtocols" => $sp::$__names,
+ "dataMovementProtocolsObject" => $dmp,
+ "dataMovementProtocols" => $dmp::$__names,
+ "jobManagerCommands" => $jmc::$__names,
+ "monitorModes" => $mm::$__names
+ );
+ }
+
+
+ public static function createQueueObject($queue)
+ {
+ $queueObject = new BatchQueue($queue);
+ return $queueObject;
+ }
+
+ public static function deleteQueue($computeResourceId, $queueName)
+ {
+ if (Config::get('pga_config.airavata')['enable-app-catalog-cache']) {
+ if (Cache::has('CR-' . $computeResourceId)) {
+ Cache::forget('CR-' . $computeResourceId);
+ }
+ }
+ Airavata::deleteBatchQueue(Session::get('authz-token'), $computeResourceId, $queueName);
+ }
+
+
+ /*
+ * Creating Job Submission Interface.
+ */
+
+ public static function create_or_update_JSIObject($inputs, $update = false)
+ {
+
+ $computeResource = CRUtilities::get_compute_resource($inputs["crId"]);
+
+ if (Config::get('pga_config.airavata')['enable-app-catalog-cache']) {
+ if (Cache::has('CR-' . $inputs["crId"])) {
+ Cache::forget('CR-' . $inputs["crId"]);
+ }
+ }
+
+ $jsiId = null;
+ if (isset($inputs["jsiId"]))
+ $jsiId = $inputs["jsiId"];
+
+ if ($inputs["jobSubmissionProtocol"] == JobSubmissionProtocol::LOCAL) {
+
+ //print_r( $jsiObject->resourceJobManager->resourceJobManagerId);
+ $resourceManager = new ResourceJobManager(array(
+ "resourceJobManagerType" => $inputs["resourceJobManagerType"],
+ "pushMonitoringEndpoint" => $inputs["pushMonitoringEndpoint"],
+ "jobManagerBinPath" => $inputs["jobManagerBinPath"],
+ "jobManagerCommands" => $inputs["jobManagerCommands"]
+ ));
+
+ //$rmId = $jsiObject->resourceJobManager->resourceJobManagerId;
+ //$rm = $airavataclient->updateResourceJobManager($rmId, $resourceManager);
+ //print_r( $rm); exit;
+ $localJobSubmission = new LOCALSubmission(array(
+ "resourceJobManager" => $resourceManager
+ )
+ );
+
+ if ($update) //update Local JSP
+ {
+ $jsiObject = Airavata::getLocalJobSubmission(Session::get('authz-token'), $jsiId);
+ $localSub = Airavata::updateResourceJobManager(Session::get('authz-token'), $jsiObject->resourceJobManager->resourceJobManagerId, $resourceManager);
+ //$localSub = $airavataclient->updateLocalSubmissionDetails( $jsiId, $localJobSubmission);
+ } else // create Local JSP
+ {
+ $localSub = Airavata::addLocalSubmissionDetails(Session::get('authz-token'), $computeResource->computeResourceId, 0, $localJobSubmission);
+ return $localSub;
+ }
+
+ } else if ($inputs["jobSubmissionProtocol"] == JobSubmissionProtocol::SSH) {
+ $resourceManager = new ResourceJobManager(array(
+ "resourceJobManagerType" => $inputs["resourceJobManagerType"],
+ "pushMonitoringEndpoint" => $inputs["pushMonitoringEndpoint"],
+ "jobManagerBinPath" => $inputs["jobManagerBinPath"],
+ "jobManagerCommands" => $inputs["jobManagerCommands"]
+ ));
+ $sshJobSubmission = new SSHJobSubmission(array
+ (
+ "securityProtocol" => intval($inputs["securityProtocol"]),
+ "resourceJobManager" => $resourceManager,
+ "alternativeSSHHostName" => $inputs["alternativeSSHHostName"],
+ "sshPort" => intval($inputs["sshPort"]),
+ "monitorMode" => MonitorMode::JOB_EMAIL_NOTIFICATION_MONITOR
+ )
+ );
+ //var_dump( $sshJobSubmission); exit;
+ if ($update) //update Local JSP
+ {
+ $jsiObject = Airavata::getSSHJobSubmission(Session::get('authz-token'), $jsiId);
+
+ //first update resource job manager
+ $rmjId = $jsiObject->resourceJobManager->resourceJobManagerId;
+ Airavata::updateResourceJobManager(Session::get('authz-token'), $rmjId, $resourceManager);
+ $jsiObject = Airavata::getSSHJobSubmission(Session::get('authz-token'), $jsiId);
+
+ $jsiObject->securityProtocol = intval($inputs["securityProtocol"]);
+ $jsiObject->alternativeSSHHostName = $inputs["alternativeSSHHostName"];
+ $jsiObject->sshPort = intval($inputs["sshPort"]);
+ $jsiObject->monitorMode = intval($inputs["monitorMode"]);
+ $jsiObject->resourceJobManager = Airavata::getresourceJobManager(Session::get('authz-token'), $rmjId);
+ //var_dump( $jsiObject); exit;
+ //add updated resource job manager to ssh job submission object.
+ //$sshJobSubmission->resourceJobManager->resourceJobManagerId = $rmjId;
+ $localSub = Airavata::updateSSHJobSubmissionDetails(Session::get('authz-token'), $jsiId, $jsiObject);
+ } else {
+ $sshSub = Airavata::addSSHJobSubmissionDetails(Session::get('authz-token'), $computeResource->computeResourceId, 0, $sshJobSubmission);
+ }
+ return;
+ } else if ($inputs["jobSubmissionProtocol"] == JobSubmissionProtocol::SSH_FORK) {
+ $resourceManager = new ResourceJobManager(array(
+ "resourceJobManagerType" => $inputs["resourceJobManagerType"],
+ "pushMonitoringEndpoint" => $inputs["pushMonitoringEndpoint"],
+ "jobManagerBinPath" => $inputs["jobManagerBinPath"],
+ "jobManagerCommands" => $inputs["jobManagerCommands"]
+ ));
+ $sshJobSubmission = new SSHJobSubmission(array
+ (
+ "securityProtocol" => intval($inputs["securityProtocol"]),
+ "resourceJobManager" => $resourceManager,
+ "alternativeSSHHostName" => $inputs["alternativeSSHHostName"],
+ "sshPort" => intval($inputs["sshPort"]),
+ "monitorMode" => MonitorMode::FORK
+ )
+ );
+ //var_dump( $sshJobSubmission); exit;
+ if ($update) //update Local JSP
+ {
+ $jsiObject = Airavata::getSSHJobSubmission(Session::get('authz-token'), $jsiId);
+
+ //first update resource job manager
+ $rmjId = $jsiObject->resourceJobManager->resourceJobManagerId;
+ Airavata::updateResourceJobManager(Session::get('authz-token'), $rmjId, $resourceManager);
+ $jsiObject = Airavata::getSSHJobSubmission(Session::get('authz-token'), $jsiId);
+
+ $jsiObject->securityProtocol = intval($inputs["securityProtocol"]);
+ $jsiObject->alternativeSSHHostName = $inputs["alternativeSSHHostName"];
+ $jsiObject->sshPort = intval($inputs["sshPort"]);
+ $jsiObject->monitorMode = intval($inputs["monitorMode"]);
+ $jsiObject->resourceJobManager = Airavata::getresourceJobManager(Session::get('authz-token'), $rmjId);
+ //var_dump( $jsiObject); exit;
+ //add updated resource job manager to ssh job submission object.
+ //$sshJobSubmission->resourceJobManager->resourceJobManagerId = $rmjId;
+ $localSub = Airavata::updateSSHJobSubmissionDetails(Session::get('authz-token'), $jsiId, $jsiObject);
+ } else {
+ $sshSub = Airavata::addSSHForkJobSubmissionDetails(Session::get('authz-token'), $computeResource->computeResourceId, 0, $sshJobSubmission);
+ }
+ return;
+ } else if ($inputs["jobSubmissionProtocol"] == JobSubmissionProtocol::UNICORE) {
+ $unicoreJobSubmission = new UnicoreJobSubmission(array
+ (
+ "securityProtocol" => intval($inputs["securityProtocol"]),
+ "unicoreEndPointURL" => $inputs["unicoreEndPointURL"]
+ )
+ );
+ if ($update) {
+ $jsiObject = Airavata::getUnicoreJobSubmission(Session::get('authz-token'), $jsiId);
+ $jsiObject->securityProtocol = intval($inputs["securityProtocol"]);
+ $jsiObject->unicoreEndPointURL = $inputs["unicoreEndPointURL"];
+
+ $unicoreSub = Airavata::updateUnicoreJobSubmissionDetails(Session::get('authz-token'), $jsiId, $jsiObject);
+ } else {
+ $unicoreSub = Airavata::addUNICOREJobSubmissionDetails(Session::get('authz-token'), $computeResource->computeResourceId, 0, $unicoreJobSubmission);
+ }
+ } else /* Globus does not work currently */ {
+ print_r("Whoops! We haven't coded for this Job Submission 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.");
+ }
+ }
+
+ /*
+ * Creating Data Movement Interface Object.
+ */
+ public static function create_or_update_DMIObject($inputs, $update = false)
+ {
+
+ $computeResource = CRUtilities::get_compute_resource($inputs["crId"]);
+
+ if (Config::get('pga_config.airavata')['enable-app-catalog-cache']) {
+ if (Cache::has('CR-' . $inputs["crId"])) {
+ Cache::forget('CR-' . $inputs["crId"]);
+ }
+ }
+
+ if ($inputs["dataMovementProtocol"] == DataMovementProtocol::LOCAL) /* LOCAL */ {
+ $localDataMovement = new LOCALDataMovement();
+ $localdmp = Airavata::addLocalDataMovementDetails(Session::get('authz-token'), $computeResource->computeResourceId, 0, $localDataMovement);
+
+ if ($localdmp)
+ print_r("The Local Data Movement has been added. Edit UI for the Local Data Movement Interface is yet to be made.
+ Please click <a href='" . URL::to('/') . "/cr/edit'>here</a> to go back to edit page for compute resource.");
+ } else if ($inputs["dataMovementProtocol"] == DataMovementProtocol::SCP) /* SCP */ {
+ //var_dump( $inputs); exit;
+ $scpDataMovement = new SCPDataMovement(array(
+ "securityProtocol" => intval($inputs["securityProtocol"]),
+ "alternativeSCPHostName" => $inputs["alternativeSSHHostName"],
+ "sshPort" => intval($inputs["sshPort"])
+ )
+
+ );
+
+ if ($update)
+ $scpdmp = Airavata::updateSCPDataMovementDetails(Session::get('authz-token'), $inputs["dmiId"], $scpDataMovement);
+ else
+ $scpdmp = Airavata::addSCPDataMovementDetails(Session::get('authz-token'), $computeResource->computeResourceId, 0, $scpDataMovement);
+ } else if ($inputs["dataMovementProtocol"] == DataMovementProtocol::GridFTP) /* GridFTP */ {
+ $gridFTPDataMovement = new GridFTPDataMovement(array(
+ "securityProtocol" => $inputs["securityProtocol"],
+ "gridFTPEndPoints" => $inputs["gridFTPEndPoints"]
+ ));
+ if ($update)
+ $gridftpdmp = Airavata::updateGridFTPDataMovementDetails(Session::get('authz-token'), $inputs["dmiId"], $gridFTPDataMovement);
+ else
+ $gridftpdmp = Airavata::addGridFTPDataMovementDetails(Session::get('authz-token'), $computeResource->computeResourceId, 0, $gridFTPDataMovement);
+ } else if ($inputs["dataMovementProtocol"] == DataMovementProtocol::UNICORE_STORAGE_SERVICE) /* Unicore Storage Service */ {
+ $unicoreDataMovement = new UnicoreDataMovement(array
+ (
+ "securityProtocol" => intval($inputs["securityProtocol"]),
+ "unicoreEndPointURL" => $inputs["unicoreEndPointURL"]
+ )
+ );
+ if ($update)
+ $unicoredmp = Airavata::updateUnicoreDataMovementDetails(Session::get('authz-token'), $inputs["dmiId"], $unicoreDataMovement);
+ else
+ $unicoredmp = Airavata::addUnicoreDataMovementDetails(Session::get('authz-token'), $computeResource->computeResourceId, 0, $unicoreDataMovement);
+ } 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.");
+ }
+ }
+
+ public static function getAllDSObjects($onlyName = false)
+ {
+ $dsNames = Airavata::getAllStorageResourceNames(Session::get('authz-token'));
+ if ($onlyName)
+ return $dsNames;
+ else {
+ $dsObjects = array();
+ foreach ($dsNames as $id => $dsName) {
+ array_push($dsObjects, Airavata::getStorageResource(Session::get('authz-token'), $id));
+ }
+ return $dsObjects;
+ }
+
+ }
+
+ public static function getBrowseDSData($onlyNames)
+ { /*
+ $appDeployments = Airavata::getAllApplicationDeployments(Session::get('authz-token'),
+ Session::get("gateway_id"));
+ */
+ return array('crObjects' => DSUtilities::getAllDSObjects($onlyNames));
+ }
+
+ public static function getJobSubmissionDetails($jobSubmissionInterfaceId, $jsp)
+ {
+ //jsp = job submission protocol type
+ if ($jsp == JobSubmissionProtocol::LOCAL)
+ return Airavata::getLocalJobSubmission(Session::get('authz-token'), $jobSubmissionInterfaceId);
+ else if ($jsp == JobSubmissionProtocol::SSH || $jsp == JobSubmissionProtocol::SSH_FORK)
+ return Airavata::getSSHJobSubmission(Session::get('authz-token'), $jobSubmissionInterfaceId);
+ else if ($jsp == JobSubmissionProtocol::UNICORE)
+ return Airavata::getUnicoreJobSubmission(Session::get('authz-token'), $jobSubmissionInterfaceId);
+ else if ($jsp == JobSubmissionProtocol::CLOUD)
+ return Airavata::getCloudJobSubmission(Session::get('authz-token'), $jobSubmissionInterfaceId);
+
+ //globus get function not present ??
+ }
+
+ public static function getDataMovementDetails($dataMovementInterfaceId, $dmi)
+ {
+ //jsp = job submission protocol type
+ if ($dmi == DataMovementProtocol::LOCAL)
+ return Airavata::getLocalDataMovement(Session::get('authz-token'), $dataMovementInterfaceId);
+ else if ($dmi == DataMovementProtocol::SCP)
+ return Airavata::getSCPDataMovement(Session::get('authz-token'), $dataMovementInterfaceId);
+ else if ($dmi == DataMovementProtocol::GridFTP)
+ 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 == JobSubmissionProtocol::CLOUD)
+ return $airavataclient->getCloudJobSubmission( $dataMovementInterfaceId);
+ */
+
+ //globus get function not present ??
+ }
+
+ public static function deleteActions($inputs)
+ {
+ if (isset($inputs["crId"])) {
+ if (Config::get('pga_config.airavata')['enable-app-catalog-cache']) {
+ if (Cache::has('CR-' . $inputs["crId"])) {
+ Cache::forget('CR-' . $inputs["crId"]);
+ }
+ }
+ } elseif (isset($inputs["del-crId"])) {
+ if (Config::get('pga_config.airavata')['enable-app-catalog-cache']) {
+ if (Cache::has('CR-' . $inputs["del-crId"])) {
+ Cache::forget('CR-' . $inputs["del-crId"]);
+ }
+ }
+ }
+
+ if (isset($inputs["jsiId"]))
+ if (Airavata::deleteJobSubmissionInterface(Session::get('authz-token'), $inputs["crId"], $inputs["jsiId"]))
+ return 1;
+ else
+ return 0;
+ else if (isset($inputs["dmiId"]))
+ if (Airavata::deleteDataMovementInterface(Session::get('authz-token'), $inputs["crId"], $inputs["dmiId"]))
+ return 1;
+ else
+ return 0;
+ elseif (isset($inputs["del-crId"]))
+ if (Airavata::deleteComputeResource(Session::get('authz-token'), $inputs["del-crId"]))
+ return 1;
+ else
+ return 0;
+ }
+
+ public static function create_or_update_gateway_profile($inputs, $update = false)
+ {
+
+ $computeResourcePreferences = array();
+ if (isset($input["crPreferences"]))
+ $computeResourcePreferences = $input["crPreferences"];
+
+ $gatewayProfile = new GatewayResourceProfile(array(
+ "gatewayName" => $inputs["gatewayName"],
+ "gatewayDescription" => $inputs["gatewayDescription"],
+ "computeResourcePreferences" => $computeResourcePreferences
+ )
+ );
+
+ if ($update) {
+ $gatewayProfile = new GatewayResourceProfile(array(
+ "gatewayName" => $inputs["gatewayName"],
+ "gatewayDescription" => $inputs["gatewayDescription"]
+ )
+ );
+ $gatewayProfileId = Airavata::updateGatewayResourceProfile(Session::get('authz-token'), $inputs["edit-gpId"], $gatewayProfile);
+ } else
+ $gatewayProfileId = Airavata::registerGatewayResourceProfile(Session::get('authz-token'), $gatewayProfile);
+ }
+
+ public static function getAllGatewayProfilesData()
+ {
+
+ if (Session::has("scigap_admin"))
+ $gateways = Airavata::getAllGateways(Session::get('authz-token'));
+ else {
+ $gateways[0] = Airavata::getGateway(Session::get('authz-token'), Session::get("gateway_id"));
+ }
+
+ $gatewayProfiles = Airavata::getAllGatewayResourceProfiles(Session::get('authz-token'));
+ //var_dump( $gatewayProfiles); exit;
+ //$gatewayProfileIds = array("GatewayTest3_57726e98-313f-4e7c-87a5-18e69928afb5", "GatewayTest4_4fd9fb28-4ced-4149-bdbd-1f276077dad8");
+ foreach ($gateways as $key => $gw) {
+ $gateways[$key]->profile = array();
+ foreach ((array)$gatewayProfiles as $index => $gp) {
+
+ if ($gw->gatewayId == $gp->gatewayID) {
+ foreach ((array)$gp->computeResourcePreferences as $i => $crp) {
+ $gatewayProfiles[$index]->computeResourcePreferences[$i]->crDetails = Airavata::getComputeResource(Session::get('authz-token'), $crp->computeResourceId);
+ }
+ $gateways[$key]->profile = $gatewayProfiles[$index];
+ }
+ }
+ }
+ //var_dump( $gatewayProfiles[0]->computeResourcePreferences[0]->crDetails); exit;
+
+ return $gateways;
+ }
+
+ public static function updateGatewayProfile( $data){
+ $gatewayResourceProfile = Airavata::getGatewayResourceProfile( Session::get('authz-token'), $data["gateway_id"]);
+ $gatewayResourceProfile->credentialStoreToken = $data["cst"];
+ return Airavata::updateGatewayResourceProfile( Session::get('authz-token'), $data["gateway_id"], $gatewayResourceProfile);
+ }
+
+ public static function add_or_update_CRP($inputs)
+ {
+ $computeResourcePreferences = new computeResourcePreference($inputs);
+
+ if (Config::get('pga_config.airavata')['enable-app-catalog-cache']) {
+ if (Cache::has('CR-' . $inputs["computeResourceId"])) {
+ Cache::forget('CR-' . $inputs["computeResourceId"]);
+ }
+ }
+
+ //var_dump( $inputs); exit;
+ return Airavata::addGatewayComputeResourcePreference(Session::get('authz-token'), $inputs["gatewayId"], $inputs["computeResourceId"], $computeResourcePreferences);
+
+ }
+
+ public static function deleteGP($gpId)
+ {
+ return Airavata::deleteGatewayResourceProfile(Session::get('authz-token'), $gpId);
+ }
+
+ public static function deleteCR($inputs)
+ {
+ if (Config::get('pga_config.airavata')['enable-app-catalog-cache']) {
+ $id = $inputs["rem-crId"];
+ if (Cache::has('CR-' . $id)) {
+ Cache::forget('CR-' . $id);
+ }
+ }
+
+ return Airavata::deleteGatewayComputeResourcePreference(Session::get('authz-token'), $inputs["gpId"], $inputs["rem-crId"]);
+ }
+
+ /**
+ * Get the ComputeResourceDescription with the given ID
+ * @param $id
+ * @return null
+ */
+ public static function get_compute_resource($id)
+ {
+ $computeResource = null;
+
+ try {
+ if (Config::get('pga_config.airavata')['enable-app-catalog-cache']) {
+ if (Cache::has('CR-' . $id)) {
+ return Cache::get('CR-' . $id);
+ } else {
+ $computeResource = Airavata::getComputeResource(Session::get('authz-token'), $id);
+ Cache::put('CR-' . $id, $computeResource, Config::get('pga_config.airavata')['app-catalog-cache-duration']);
+ return $computeResource;
+ }
+ } else {
+ return $computeResource = Airavata::getComputeResource(Session::get('authz-token'), $id);
+ }
+
+ } catch (InvalidRequestException $ire) {
+ CommonUtilities::print_error_message('<p>There was a problem getting the compute resource.
+ Please try again later or submit a bug report using the link in the Help menu.</p>' .
+ '<p>InvalidRequestException: ' . $ire->getMessage() . '</p>');
+ } catch (AiravataClientException $ace) {
+ CommonUtilities::print_error_message('<p>There was a problem getting the compute resource.
+ Please try again later or submit a bug report using the link in the Help menu.</p>' .
+ '<p>Airavata Client Exception: ' . $ace->getMessage() . '</p>');
+ } catch (AiravataSystemException $ase) {
+ CommonUtilities::print_error_message('<p>There was a problem getting the compute resource.
+ Please try again later or submit a bug report using the link in the Help menu.</p>' .
+ '<p>Airavata System Exception: ' . $ase->getMessage() . '</p>');
+ }
+ }
+
+
+ /**
+ * Create a select input and populate it with compute resources
+ * available for the given application ID
+ * @param $applicationId
+ * @param $resourceHostId
+ */
+ public static function create_compute_resources_select($applicationId, $resourceHostId)
+ {
+ return CRUtilities::get_available_app_interface_compute_resources($applicationId);
+ }
+
+ /**
+ * Get a list of compute resources available for the given application ID
+ * @param $id
+ * @return null
+ */
+ public static function get_available_app_interface_compute_resources($id)
+ {
+ $computeResources = null;
+
+ try {
+ $computeResources = Airavata::getAvailableAppInterfaceComputeResources(Session::get('authz-token'), $id);
+ } catch (InvalidRequestException $ire) {
+ CommonUtilities::print_error_message('<p>There was a problem getting compute resources.
+ Please try again later or submit a bug report using the link in the Help menu.</p>' .
+ '<p>InvalidRequestException: ' . $ire->getMessage() . '</p>');
+ } catch (AiravataClientException $ace) {
+ CommonUtilities::print_error_message('<p>There was a problem getting compute resources.
+ Please try again later or submit a bug report using the link in the Help menu.</p>' .
+ '<p>Airavata Client Exception: ' . $ace->getMessage() . '</p>');
+ } catch (AiravataSystemException $ase) {
+ CommonUtilities::print_error_message('<p>There was a problem getting compute resources.
+ Please try again later or submit a bug report using the link in the Help menu.</p>' .
+ '<p>Airavata System Exception: ' . $ase->getMessage() . '</p>');
+ }
+
+ return $computeResources;
+ }
+
+ /**
+ * Get a list of all Data Storages available
+ * @param null
+ * @return
+ **/
+
+ public static function getAllDataStoragePreferences( $gateways){
+ $dspArray = array();
+ foreach( $gateways as $gateway){
+ $dspArray[] = Airavata::getAllGatewayDataStoragePreferences( Session::get('authz-token'), $gateway->gatewayId);
+ }
+ return $dspArray;
+ }
+
+}
+
+?>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/7dcf7f98/app/routes.php
----------------------------------------------------------------------
diff --git a/app/routes.php b/app/routes.php
index 31980a2..59bdf38 100755
--- a/app/routes.php
+++ b/app/routes.php
@@ -117,6 +117,33 @@ Route::post("cr/delete-jsi", "ComputeResourceController@deleteActions");
Route::post("cr/delete-dmi", "ComputeResourceController@deleteActions");
Route::post("cr/delete-cr", "ComputeResourceController@deleteActions");
+
+/*
+ * Data Storage Resources Routes
+*/
+
+Route::get("ds/create", function () {
+ return Redirect::to("cr/create/step1");
+});
+
+Route::get("ds/create", "DatastorageController@createView");
+
+Route::post("ds/create", "DatastorageController@createSubmit");
+
+Route::get("ds/edit", "DatastorageController@editView");
+
+Route::post("ds/edit", "DatastorageController@editSubmit");
+
+Route::get("ds/view", "DatastorageController@viewView");
+
+Route::get("ds/browse", "DatastorageController@browseView");
+
+Route::post("ds/delete-jsi", "DatastorageController@deleteActions");
+
+Route::post("ds/delete-dmi", "DatastorageController@deleteActions");
+
+Route::post("ds/delete-cr", "DatastorageController@deleteActions");
+
/*
* Application Catalog Routes
*/
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/7dcf7f98/app/views/data-storage/browse.blade.php
----------------------------------------------------------------------
diff --git a/app/views/data-storage/browse.blade.php b/app/views/data-storage/browse.blade.php
new file mode 100644
index 0000000..c9b5382
--- /dev/null
+++ b/app/views/data-storage/browse.blade.php
@@ -0,0 +1,213 @@
+@extends('layout.basic')
+
+@section('page-header')
+@parent
+{{ HTML::style('css/admin.css')}}
+{{ HTML::style('css/datetimepicker.css')}}
+@stop
+
+@section('content')
+
+<div id="wrapper">
+ <!-- Sidebar Menu Items - These collapse to the responsive navigation menu on small screens -->
+ @include( 'partials/dashboard-block')
+ <div id="page-wrapper">
+
+<div class="container-fluid">
+ @if( Session::has("message"))
+ <div class="col-md-12">
+ <span class="alert alert-success">{{ Session::get("message") }}</span>
+ </div>
+ {{ Session::forget("message") }}
+ @endif
+
+ @if ( isset( $allCRs) )
+ @if (sizeof($allCRs) == 0)
+ {{ CommonUtilities::print_warning_message('No Compute Resources are registered. Please use "Register Compute
+ Resource" to
+ register a new resources.') }}
+ @else
+ <br/>
+ <div class="col-md-12">
+ <div class="panel panel-default form-inline">
+ <div class="panel-heading">
+ <h3 style="margin:0;">Search Compute Resources</h3>
+ </div>
+ <div class="panel-body">
+ <div class="form-group search-text-block">
+ <label>Compute Resource Name </label>
+ <input type="search" class="form-control filterinput"/>
+ </div>
+ </div>
+ </div>
+
+ <div class="row">
+ <div class="table-responsive">
+ <table class="table">
+
+ <tr>
+
+ <th>Name</th>
+ <th>Id</th>
+ @if(Session::has("admin"))
+ <th>Enabled</th>
+ <th>Edit</th>
+ @endif
+ <th>View</th>
+ @if(Session::has("admin"))
+ <th>Delete</th>
+ @endif
+ </tr>
+
+ @foreach($allCRs as $resource)
+ <?php
+ $crId = $resource->computeResourceId;
+ $crName = $resource->hostName;
+ $enabled = $resource->enabled;
+ ?>
+ <tr id="crDetails">
+ <td>{{ $crName }}</td>
+ <td>{{ $crId }}</td>
+ @if(Session::has("admin"))
+ <td>
+ @if(!$enabled)
+ <div class="checkbox">
+ <input class="resource-status" resourceId="{{$crId}}" type="checkbox">
+ </div>
+ @else
+ <div class="checkbox">
+ <input class="resource-status" type="checkbox" resourceId="{{$crId}}" checked>
+ </div>
+ @endif
+ </td>
+ <td><a href="{{URL::to('/')}}/cr/edit?crId={{ $crId }}" title="Edit">
+ <span class="glyphicon glyphicon-pencil"></span>
+ </a>
+ </td>
+ @endif
+ <td>
+ <a href="{{URL::to('/')}}/cr/view?crId={{ $crId }}" title="Edit">
+ <span class="glyphicon glyphicon-list"></span>
+ </a>
+ </td>
+ @if(Session::has("admin"))
+ <td>
+ <a href="#" title="Delete">
+ <span class="glyphicon glyphicon-trash del-cr" data-toggle="modal"
+ data-target="#delete-cr-block" data-delete-cr-name="{{$crName}}"
+ data-deployment-count="{{$connectedDeployments[$crId]}}"
+ data-crid="{{$crId}}"></span>
+ </a>
+ </td>
+ @endif
+ </tr>
+ @endforeach
+
+ </table>
+ </div>
+ </div>
+ @endif
+ @endif
+
+ <div class="modal fade" id="delete-cr-block" tabindex="-1" role="dialog" aria-labelledby="add-modal"
+ aria-hidden="true">
+ <div class="modal-dialog">
+
+ <form action="{{URL::to('/')}}/cr/delete-cr" method="POST">
+ <div class="modal-content">
+ <div class="modal-header">
+ <h3 class="text-center">Delete Compute Resource Confirmation</h3>
+ </div>
+ <div class="modal-body">
+ <input type="hidden" class="form-control delete-crId" name="del-crId"/>
+ The Compute Resource, <span class="delete-cr-name"></span> is connected to <span
+ class="deploymentCount">0</span> deployments.
+ Do you really want to delete it? This action cannot be undone.
+ </div>
+ <div class="modal-footer">
+ <div class="form-group">
+ <input type="submit" class="btn btn-danger" value="Delete"/>
+ <input type="button" class="btn btn-default" data-dismiss="modal" value="Cancel"/>
+ </div>
+ </div>
+ </div>
+
+ </form>
+ </div>
+ </div>
+
+ </div>
+</div>
+</div>
+
+ @stop
+ @section('scripts')
+ @parent
+ <script type="text/javascript">
+ $('.filterinput').keyup(function () {
+ var value = $(this).val();
+ if (value.length > 0) {
+ $("table tr").each(function (index) {
+ if (index != 0) {
+
+ $row = $(this);
+
+ var id = $row.find("td:first").text();
+ id = $.trim(id);
+ id = id.substr(0, value.length);
+ if (id == value) {
+ $(this).slideDown();
+ }
+ else {
+ $(this).slideUp();
+ }
+ }
+ });
+ } else {
+ $("table tr").slideDown();
+ }
+ return false;
+ });
+
+ $(".del-cr").click(function () {
+ $(".delete-cr-name").html("'" + $(this).data("delete-cr-name") + "'");
+ $(".delete-crId").val($(this).data("crid"));
+ $(".deploymentCount").html($(this).data("deployment-count"));
+ });
+
+ $('.resource-status').click(function() {
+ var $this = $(this);
+ if ($this.is(':checked')) {
+ //enable compute resource
+ $resourceId = $this.attr("resourceId");
+ $.ajax({
+ type: 'POST',
+ url: "{{URL::to('/')}}/admin/enable-cr",
+ data: {
+ 'resourceId': $resourceId
+ },
+ async: true,
+ success: function (data) {
+ console.log("enabled cr " + $resourceId);
+ $(".success-message").html("<span class='alert alert-success col-md-12'>Successfully enabled compute resource</span>");
+ }
+ });
+ } else {
+ //disabled compute resource
+ $resourceId = $this.attr("resourceId");
+ $.ajax({
+ type: 'POST',
+ url: "{{URL::to('/')}}/admin/disable-cr",
+ data: {
+ 'resourceId': $resourceId
+ },
+ async: true,
+ success: function (data) {
+ console.log("disabled cr " + $resourceId);
+ $(".success-message").html("<span class='alert alert-success col-md-12'>Successfully disabled compute resource</span>");
+ }
+ });
+ }
+ });
+ </script>
+ @stop
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/7dcf7f98/app/views/data-storage/create.blade.php
----------------------------------------------------------------------
diff --git a/app/views/data-storage/create.blade.php b/app/views/data-storage/create.blade.php
new file mode 100644
index 0000000..1d44c22
--- /dev/null
+++ b/app/views/data-storage/create.blade.php
@@ -0,0 +1,53 @@
+@extends('layout.basic')
+
+@section('page-header')
+@parent
+{{ HTML::style('css/admin.css')}}
+{{ HTML::style('css/datetimepicker.css')}}
+@stop
+
+@section('content')
+
+<div id="wrapper">
+ <!-- Sidebar Menu Items - These collapse to the responsive navigation menu on small screens -->
+ @include( 'partials/dashboard-block')
+ <div id="page-wrapper">
+
+<div class="container-fluid">
+ <div class="col-md-offset-2 col-md-8">
+ <h3>Create a Resource</h3>
+
+ <form role="form" method="POST" action="{{ URL::to('/') }}/cr/create">
+ <div class="form-group required">
+ <label class="control-label">Host Name</label>
+ <input class="form-control hostName" maxlength="100" name="hostname" required="required"/>
+ </div>
+ <div class="form-group">
+ <label class="control-label">Host Aliases</label>
+ <input class="form-control" maxlength="30" name="hostaliases[]"/>
+ <button type="button" class="btn btn-sm btn-default add-alias">Add More Aliases</button>
+ </div>
+ <div class="form-group">
+ <label class="control-label">IP Addresses</label>
+ <input class="form-control" maxlength="30" name="ips[]"/>
+ <button type="button" class="btn btn-sm btn-default add-ip">Add More IP Addresses</button>
+ </div>
+ <div class="form-group">
+ <label class="control-label">Resource Description</label>
+ <textarea class="form-control" maxlength="255" name="description"></textarea>
+ </div>
+ <div class="form-group">
+ <input type="submit" class="btn btn-lg btn-primary" name="step1" value="Create"/>
+ <input type="reset" class="btn btn-lg btn-success" value="Reset"/>
+ </div>
+ </form>
+ </div>
+</div>
+</div>
+</div>
+@stop
+
+@section('scripts')
+@parent
+{{ HTML::script('js/script.js') }}
+@stop
\ No newline at end of file