summaryrefslogtreecommitdiffstats
path: root/testapi/opnfv_testapi/ui/components
diff options
context:
space:
mode:
Diffstat (limited to 'testapi/opnfv_testapi/ui/components')
-rw-r--r--testapi/opnfv_testapi/ui/components/deploy-results/deployResults.html4
-rw-r--r--testapi/opnfv_testapi/ui/components/deploy-results/deployResultsController.js14
-rw-r--r--testapi/opnfv_testapi/ui/components/pods/pod/pod.html4
-rw-r--r--testapi/opnfv_testapi/ui/components/pods/pods.html29
-rw-r--r--testapi/opnfv_testapi/ui/components/pods/podsController.js37
-rw-r--r--testapi/opnfv_testapi/ui/components/projects/project/project.html4
-rw-r--r--testapi/opnfv_testapi/ui/components/projects/project/testCases/testCase/testCase.html4
-rw-r--r--testapi/opnfv_testapi/ui/components/projects/project/testCases/testCasesController.js12
-rw-r--r--testapi/opnfv_testapi/ui/components/projects/projects.html11
-rw-r--r--testapi/opnfv_testapi/ui/components/projects/projectsController.js35
-rw-r--r--testapi/opnfv_testapi/ui/components/results/results.html32
-rw-r--r--testapi/opnfv_testapi/ui/components/results/resultsController.js95
-rw-r--r--testapi/opnfv_testapi/ui/components/scenarios/modals/customModal.html18
-rw-r--r--testapi/opnfv_testapi/ui/components/scenarios/modals/projectModal.html2
-rw-r--r--testapi/opnfv_testapi/ui/components/scenarios/scenario/scenario.html4
-rw-r--r--testapi/opnfv_testapi/ui/components/scenarios/scenario/scenarioController.js21
-rw-r--r--testapi/opnfv_testapi/ui/components/scenarios/scenariosController.js31
17 files changed, 275 insertions, 82 deletions
diff --git a/testapi/opnfv_testapi/ui/components/deploy-results/deployResults.html b/testapi/opnfv_testapi/ui/components/deploy-results/deployResults.html
index 6fbaaea..380416f 100644
--- a/testapi/opnfv_testapi/ui/components/deploy-results/deployResults.html
+++ b/testapi/opnfv_testapi/ui/components/deploy-results/deployResults.html
@@ -15,7 +15,7 @@
<div class="col-sm-2 pull-right" ng-class="{'hidden': ctrl.filter=='start_date' || ctrl.filter=='end_date'}">
<span style="margin-top:6px">Search:&nbsp;&nbsp;</span>
<input list="filter" name="filter" class="form-control search" style="display:inline;width:105px;padding-left:6px;"
- ng-Model="ctrl.filterText" placeholder="Search String">
+ ng-enter="ctrl.filterList()" ng-Model="ctrl.filterText" placeholder="Search String">
<datalist id="filter" ng-class="{ 'hidden' : ctrl.filterOption.length<0}">
<option ng-repeat="(index, filterValue) in ctrl.filterOption " value="{{filterValue}}">{{filterValue}}</option>
</datalist>
@@ -24,6 +24,7 @@
<span style="margin-top:6px">Start&nbsp;Date:&nbsp;&nbsp;</span>
<p class="input-group" style="width:48%;display:inline-flex;">
<input type="text" class="form-control"
+ ng-enter="ctrl.filterList()"
uib-datepicker-popup="{{ctrl.format}}"
ng-model="ctrl.filterText" is-open="ctrl.startOpen"
close-text="Close" />
@@ -38,6 +39,7 @@
<span style="margin-top:6px">End&nbsp;Date:&nbsp;&nbsp;</span>
<p class="input-group" style="width:48%;display:inline-flex;">
<input type="text" class="form-control"
+ ng-enter="ctrl.filterList()"
uib-datepicker-popup="{{ctrl.format}}"
ng-model="ctrl.filterText" is-open="ctrl.endOpen"
close-text="Close" />
diff --git a/testapi/opnfv_testapi/ui/components/deploy-results/deployResultsController.js b/testapi/opnfv_testapi/ui/components/deploy-results/deployResultsController.js
index 5230a75..1128825 100644
--- a/testapi/opnfv_testapi/ui/components/deploy-results/deployResultsController.js
+++ b/testapi/opnfv_testapi/ui/components/deploy-results/deployResultsController.js
@@ -20,7 +20,8 @@
.controller('DeployResultsController', DeployResultsController);
DeployResultsController.$inject = [
- '$scope', '$http', '$filter', '$state', 'testapiApiUrl','raiseAlert'
+ '$scope', '$http', '$filter', '$state', 'testapiApiUrl','raiseAlert',
+ 'keepState'
];
/**
@@ -29,7 +30,7 @@
* a listing of community uploaded results.
*/
function DeployResultsController($scope, $http, $filter, $state, testapiApiUrl,
- raiseAlert) {
+ raiseAlert, keepState) {
var ctrl = this;
ctrl.open = open;
@@ -122,6 +123,15 @@
function filterList(){
if(ctrl.filter && ctrl.filterText!="" && ctrl.filterText!=undefined){
ctrl.tagArray[ctrl.filter] = ctrl.filterText;
+ if(!keepState.filter.deployResultFilter){
+ keepState.filter.deployResultFilter = {}
+ }
+ keepState.filter.deployResultFilter[ctrl.filter] = ctrl.filterText
+ }
+ else if(Object.keys(ctrl.tagArray).length==0){
+ if(keepState.filter.deployResultFilter){
+ ctrl.tagArray = keepState.filter.deployResultFilter
+ }
}
ctrl.showError = false;
var content_url = testapiApiUrl + '/deployresults' +
diff --git a/testapi/opnfv_testapi/ui/components/pods/pod/pod.html b/testapi/opnfv_testapi/ui/components/pods/pod/pod.html
index b78eb2d..6aace92 100644
--- a/testapi/opnfv_testapi/ui/components/pods/pod/pod.html
+++ b/testapi/opnfv_testapi/ui/components/pods/pod/pod.html
@@ -12,8 +12,8 @@
<td width="90%" class="podsTableLeftTd">{{ctrl.data.name}}</td>
</tr>
<tr style="padding:9px">
- <td class="podsTableTd">Owner&nbsp;:</td>
- <td width="90%" class="podsTableLeftTd">{{ctrl.data.owner}}</td>
+ <td class="podsTableTd">Creator&nbsp;:</td>
+ <td width="90%" class="podsTableLeftTd">{{ctrl.data.creator}}</td>
</tr>
<tr style="padding:9px">
<td class="podsTableTd">Role&nbsp;:</td>
diff --git a/testapi/opnfv_testapi/ui/components/pods/pods.html b/testapi/opnfv_testapi/ui/components/pods/pods.html
index 4fa8fb1..8e66a9c 100644
--- a/testapi/opnfv_testapi/ui/components/pods/pods.html
+++ b/testapi/opnfv_testapi/ui/components/pods/pods.html
@@ -22,7 +22,7 @@
</div>
<div class="col-sm-3 pull-right">
<span style="margin-top:6px">Search:&nbsp;&nbsp;</span>
- <input type="text" class="form-control search" ng-Model="ctrl.filterText" placeholder="Search String">
+ <input type="text" class="form-control search" ng-enter="ctrl.listPods()" ng-Model="ctrl.filterText" placeholder="Search String">
</div>
</div>
<div class="col-md-12">
@@ -42,9 +42,30 @@
<tr style="
text-align: center;">
<th style="width:1%">Bulk Select</th>
- <th>Name</th>
- <th>Role</th>
- <th>Mode</th>
+ <th>Name
+ <a class="text-danger" ng-click="ctrl.sortBy('name')" ng-class="{ 'hidden': !ctrl.sorting['name'] }" >
+ <span class="glyphicon glyphicon-sort-by-alphabet pull-right" aria-hidden="true"></span>
+ </a>
+ <a class="text-danger" ng-click="ctrl.sortBy('name')" ng-class="{ 'hidden': ctrl.sorting['name'] }" >
+ <span class="glyphicon glyphicon-sort-by-alphabet-alt pull-right" aria-hidden="true"></span>
+ </a>
+ </th>
+ <th>Role
+ <a class="text-danger" ng-click="ctrl.sortBy('role')" ng-class="{ 'hidden': !ctrl.sorting['role']}" >
+ <span class="glyphicon glyphicon-sort-by-alphabet pull-right" aria-hidden="true"></span>
+ </a>
+ <a class="text-danger" ng-click="ctrl.sortBy('role')" ng-class="{ 'hidden': ctrl.sorting['role']}" >
+ <span class="glyphicon glyphicon-sort-by-alphabet-alt pull-right" aria-hidden="true"></span>
+ </a>
+ </th>
+ <th>Mode
+ <a class="text-danger" ng-click="ctrl.sortBy('mode')" ng-class="{ 'hidden': !ctrl.sorting['mode'] }" >
+ <span class="glyphicon glyphicon-sort-by-alphabet pull-right" aria-hidden="true"></span>
+ </a>
+ <a class="text-danger" ng-click="ctrl.sortBy('mode')" ng-class="{ 'hidden': ctrl.sorting['mode'] }" >
+ <span class="glyphicon glyphicon-sort-by-alphabet-alt pull-right" aria-hidden="true"></span>
+ </a>
+ </th>
<th ng-class="{ 'hidden': !auth.isAuthenticated }">Operation</th>
</tr>
</thead>
diff --git a/testapi/opnfv_testapi/ui/components/pods/podsController.js b/testapi/opnfv_testapi/ui/components/pods/podsController.js
index 95e3571..f405ecb 100644
--- a/testapi/opnfv_testapi/ui/components/pods/podsController.js
+++ b/testapi/opnfv_testapi/ui/components/pods/podsController.js
@@ -21,7 +21,7 @@
PodsController.$inject = [
'$scope', '$http', '$filter', '$state', '$window', '$uibModal', 'testapiApiUrl','raiseAlert',
- 'confirmModal'
+ 'confirmModal', 'keepState', 'sortService'
];
/**
@@ -30,11 +30,12 @@
* through pods declared in TestAPI.
*/
function PodsController($scope, $http, $filter, $state, $window, $uibModal, testapiApiUrl,
- raiseAlert, confirmModal) {
+ raiseAlert, confirmModal, keepState, sortService) {
var ctrl = this;
ctrl.url = testapiApiUrl + '/pods';
ctrl.checkBox = []
ctrl.checkBoxList = [];
+ ctrl.sorting = {};
ctrl.create = create;
ctrl.listPods = listPods;
@@ -46,7 +47,12 @@
ctrl.podDelete = podDelete
ctrl.batchDelete = batchDelete;
ctrl.viewPod = viewPod
- ctrl.filterText = ''
+ ctrl.sortBy = sortBy
+
+ function sortBy(field){
+ ctrl.data.pods = sortService.sortFunction(ctrl.data.pods, field , ctrl.sorting[field] )
+ ctrl.sorting[field]=!ctrl.sorting[field]
+ }
/**
* This is called when the date filter calendar is opened. It
@@ -68,7 +74,6 @@
function create(pod) {
ctrl.showError = false;
ctrl.showSuccess = false;
- console.log(pod);
if(pod.name != ""){
var pods_url = ctrl.url;
var body = {
@@ -99,12 +104,22 @@
function listPods() {
ctrl.showError = false;
var reqURL = ctrl.url;
- if(ctrl.filterText!=''){
+ if(ctrl.filterText!=undefined){
reqURL = ctrl.url + "?name=" + ctrl.filterText
}
+ else if(keepState.filter.podFilter){
+ for (var filter in keepState.filter.podFilter){
+ reqURL = ctrl.url + '?' + filter + '=' + keepState.filter.podFilter[filter]
+ ctrl.filterText = keepState.filter.podFilter[filter]
+ }
+ }
ctrl.podsRequest =
$http.get(reqURL).success(function (data) {
ctrl.data = data;
+ ctrl.sortBy("name")
+ keepState.filter.podFilter = {
+ 'name': ctrl.filterText
+ }
}).catch(function (data) {
ctrl.data = null;
ctrl.showError = true;
@@ -137,7 +152,6 @@
function batchDelete(){
var index;
var checkedBox = [];
- console.log(ctrl.checkBox)
for(index in ctrl.checkBox){
if(!ctrl.showError){
if(ctrl.checkBox[index]){
@@ -153,7 +167,13 @@
* message
*/
function openBatchDeleteModal() {
- confirmModal("Delete",ctrl.batchDelete);
+ var deleteObjects = []
+ for(var index in ctrl.checkBox){
+ if(ctrl.checkBox[index]){
+ deleteObjects.push(ctrl.data.pods[index].name)
+ }
+ }
+ confirmModal("Delete", 'pods', ctrl.batchDelete, deleteObjects);
}
/**
@@ -161,8 +181,7 @@
* message
*/
function openDeleteModal(name) {
- console.log(name)
- confirmModal("Delete", ctrl.podDelete, name);
+ confirmModal("Delete", 'pod', ctrl.podDelete, name);
}
/**
diff --git a/testapi/opnfv_testapi/ui/components/projects/project/project.html b/testapi/opnfv_testapi/ui/components/projects/project/project.html
index 2921bd9..b6a751c 100644
--- a/testapi/opnfv_testapi/ui/components/projects/project/project.html
+++ b/testapi/opnfv_testapi/ui/components/projects/project/project.html
@@ -25,8 +25,8 @@
<td width="90%" class="podsTableLeftTd">{{ctrl.data.name}}</td>
</tr>
<tr style="padding:9px">
- <td class="podsTableTd">Owner&nbsp;:</td>
- <td width="90%" class="podsTableLeftTd">{{ctrl.data.owner}}</td>
+ <td class="podsTableTd">Creator&nbsp;:</td>
+ <td width="90%" class="podsTableLeftTd">{{ctrl.data.creator}}</td>
</tr>
<tr style="padding:9px">
<td class="podsTableTd">Created&nbsp;at&nbsp;:</td>
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 70c026a..f4bae41 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
@@ -16,6 +16,10 @@
<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>
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 6d3c245..9a865d3 100644
--- a/testapi/opnfv_testapi/ui/components/projects/project/testCases/testCasesController.js
+++ b/testapi/opnfv_testapi/ui/components/projects/project/testCases/testCasesController.js
@@ -84,7 +84,15 @@
* message
*/
function openBatchDeleteModal() {
- confirmModal("Delete",ctrl.batchDelete);
+ var deleteObjects = []
+ ctrl.checkBox.forEach(function(testcase, index){
+ if(!ctrl.showError){
+ if(testcase){
+ deleteObjects.push(ctrl.data.testcases[index].name)
+ }
+ }
+ });
+ confirmModal("Delete", 'testcases', ctrl.batchDelete, deleteObjects);
}
/**
@@ -149,7 +157,7 @@
* message
*/
function openDeleteTestModal(name) {
- confirmModal("Delete", ctrl.deleteTestCase, name);
+ confirmModal("Delete", 'testcases', ctrl.deleteTestCase, name);
}
/**
diff --git a/testapi/opnfv_testapi/ui/components/projects/projects.html b/testapi/opnfv_testapi/ui/components/projects/projects.html
index b6b73d4..5d514d1 100644
--- a/testapi/opnfv_testapi/ui/components/projects/projects.html
+++ b/testapi/opnfv_testapi/ui/components/projects/projects.html
@@ -18,7 +18,7 @@
</div>
<div class="col-sm-3 pull-right">
<span style="margin-top:6px">Search:&nbsp;&nbsp;</span>
- <input type="text" class="form-control search" ng-Model="ctrl.filterText" style="width:80%;" placeholder="Search By Name">
+ <input type="text" class="form-control search" ng-enter="ctrl.listProjects()" ng-Model="ctrl.filterText" style="width:80%;" placeholder="Search By Name">
</div>
</div>
<div class='clo-md-12'>
@@ -38,7 +38,14 @@
<tr style="
text-align: center;">
<th style="width: 1%;">Bulk Select</th>
- <th style="width: 19%;">Name</th>
+ <th style="width: 19%;">Name
+ <a class="text-danger" ng-click="ctrl.sortByName()" ng-class="{ 'hidden': !ctrl.sortName }" >
+ <span class="glyphicon glyphicon-sort-by-alphabet pull-right" aria-hidden="true"></span>
+ </a>
+ <a class="text-danger" ng-click="ctrl.sortByName()" ng-class="{ 'hidden': ctrl.sortName }" >
+ <span class="glyphicon glyphicon-sort-by-alphabet-alt pull-right" aria-hidden="true"></span>
+ </a>
+ </th>
<th style="width: 70%;">Description</th>
<th style="width: 10%;" ng-class="{'hidden': ! ((auth.projectNames.length>0) && auth.isAuthenticated) && authenticate}">Operations</th>
</tr>
diff --git a/testapi/opnfv_testapi/ui/components/projects/projectsController.js b/testapi/opnfv_testapi/ui/components/projects/projectsController.js
index 940c1e2..07a58fe 100644
--- a/testapi/opnfv_testapi/ui/components/projects/projectsController.js
+++ b/testapi/opnfv_testapi/ui/components/projects/projectsController.js
@@ -21,7 +21,7 @@
ProjectsController.$inject = [
'$scope', '$http', '$filter', '$state', '$window', '$uibModal', 'testapiApiUrl',
- 'raiseAlert', 'confirmModal', 'authenticate'
+ 'raiseAlert', 'confirmModal', 'authenticate', 'keepState', 'sortService'
];
/**
@@ -30,7 +30,7 @@
* through projects declared in TestAPI.
*/
function ProjectsController($scope, $http, $filter, $state, $window, $uibModal, testapiApiUrl,
- raiseAlert, confirmModal, authenticate) {
+ raiseAlert, confirmModal, authenticate, keepState, sortService) {
var ctrl = this;
ctrl.url = testapiApiUrl + '/projects';
@@ -44,12 +44,13 @@
ctrl.openBatchDeleteModal = openBatchDeleteModal;
ctrl.projectDelete = projectDelete;
ctrl.batchDelete = batchDelete;
+ ctrl.sortByName = sortByName
ctrl.checkBox = [];
ctrl.checkBoxList = [];
ctrl.name = '';
ctrl.details = '';
- ctrl.filterText='';
+ ctrl.ascending = false;
/**
* This will contact the TestAPI to create a new project.
@@ -73,6 +74,11 @@
});
}
+ function sortByName(){
+ ctrl.data.projects = sortService.sortFunction(ctrl.data.projects, 'name', ctrl.ascending)
+ ctrl.ascending = !ctrl.ascending
+ }
+
/**
* This will open the modal that will show the create
* project view
@@ -148,13 +154,22 @@
ctrl.showError = false;
var content_url = ctrl.url + '?';
var filterText = ctrl.filterText;
- if(filterText != ''){
+ if(filterText != undefined){
content_url = content_url + 'name=' +
filterText;
}
+ else if(keepState.filter.projectFilter){
+ for (var filter in keepState.filter.projectFilter){
+ content_url = content_url + filter + '=' + keepState.filter.projectFilter[filter]
+ ctrl.filterText = keepState.filter.projectFilter[filter]
+ }
+ }
ctrl.resultsRequest =
$http.get(content_url).success(function (data) {
ctrl.data = data;
+ keepState.filter.projectFilter = {
+ 'name': ctrl.filterText
+ }
}).catch(function (data) {
ctrl.data = null;
ctrl.showError = true;
@@ -204,7 +219,15 @@
* message
*/
function openBatchDeleteModal() {
- confirmModal("Delete",ctrl.batchDelete);
+ var deleteObjects = []
+ ctrl.checkBox.forEach(function(project, index){
+ if(!ctrl.showError){
+ if(project){
+ deleteObjects.push(ctrl.data.projects[index].name)
+ }
+ }
+ });
+ confirmModal("Delete", 'projects', ctrl.batchDelete, deleteObjects);
}
/**
@@ -212,7 +235,7 @@
* message
*/
function openDeleteModal(name) {
- confirmModal("Delete", ctrl.projectDelete, name);
+ confirmModal("Delete",'projects', ctrl.projectDelete, name);
}
ctrl.listProjects();
diff --git a/testapi/opnfv_testapi/ui/components/results/results.html b/testapi/opnfv_testapi/ui/components/results/results.html
index b0c05ba..e1413d5 100644
--- a/testapi/opnfv_testapi/ui/components/results/results.html
+++ b/testapi/opnfv_testapi/ui/components/results/results.html
@@ -1,22 +1,5 @@
<h3>{{ctrl.pageHeader}}</h3>
<p>{{ctrl.pageParagraph}}</p>
-<form class="form-inline" ng-show="ctrl.isUserResults">
-<h4>Upload Results</h4>
-<div class="form-group col-m-3">
- <input class="form-contrl btn btn-default" type = "file" file-model = "resultFile"/>
-</div>
-<div class="checkbox col-m-1">
- <label>
- <input type="checkbox" ng-model="ctrl.isPublic">public
- </label>
-</div>
-<div class="form-group col-m-3">
- <button class="btn btn-primary" ng-click = "ctrl.uploadFile()">upload result</button>
-</div>
-<div>
-<lable>{{ctrl.uploadState}}</label>
-</div>
-</form>
<div class="row" style="margin-bottom:24px;"></div>
<div class="result-filters" style="border-top: none;">
<div class="row podTable" style="vertical-align:middle">
@@ -31,13 +14,17 @@
</div>
<div class="col-sm-2 pull-right" ng-class="{'hidden': ctrl.filter=='start_date' || ctrl.filter=='end_date'}">
<span style="margin-top:6px">Search:&nbsp;&nbsp;</span>
- <input type="text" class="form-control search" style="display:inline;width:105px;padding-left:6px;"
+ <input list="filter" ng-enter="ctrl.filterList()" name="filter" class="form-control search" style="display:inline;width:105px;padding-left:6px;"
ng-Model="ctrl.filterText" placeholder="Search String">
+ <datalist id="filter" ng-class="{ 'hidden' : ctrl.filterOption.length<0}">
+ <option ng-repeat="(index, filterValue) in ctrl.filterOption " value="{{filterValue}}">{{filterValue}}</option>
+ </datalist>
</div>
<div class="col-sm-3 pull-right" style="width:20%" ng-class="{'hidden': ctrl.filter!='start_date'}">
<span style="margin-top:6px">Start&nbsp;Date:&nbsp;&nbsp;</span>
<p class="input-group" style="width:48%;display:inline-flex;">
<input type="text" class="form-control"
+ ng-enter="ctrl.filterList()"
uib-datepicker-popup="{{ctrl.format}}"
ng-model="ctrl.filterText" is-open="ctrl.startOpen"
close-text="Close" />
@@ -52,6 +39,7 @@
<span style="margin-top:6px">End&nbsp;Date:&nbsp;&nbsp;</span>
<p class="input-group" style="width:48%;display:inline-flex;">
<input type="text" class="form-control"
+ ng-enter="ctrl.filterList()"
uib-datepicker-popup="{{ctrl.format}}"
ng-model="ctrl.filterText" is-open="ctrl.endOpen"
close-text="Close" />
@@ -64,7 +52,7 @@
</div>
<div class="col-md-2 row pull-right" style="width: 20%;">
<span style="margin-top:6px">Filter:&nbsp;&nbsp;</span>
- <select ng-model="ctrl.filter" class="form-control" style="display:inline; width:150px;">
+ <select ng-model="ctrl.filter" ng-change="ctrl.encodeFilter()" class="form-control" style="display:inline; width:150px;">
<option value="pod" ng-disabled="ctrl.testFilter('pod')" >Pod Name</option>
<option value="project" ng-disabled="ctrl.testFilter('project')" >Project Name</option>
<option value="case" ng-disabled="ctrl.testFilter('case')">Case Name</option>
@@ -79,9 +67,9 @@
</div>
<div class='filter-box'>
- <div class='filter-tag' ng-repeat="(key, tag) in ctrl.tagArray">
+ <div class='filter-tag col-md-1' ng-repeat="(key, tag) in ctrl.tagArray" style="background-color: #f5f5f5;border: 1px solid #e3e3e3;/* border: 1px; */margin-top: 3px;padding: 4px;margin-left: 15px;width: 13%;">
{{key}}&nbsp:&nbsp{{tag}}
- <div class='delete-tag' ng-click='ctrl.deleteTag(key)'>
+ <div class='delete-tag btn btn-danger btn-xs' ng-click='ctrl.deleteTag(key)'>
&times;
</div>
</div>
@@ -143,4 +131,4 @@
<span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span>
<span class="sr-only">Error:</span>
{{ctrl.error}}
-</div>
+</div> \ No newline at end of file
diff --git a/testapi/opnfv_testapi/ui/components/results/resultsController.js b/testapi/opnfv_testapi/ui/components/results/resultsController.js
index 73f3c15..13ead6e 100644
--- a/testapi/opnfv_testapi/ui/components/results/resultsController.js
+++ b/testapi/opnfv_testapi/ui/components/results/resultsController.js
@@ -38,7 +38,8 @@
}]);
ResultsController.$inject = [
- '$scope', '$http', '$filter', '$state', 'testapiApiUrl','raiseAlert'
+ '$scope', '$http', '$filter', '$state', 'testapiApiUrl', 'raiseAlert',
+ 'keepState'
];
/**
@@ -47,7 +48,7 @@
* a listing of community uploaded results.
*/
function ResultsController($scope, $http, $filter, $state, testapiApiUrl,
- raiseAlert) {
+ raiseAlert, keepState) {
var ctrl = this;
ctrl.open = open;
@@ -56,8 +57,12 @@
ctrl.filterList= filterList;
ctrl.testFilter = testFilter
ctrl.viewResult = viewResult;
+ ctrl.filter = "pod"
+ ctrl.filterValue = "pod_name"
+ ctrl.encodeFilter = encodeFilter
ctrl.tagArray = {}
+ ctrl.filterOption=[]
/** Mappings of Interop WG components to marketing program names. */
ctrl.targetMappings = {
@@ -121,6 +126,75 @@
// ctrl.filterList();
// }
+ function encodeFilter(){
+ ctrl.filterText = ''
+ ctrl.filterOption=[]
+ if(ctrl.filter=="pod" || ctrl.filter=="project" || ctrl.filter=="scenario"){
+ var reqURL = testapiApiUrl +"/" + ctrl.filter + "s"
+ ctrl.datasRequest =
+ $http.get(reqURL).success(function (data) {
+ ctrl.filterData = data;
+ for(var index in ctrl.filterData[ctrl.filter + "s"]){
+ if( ctrl.filterOption.indexOf(ctrl.filterData[ctrl.filter + "s"][index]["name"]) < 0){
+ ctrl.filterOption.push(ctrl.filterData[ctrl.filter + "s"][index]["name"])
+ }
+ }
+ }).catch(function (data) {
+ ctrl.data = null;
+ ctrl.showError = true;
+ ctrl.error = data.statusText;
+ });
+
+ }
+ else if(ctrl.filter=="case"){
+ if("project" in ctrl.tagArray){
+ var reqURL = testapiApiUrl +"/projects/"+ctrl.tagArray["project"]+"/cases"
+ ctrl.dataRequest =
+ $http.get(reqURL).success(function (data) {
+ ctrl.filterData = data;
+ for(var index in ctrl.filterData.testcases){
+ if( ctrl.filterOption.indexOf(ctrl.filterData.testcases[index]["name"]) < 0){
+ ctrl.filterOption.push(ctrl.filterData.testcases[index]["name"])
+ }
+ }
+ }).catch(function (data) {
+ ctrl.data = null;
+ ctrl.showError = true;
+ ctrl.error = data.statusText;
+ });
+
+ }
+ else{
+ var reqURL = testapiApiUrl +"/projects"
+ ctrl.dataRequest =
+ $http.get(reqURL).success(function (data) {
+ ctrl.projectsData = data;
+ for(var indexP in ctrl.projectsData.projects){
+ reqURL = testapiApiUrl +"/projects/" + ctrl.projectsData.projects[indexP]["name"] +"/cases"
+ ctrl.datasRequest =
+ $http.get(reqURL).success(function (data) {
+ ctrl.filterData = data;
+ for(var index in ctrl.filterData.testcases){
+ if( ctrl.filterOption.indexOf(ctrl.filterData.testcases[index]["name"]) < 0){
+ ctrl.filterOption.push(ctrl.filterData.testcases[index]["name"])
+ }
+ }
+ }).catch(function (data) {
+ ctrl.data = null;
+ ctrl.showError = true;
+ ctrl.error = data.statusText;
+ });
+ }
+ }).catch(function (data) {
+ ctrl.data = null;
+ ctrl.showError = true;
+ ctrl.error = data.statusText;
+ });
+ }
+
+ }
+ }
+
function viewResult(_id){
$state.go('result', {'_id':_id}, {reload: true});
}
@@ -144,8 +218,17 @@
* results.
*/
function filterList(){
- if(ctrl.filter && ctrl.filterText!=""){
+ if(ctrl.filter && ctrl.filterText!="" && ctrl.filterText!=undefined){
ctrl.tagArray[ctrl.filter] = ctrl.filterText;
+ if(!keepState.filter.resultFilter){
+ keepState.filter.resultFilter = {}
+ }
+ keepState.filter.resultFilter[ctrl.filter] = ctrl.filterText
+ }
+ else if(Object.keys(ctrl.tagArray).length==0){
+ if(keepState.filter.resultFilter){
+ ctrl.tagArray = keepState.filter.resultFilter
+ }
}
ctrl.showError = false;
var content_url = testapiApiUrl + '/results' +
@@ -176,6 +259,7 @@
ctrl.data = data;
ctrl.totalItems = ctrl.data.pagination.total_pages * ctrl.itemsPerPage;
ctrl.currentPage = ctrl.data.pagination.current_page;
+ ctrl.encodeFilter();
}).error(function (error) {
ctrl.data = null;
ctrl.totalItems = 0;
@@ -186,8 +270,10 @@
});
ctrl.filterText = ''
}
+
ctrl.filterList();
+
/**
* This is called when the date filter calendar is opened. It
* does some event handling, and sets a scope variable so the UI
@@ -208,7 +294,8 @@
function clearFilters() {
ctrl.tagArray = {}
ctrl.filter = undefined
+ keepState.filter.resultFilter = {}
ctrl.filterList();
}
}
-})();
+})(); \ No newline at end of file
diff --git a/testapi/opnfv_testapi/ui/components/scenarios/modals/customModal.html b/testapi/opnfv_testapi/ui/components/scenarios/modals/customModal.html
index 987cb1e..0cd2663 100644
--- a/testapi/opnfv_testapi/ui/components/scenarios/modals/customModal.html
+++ b/testapi/opnfv_testapi/ui/components/scenarios/modals/customModal.html
@@ -6,11 +6,19 @@
<legend>{{customModalCtrl.data.text}}</legend>
<div class="row">
<div class="update-project">
- <label for="cpid" class="control-label col-sm-4">Custom: </label>
- <div class="col-sm-6">
- <input type="text" class="form-control" ng-model="customModalCtrl.custom"/>
- <p class="help-block"></p>
- </div>
+ <label for="cpid" class="control-label col-sm-4">Custom: </label>
+ <table cellpadding="0" cellspacing="0">
+ <tbody>
+ <tr>
+ <td>
+ <div class="col-sm-12">
+ <input type="text" class="form-control" ng-model="customModalCtrl.custom"/>
+ <p class="help-block"></p>
+ </div>
+ </td>
+ </tr>
+ </tbody>
+ </table>
</div>
</div>
</div>
diff --git a/testapi/opnfv_testapi/ui/components/scenarios/modals/projectModal.html b/testapi/opnfv_testapi/ui/components/scenarios/modals/projectModal.html
index 0a14be9..171cc33 100644
--- a/testapi/opnfv_testapi/ui/components/scenarios/modals/projectModal.html
+++ b/testapi/opnfv_testapi/ui/components/scenarios/modals/projectModal.html
@@ -38,7 +38,7 @@
</tr>
</thead>
<tbody>
- <tr ng-repeat-start="(index, custom) in projectModalCtrl.project.customs" style="padding:9px">
+ <tr ng-repeat-start="custom in projectModalCtrl.project.customs" style="padding:9px">
<td>{{custom}}</td>
</tr>
<tr ng-repeat-end=>
diff --git a/testapi/opnfv_testapi/ui/components/scenarios/scenario/scenario.html b/testapi/opnfv_testapi/ui/components/scenarios/scenario/scenario.html
index 2a73e9b..4f0a580 100644
--- a/testapi/opnfv_testapi/ui/components/scenarios/scenario/scenario.html
+++ b/testapi/opnfv_testapi/ui/components/scenarios/scenario/scenario.html
@@ -12,6 +12,10 @@
<td width="90%" class="podsTableLeftTd">{{ctrl.data.scenarios[0].name}}</td>
</tr>
<tr style="padding:9px">
+ <td class="podsTableTd">Creator&nbsp;:</td>
+ <td width="90%" class="podsTableLeftTd">{{ctrl.data.scenarios[0].creator}}</td>
+ </tr>
+ <tr style="padding:9px">
<td class="podsTableTd">Created&nbsp;at&nbsp;:</td>
<td width="90%" class="podsTableLeftTd">{{ctrl.data.scenarios[0].creation_date}}</td>
</tr>
diff --git a/testapi/opnfv_testapi/ui/components/scenarios/scenario/scenarioController.js b/testapi/opnfv_testapi/ui/components/scenarios/scenario/scenarioController.js
index 9935649..a0cd5eb 100644
--- a/testapi/opnfv_testapi/ui/components/scenarios/scenario/scenarioController.js
+++ b/testapi/opnfv_testapi/ui/components/scenarios/scenario/scenarioController.js
@@ -219,7 +219,7 @@
var data = {
"installers": installers
}
- confirmModal("Delete",ctrl.deleteInstaller,data);
+ confirmModal("Delete", 'installers', ctrl.deleteInstaller, data);
}
function addInstaller(installer){
@@ -273,7 +273,7 @@
"version": versions,
"installer": installer
}
- confirmModal("Delete",ctrl.deleteVersion,data);
+ confirmModal("Delete", "version", ctrl.deleteVersion, data);
}
function deleteVersion(data){
@@ -359,7 +359,7 @@
"version": version,
"installer": installer
}
- confirmModal("Delete",ctrl.deleteCustom,data);
+ confirmModal("Delete", 'customs', ctrl.deleteCustom, data);
}
function deleteCustom(data){
@@ -402,7 +402,7 @@
"version": version,
"installer": installer
}
- confirmModal("Delete",ctrl.deleteProject,data);
+ confirmModal("Delete", 'projects', ctrl.deleteProject, data);
}
function deleteProject(data){
@@ -434,16 +434,15 @@
ctrl.confirm = confirm;
ctrl.cancel = cancel;
ctrl.data = angular.copy(data);
- ctrl.open = open;
+ ctrl.customs = [];
- /**
- * Initiate confirmation and call the success handler with the
- * inputs.
- */
function confirm() {
- ctrl.customs = []
- ctrl.customs.push(ctrl.custom)
+ var custom = ctrl.custom;
+ if(custom!="" && custom!=undefined ){
+ ctrl.customs = custom.split(/[ ,]+/).filter(Boolean);
+ }
+ console.log(ctrl.customs)
ctrl.data.successHandler(ctrl.customs,ctrl.data.project,ctrl.data.version,ctrl.data.installer);
$uibModalInstance.dismiss('cancel');
diff --git a/testapi/opnfv_testapi/ui/components/scenarios/scenariosController.js b/testapi/opnfv_testapi/ui/components/scenarios/scenariosController.js
index fd137e5..98e4089 100644
--- a/testapi/opnfv_testapi/ui/components/scenarios/scenariosController.js
+++ b/testapi/opnfv_testapi/ui/components/scenarios/scenariosController.js
@@ -65,7 +65,7 @@
}
function openDeleteModal(name){
- confirmModal("Delete",ctrl.deleteScenario,name);
+ confirmModal("Delete", 'scenarios', ctrl.deleteScenario,name);
}
function deleteScenario(name){
@@ -82,15 +82,23 @@
}
function openBatchDeleteModal(){
- confirmModal("Delete",ctrl.deleteBatchScenario);
+ var deleteObjects = []
+ ctrl.checkBox.forEach(function(scenario, index){
+ if(!ctrl.showError){
+ if(scenario){
+ deleteObjects.push(ctrl.data.scenarios[index].name);
+ }
+ }
+ });
+ confirmModal("Delete", 'scenarios', ctrl.deleteBatchScenario, deleteObjects);
}
function deleteBatchScenario(){
var index;
var checkedBox = [];
- ctrl.checkBox.forEach(function(project, index){
+ ctrl.checkBox.forEach(function(scenario, index){
if(!ctrl.showError){
- if(project){
+ if(scenario){
deleteScenario(ctrl.data.scenarios[index].name);
}
}
@@ -119,7 +127,6 @@
}
function createScenario(scenario) {
- console.log(scenario)
ctrl.scenarioRequest =
$http.post(ctrl.url, scenario).success(function (data){
ctrl.showCreateSuccess = true;
@@ -262,7 +269,6 @@
}
function openVersionModal(){
- console.log("Hello");
$uibModal.open({
templateUrl: 'testapi-ui/components/scenarios/modals/versionModal.html',
controller: 'versionModalCtrl as versionModalCtrl',
@@ -375,8 +381,10 @@
$uibModalInstance.dismiss('cancel');
}
- function handleModalCustom(custom){
- ctrl.project.customs.push(custom);
+ function handleModalCustom(customs){
+ for (var custom in customs){
+ ctrl.project.customs.push(customs[custom]);
+ }
}
function openCustomModal(){
@@ -410,6 +418,7 @@
ctrl.cancel = cancel;
ctrl.data = angular.copy(data);
ctrl.open = open;
+ ctrl.customs = []
/**
@@ -417,7 +426,11 @@
* inputs.
*/
function confirm() {
- ctrl.data.successHandler(ctrl.custom);
+ var custom = ctrl.custom;
+ if(custom!="" && custom!=undefined ){
+ ctrl.customs = custom.split(/[ ,]+/).filter(Boolean);
+ }
+ ctrl.data.successHandler(ctrl.customs);
$uibModalInstance.dismiss('cancel');
}