Merge pull request #3665 from codyrancher/cis-multi

Ensure skipping works for multiple cis versions
This commit is contained in:
Westly Wright 2019-12-23 10:26:20 -07:00 committed by GitHub
commit 490da98bb0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 5 deletions

View File

@ -49,7 +49,7 @@ export default Controller.extend({
runningClusterScans: computed.filterBy('clusterScans', 'isRunning', true),
isRKE: computed.alias('scope.currentCluster.isRKE'),
isRKE: computed.alias('scope.currentCluster.isRKE'),
actions: {
runScan() {
get(this, 'scope.currentCluster').doAction('runSecurityScan', {
@ -59,7 +59,7 @@ export default Controller.extend({
}
},
disableRunScanButton: computed('runningClusterScans', 'scope.currentCluster.systemProject', function() {
return get(this, 'runningClusterScans') || !get(this, 'scope.currentCluster.systemProject');
return get(this, 'runningClusterScans.length') > 0 || !get(this, 'scope.currentCluster.systemProject');
}),
bulkActionHandler: computed(function() {

View File

@ -62,7 +62,7 @@ export default Controller.extend({
},
disableRunScanButton: computed('runningClusterScans', 'scope.currentCluster.systemProject', function() {
return get(this, 'runningClusterScans') || !get(this, 'scope.currentCluster.systemProject');
return get(this, 'runningClusterScans.length') > 0 || !get(this, 'scope.currentCluster.systemProject');
}),
tests: computed('model.scan.report', 'securityScanConfig.skipList', function() {

View File

@ -77,7 +77,7 @@ export default Service.extend({
return;
}
if (!Array.isArray(parsed.skip[version])) {
if (parsed.skip[version] && !Array.isArray(parsed.skip[version])) {
throw new Error("Security Scan Config didin't contain the 'skip' array.");
}
} catch (error) {
@ -145,7 +145,14 @@ export default Service.extend({
editSkipList(newValue) {
const version = get(this, 'report.version');
const newSkipListObject = { skip: { [version]: newValue } };
const existingSkip = get(this, 'parsedSecurityScanConfig.skip') || {};
const newSkipListObject = {
skip: {
...existingSkip,
[version]: newValue
}
};
const newConfig = { [get(this, 'FILE_KEY')]: JSON.stringify(newSkipListObject) };
this.editSecurityScanConfig(newConfig);