Update node packages and styling
With the update of some linting packages, several style fixes were needed to conform with the updated style guidelines. Change-Id: If73036a6d4a3a2f6e93b15d1fa6ed3d253fdc7b1
This commit is contained in:
parent
33eb6586cf
commit
6d473eed7d
@ -57,6 +57,8 @@
|
|||||||
"no-extra-boolean-cast": 0,
|
"no-extra-boolean-cast": 0,
|
||||||
"operator-linebreak": 0,
|
"operator-linebreak": 0,
|
||||||
"require-jsdoc": 2,
|
"require-jsdoc": 2,
|
||||||
|
"quote-props": 0,
|
||||||
|
"valid-jsdoc": 0,
|
||||||
|
|
||||||
// Stylistic
|
// Stylistic
|
||||||
"indent": [2, 4, {SwitchCase: 1}],
|
"indent": [2, 4, {SwitchCase: 1}],
|
||||||
|
24
package.json
24
package.json
@ -5,24 +5,22 @@
|
|||||||
"description": "A user interface for RefStack",
|
"description": "A user interface for RefStack",
|
||||||
"license": "Apache2",
|
"license": "Apache2",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"bower": "1.3.12",
|
"bower": "1.7.5",
|
||||||
"eslint": "1.5.1",
|
"eslint": "^3.0.0",
|
||||||
"eslint-config-openstack": "1.2.1",
|
"eslint-config-openstack": "4.0.1",
|
||||||
"eslint-plugin-angular": "0.12.0",
|
"eslint-plugin-angular": "1.4.0",
|
||||||
"http-server": "^0.6.1",
|
"jasmine-core": "2.8.0",
|
||||||
"karma": "^0.12.23",
|
"karma": "^1.7.1",
|
||||||
"karma-chrome-launcher": "^0.1.5",
|
"karma-chrome-launcher": "^2.2.0",
|
||||||
"karma-cli": "0.0.4",
|
"karma-cli": "1.0.1",
|
||||||
"karma-jasmine": "^0.2.2",
|
"karma-jasmine": "^1.1.0"
|
||||||
"protractor": "~1.0.0"
|
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"postinstall": "bower install --config.interactive=false",
|
"postinstall": "bower install --config.interactive=false",
|
||||||
"prestart": "npm install",
|
"prestart": "npm install",
|
||||||
"start": "http-server ./refstack-ui/app -a 0.0.0.0 -p 8080",
|
|
||||||
"pretest": "npm install",
|
"pretest": "npm install",
|
||||||
"test": "karma start ./refstack-ui/tests/karma.conf.js --single-run",
|
"test": "if [ -z $CHROME_BIN ];then export CHROME_BIN=/usr/bin/chromium-browser;fi && karma start ./refstack-ui/tests/karma.conf.js --single-run",
|
||||||
"test-auto-watch": "karma start ./refstack-ui/tests/karma.conf.js --auto-watch",
|
"test-auto-watch": "if [ -z $CHROME_BIN ];then export CHROME_BIN=/usr/bin/chromium-browser;fi && karma start ./refstack-ui/tests/karma.conf.js --auto-watch",
|
||||||
"lint": "eslint -c ./.eslintrc --no-color ./refstack-ui"
|
"lint": "eslint -c ./.eslintrc --no-color ./refstack-ui"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -74,8 +74,7 @@
|
|||||||
var hash = $location.hash();
|
var hash = $location.hash();
|
||||||
if (hash && hash in ctrl.options) {
|
if (hash && hash in ctrl.options) {
|
||||||
ctrl.selectOption(hash);
|
ctrl.selectOption(hash);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
ctrl.selectOption('about');
|
ctrl.selectOption('about');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -94,8 +94,7 @@
|
|||||||
data.metadata.os_trademark_approval.releases;
|
data.metadata.os_trademark_approval.releases;
|
||||||
ctrl.guidelineStatus =
|
ctrl.guidelineStatus =
|
||||||
data.metadata.os_trademark_approval.status;
|
data.metadata.os_trademark_approval.status;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
ctrl.schema = data.schema;
|
ctrl.schema = data.schema;
|
||||||
ctrl.criteria = data.criteria;
|
ctrl.criteria = data.criteria;
|
||||||
ctrl.releases = data.releases;
|
ctrl.releases = data.releases;
|
||||||
@ -121,6 +120,7 @@
|
|||||||
ctrl.targetCapabilities = {};
|
ctrl.targetCapabilities = {};
|
||||||
var components = ctrl.guidelines.components;
|
var components = ctrl.guidelines.components;
|
||||||
var targetCaps = ctrl.targetCapabilities;
|
var targetCaps = ctrl.targetCapabilities;
|
||||||
|
var targetComponents = null;
|
||||||
|
|
||||||
// The 'platform' target is comprised of multiple components, so
|
// The 'platform' target is comprised of multiple components, so
|
||||||
// we need to get the capabilities belonging to each of its
|
// we need to get the capabilities belonging to each of its
|
||||||
@ -133,15 +133,14 @@
|
|||||||
'object': 'OpenStack Powered Storage'
|
'object': 'OpenStack Powered Storage'
|
||||||
};
|
};
|
||||||
|
|
||||||
var targetComponents = ctrl.guidelines.platforms[
|
targetComponents = ctrl.guidelines.platforms[
|
||||||
platformsMap[ctrl.target]].components.map(
|
platformsMap[ctrl.target]].components.map(
|
||||||
function(c) {
|
function(c) {
|
||||||
return c.name;
|
return c.name;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
} else {
|
||||||
else {
|
targetComponents = ctrl.guidelines.platform.required;
|
||||||
var targetComponents = ctrl.guidelines.platform.required;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// This will contain status priority values, where lower
|
// This will contain status priority values, where lower
|
||||||
@ -173,15 +172,13 @@
|
|||||||
statusMap[targetCaps[cap]]) {
|
statusMap[targetCaps[cap]]) {
|
||||||
targetCaps[cap] = status;
|
targetCaps[cap] = status;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
targetCaps[cap] = status;
|
targetCaps[cap] = status;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
angular.forEach(components[ctrl.target],
|
angular.forEach(components[ctrl.target],
|
||||||
function (caps, status) {
|
function (caps, status) {
|
||||||
angular.forEach(caps, function(cap) {
|
angular.forEach(caps, function(cap) {
|
||||||
@ -200,14 +197,14 @@
|
|||||||
*/
|
*/
|
||||||
function filterStatus(capability) {
|
function filterStatus(capability) {
|
||||||
var caps = ctrl.targetCapabilities;
|
var caps = ctrl.targetCapabilities;
|
||||||
return (ctrl.status.required &&
|
return ctrl.status.required &&
|
||||||
caps[capability.id] === 'required') ||
|
caps[capability.id] === 'required' ||
|
||||||
(ctrl.status.advisory &&
|
ctrl.status.advisory &&
|
||||||
caps[capability.id] === 'advisory') ||
|
caps[capability.id] === 'advisory' ||
|
||||||
(ctrl.status.deprecated &&
|
ctrl.status.deprecated &&
|
||||||
caps[capability.id] === 'deprecated') ||
|
caps[capability.id] === 'deprecated' ||
|
||||||
(ctrl.status.removed &&
|
ctrl.status.removed &&
|
||||||
caps[capability.id] === 'removed');
|
caps[capability.id] === 'removed';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -282,8 +279,7 @@
|
|||||||
// Check if the API URL is absolute or relative.
|
// Check if the API URL is absolute or relative.
|
||||||
if (refstackApiUrl.indexOf('http') > -1) {
|
if (refstackApiUrl.indexOf('http') > -1) {
|
||||||
ctrl.url = refstackApiUrl;
|
ctrl.url = refstackApiUrl;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
ctrl.url = location.protocol + '//' + location.host +
|
ctrl.url = location.protocol + '//' + location.host +
|
||||||
refstackApiUrl;
|
refstackApiUrl;
|
||||||
}
|
}
|
||||||
@ -333,8 +329,7 @@
|
|||||||
ctrl.testListString = response.data;
|
ctrl.testListString = response.data;
|
||||||
if (!ctrl.testListString) {
|
if (!ctrl.testListString) {
|
||||||
ctrl.testListCount = 0;
|
ctrl.testListCount = 0;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
ctrl.testListCount =
|
ctrl.testListCount =
|
||||||
ctrl.testListString.split('\n').length;
|
ctrl.testListString.split('\n').length;
|
||||||
}
|
}
|
||||||
@ -345,8 +340,7 @@
|
|||||||
response.data.message) {
|
response.data.message) {
|
||||||
ctrl.error = 'Error retrieving test list: ' +
|
ctrl.error = 'Error retrieving test list: ' +
|
||||||
response.data.message;
|
response.data.message;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
ctrl.error = 'Unknown error retrieving test list.';
|
ctrl.error = 'Unknown error retrieving test list.';
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -232,8 +232,7 @@
|
|||||||
}).error(function (error) {
|
}).error(function (error) {
|
||||||
raiseAlert('danger', error.title, error.detail);
|
raiseAlert('danger', error.title, error.detail);
|
||||||
});
|
});
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
ctrl.unassociateRequest = $http.delete(metaUrl)
|
ctrl.unassociateRequest = $http.delete(metaUrl)
|
||||||
.success(function () {
|
.success(function () {
|
||||||
ctrl.testsData[index][editFlag] = false;
|
ctrl.testsData[index][editFlag] = false;
|
||||||
@ -447,7 +446,7 @@
|
|||||||
var properties = propertiesToJson();
|
var properties = propertiesToJson();
|
||||||
var content = {'description': ctrl.product.description,
|
var content = {'description': ctrl.product.description,
|
||||||
'properties': properties};
|
'properties': properties};
|
||||||
if (ctrl.productName != ctrl.product.name) {
|
if (ctrl.productName !== ctrl.product.name) {
|
||||||
content.name = ctrl.product.name;
|
content.name = ctrl.product.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -468,8 +467,7 @@
|
|||||||
ctrl.showError = true;
|
ctrl.showError = true;
|
||||||
ctrl.error = error.detail;
|
ctrl.error = error.detail;
|
||||||
});
|
});
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
ctrl.showSuccess = true;
|
ctrl.showSuccess = true;
|
||||||
$state.reload();
|
$state.reload();
|
||||||
}
|
}
|
||||||
|
@ -20,15 +20,14 @@
|
|||||||
.controller('ProductsController', ProductsController);
|
.controller('ProductsController', ProductsController);
|
||||||
|
|
||||||
ProductsController.$inject = [
|
ProductsController.$inject = [
|
||||||
'$rootScope', '$scope', '$http', '$state',
|
'$rootScope', '$scope', '$http', '$state', 'refstackApiUrl'
|
||||||
'refstackApiUrl','raiseAlert'
|
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* RefStack Products Controller
|
* RefStack Products Controller
|
||||||
*/
|
*/
|
||||||
function ProductsController($rootScope, $scope, $http, $state,
|
function ProductsController($rootScope, $scope, $http, $state,
|
||||||
refstackApiUrl, raiseAlert) {
|
refstackApiUrl) {
|
||||||
var ctrl = this;
|
var ctrl = this;
|
||||||
|
|
||||||
ctrl.update = update;
|
ctrl.update = update;
|
||||||
@ -82,7 +81,7 @@
|
|||||||
ctrl.showError = false;
|
ctrl.showError = false;
|
||||||
// Construct the API URL based on user-specified filters.
|
// Construct the API URL based on user-specified filters.
|
||||||
var contentUrl = refstackApiUrl + '/products';
|
var contentUrl = refstackApiUrl + '/products';
|
||||||
if (typeof ctrl.rawData == 'undefined'
|
if (typeof ctrl.rawData === 'undefined'
|
||||||
|| ctrl.rawData === null) {
|
|| ctrl.rawData === null) {
|
||||||
ctrl.productsRequest =
|
ctrl.productsRequest =
|
||||||
$http.get(contentUrl).success(function (data) {
|
$http.get(contentUrl).success(function (data) {
|
||||||
@ -106,7 +105,8 @@
|
|||||||
function updateData() {
|
function updateData() {
|
||||||
ctrl.data = {};
|
ctrl.data = {};
|
||||||
ctrl.data.products = ctrl.rawData.products.filter(function(s) {
|
ctrl.data.products = ctrl.rawData.products.filter(function(s) {
|
||||||
return ctrl._filterProduct(s); });
|
return ctrl._filterProduct(s);
|
||||||
|
});
|
||||||
ctrl.data.products.sort(function(a, b) {
|
ctrl.data.products.sort(function(a, b) {
|
||||||
return a.name.localeCompare(b.name);
|
return a.name.localeCompare(b.name);
|
||||||
});
|
});
|
||||||
@ -165,7 +165,7 @@
|
|||||||
ctrl.vendors.sort(function(a, b) {
|
ctrl.vendors.sort(function(a, b) {
|
||||||
return a.name.localeCompare(b.name);
|
return a.name.localeCompare(b.name);
|
||||||
});
|
});
|
||||||
if (ctrl.vendors.length == 0) {
|
if (ctrl.vendors.length === 0) {
|
||||||
ctrl.vendors.push({name: 'Create New...', id: ''});
|
ctrl.vendors.push({name: 'Create New...', id: ''});
|
||||||
}
|
}
|
||||||
ctrl.organizationId = ctrl.vendors[0].id;
|
ctrl.organizationId = ctrl.vendors[0].id;
|
||||||
@ -189,9 +189,9 @@
|
|||||||
name: ctrl.name,
|
name: ctrl.name,
|
||||||
description: ctrl.description,
|
description: ctrl.description,
|
||||||
organization_id: ctrl.organizationId,
|
organization_id: ctrl.organizationId,
|
||||||
product_type: parseInt(ctrl.productType)
|
product_type: parseInt(ctrl.productType, 10)
|
||||||
};
|
};
|
||||||
$http.post(url, data).success(function (data) {
|
$http.post(url, data).success(function () {
|
||||||
ctrl.rawData = null;
|
ctrl.rawData = null;
|
||||||
ctrl.showSuccess = true;
|
ctrl.showSuccess = true;
|
||||||
ctrl.name = '';
|
ctrl.name = '';
|
||||||
|
@ -234,8 +234,7 @@
|
|||||||
data.metadata.os_trademark_approval.status;
|
data.metadata.os_trademark_approval.status;
|
||||||
ctrl.releases =
|
ctrl.releases =
|
||||||
data.metadata.os_trademark_approval.releases;
|
data.metadata.os_trademark_approval.releases;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
ctrl.schemaVersion = data.schema;
|
ctrl.schemaVersion = data.schema;
|
||||||
ctrl.guidelineStatus = data.status;
|
ctrl.guidelineStatus = data.status;
|
||||||
ctrl.releases = data.releases;
|
ctrl.releases = data.releases;
|
||||||
@ -257,6 +256,7 @@
|
|||||||
function getTargetCapabilities() {
|
function getTargetCapabilities() {
|
||||||
var components = ctrl.guidelineData.components;
|
var components = ctrl.guidelineData.components;
|
||||||
var targetCaps = {};
|
var targetCaps = {};
|
||||||
|
var targetComponents = null;
|
||||||
|
|
||||||
// The 'platform' target is comprised of multiple components, so
|
// The 'platform' target is comprised of multiple components, so
|
||||||
// we need to get the capabilities belonging to each of its
|
// we need to get the capabilities belonging to each of its
|
||||||
@ -269,15 +269,14 @@
|
|||||||
'object': 'OpenStack Powered Storage'
|
'object': 'OpenStack Powered Storage'
|
||||||
};
|
};
|
||||||
|
|
||||||
var targetComponents = ctrl.guidelineData.platforms[
|
targetComponents = ctrl.guidelineData.platforms[
|
||||||
platformsMap[ctrl.target]].components.map(
|
platformsMap[ctrl.target]].components.map(
|
||||||
function(c) {
|
function(c) {
|
||||||
return c.name;
|
return c.name;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
} else {
|
||||||
else {
|
targetComponents = ctrl.guidelineData.platform.required;
|
||||||
var targetComponents = ctrl.guidelineData.platform.required;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// This will contain status priority values, where lower
|
// This will contain status priority values, where lower
|
||||||
@ -309,15 +308,13 @@
|
|||||||
statusMap[targetCaps[cap]]) {
|
statusMap[targetCaps[cap]]) {
|
||||||
targetCaps[cap] = status;
|
targetCaps[cap] = status;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
targetCaps[cap] = status;
|
targetCaps[cap] = status;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
angular.forEach(components[ctrl.target],
|
angular.forEach(components[ctrl.target],
|
||||||
function (caps, status) {
|
function (caps, status) {
|
||||||
angular.forEach(caps, function(cap) {
|
angular.forEach(caps, function(cap) {
|
||||||
@ -353,8 +350,7 @@
|
|||||||
if (capDetails.flagged.indexOf(testId) > -1) {
|
if (capDetails.flagged.indexOf(testId) > -1) {
|
||||||
cap.passedFlagged.push(testId);
|
cap.passedFlagged.push(testId);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
cap.notPassedTests.push(testId);
|
cap.notPassedTests.push(testId);
|
||||||
if (capDetails.flagged.indexOf(testId) > -1) {
|
if (capDetails.flagged.indexOf(testId) > -1) {
|
||||||
cap.notPassedFlagged.push(testId);
|
cap.notPassedFlagged.push(testId);
|
||||||
@ -393,8 +389,7 @@
|
|||||||
// If the test ID is in the results' test list.
|
// If the test ID is in the results' test list.
|
||||||
if (ctrl.resultsData.results.indexOf(testId) > -1) {
|
if (ctrl.resultsData.results.indexOf(testId) > -1) {
|
||||||
passed = true;
|
passed = true;
|
||||||
}
|
} else if ('aliases' in details) {
|
||||||
else if ('aliases' in details) {
|
|
||||||
var len = details.aliases.length;
|
var len = details.aliases.length;
|
||||||
for (var i = 0; i < len; i++) {
|
for (var i = 0; i < len; i++) {
|
||||||
var alias = details.aliases[i];
|
var alias = details.aliases[i];
|
||||||
@ -412,8 +407,7 @@
|
|||||||
if ('flagged' in details) {
|
if ('flagged' in details) {
|
||||||
cap.passedFlagged.push(testId);
|
cap.passedFlagged.push(testId);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
cap.notPassedTests.push(testId);
|
cap.notPassedTests.push(testId);
|
||||||
if ('flagged' in details) {
|
if ('flagged' in details) {
|
||||||
cap.notPassedFlagged.push(testId);
|
cap.notPassedFlagged.push(testId);
|
||||||
@ -443,10 +437,11 @@
|
|||||||
'removed': {'caps': [], 'count': 0, 'passedCount': 0,
|
'removed': {'caps': [], 'count': 0, 'passedCount': 0,
|
||||||
'flagFailCount': 0, 'flagPassCount': 0}
|
'flagFailCount': 0, 'flagPassCount': 0}
|
||||||
};
|
};
|
||||||
|
var capMethod = null;
|
||||||
|
|
||||||
switch (ctrl.schemaVersion) {
|
switch (ctrl.schemaVersion) {
|
||||||
case '1.2':
|
case '1.2':
|
||||||
var capMethod = 'buildCapabilityV1_2';
|
capMethod = 'buildCapabilityV1_2';
|
||||||
break;
|
break;
|
||||||
case '1.3':
|
case '1.3':
|
||||||
case '1.4':
|
case '1.4':
|
||||||
@ -478,8 +473,8 @@
|
|||||||
ctrl.caps[status].caps.push(cap);
|
ctrl.caps[status].caps.push(cap);
|
||||||
});
|
});
|
||||||
|
|
||||||
ctrl.requiredPassPercent = (ctrl.caps.required.passedCount *
|
ctrl.requiredPassPercent = ctrl.caps.required.passedCount *
|
||||||
100 / ctrl.caps.required.count);
|
100 / ctrl.caps.required.count;
|
||||||
|
|
||||||
ctrl.totalRequiredFailCount = ctrl.caps.required.count -
|
ctrl.totalRequiredFailCount = ctrl.caps.required.count -
|
||||||
ctrl.caps.required.passedCount;
|
ctrl.caps.required.passedCount;
|
||||||
@ -492,8 +487,8 @@
|
|||||||
(ctrl.totalRequiredFailCount -
|
(ctrl.totalRequiredFailCount -
|
||||||
ctrl.caps.required.flagFailCount);
|
ctrl.caps.required.flagFailCount);
|
||||||
|
|
||||||
ctrl.nonFlagRequiredPassPercent = (ctrl.nonFlagPassCount *
|
ctrl.nonFlagRequiredPassPercent = ctrl.nonFlagPassCount *
|
||||||
100 / ctrl.totalNonFlagCount);
|
100 / ctrl.totalNonFlagCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -506,10 +501,10 @@
|
|||||||
if (!capObj) {
|
if (!capObj) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return (((ctrl.schemaVersion === '1.2') &&
|
return ctrl.schemaVersion === '1.2' &&
|
||||||
(capObj.flagged.indexOf(test) > -1)) ||
|
capObj.flagged.indexOf(test) > -1 ||
|
||||||
((ctrl.schemaVersion >= '1.3') &&
|
ctrl.schemaVersion >= '1.3' &&
|
||||||
(capObj.tests[test].flagged)));
|
capObj.tests[test].flagged;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -520,19 +515,17 @@
|
|||||||
* @returns {String} reason
|
* @returns {String} reason
|
||||||
*/
|
*/
|
||||||
function getFlaggedReason(test, capObj) {
|
function getFlaggedReason(test, capObj) {
|
||||||
if ((ctrl.schemaVersion === '1.2') &&
|
if (ctrl.schemaVersion === '1.2' &&
|
||||||
(ctrl.isTestFlagged(test, capObj))) {
|
ctrl.isTestFlagged(test, capObj)) {
|
||||||
|
|
||||||
// Return a generic message since schema 1.2 does not
|
// Return a generic message since schema 1.2 does not
|
||||||
// provide flag reasons.
|
// provide flag reasons.
|
||||||
return 'Interop Working Group has flagged this test.';
|
return 'Interop Working Group has flagged this test.';
|
||||||
}
|
} else if (ctrl.schemaVersion >= '1.3' &&
|
||||||
else if ((ctrl.schemaVersion >= '1.3') &&
|
ctrl.isTestFlagged(test, capObj)) {
|
||||||
(ctrl.isTestFlagged(test, capObj))) {
|
|
||||||
|
|
||||||
return capObj.tests[test].flagged.reason;
|
return capObj.tests[test].flagged.reason;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -545,14 +538,14 @@
|
|||||||
* @returns {Boolean} true if capability should be shown
|
* @returns {Boolean} true if capability should be shown
|
||||||
*/
|
*/
|
||||||
function isCapabilityShown(capability) {
|
function isCapabilityShown(capability) {
|
||||||
return ((ctrl.testStatus === 'total') ||
|
return ctrl.testStatus === 'total' ||
|
||||||
(ctrl.testStatus === 'passed' &&
|
ctrl.testStatus === 'passed' &&
|
||||||
capability.passedTests.length > 0) ||
|
capability.passedTests.length > 0 ||
|
||||||
(ctrl.testStatus === 'not passed' &&
|
ctrl.testStatus === 'not passed' &&
|
||||||
capability.notPassedTests.length > 0) ||
|
capability.notPassedTests.length > 0 ||
|
||||||
(ctrl.testStatus === 'flagged' &&
|
ctrl.testStatus === 'flagged' &&
|
||||||
(capability.passedFlagged.length +
|
capability.passedFlagged.length +
|
||||||
capability.notPassedFlagged.length > 0)));
|
capability.notPassedFlagged.length > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -563,14 +556,14 @@
|
|||||||
* @return {Boolean} true if test should be shown
|
* @return {Boolean} true if test should be shown
|
||||||
*/
|
*/
|
||||||
function isTestShown(test, capability) {
|
function isTestShown(test, capability) {
|
||||||
return ((ctrl.testStatus === 'total') ||
|
return ctrl.testStatus === 'total' ||
|
||||||
(ctrl.testStatus === 'passed' &&
|
ctrl.testStatus === 'passed' &&
|
||||||
capability.passedTests.indexOf(test) > -1) ||
|
capability.passedTests.indexOf(test) > -1 ||
|
||||||
(ctrl.testStatus === 'not passed' &&
|
ctrl.testStatus === 'not passed' &&
|
||||||
capability.notPassedTests.indexOf(test) > -1) ||
|
capability.notPassedTests.indexOf(test) > -1 ||
|
||||||
(ctrl.testStatus === 'flagged' &&
|
ctrl.testStatus === 'flagged' &&
|
||||||
(capability.passedFlagged.indexOf(test) > -1 ||
|
(capability.passedFlagged.indexOf(test) > -1 ||
|
||||||
capability.notPassedFlagged.indexOf(test) > -1)));
|
capability.notPassedFlagged.indexOf(test) > -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -583,18 +576,14 @@
|
|||||||
if (ctrl.testStatus === 'total') {
|
if (ctrl.testStatus === 'total') {
|
||||||
return capability.passedTests.length +
|
return capability.passedTests.length +
|
||||||
capability.notPassedTests.length;
|
capability.notPassedTests.length;
|
||||||
}
|
} else if (ctrl.testStatus === 'passed') {
|
||||||
else if (ctrl.testStatus === 'passed') {
|
|
||||||
return capability.passedTests.length;
|
return capability.passedTests.length;
|
||||||
}
|
} else if (ctrl.testStatus === 'not passed') {
|
||||||
else if (ctrl.testStatus === 'not passed') {
|
|
||||||
return capability.notPassedTests.length;
|
return capability.notPassedTests.length;
|
||||||
}
|
} else if (ctrl.testStatus === 'flagged') {
|
||||||
else if (ctrl.testStatus === 'flagged') {
|
|
||||||
return capability.passedFlagged.length +
|
return capability.passedFlagged.length +
|
||||||
capability.notPassedFlagged.length;
|
capability.notPassedFlagged.length;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -608,22 +597,17 @@
|
|||||||
function getStatusTestCount(status) {
|
function getStatusTestCount(status) {
|
||||||
if (!ctrl.caps) {
|
if (!ctrl.caps) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
} else if (ctrl.testStatus === 'total') {
|
||||||
else if (ctrl.testStatus === 'total') {
|
|
||||||
return ctrl.caps[status].count;
|
return ctrl.caps[status].count;
|
||||||
}
|
} else if (ctrl.testStatus === 'passed') {
|
||||||
else if (ctrl.testStatus === 'passed') {
|
|
||||||
return ctrl.caps[status].passedCount;
|
return ctrl.caps[status].passedCount;
|
||||||
}
|
} else if (ctrl.testStatus === 'not passed') {
|
||||||
else if (ctrl.testStatus === 'not passed') {
|
|
||||||
return ctrl.caps[status].count -
|
return ctrl.caps[status].count -
|
||||||
ctrl.caps[status].passedCount;
|
ctrl.caps[status].passedCount;
|
||||||
}
|
} else if (ctrl.testStatus === 'flagged') {
|
||||||
else if (ctrl.testStatus === 'flagged') {
|
|
||||||
return ctrl.caps[status].flagFailCount +
|
return ctrl.caps[status].flagFailCount +
|
||||||
ctrl.caps[status].flagPassCount;
|
ctrl.caps[status].flagPassCount;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -791,8 +775,8 @@
|
|||||||
* a test result.
|
* a test result.
|
||||||
*/
|
*/
|
||||||
function associateProductVersion() {
|
function associateProductVersion() {
|
||||||
var verId = (ctrl.selectedVersion ?
|
var verId = ctrl.selectedVersion ?
|
||||||
ctrl.selectedVersion.id : null);
|
ctrl.selectedVersion.id : null;
|
||||||
var testId = resultsData.id;
|
var testId = resultsData.id;
|
||||||
var url = refstackApiUrl + '/results/' + testId;
|
var url = refstackApiUrl + '/results/' + testId;
|
||||||
ctrl.associateRequest = $http.put(url, {'product_version_id':
|
ctrl.associateRequest = $http.put(url, {'product_version_id':
|
||||||
@ -822,11 +806,10 @@
|
|||||||
.success(function (data) {
|
.success(function (data) {
|
||||||
ctrl.productVersions = data;
|
ctrl.productVersions = data;
|
||||||
if (ctrl.prodVersionCopy &&
|
if (ctrl.prodVersionCopy &&
|
||||||
ctrl.prodVersionCopy.product_info.id ==
|
ctrl.prodVersionCopy.product_info.id ===
|
||||||
ctrl.selectedProduct.id) {
|
ctrl.selectedProduct.id) {
|
||||||
ctrl.selectedVersion = ctrl.prodVersionCopy;
|
ctrl.selectedVersion = ctrl.prodVersionCopy;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
angular.forEach(data, function(ver) {
|
angular.forEach(data, function(ver) {
|
||||||
if (!ver.version) {
|
if (!ver.version) {
|
||||||
ctrl.selectedVersion = ver;
|
ctrl.selectedVersion = ver;
|
||||||
@ -850,13 +833,13 @@
|
|||||||
var metaFields = ['target', 'guideline', 'shared'];
|
var metaFields = ['target', 'guideline', 'shared'];
|
||||||
var meta = ctrl.metaCopy;
|
var meta = ctrl.metaCopy;
|
||||||
angular.forEach(metaFields, function(field) {
|
angular.forEach(metaFields, function(field) {
|
||||||
var oldMetaValue = (field in ctrl.resultsData.meta) ?
|
var oldMetaValue = field in ctrl.resultsData.meta ?
|
||||||
ctrl.resultsData.meta[field] : '';
|
ctrl.resultsData.meta[field] : '';
|
||||||
if (field in meta && oldMetaValue != meta[field]) {
|
if (field in meta && oldMetaValue !== meta[field]) {
|
||||||
var metaUrl = metaBaseUrl + field;
|
var metaUrl = metaBaseUrl + field;
|
||||||
if (meta[field]) {
|
if (meta[field]) {
|
||||||
ctrl.assocRequest = $http.post(metaUrl, meta[field])
|
ctrl.assocRequest = $http.post(metaUrl, meta[field])
|
||||||
.success(function(data) {
|
.success(function() {
|
||||||
ctrl.resultsData.meta[field] = meta[field];
|
ctrl.resultsData.meta[field] = meta[field];
|
||||||
})
|
})
|
||||||
.error(function (error) {
|
.error(function (error) {
|
||||||
@ -866,10 +849,9 @@
|
|||||||
'Error associating metadata with ' +
|
'Error associating metadata with ' +
|
||||||
'test run: ' + angular.toJson(error);
|
'test run: ' + angular.toJson(error);
|
||||||
});
|
});
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
ctrl.unassocRequest = $http.delete(metaUrl)
|
ctrl.unassocRequest = $http.delete(metaUrl)
|
||||||
.success(function (data) {
|
.success(function () {
|
||||||
delete ctrl.resultsData.meta[field];
|
delete ctrl.resultsData.meta[field];
|
||||||
delete meta[field];
|
delete meta[field];
|
||||||
})
|
})
|
||||||
|
@ -183,18 +183,16 @@
|
|||||||
}).error(function (error) {
|
}).error(function (error) {
|
||||||
raiseAlert('danger', error.title, error.detail);
|
raiseAlert('danger', error.title, error.detail);
|
||||||
});
|
});
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
ctrl.unassociateRequest = $http.delete(metaUrl)
|
ctrl.unassociateRequest = $http.delete(metaUrl)
|
||||||
.success(function () {
|
.success(function () {
|
||||||
ctrl.data.results[index][editFlag] = false;
|
ctrl.data.results[index][editFlag] = false;
|
||||||
}).error(function (error) {
|
}).error(function (error) {
|
||||||
if (error.code == 404) {
|
if (error.code === 404) {
|
||||||
// Key doesn't exist, so count it as a success,
|
// Key doesn't exist, so count it as a success,
|
||||||
// and don't raise an alert.
|
// and don't raise an alert.
|
||||||
ctrl.data.results[index][editFlag] = false;
|
ctrl.data.results[index][editFlag] = false;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
raiseAlert('danger', error.title, error.detail);
|
raiseAlert('danger', error.title, error.detail);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -273,13 +271,13 @@
|
|||||||
* a test result.
|
* a test result.
|
||||||
*/
|
*/
|
||||||
function associateProductVersion(result) {
|
function associateProductVersion(result) {
|
||||||
var verId = (result.selectedVersion ?
|
var verId = result.selectedVersion ?
|
||||||
result.selectedVersion.id : null);
|
result.selectedVersion.id : null;
|
||||||
var testId = result.id;
|
var testId = result.id;
|
||||||
var url = refstackApiUrl + '/results/' + testId;
|
var url = refstackApiUrl + '/results/' + testId;
|
||||||
ctrl.associateRequest = $http.put(url, {'product_version_id':
|
ctrl.associateRequest = $http.put(url, {'product_version_id':
|
||||||
verId})
|
verId})
|
||||||
.success(function (data) {
|
.success(function () {
|
||||||
result.product_version = result.selectedVersion;
|
result.product_version = result.selectedVersion;
|
||||||
if (result.selectedVersion) {
|
if (result.selectedVersion) {
|
||||||
result.product_version.product_info =
|
result.product_version.product_info =
|
||||||
|
@ -70,10 +70,10 @@
|
|||||||
ctrl.vendor = data;
|
ctrl.vendor = data;
|
||||||
var isAdmin = $rootScope.auth.currentUser.is_admin;
|
var isAdmin = $rootScope.auth.currentUser.is_admin;
|
||||||
ctrl.vendor.canDelete = ctrl.vendor.canEdit =
|
ctrl.vendor.canDelete = ctrl.vendor.canEdit =
|
||||||
ctrl.vendor.type != 0
|
ctrl.vendor.type !== 0
|
||||||
&& (ctrl.vendor.can_manage || isAdmin);
|
&& (ctrl.vendor.can_manage || isAdmin);
|
||||||
ctrl.vendor.canRegister =
|
ctrl.vendor.canRegister =
|
||||||
ctrl.vendor.type == 1;
|
ctrl.vendor.type === 1;
|
||||||
ctrl.vendor.canApprove = isAdmin;
|
ctrl.vendor.canApprove = isAdmin;
|
||||||
ctrl.vendorProperties = angular.fromJson(data.properties);
|
ctrl.vendorProperties = angular.fromJson(data.properties);
|
||||||
}).error(function(error) {
|
}).error(function(error) {
|
||||||
@ -299,7 +299,7 @@
|
|||||||
var properties = propertiesToJson();
|
var properties = propertiesToJson();
|
||||||
var content = {'description': ctrl.vendor.description,
|
var content = {'description': ctrl.vendor.description,
|
||||||
'properties': properties};
|
'properties': properties};
|
||||||
if (ctrl.vendorName != ctrl.vendor.name) {
|
if (ctrl.vendorName !== ctrl.vendor.name) {
|
||||||
content.name = ctrl.vendor.name;
|
content.name = ctrl.vendor.name;
|
||||||
}
|
}
|
||||||
$http.put(url, content).success(function() {
|
$http.put(url, content).success(function() {
|
||||||
|
@ -20,9 +20,7 @@
|
|||||||
.controller('VendorsController', VendorsController);
|
.controller('VendorsController', VendorsController);
|
||||||
|
|
||||||
VendorsController.$inject = [
|
VendorsController.$inject = [
|
||||||
'$rootScope', '$scope', '$http', '$state',
|
'$rootScope', '$scope', '$http', '$state', 'refstackApiUrl'];
|
||||||
'refstackApiUrl','raiseAlert'
|
|
||||||
];
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* RefStack Vendors Controller
|
* RefStack Vendors Controller
|
||||||
@ -30,7 +28,7 @@
|
|||||||
* where a user can browse a listing of his/her vendors or public vendors.
|
* where a user can browse a listing of his/her vendors or public vendors.
|
||||||
*/
|
*/
|
||||||
function VendorsController($rootScope, $scope, $http, $state,
|
function VendorsController($rootScope, $scope, $http, $state,
|
||||||
refstackApiUrl, raiseAlert) {
|
refstackApiUrl) {
|
||||||
var ctrl = this;
|
var ctrl = this;
|
||||||
|
|
||||||
ctrl.update = update;
|
ctrl.update = update;
|
||||||
@ -81,7 +79,7 @@
|
|||||||
ctrl.data = null;
|
ctrl.data = null;
|
||||||
// Construct the API URL based on user-specified filters.
|
// Construct the API URL based on user-specified filters.
|
||||||
var contentUrl = refstackApiUrl + '/vendors';
|
var contentUrl = refstackApiUrl + '/vendors';
|
||||||
if (typeof ctrl.rawData == 'undefined'
|
if (typeof ctrl.rawData === 'undefined'
|
||||||
|| ctrl.rawData === null) {
|
|| ctrl.rawData === null) {
|
||||||
ctrl.vendorsRequest =
|
ctrl.vendorsRequest =
|
||||||
$http.get(contentUrl).success(function (data) {
|
$http.get(contentUrl).success(function (data) {
|
||||||
@ -123,7 +121,7 @@
|
|||||||
*/
|
*/
|
||||||
function _filterVendor(vendor) {
|
function _filterVendor(vendor) {
|
||||||
if (!ctrl.isUserVendors) {
|
if (!ctrl.isUserVendors) {
|
||||||
return (vendor.type == 0 || vendor.type == 3);
|
return vendor.type === 0 || vendor.type === 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$rootScope.auth || !$rootScope.auth.currentUser) {
|
if (!$rootScope.auth || !$rootScope.auth.currentUser) {
|
||||||
@ -131,7 +129,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($rootScope.auth.currentUser.is_admin) {
|
if ($rootScope.auth.currentUser.is_admin) {
|
||||||
return vendor.type != 1 || ctrl.withPrivate;
|
return vendor.type !== 1 || ctrl.withPrivate;
|
||||||
}
|
}
|
||||||
|
|
||||||
return vendor.can_manage;
|
return vendor.can_manage;
|
||||||
@ -148,7 +146,7 @@
|
|||||||
name: ctrl.name,
|
name: ctrl.name,
|
||||||
description: ctrl.description
|
description: ctrl.description
|
||||||
};
|
};
|
||||||
$http.post(url, data).success(function (data) {
|
$http.post(url, data).success(function () {
|
||||||
ctrl.showSuccess = true;
|
ctrl.showSuccess = true;
|
||||||
ctrl.name = '';
|
ctrl.name = '';
|
||||||
ctrl.description = '';
|
ctrl.description = '';
|
||||||
|
@ -19,7 +19,6 @@ module.exports = function (config) {
|
|||||||
'app/components/**/*.js',
|
'app/components/**/*.js',
|
||||||
'app/shared/*.js',
|
'app/shared/*.js',
|
||||||
'app/shared/**/*.js',
|
'app/shared/**/*.js',
|
||||||
'app/assets/js/*.js',
|
|
||||||
|
|
||||||
// Test Specs.
|
// Test Specs.
|
||||||
'tests/unit/*.js'
|
'tests/unit/*.js'
|
||||||
|
@ -280,13 +280,12 @@ describe('Refstack controllers', function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('TestListModalController', function () {
|
describe('TestListModalController', function () {
|
||||||
var modalInstance, ctrl, $window;
|
var modalInstance, ctrl;
|
||||||
|
|
||||||
beforeEach(inject(function ($controller, _$window_) {
|
beforeEach(inject(function ($controller) {
|
||||||
modalInstance = {
|
modalInstance = {
|
||||||
dismiss: jasmine.createSpy('modalInstance.dismiss')
|
dismiss: jasmine.createSpy('modalInstance.dismiss')
|
||||||
};
|
};
|
||||||
$window = _$window_;
|
|
||||||
ctrl = $controller('TestListModalController',
|
ctrl = $controller('TestListModalController',
|
||||||
{$uibModalInstance: modalInstance,
|
{$uibModalInstance: modalInstance,
|
||||||
target: 'platform',
|
target: 'platform',
|
||||||
@ -423,10 +422,9 @@ describe('Refstack controllers', function () {
|
|||||||
|
|
||||||
it('should have a function to get products manageable by a user',
|
it('should have a function to get products manageable by a user',
|
||||||
function () {
|
function () {
|
||||||
var prodResp = {'products': [{'id': 'abc',
|
var prodResp = {'products': [
|
||||||
'can_manage': true},
|
{'id': 'abc', 'can_manage': true},
|
||||||
{'id': 'foo',
|
{'id': 'foo', 'can_manage': false}]};
|
||||||
'can_manage': false}]};
|
|
||||||
ctrl.products = null;
|
ctrl.products = null;
|
||||||
$httpBackend.expectGET(fakeApiUrl + '/products')
|
$httpBackend.expectGET(fakeApiUrl + '/products')
|
||||||
.respond(200, prodResp);
|
.respond(200, prodResp);
|
||||||
@ -984,7 +982,6 @@ describe('Refstack controllers', function () {
|
|||||||
'target': 'object'
|
'target': 'object'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
var fakeProdResp = {'products': [{'id': 1234}]};
|
|
||||||
var fakeVersionResp = [{'id': 'ver1', 'version': '1.0'},
|
var fakeVersionResp = [{'id': 'ver1', 'version': '1.0'},
|
||||||
{'id': 'ver2', 'version': null}];
|
{'id': 'ver2', 'version': null}];
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user