You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by sc...@apache.org on 2015/07/13 19:25:36 UTC
[42/42] airavata-php-gateway git commit: merging master branch to the
0.15 release branch
merging master branch to the 0.15 release branch
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/30937119
Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/30937119
Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/30937119
Branch: refs/heads/airavata-php-gateway-0.15-release
Commit: 3093711957f0349ffb26712c5fa2da6850a6f531
Parents: ac23dee
Author: Supun Nakandala <sc...@apache.org>
Authored: Thu Jul 2 00:27:20 2015 +0530
Committer: Supun Nakandala <sc...@apache.org>
Committed: Thu Jul 2 00:27:20 2015 +0530
----------------------------------------------------------------------
app/controllers/AdminController.php | 249 ++++++++++---------
app/libraries/ExperimentUtilities.php | 6 +-
app/views/admin/experiment-statistics.blade.php | 8 +-
app/views/project/summary.blade.php | 10 +-
4 files changed, 142 insertions(+), 131 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/30937119/app/controllers/AdminController.php
----------------------------------------------------------------------
diff --git a/app/controllers/AdminController.php b/app/controllers/AdminController.php
index 3993838..00b93bd 100644
--- a/app/controllers/AdminController.php
+++ b/app/controllers/AdminController.php
@@ -1,128 +1,139 @@
<?php
-class AdminController extends BaseController {
-
- public function __construct()
- {
- Session::put("nav-active", "user-console");
- }
-
- public function console(){
- return View::make("admin/dashboard");
- }
-
- public function dashboard(){
- //only for super admin
- //Session::put("scigap_admin", true);
-
- $crData = CRUtilities::getEditCRData();
- $gateways = CRUtilities::getAllGatewayProfilesData();
-
- $gatewayData = array(
- "gateways" => $gateways,
- "computeResources" => CRUtilities::getAllCRObjects(),
- "crData" => $crData);
- if( Session::has("scigap_admin"))
- $view = "scigap-admin/manage-gateway";
- else
- $view = "admin/manage-gateway";
-
- return View::make( $view, $gatewayData);
- }
-
- public function addAdminSubmit(){
- WSIS::update_user_roles( Input::get("username"), array( "new"=>array("admin"), "deleted"=>array() ) );
-
- return View::make("account/admin-dashboard")->with("message", "User has been added to Admin.");
- }
-
- public function usersView(){
- if( Input::has("role"))
- {
- $users = WSIS::getUserlistOfRole(Input::get("role"));
- if( isset( $users->return))
- $users = $users->return;
- else
- $users = array();
- }
- else
- $users = WSIS::listUsers();
-
- $roles = WSIS::getAllRoles();
-
- return View::make("admin/manage-users", array("users" => $users, "roles" => $roles));
-
- }
-
- public function addGatewayAdminSubmit(){
- //check if username exists
- if(WSIS::usernameExists( Input::get("username")) )
- {
- WSIS::updateUserRoles(Input::get("username"), array( "new"=>array( Config::get('wsis::admin-role-name')), "deleted"=>array() ) );
- return Redirect::to("admin/dashboard/users?role=" . Config::get('wsis::admin-role-name'))->with("Gateway Admin has been added.");
- }
- else
- {
- echo ("username doesn't exist only."); exit;
- }
- }
-
- public function rolesView(){
-
- $roles = WSIS::getAllRoles();
- return View::make("admin/manage-roles", array("roles" => $roles));
- }
-
- public function experimentsView(){
- return View::make("admin/manage-experiments" );
- }
-
- public function resourcesView(){
- $data = CRUtilities::getBrowseCRData();
- $allCRs = $data["crObjects"];
- return View::make("admin/manage-resources", array("resources" => $allCRs) );
- }
-
- public function addRole(){
- WSIS::addRole( Input::get("role") );
- return Redirect::to("admin/dashboard/roles")->with( "message", "Role has been added.");
- }
-
- public function getRoles(){
- return json_encode((array)WSIS::getUserRoles(Input::get("username")));
- }
-
- public function deleteRole(){
- WSIS::deleteRole( Input::get("role") );
- return Redirect::to("admin/dashboard/roles")->with( "message", "Role has been deleted.");
-
- }
-
- public function credentialStoreView(){
- return View::make("admin/manage-credentials", array("tokens" => array()) );
- }
-
- public function updateUserRoles(){
- if( Input::has("add"))
- return WSIS::updateUserRoles(Input::get("username"), array("new"=> Input::get("roles"), "deleted" => array() ) );
- else
- return WSIS::updateUserRoles(Input::get("username"), array("new"=> array(), "deleted" => Input::get("roles") ) );
- }
-
-
- /* ---- Super Admin Functions ------- */
-
- public function addGateway(){
-
- $inputs = Input::all();
+class AdminController extends BaseController
+{
+
+ public function __construct()
+ {
+ Session::put("nav-active", "user-console");
+ }
+
+ public function console()
+ {
+ return View::make("admin/dashboard");
+ }
+
+ public function dashboard()
+ {
+ //only for super admin
+ //Session::put("scigap_admin", true);
+
+ $crData = CRUtilities::getEditCRData();
+ $gateways = CRUtilities::getAllGatewayProfilesData();
+
+ $gatewayData = array(
+ "gateways" => $gateways,
+ "computeResources" => CRUtilities::getAllCRObjects(),
+ "crData" => $crData);
+ if (Session::has("scigap_admin"))
+ $view = "scigap-admin/manage-gateway";
+ else
+ $view = "admin/manage-gateway";
+
+ return View::make($view, $gatewayData);
+ }
+
+ public function addAdminSubmit()
+ {
+ WSIS::update_user_roles(Input::get("username"), array("new" => array("admin"), "deleted" => array()));
+
+ return View::make("account/admin-dashboard")->with("message", "User has been added to Admin.");
+ }
+
+ public function usersView()
+ {
+ if (Input::has("role")) {
+ $users = WSIS::getUserlistOfRole(Input::get("role"));
+ if (isset($users->return))
+ $users = $users->return;
+ else
+ $users = array();
+ } else
+ $users = WSIS::listUsers();
+
+ $roles = WSIS::getAllRoles();
+
+ return View::make("admin/manage-users", array("users" => $users, "roles" => $roles));
+
+ }
+
+ public function addGatewayAdminSubmit()
+ {
+ //check if username exists
+ if (WSIS::usernameExists(Input::get("username"))) {
+ WSIS::updateUserRoles(Input::get("username"), array("new" => array(Config::get('wsis::admin-role-name')), "deleted" => array()));
+ return Redirect::to("admin/dashboard/users?role=" . Config::get('wsis::admin-role-name'))->with("Gateway Admin has been added.");
+ } else {
+ echo("username doesn't exist only.");
+ exit;
+ }
+ }
+
+ public function rolesView()
+ {
+
+ $roles = WSIS::getAllRoles();
+ return View::make("admin/manage-roles", array("roles" => $roles));
+ }
+
+ public function experimentsView()
+ {
+ return View::make("admin/manage-experiments");
+ }
+
+ public function resourcesView()
+ {
+ $data = CRUtilities::getBrowseCRData();
+ $allCRs = $data["crObjects"];
+ return View::make("admin/manage-resources", array("resources" => $allCRs));
+ }
+
+ public function addRole()
+ {
+ WSIS::addRole(Input::get("role"));
+ return Redirect::to("admin/dashboard/roles")->with("message", "Role has been added.");
+ }
+
+ public function getRoles()
+ {
+ return json_encode((array)WSIS::getUserRoles(Input::get("username")));
+ }
+
+ public function deleteRole()
+ {
+ WSIS::deleteRole(Input::get("role"));
+ return Redirect::to("admin/dashboard/roles")->with("message", "Role has been deleted.");
+
+ }
+
+ public function credentialStoreView()
+ {
+ return View::make("admin/manage-credentials", array("tokens" => array()));
+ }
+
+ public function updateUserRoles()
+ {
+ if (Input::has("add"))
+ return WSIS::updateUserRoles(Input::get("username"), array("new" => Input::get("roles"), "deleted" => array()));
+ else
+ return WSIS::updateUserRoles(Input::get("username"), array("new" => array(), "deleted" => Input::get("roles")));
+ }
+
+
+ /* ---- Super Admin Functions ------- */
+
+ public function addGateway()
+ {
+
+ $inputs = Input::all();
$gateway = AdminUtilities::add_gateway(Input::all());
$tm = WSIS::createTenant(1, $inputs["admin-username"], $inputs["admin-password"], $inputs["admin-email"],
- $inputs["admin-firstname"], $inputs["admin-lastname"], $inputs["domain"]);
-
- return $gateway;
- }
+ $inputs["admin-firstname"], $inputs["admin-lastname"], $inputs["domain"]);
+
+ return $gateway;
+ }
public function experimentStatistics()
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/30937119/app/libraries/ExperimentUtilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/ExperimentUtilities.php b/app/libraries/ExperimentUtilities.php
index ad0ac56..f2c3053 100644
--- a/app/libraries/ExperimentUtilities.php
+++ b/app/libraries/ExperimentUtilities.php
@@ -665,9 +665,9 @@ class ExperimentUtilities
public static function get_job_status(Experiment $experiment)
{
//$jobStatus = Airavata::getJobStatuses($experiment->experimentID);
- if(!empty($experiment->workflowNodeDetailsList)){
- if(!empty($experiment->workflowNodeDetailsList[0]->taskDetailsList)){
- if(!empty($experiment->workflowNodeDetailsList[0]->taskDetailsList[0]->jobDetailsList)){
+ if (!empty($experiment->workflowNodeDetailsList)) {
+ if (!empty($experiment->workflowNodeDetailsList[0]->taskDetailsList)) {
+ if (!empty($experiment->workflowNodeDetailsList[0]->taskDetailsList[0]->jobDetailsList)) {
$jobStatus = $experiment->workflowNodeDetailsList[0]->taskDetailsList[0]->jobDetailsList[0]->jobStatus;
}
}
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/30937119/app/views/admin/experiment-statistics.blade.php
----------------------------------------------------------------------
diff --git a/app/views/admin/experiment-statistics.blade.php b/app/views/admin/experiment-statistics.blade.php
index 36cd5d5..1f67687 100644
--- a/app/views/admin/experiment-statistics.blade.php
+++ b/app/views/admin/experiment-statistics.blade.php
@@ -14,7 +14,7 @@
</div>
</div>
<a id="getAllExperiments" href="#experiment-container">
- <div class="panel-footer">
+ <div class="panel-footer">
<span class="pull-left">View Details</span>
<span class="pull-right"><span class="glyphicon glyphicon-arrow-right"></span></span>
@@ -38,7 +38,7 @@
</div>
</div>
<a id="getCompletedExperiments" href="#experiment-container">
- <div class="panel-footer">
+ <div class="panel-footer">
<span class="pull-left">View Details</span>
<span class="pull-right"><span class="glyphicon glyphicon-arrow-right"></span></i></span>
@@ -62,7 +62,7 @@
</div>
</div>
<a id="getCancelledExperiments" href="#experiment-container">
- <div class="panel-footer">
+ <div class="panel-footer">
<span class="pull-left">View Details</span>
<span class="pull-right"><span class="glyphicon glyphicon-arrow-right"></span></i></span>
@@ -86,7 +86,7 @@
</div>
</div>
<a id="getFailedExperiments" href="#experiment-container">
- <div class="panel-footer">
+ <div class="panel-footer">
<span class="pull-left">View Details</span>
<span class="pull-right"><span class="glyphicon glyphicon-arrow-right"></span></span>
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/30937119/app/views/project/summary.blade.php
----------------------------------------------------------------------
diff --git a/app/views/project/summary.blade.php b/app/views/project/summary.blade.php
index a05c59e..f09fccf 100755
--- a/app/views/project/summary.blade.php
+++ b/app/views/project/summary.blade.php
@@ -9,7 +9,7 @@
<div class="container" style="max-width: 750px;">
-<h1>Project Summary</h1>
+ <h1>Project Summary</h1>
@@ -76,9 +76,9 @@
case 'EXECUTING':
case 'CANCELING':
case 'COMPLETED':
- echo '<a class="' . $textClass . '" href="' . URL::to('/') . '/experiment/summary?expId=' .
- $experiment->experimentID . '">' . $experiment->name . '</a>';
- break;
+ echo '<a class="' . $textClass . '" href="' . URL::to('/') . '/experiment/summary?expId=' .
+ $experiment->experimentID . '">' . $experiment->name . '</a>';
+ break;
default:
echo '<a class="' . $textClass . '" href="' . URL::to('/') . '/experiment/summary?expId=' .
$experiment->experimentID . '">' . $experiment->name . '</a>' .
@@ -106,7 +106,7 @@
echo '</td>';
echo '<td class="time" unix-time="' . $expValues["experimentTimeOfStateChange"] . '"></td>';
- echo '<td>'. $expValues["experimentStatusString"] . '</td>';
+ echo '<td>' . $expValues["experimentStatusString"] . '</td>';
if ($expValues["jobState"]) echo '
<td>' . $expValues["jobState"] . '</td>';