From 2603d107bf15ab0d48417f7c948f7aeba057563b Mon Sep 17 00:00:00 2001 From: SerenaFeng Date: Mon, 5 Jun 2017 14:14:43 +0800 Subject: show community results show latest 20 results in cummunity results page. Because pagination is not supported, pagination related buttons are forbiddened now Change-Id: I3d94fc1b89845b6583dd40fe86d69407adfd2e6c Signed-off-by: SerenaFeng --- .../testapi-ui/components/results/results.html | 192 +++------------------ .../components/results/resultsController.js | 29 +--- .../opnfv_testapi/resources/result_handlers.py | 6 +- 3 files changed, 29 insertions(+), 198 deletions(-) (limited to 'utils/test/testapi') diff --git a/utils/test/testapi/3rd_party/static/testapi-ui/components/results/results.html b/utils/test/testapi/3rd_party/static/testapi-ui/components/results/results.html index 2a43cd1e2..3056e1dbe 100644 --- a/utils/test/testapi/3rd_party/static/testapi-ui/components/results/results.html +++ b/utils/test/testapi/3rd_party/static/testapi-ui/components/results/results.html @@ -43,184 +43,36 @@
- +
- - - - - - - - - + + + + + + + + + + - - - - - - - - - + + + + + + + + + + - - - +
Upload DateTest Run IDVendorProduct (version)Target ProgramGuidelineVerifiedSharedIDPodProjectTest CaseInstallerVersionScenarioCriteriaStart DateStop Date
- - - - - {{result.created_at}} - {{result.id.slice(0, 8)}}...{{result.id.slice(-8)}} - - - {{ctrl.vendors[result.product_version.product_info.organization_id].name || '-'}} - {{result.product_version.product_info.name || '-'}} - - ({{result.product_version.version}}) - - {{ctrl.targetMappings[result.meta.target] || '-'}}{{result.meta.guideline.slice(0, -5) || '-'}} - - - - - - - {{ result._id }}{{ result.pod_name }}{{ result.project_name }}{{ result.case_name }}{{ result.installer }}{{ result.version }}{{ result.scenario }}{{ result.criteria }}{{ result.start_date }}{{ result.stop_date }}
- Publicly Shared: - Yes - - No - - - - -
- - Associated Guideline: - - None - - - {{result.meta.guideline.slice(0, -5)}} - - - - - -
- - Associated Target Program: - - None - - - {{ctrl.targetMappings[result.meta.target]}} - - - - - -
- - Associated Product: - - None - - - - - {{ctrl.products[result.product_version.product_info.id].name}} - - ({{result.product_version.version}}) - - - - - - {{ctrl.products[result.product_version.product_info.id].name}} - - ({{result.product_version.version}}) - - - - - - - - - - Version: - - - - - - - -
-
diff --git a/utils/test/testapi/3rd_party/static/testapi-ui/components/results/resultsController.js b/utils/test/testapi/3rd_party/static/testapi-ui/components/results/resultsController.js index 2b0338c87..39ace00eb 100644 --- a/utils/test/testapi/3rd_party/static/testapi-ui/components/results/resultsController.js +++ b/utils/test/testapi/3rd_party/static/testapi-ui/components/results/resultsController.js @@ -38,7 +38,6 @@ ctrl.associateMeta = associateMeta; ctrl.getVersionList = getVersionList; ctrl.getUserProducts = getUserProducts; - ctrl.getVendors = getVendors; ctrl.associateProductVersion = associateProductVersion; ctrl.getProductVersions = getProductVersions; ctrl.prepVersionEdit = prepVersionEdit; @@ -100,8 +99,6 @@ ctrl.update(); } - ctrl.getVendors(); - /** * This will contact the TestAPI API to get a listing of test run * results. @@ -126,9 +123,8 @@ ctrl.resultsRequest = $http.get(content_url).success(function (data) { ctrl.data = data; - ctrl.totalItems = ctrl.data.pagination.total_pages * - ctrl.itemsPerPage; - ctrl.currentPage = ctrl.data.pagination.current_page; + ctrl.totalItems = 20 // ctrl.data.pagination.total_pages * ctrl.itemsPerPage; + ctrl.currentPage = 1 // ctrl.data.pagination.current_page; }).error(function (error) { ctrl.data = null; ctrl.totalItems = 0; @@ -247,27 +243,6 @@ }); } - /** - * This will contact the TestAPI API to get a listing of - * vendors. - */ - function getVendors() { - var contentUrl = testapiApiUrl + '/vendors'; - ctrl.vendorsRequest = - $http.get(contentUrl).success(function (data) { - ctrl.vendors = {}; - data.vendors.forEach(function(vendor) { - ctrl.vendors[vendor.id] = vendor; - }); - }).error(function (error) { - ctrl.vendors = null; - ctrl.showError = true; - ctrl.error = - 'Error retrieving vendor listing from server: ' + - angular.toJson(error); - }); - } - /** * Send a PUT request to the API server to associate a product with * a test result. diff --git a/utils/test/testapi/opnfv_testapi/resources/result_handlers.py b/utils/test/testapi/opnfv_testapi/resources/result_handlers.py index 214706f5f..b84d1e3c2 100644 --- a/utils/test/testapi/opnfv_testapi/resources/result_handlers.py +++ b/utils/test/testapi/opnfv_testapi/resources/result_handlers.py @@ -47,7 +47,7 @@ class GenericResultHandler(handlers.GenericApiHandler): query['start_date'] = obj elif k == 'trust_indicator': query[k + '.current'] = float(v) - elif k != 'last': + elif k != 'last' and k != 'page': query[k] = v return query @@ -126,6 +126,10 @@ class ResultsCLHandler(GenericResultHandler): if last is not None: last = self.get_int('last', last) + page = self.get_query_argument('page', 0) + if page: + last = 20 + self._list(query=self.set_query(), sort=[('start_date', -1)], last=last) -- cgit 1.2.3-korg