Add additional columns to user results table

This will allow the table to display some more
pertinent info regarding each test run.

Also, the public Catalog header button was disabled
for now as we ease in new features.

Change-Id: Ibb8a4eec216a383a346f5a58fa20010bc1d60689
This commit is contained in:
Paul Van Eck
2016-12-06 15:11:37 -08:00
parent 0e8721e4ad
commit 539bf16aa4
4 changed files with 66 additions and 2 deletions

View File

@@ -49,6 +49,11 @@
<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>
</tr>
</thead>
@@ -66,7 +71,25 @@
</a>
</td>
<td>{{result.created_at}}</td>
<td><a ui-sref="resultsDetail({testID: result.id})">{{result.id}}</a></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>

View File

@@ -38,6 +38,7 @@
ctrl.associateMeta = associateMeta;
ctrl.getVersionList = getVersionList;
ctrl.getUserProducts = getUserProducts;
ctrl.getVendors = getVendors;
ctrl.associateProductVersion = associateProductVersion;
ctrl.getProductVersions = getProductVersions;
ctrl.prepVersionEdit = prepVersionEdit;
@@ -99,6 +100,8 @@
ctrl.update();
}
ctrl.getVendors();
/**
* This will contact the Refstack API to get a listing of test run
* results.
@@ -244,6 +247,27 @@
});
}
/**
* This will contact the Refstack API to get a listing of
* vendors.
*/
function getVendors() {
var contentUrl = refstackApiUrl + '/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.

View File

@@ -19,6 +19,7 @@ RefStack
<li ng-class="{ active: header.isActive('/about')}"><a ui-sref="about">About</a></li>
<li ng-class="{ active: header.isActive('/guidelines')}"><a ui-sref="guidelines">DefCore Guidelines</a></li>
<li ng-class="{ active: header.isActive('/community_results')}"><a ui-sref="communityResults">Community Results</a></li>
<!--
<li ng-class="{ active: header.isCatalogActive('public')}" class="dropdown" uib-dropdown>
<a role="button" class="dropdown-toggle" uib-dropdown-toggle>
Catalog <strong class="caret"></strong>
@@ -28,6 +29,7 @@ RefStack
<li><a ui-sref="publicProducts">Products</a></li>
</ul>
</li>
-->
</ul>
<ul class="nav navbar-nav navbar-right">
<li ng-class="{ active: header.isActive('/user_results')}" ng-if="auth.isAuthenticated"><a ui-sref="userResults">My Results</a></li>

View File

@@ -201,7 +201,7 @@ describe('Refstack controllers', function () {
});
});
describe('resultsController', function () {
describe('ResultsController', function () {
var scope, ctrl;
var fakeResponse = {
'pagination': {'current_page': 1, 'total_pages': 2},
@@ -211,12 +211,17 @@ describe('Refstack controllers', function () {
'cpid': 'some-cpid'
}]
};
var fakeVendorResp = {
'vendors': [{'id': 'fakeid', 'name': 'Foo Vendor'}]
};
beforeEach(inject(function ($rootScope, $controller) {
scope = $rootScope.$new();
ctrl = $controller('ResultsController', {$scope: scope});
$httpBackend.when('GET', fakeApiUrl +
'/results?page=1').respond(fakeResponse);
$httpBackend.when('GET', fakeApiUrl +
'/vendors').respond(fakeVendorResp);
}));
it('should fetch the first page of results with proper URL args',
@@ -319,6 +324,16 @@ describe('Refstack controllers', function () {
expect(ctrl.products).toEqual(expected);
});
it('should have a function to get a listing of vendors',
function () {
$httpBackend.expectGET(fakeApiUrl + '/vendors')
.respond(fakeVendorResp);
ctrl.getVendors();
$httpBackend.flush();
var expected = fakeVendorResp.vendors[0];
expect(ctrl.vendors.fakeid).toEqual(expected);
});
it('should have a function to associate a product version to a test',
function () {
var result = {'id': 'bar',