summaryrefslogtreecommitdiffstats
path: root/testapi/opnfv_testapi/ui/components/results
diff options
context:
space:
mode:
Diffstat (limited to 'testapi/opnfv_testapi/ui/components/results')
-rw-r--r--testapi/opnfv_testapi/ui/components/results/results.html32
-rw-r--r--testapi/opnfv_testapi/ui/components/results/resultsController.js95
2 files changed, 101 insertions, 26 deletions
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