From 3bc75572f3cf412e39be0651357b8667877b17c9 Mon Sep 17 00:00:00 2001
From: Paul Van Eck
Date: Wed, 9 Nov 2016 15:56:32 -0800
Subject: [PATCH] Add UI enhancements
* Provide ability for Foundation admin to mark/unmark
a test run as verified.
* Explicitly show a test run's associated guideline/target.
* If a test is associated to a product, display that product.
* Change share/unshare to yes/no in edit dropdown.
Change-Id: Iffd4c6b99799be9b8f026b6c4a55922a9e5cb4e4
---
refstack-ui/app/assets/css/style.css | 6 +++
.../results-report/resultsReport.html | 38 +++++++++++++++++--
.../results-report/resultsReportController.js | 35 ++++++++++++++---
.../app/components/results/results.html | 6 +--
refstack-ui/tests/unit/ControllerSpec.js | 19 ++++++++++
5 files changed, 91 insertions(+), 13 deletions(-)
diff --git a/refstack-ui/app/assets/css/style.css b/refstack-ui/app/assets/css/style.css
index 235b79dc..3f3b4e60 100644
--- a/refstack-ui/app/assets/css/style.css
+++ b/refstack-ui/app/assets/css/style.css
@@ -80,6 +80,12 @@ h1, h2, h3, h4, h5, h6 {
cursor: help;
}
+.checkbox-verified {
+ border: 1px solid #A9A9A9;
+ text-align: center;
+ width: 150px;
+}
+
.capabilities {
color: #4B4B4B;
}
diff --git a/refstack-ui/app/components/results-report/resultsReport.html b/refstack-ui/app/components/results-report/resultsReport.html
index 84960e5d..0b3c366d 100644
--- a/refstack-ui/app/components/results-report/resultsReport.html
+++ b/refstack-ui/app/components/results-report/resultsReport.html
@@ -5,22 +5,50 @@
Test ID: {{ctrl.testId}}
-
Cloud ID: {{ctrl.resultsData.cpid}}
+
Cloud ID: {{ctrl.resultsData.cpid}}
Upload Date: {{ctrl.resultsData.created_at}} UTC Duration: {{ctrl.resultsData.duration_seconds}} seconds Total Number of Passed Tests:
{{ctrl.resultsData.results.length}}
-
-
+
diff --git a/refstack-ui/app/components/results-report/resultsReportController.js b/refstack-ui/app/components/results-report/resultsReportController.js
index d28053a6..b53184e7 100644
--- a/refstack-ui/app/components/results-report/resultsReportController.js
+++ b/refstack-ui/app/components/results-report/resultsReportController.js
@@ -36,10 +36,11 @@
ctrl.getVersionList = getVersionList;
ctrl.getResults = getResults;
- ctrl.isEditingAllowed = isEditingAllowed;
+ ctrl.isResultAdmin = isResultAdmin;
ctrl.isShared = isShared;
ctrl.shareTestRun = shareTestRun;
ctrl.deleteTestRun = deleteTestRun;
+ ctrl.updateVerificationStatus = updateVerificationStatus;
ctrl.updateGuidelines = updateGuidelines;
ctrl.getTargetCapabilities = getTargetCapabilities;
ctrl.buildCapabilityV1_2 = buildCapabilityV1_2;
@@ -114,6 +115,7 @@
$http.get(content_url).success(function (data) {
ctrl.resultsData = data;
ctrl.version = ctrl.resultsData.meta.guideline;
+ ctrl.isVerified = ctrl.resultsData.verification_status;
if (ctrl.resultsData.meta.target) {
ctrl.target = ctrl.resultsData.meta.target;
}
@@ -127,14 +129,14 @@
}
/**
- * This tells you whether the current results can be edited/managed
- * based on if the current user is the owner of the results set.
- * @returns {Boolean} true if editing is allowed
+ * This tells you whether the current user has administrative
+ * privileges for the test result.
+ * @returns {Boolean} true if the user has admin privileges.
*/
- function isEditingAllowed() {
+ function isResultAdmin() {
return Boolean(ctrl.resultsData &&
(ctrl.resultsData.user_role === 'owner' ||
- ctrl.resultsData.user_role == 'foundation'));
+ ctrl.resultsData.user_role === 'foundation'));
}
/**
* This tells you whether the current results are shared with the
@@ -190,6 +192,27 @@
});
}
+ /**
+ * This will send a request to the API to delete the current
+ * test results set.
+ */
+ function updateVerificationStatus() {
+ var content_url = [
+ refstackApiUrl, '/results/', ctrl.testId
+ ].join('');
+ var data = {'verification_status': ctrl.isVerified};
+ ctrl.updateRequest =
+ $http.put(content_url, data).success(
+ function () {
+ ctrl.resultsData.verification_status = ctrl.isVerified;
+ raiseAlert('success', '',
+ 'Verification status changed!');
+ }).error(function (error) {
+ ctrl.isVerified = ctrl.resultsData.verification_status;
+ raiseAlert('danger', error.title, error.detail);
+ });
+ }
+
/**
* This will contact the Refstack API server to retrieve the JSON
* content of the guideline file corresponding to the selected
diff --git a/refstack-ui/app/components/results/results.html b/refstack-ui/app/components/results/results.html
index 2552fba3..1f0c3b9c 100644
--- a/refstack-ui/app/components/results/results.html
+++ b/refstack-ui/app/components/results/results.html
@@ -32,7 +32,7 @@
-