summaryrefslogtreecommitdiffstats
path: root/testapi/opnfv_testapi/ui/components/projects/project/testCases
diff options
context:
space:
mode:
Diffstat (limited to 'testapi/opnfv_testapi/ui/components/projects/project/testCases')
-rw-r--r--testapi/opnfv_testapi/ui/components/projects/project/testCases/testCase/testCase.html70
-rw-r--r--testapi/opnfv_testapi/ui/components/projects/project/testCases/testCase/testCaseController.js6
-rw-r--r--testapi/opnfv_testapi/ui/components/projects/project/testCases/testCases.html130
-rw-r--r--testapi/opnfv_testapi/ui/components/projects/project/testCases/testCasesController.js68
4 files changed, 112 insertions, 162 deletions
diff --git a/testapi/opnfv_testapi/ui/components/projects/project/testCases/testCase/testCase.html b/testapi/opnfv_testapi/ui/components/projects/project/testCases/testCase/testCase.html
index f4bae41..509f39a 100644
--- a/testapi/opnfv_testapi/ui/components/projects/project/testCases/testCase/testCase.html
+++ b/testapi/opnfv_testapi/ui/components/projects/project/testCases/testCase/testCase.html
@@ -3,73 +3,11 @@
<div class="table-responsive">
<table class="table" ng-data="ctrl.data">
<tbody>
- <tr style="padding:9px">
- <td class="podsTableTd">Id&nbsp;:</td>
- <td class="podsTableLeftTd">{{ctrl.data._id}}</td>
+ <tr ng-repeat-start="(index, detail) in ctrl.data_field" style="padding:9px">
+ <td class="podsTableTd" >{{detail | capitalize}}&nbsp;:</td>
+ <td width="86%" class="podsTableLeftTd">{{ctrl.data[index]}}</td>
</tr>
- <tr style="padding:9px">
- <td class="podsTableTd">Name&nbsp;:</td>
- <td width="90%" class="podsTableLeftTd">{{ctrl.data.name}}</td>
- </tr>
- <tr style="padding:9px">
- <td class="podsTableTd">Project&nbsp;:</td>
- <td width="90%" class="podsTableLeftTd">{{ctrl.data.project_name}}</td>
- </tr>
- <tr style="padding:9px">
- <td class="podsTableTd">Creator&nbsp;:</td>
- <td width="90%" class="podsTableLeftTd">{{ctrl.data.creator}}</td>
- </tr>
- <tr style="padding:9px">
- <td class="podsTableTd">Tier&nbsp;:</td>
- <td width="90%" class="podsTableLeftTd">{{ctrl.data.tier}}</td>
- </tr>
- <tr style="padding:9px">
- <td class="podsTableTd">Blocking&nbsp;:</td>
- <td width="90%" class="podsTableLeftTd">{{ctrl.data.blocking}}</td>
- </tr>
- <tr style="padding:9px">
- <td class="podsTableTd">CI&nbsp;Loop&nbsp;:</td>
- <td width="90%" class="podsTableLeftTd">{{ctrl.data.ci_loop}}</td>
- </tr>
- <tr style="padding:9px">
- <td class="podsTableTd">Tags&nbsp;:</td>
- <td width="90%" class="podsTableLeftTd">{{ctrl.data.tags}}</td>
- </tr>
- <tr style="padding:9px">
- <td class="podsTableTd">Version&nbsp;:</td>
- <td width="90%" class="podsTableLeftTd">{{ctrl.data.version}}</td>
- </tr>
- <tr style="padding:9px">
- <td class="podsTableTd">Created&nbsp;at&nbsp;:</td>
- <td width="90%" class="podsTableLeftTd">{{ctrl.data['creation_date']}}</td>
- </tr>
- <tr style="padding:9px">
- <td class="podsTableTd">Dependencies&nbsp;:</td>
- <td width="90%" class="podsTableLeftTd">{{ctrl.data.dependencies}}</td>
- </tr>
- <tr style="padding:9px">
- <td class="podsTableTd">Trust&nbsp;:</td>
- <td width="90%" class="podsTableLeftTd">{{ctrl.data.trust}}</td>
- </tr>
- <tr style="padding:9px">
- <td class="podsTableTd">Criteria&nbsp;:</td>
- <td width="90%" class="podsTableLeftTd">{{ctrl.data.criteria}}</td>
- </tr>
- <tr style="padding:9px">
- <td class="podsTableTd">Catalog&nbsp;Description&nbsp;:</td>
- <td width="90%" class="podsTableLeftTd">{{ctrl.data.catalog_description}}</td>
- </tr>
- <tr style="padding:9px">
- <td class="podsTableTd">URL&nbsp;:</td>
- <td width="90%" class="podsTableLeftTd">{{ctrl.data.url}}</td>
- </tr>
- <tr style="padding:9px">
- <td class="podsTableTd">Run&nbsp;:</td>
- <td width="90%" class="podsTableLeftTd">{{ctrl.data.run}}</td>
- </tr>
- <tr style="padding:9px">
- <td class="podsTableTd">Description&nbsp;:</td>
- <td width="90%" class="podsTableLeftTd">{{ctrl.data.description}}</td>
+ <tr ng-repeat-end=>
</tr>
</tbody>
</table>
diff --git a/testapi/opnfv_testapi/ui/components/projects/project/testCases/testCase/testCaseController.js b/testapi/opnfv_testapi/ui/components/projects/project/testCases/testCase/testCaseController.js
index a38b633..6f93fc1 100644
--- a/testapi/opnfv_testapi/ui/components/projects/project/testCases/testCase/testCaseController.js
+++ b/testapi/opnfv_testapi/ui/components/projects/project/testCases/testCase/testCaseController.js
@@ -21,7 +21,7 @@
TestCaseController.$inject = [
'$scope', '$http', '$filter', '$state', '$window', '$uibModal', 'testapiApiUrl','raiseAlert',
- 'confirmModal'
+ 'confirmModal', 'dataFieldService'
];
/**
@@ -30,13 +30,14 @@
* through projects declared in TestAPI.
*/
function TestCaseController($scope, $http, $filter, $state, $window, $uibModal, testapiApiUrl,
- raiseAlert, confirmModal) {
+ raiseAlert, confirmModal, dataFieldService) {
var ctrl = this;
ctrl.name = $state.params['name'];
ctrl.projectName = $state.params['project_name'];
ctrl.url = testapiApiUrl + '/projects/' + ctrl.projectName + "/cases/" + ctrl.name;
ctrl.loadDetails = loadDetails;
+ ctrl.data_field = {}
/**
* This will contact the TestAPI to get a listing of declared projects.
@@ -46,6 +47,7 @@
ctrl.projectsRequest =
$http.get(ctrl.url).success(function (data) {
ctrl.data = data;
+ ctrl.data_field = dataFieldService.dataFunction(ctrl.data, ctrl.data_field)
}).catch(function (error) {
ctrl.data = null;
ctrl.showError = true;
diff --git a/testapi/opnfv_testapi/ui/components/projects/project/testCases/testCases.html b/testapi/opnfv_testapi/ui/components/projects/project/testCases/testCases.html
index ee87e0a..04baa9c 100644
--- a/testapi/opnfv_testapi/ui/components/projects/project/testCases/testCases.html
+++ b/testapi/opnfv_testapi/ui/components/projects/project/testCases/testCases.html
@@ -1,68 +1,64 @@
<div ng-controller="TestCasesController as testCasesCtrl" class="col-md-12">
-<div class="row podsTable" style="vertical-align:middle">
- <div class="col-sm-1 pull-right" ng-class="{ 'hidden': ! ((auth.projectNames.length>0) &&
- auth.isAuthenticated) }" >
- <button type="button" class="btn btn-danger" ng-click="testCasesCtrl.openBatchDeleteModal()">
- <i class="fa fa-minus"></i> Delete</button>
- </div>
- <div class="col-sm-1 pull-right" ng-class="{ 'hidden': ! ((auth.projectNames.length>0) &&
- auth.isAuthenticated) }">
- <button type="button" class="btn btn-success" ng-click="testCasesCtrl.openCreateModal()">
- <i class="fa fa-plus"></i> Create</button>
- </div>
-</div>
-<div class='clo-md-12'>
- <div ng-show="testCasesCtrl.showError" class="alert alert-danger" role="alert">
- <span class="pull-right">&nbsp;{{testCasesCtrl.error}}</span>
- <span class="glyphicon glyphicon-exclamation-sign pull-right" aria-hidden="true" >Error:</span>
- </div>
- <div ng-show="testCasesCtrl.showSuccess" class="alert alert-success" role="alert">
- <span class="pull-right">&nbsp;{{testCasesCtrl.successMessage}}</span>
- <span class="glyphicon glyphicon-ok pull-right" aria-hidden="true"></span>
- </div>
-</div>
-<div class='clo-md-12' style="padding-right:0px">
- <div class="table-responsive">
- <table class="table table-bordered table-hover" ng-data="testCasesCtrl.data.testcases">
- <thead>
- <tr style="
- text-align: center;">
- <th style="width: 1%;">Bulk Select</th>
- <th style="width: 19%;">Name</th>
- <th style="width: 20%;">Tier</th>
- <th style="width: 20%;">Blocking</th>
- <th style="width: 20%;">CI&nbsp;Loop</th>
- <th style="width: 20%;" ng-class="{'hidden': ! ((auth.projectNames.length>0) && auth.isAuthenticated)}">Operations</th>
- </tr>
- </thead>
- <tbody>
- <tr ng-repeat-start="(index, testcase) in testCasesCtrl.data.testcases" style="padding:9px">
- <td>
- <div class="text-center">
- <input type="checkbox" value="{{project.name}}" ng-model="testCasesCtrl.checkBox[index]" >
- </div>
- </td>
- <td>
- <a class="text-info" ng-click="testCasesCtrl.viewTestCase(testcase.name, testcase.project_name)">
- {{testcase.name}}
- </a>
- </td>
- <td>{{testcase.tier}}</td>
- <td>{{testcase.blocking}}</td>
- <td>{{testcase.ci_loop}}</td>
- <td ng-class="{'hidden': ! ((auth.projectNames.length>0) && auth.isAuthenticated)}">
- <span class="podsTable-col">
- <a class="text-warning" ng-click="testCasesCtrl.openUpdateTestModal(testcase.name)" title="Edit">
- <i class="fa fa-pencil-square-o"></i></a>
- <a class="text-danger" ng-click="testCasesCtrl.openDeleteTestModal(testcase.name)" title="Delete">
- <i class="fa fa-trash-o"></i></a>
- </span>
- </td>
- </tr>
- <tr ng-repeat-end=>
- </tr>
- </tbody>
- </table>
- </div>
-</div>
-</div>
+ <div class="row podsTable" style="vertical-align:middle">
+ <div class="col-sm-1 pull-right" ng-class="{ 'hidden': !((auth.projectNames.length>0) &&
+ auth.isAuthenticated) && authenticate }" >
+ <button type="button" class="btn btn-danger" ng-click="testCasesCtrl.openBatchDeleteModal()">
+ <i class="fa fa-minus"></i> Delete</button>
+ </div>
+ <div class="col-sm-1 pull-right" ng-class="{ 'hidden': ! ((auth.projectNames.length>0) &&
+ auth.isAuthenticated) && authenticate }">
+ <button type="button" class="btn btn-success" ng-click="testCasesCtrl.openCreateModal()">
+ <i class="fa fa-plus"></i> Create</button>
+ </div>
+ </div>
+ <div ng-class="{'show': testCasesCtrl.showError}" id="toast" class="error">
+ <span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true" ></span>
+ {{testCasesCtrl.error}}</div>
+ <div ng-class="{'show': testCasesCtrl.showSuccess}" id="toast" class="success">
+ <span class="glyphicon glyphicon-ok" aria-hidden="true"></span>
+ {{testCasesCtrl.success}}</div>
+ <div class='clo-md-12' style="padding-right:0px">
+ <div class="table-responsive">
+ <table class="table table-bordered table-hover" ng-data="testCasesCtrl.data.testcases">
+ <thead>
+ <tr style="
+ text-align: center;">
+ <th style="width: 1%;">Bulk Select</th>
+ <th style="width: 19%;">Name</th>
+ <th style="width: 20%;">Tier</th>
+ <th style="width: 20%;">Blocking</th>
+ <th style="width: 20%;">CI&nbsp;Loop</th>
+ <th style="width: 20%;" ng-class="{'hidden': ! ((auth.projectNames.length>0) && auth.isAuthenticated) && authenticate}">Operations</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr ng-repeat-start="(index, testcase) in testCasesCtrl.data.testcases" style="padding:9px">
+ <td>
+ <div class="text-center">
+ <input type="checkbox" value="{{project.name}}" ng-model="testCasesCtrl.checkBox[index]" >
+ </div>
+ </td>
+ <td>
+ <a class="text-info" ng-click="testCasesCtrl.viewTestCase(testcase.name, testcase.project_name)">
+ {{testcase.name}}
+ </a>
+ </td>
+ <td>{{testcase.tier}}</td>
+ <td>{{testcase.blocking}}</td>
+ <td>{{testcase.ci_loop}}</td>
+ <td ng-class="{'hidden': ! ((auth.projectNames.length>0) && auth.isAuthenticated) && authenticate}">
+ <span class="podsTable-col">
+ <a class="text-warning" ng-click="testCasesCtrl.openUpdateTestModal(testcase.name)" title="Edit">
+ <i class="fa fa-pencil-square-o"></i></a>
+ <a class="text-danger" ng-click="testCasesCtrl.openDeleteTestModal(testcase.name)" title="Delete">
+ <i class="fa fa-trash-o"></i></a>
+ </span>
+ </td>
+ </tr>
+ <tr ng-repeat-end=>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ </div>
+ </div> \ No newline at end of file
diff --git a/testapi/opnfv_testapi/ui/components/projects/project/testCases/testCasesController.js b/testapi/opnfv_testapi/ui/components/projects/project/testCases/testCasesController.js
index 9a865d3..ea0498a 100644
--- a/testapi/opnfv_testapi/ui/components/projects/project/testCases/testCasesController.js
+++ b/testapi/opnfv_testapi/ui/components/projects/project/testCases/testCasesController.js
@@ -21,7 +21,7 @@
TestCasesController.$inject = [
'$scope', '$http', '$filter', '$state', '$window', '$uibModal', 'testapiApiUrl','raiseAlert',
- 'confirmModal'
+ 'confirmModal', 'authenticate', '$timeout'
];
/**
@@ -31,7 +31,7 @@
* in them.
*/
function TestCasesController($scope, $http, $filter, $state, $window, $uibModal, testapiApiUrl,
- raiseAlert, confirmModal) {
+ raiseAlert, confirmModal, authenticate, $timeout) {
var ctrl = this;
ctrl.loadDetails = loadDetails;
ctrl.name = $state.params['name'];
@@ -49,29 +49,40 @@
ctrl.checkBox = [];
ctrl.checkBoxList = [];
+ ctrl.toastError = toastError
+ ctrl.toastSuccess = toastSuccess
+
+ function toastError() {
+ ctrl.showError = true
+ $timeout(function(){ ctrl.showError = false;}, 3000);
+ }
+
+ function toastSuccess() {
+ ctrl.showSuccess = true
+ $timeout(function(){ ctrl.showSuccess = false;}, 3000);
+ }
/**
* This will contact the TestAPI to create a new test case.
*/
function createTestCase(name, testcase) {
- ctrl.showError = false;
- ctrl.showSuccess = false;
if(testcase.name != "" && testcase.name!=null){
var testCase_url = ctrl.requestUrl;
- ctrl.testCasesRequest =
- $http.post(testCase_url, testcase).success(function (data){
- ctrl.showSuccess = true ;
- ctrl.successMessage = "Testcase is successfully created."
+ ctrl.testCasesRequest = $http.post(testCase_url, testcase)
+ ctrl.testCasesRequest.success(function (data){
+ ctrl.success = "Testcase is successfully created."
loadDetails();
+ ctrl.toastSuccess()
})
.catch(function (data) {
- ctrl.showError = true;
ctrl.error = data.statusText;
+ ctrl.toastError();
});
+ return ctrl.testCasesRequest;
}
else{
- ctrl.showError = true;
ctrl.error = 'Name is missing.'
+ ctrl.toastError();
}
}
@@ -114,24 +125,23 @@
* This will contact the TestAPI to update an existing test case.
*/
function updateTestCase(name, testCase) {
- ctrl.showError = false;
- ctrl.showSuccess = false;
if(testCase.name != ""){
var testCase_url = ctrl.requestUrl + '/' + name;
- ctrl.testCasesRequest =
- $http.put(testCase_url, testCase).success(function (data){
- ctrl.showSuccess = true ;
- ctrl.successMessage = "Test case is successfully updated"
+ ctrl.testCasesRequest = $http.put(testCase_url, testCase)
+ ctrl.testCasesRequest.success(function (data){
+ ctrl.success = "Test case is successfully updated"
loadDetails();
+ ctrl.toastSuccess();
})
.catch(function (data) {
- ctrl.showError = true;
ctrl.error = data.statusText;
+ ctrl.toastError()
});
+ return ctrl.testCasesRequest;
}
else{
- ctrl.showError = true;
ctrl.error = 'Name is missing.'
+ ctrl.toastError()
}
}
@@ -139,16 +149,14 @@
* This will contact the TestAPI to delete an existing test case.
*/
function deleteTestCase(name) {
- ctrl.showError = false;
- ctrl.showSuccess = false;
ctrl.testCasesRequest =
$http.delete(ctrl.requestUrl+"/"+name).success(function (data) {
loadDetails();
- ctrl.showSuccess = true ;
- ctrl.successMessage = "Test case is successfully deleted"
+ ctrl.success = "Test case is successfully deleted";
+ ctrl.toastSuccess();
}).catch(function (error) {
- ctrl.showError = true;
- ctrl.error = data.statusText;
+ ctrl.error = error.statusText;
+ ctrl.toastError();
});
}
@@ -218,8 +226,8 @@
ctrl.data = data;
}).catch(function (error) {
ctrl.data = null;
- ctrl.showError = true;
ctrl.error = error.statusText;
+ ctrl.toastError()
});
}
ctrl.loadDetails();
@@ -271,9 +279,15 @@
* inputs.
*/
function confirm() {
- $uibModalInstance.close();
if (angular.isDefined(ctrl.data.successHandler)) {
- ctrl.data.successHandler(ctrl.name, ctrl.testcase);
+ if(ctrl.testcase.name){
+ ctrl.data.successHandler(ctrl.name, ctrl.testcase).success( function(){
+ $uibModalInstance.close();
+ })
+ }
+ else{
+ ctrl.data.successHandler(ctrl.name, ctrl.testcase)
+ }
}
}