diff options
Diffstat (limited to 'utils')
3 files changed, 29 insertions, 198 deletions
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 @@ <div cg-busy="{promise:ctrl.resultsRequest,message:'Loading'}"></div> <div ng-show="ctrl.data" class="results-table"> - <table ng-show="ctrl.data" class="table table-striped table-hover"> + <table ng-data="ctrl.data.result" ng-show="ctrl.data" class="table table-striped table-hover"> <thead> <tr> - <th ng-if="ctrl.isUserResults"></th> - <th>Upload Date</th> - <th>Test Run ID</th> - <th ng-if="ctrl.isUserResults">Vendor</th> - <th ng-if="ctrl.isUserResults">Product (version)</th> - <th ng-if="ctrl.isUserResults">Target Program</th> - <th ng-if="ctrl.isUserResults">Guideline</th> - <th ng-if="ctrl.isUserResults">Verified</th> - <th ng-if="ctrl.isUserResults">Shared</th> + <th>ID</th> + <th>Pod</th> + <th>Project</th> + <th>Test Case</th> + <th>Installer</th> + <th>Version</th> + <th>Scenario</th> + <th>Criteria</th> + <th>Start Date</th> + <th>Stop Date</th> </tr> </thead> <tbody> <tr ng-repeat-start="(index, result) in ctrl.data.results"> - <td ng-if="ctrl.isUserResults"> - <a ng-if="!result.expanded" - class="glyphicon glyphicon-plus" - ng-click="result.expanded = true"> - </a> - <a ng-if="result.expanded" - class="glyphicon glyphicon-minus" - ng-click="result.expanded = false"> - </a> - </td> - <td>{{result.created_at}}</td> - <td><a ui-sref="resultsDetail({testID: result.id})"> - {{result.id.slice(0, 8)}}...{{result.id.slice(-8)}} - </a> - </td> - <td ng-if="ctrl.isUserResults"> - {{ctrl.vendors[result.product_version.product_info.organization_id].name || '-'}} - </td> - <td ng-if="ctrl.isUserResults">{{result.product_version.product_info.name || '-'}} - <span ng-if="result.product_version.version"> - ({{result.product_version.version}}) - </span> - </td> - <td ng-if="ctrl.isUserResults">{{ctrl.targetMappings[result.meta.target] || '-'}}</td> - <td ng-if="ctrl.isUserResults">{{result.meta.guideline.slice(0, -5) || '-'}}</td> - <td ng-if="ctrl.isUserResults"> - <span ng-if="result.verification_status" class="glyphicon glyphicon-ok"></span> - <span ng-if="!result.verification_status">-</span> - - </td> - <td ng-if="ctrl.isUserResults"> - <span ng-show="result.meta.shared" class="glyphicon glyphicon-share"></span> - </td> + <td>{{ result._id }}</td> + <td>{{ result.pod_name }}</td> + <td>{{ result.project_name }}</td> + <td>{{ result.case_name }}</td> + <td>{{ result.installer }}</td> + <td>{{ result.version }}</td> + <td>{{ result.scenario }}</td> + <td>{{ result.criteria }}</td> + <td>{{ result.start_date }}</td> + <td>{{ result.stop_date }}</td> </tr> - <tr ng-if="result.expanded" ng-repeat-end> - <td></td> - <td colspan="3"> - <strong>Publicly Shared:</strong> - <span ng-if="result.meta.shared == 'true' && !result.sharedEdit">Yes</span> - <span ng-if="!result.meta.shared && !result.sharedEdit"> - <em>No</em> - </span> - <select ng-if="result.sharedEdit" - ng-model="result.meta.shared" - class="form-inline"> - <option value="true">Yes</option> - <option value="">No</option> - </select> - <a ng-if="!result.sharedEdit" - ng-click="result.sharedEdit = true" - title="Edit" - class="glyphicon glyphicon-pencil"></a> - <a ng-if="result.sharedEdit" - ng-click="ctrl.associateMeta(index,'shared',result.meta.shared)" - title="Save" - class="glyphicon glyphicon-floppy-disk"></a> - <br /> - - <strong>Associated Guideline:</strong> - <span ng-if="!result.meta.guideline && !result.guidelineEdit"> - <em>None</em> - </span> - <span ng-if="result.meta.guideline && !result.guidelineEdit"> - {{result.meta.guideline.slice(0, -5)}} - </span> - <select ng-if="result.guidelineEdit" - ng-model="result.meta.guideline" - ng-options="o as o.slice(0, -5) for o in ctrl.versionList" - class="form-inline"> - <option value="">None</option> - </select> - <a ng-if="!result.guidelineEdit" - ng-click="ctrl.getVersionList();result.guidelineEdit = true" - title="Edit" - class="glyphicon glyphicon-pencil"></a> - <a ng-if="result.guidelineEdit" - ng-click="ctrl.associateMeta(index, 'guideline', result.meta.guideline)" - title="Save" - class="glyphicon glyphicon-floppy-disk"> - </a> - <br /> - - <strong>Associated Target Program:</strong> - <span ng-if="!result.meta.target && !result.targetEdit"> - <em>None</em> - </span> - <span ng-if="result.meta.target && !result.targetEdit"> - {{ctrl.targetMappings[result.meta.target]}}</span> - <select ng-if="result.targetEdit" - ng-model="result.meta.target" - class="form-inline"> - <option value="">None</option> - <option value="platform">OpenStack Powered Platform</option> - <option value="compute">OpenStack Powered Compute</option> - <option value="object">OpenStack Powered Object Storage</option> - </select> - <a ng-if="!result.targetEdit" - ng-click="result.targetEdit = true;" - title="Edit" - class="glyphicon glyphicon-pencil"> - </a> - <a ng-if="result.targetEdit" - ng-click="ctrl.associateMeta(index, 'target', result.meta.target)" - title="Save" - class="glyphicon glyphicon-floppy-disk"> - </a> - <br /> - - <strong>Associated Product:</strong> - <span ng-if="!result.product_version && !result.productEdit"> - <em>None</em> - </span> - <span ng-if="result.product_version && !result.productEdit"> - <span ng-if="ctrl.products[result.product_version.product_info.id].product_type == 0"> - <a ui-sref="distro({id: result.product_version.product_info.id})"> - {{ctrl.products[result.product_version.product_info.id].name}} - <small ng-if="result.product_version.version"> - ({{result.product_version.version}}) - </small> - </a> - </span> - <span ng-if="ctrl.products[result.product_version.product_info.id].product_type != 0"> - <a ui-sref="cloud({id: result.product_version.product_info.id})"> - {{ctrl.products[result.product_version.product_info.id].name}} - <small ng-if="result.product_version.version"> - ({{result.product_version.version}}) - </small> - </a> - </span> - </span> - - <select ng-if="result.productEdit" - ng-options="product as product.name for product in ctrl.products | arrayConverter | orderBy: 'name' track by product.id" - ng-model="result.selectedProduct" - ng-change="ctrl.getProductVersions(result)"> - <option value="">-- No Product --</option> - </select> - - <span ng-if="result.productVersions.length && result.productEdit"> - <span class="glyphicon glyphicon-arrow-right" style="padding-right:3px;color:#303030;"></span> - Version: - <select ng-options="version as version.version for version in result.productVersions | orderBy: 'version' track by version.id" - ng-model="result.selectedVersion"> - </select> - - </span> - <a ng-if="!result.productEdit" - ng-click="ctrl.prepVersionEdit(result)" - title="Edit" - class="glyphicon glyphicon-pencil"> - </a> - <a ng-if="result.productEdit" - ng-click="ctrl.associateProductVersion(result)" - confirm="Once you associate this test to this product, ownership - will be transferred to the product's vendor admins. - Continue?" - title="Save" - class="glyphicon glyphicon-floppy-disk"> - </a> - <br /> - </td> + <tr ng-repeat-end=> </tr> </tbody> </table> 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; @@ -248,27 +244,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) |