Skip to content

Commit

Permalink
fixing minor bugs in criteria and vulnerabilities
Browse files Browse the repository at this point in the history
  • Loading branch information
dianamariand92 committed Feb 23, 2022
1 parent 2284696 commit b97f24a
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 39 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"@vue/cli-plugin-eslint": "^3.4.0",
"@vue/cli-service": "^3.4.0",
"gh-pages": "^3.1.0",
"node-sass": "^4.11.0",
"sass": "^1.49.8",
"sass-loader": "^7.1.0",
"vue-template-compiler": "^2.6.6"
},
Expand Down
1 change: 0 additions & 1 deletion src/pages/Composer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,6 @@
import Card from 'src/components/Cards/Card.vue'
import YAML from 'json-to-pretty-yaml'
import Services from '../services/services'
import services from '../services/services'
export default {
components: {
Card
Expand Down
108 changes: 71 additions & 37 deletions src/pages/SQACriteria.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,23 @@
<div v-show="loading" class="loading-overlay is-active">
<span class="fas fa-spinner fa-3x fa-spin"></span>
</div>
<div v-show="loadingError" class="loading-overlay is-active">
<div class="text-center" style="padding: 20px;background-color: #ccc;border-radius: 5px;">
<div>
<p style="font-size:20px;">We are having problems making the request.</p>
</div>
<div class="text-center">
<i class="fa fa-times-circle fa-10x" style="color:red;width:auto" aria-hidden="true"></i>
</div>
<div style="padding-top:20px;">
<a style="font-size:18px;color:red; text-decoration:underline;" href="https://github.com/EOSC-synergy/SQAaaS/issues/new/choose" target="_blank">Report the issue</a>
</div>
<div style="padding-top:20px;">
<button style="margin-left:10px;" class="btn btn-sm btn-danger btn-fill" @click="cancelExecution()">Cancel</button>
</div>
</div>
</div>
<div class="col-12 col-sm-12 col-xl-6 col-lg-10 mx-auto" style="margin:auto;padding:0px;">
<!-- <card>
</card> -->

<card >
<template slot="header">
Expand Down Expand Up @@ -110,6 +123,7 @@
<option value="default">CHOOSE A REPOSITORY...</option>
<option v-for="(repo,key) in $store.state.config_yaml.config.project_repos" :key="key" :value="repo.repo">{{repo.repo}}</option>
</select>
<p v-show="showErrorRepoCrit" style="color:red; font-size:12px;padding-left:20px; padding-top:10px;">Error: You can only select one repo per criteria.</p>
<span v-show="showErrorRepo" style="color:red; font-size:12px;">You must select a respository</span>
</div>
</div>
Expand Down Expand Up @@ -203,8 +217,9 @@
</div>



<div class="text-right" style="padding-top:4rem;padding-bottom:10px;">
<button type="button" class="btn-outline btn btn-info" @click="addCriteria()" :disabled="array_selected_tools.length == 0"><i class="fa fa-plus"></i>ADD CRITERION</button>
<button type="button" class="btn-outline btn btn-info" @click="addCriteria()" :disabled="array_selected_tools.length == 0 || disabled_add_crit == true"><i class="fa fa-plus"></i>ADD CRITERION</button>
</div>

<div v-show="Object.keys(selected_criteria).length > 0" style="padding-top:40px;margin-bottom:2rem;">
Expand Down Expand Up @@ -372,6 +387,7 @@
data () {
return {
loading:false,
loadingError:false,
pipelineName:'',
criteria:'default',
repository:'default',
Expand All @@ -383,6 +399,8 @@
file:'',
env:''
},
disabled_add_crit:false,
showErrorRepoCrit:false,
showCommands:false,
testenv:[],
show_tool_tox:false,
Expand Down Expand Up @@ -455,6 +473,12 @@
}
},
watch:{
'disable_menu'(val){
if(val == false){
this.repository = 'default';
this.disabled_add_crit = false;
}
},
'criteria'(val){
this.showBuilderTool=false;
if(val != "default"){
Expand All @@ -465,7 +489,7 @@
this.showSelect = true;
for (var i in this.array_criterias){
if (this.array_criterias[i].id == val){
this.array_tools = this.array_criterias[i]['tools']
this.array_tools = [...this.array_criterias[i]['tools']]
}
}
this.showErrorCriteria = false;
Expand All @@ -483,13 +507,13 @@
}else{
this.show_link = false;
this.showSelect = false;
this.array_tools = [];
// this.showErrorCriteria = true;
}
},
'repository'(val){
if(val != "default"){
this.showErrorRepo = false;
console.log(this.selected_criteria[this.criteria])
if(this.selected_criteria[this.criteria] && this.selected_criteria[this.criteria]['repos']){
for (var i in this.selected_criteria[this.criteria]['repos']){
if(this.selected_criteria[this.criteria]['repos'][i]['repo_url'] != ''){
Expand All @@ -516,11 +540,12 @@
}
},
'builder_tool'(val){
console.log(val)
if(val != 'default'){
this.selected_tool = {};
for (var i in this.array_tools){
if(this.array_tools[i].name == val){
this.selected_tool = this.array_tools[i]
// this.selected_tool = Object.assign({},this.array_tools[i]);
this.selected_tool = JSON.parse(JSON.stringify(this.array_tools[i]));
}
}
var _this = this;
Expand All @@ -533,14 +558,16 @@
select_false = select_false + 1;
}
}
if(no_error+select_false == this.selected_tool.args.length){
// if(no_error+select_false == this.selected_tool.args.length){
this.showBuilderTool = true;
}else{
this.showBuilderTool = false;
this.notifyVue("There was an error bulding the arguments of the tool.")
}
// }else{
// this.showBuilderTool = false;
// this.notifyVue("There was an error bulding the arguments of the tool.")
// }
//Painting Arg
console.log(this.selected_tool.args)
this.paintingArg(this.selected_tool.args, 0);
setTimeout(function(){
Expand All @@ -557,9 +584,16 @@
}else{
this.showBuilderTool = false;
}
console.log(this.array_criterias)
console.log(this.array_tools)
console.log(this.array_selected_tools)
console.log(this.selected_tool)
}
},
methods:{
cancelExecution(){
this.$router.push({name: 'SelectOption'});
},
async paintingArg(args, count){
var text = '', body = '';
for(var i in args){
Expand Down Expand Up @@ -635,7 +669,6 @@
var text = '', body = '';
for(var i in args){
console.log(args[i].value)
text = '';
if(args[i].type && args[i].value){
text += `<p style='margin-bottom:0px;'>
Expand All @@ -648,8 +681,6 @@
body += text;
}
console.log(body)
return body;
},
async addTool(){
Expand All @@ -660,16 +691,16 @@
error_args = true;
}
}
console.log(error_args)
if(error_args == true){
this.showErrorArgs = true;
}else{
this.showErrorArgs = false;
this.selected_tool.args = args;
console.log(typeof args)
this.selected_tool['args'] = args;
this.builder_tool = 'default';
this.showBuilderTool = false;
console.log(this.selected_tool)
this.array_selected_tools.push(this.selected_tool);
console.log(this.showBuilderTool);
}
},
get_string_repos(repos){
Expand Down Expand Up @@ -777,21 +808,16 @@
}
},
customize_criteria(key){
console.log(key.replace(/\./g,"\\."))
$('#criteria_'+key.replace(/\./g,"\\.")).toggleClass('open-criteria',500);
},
addWhenProp(item){
console.log(item)
console.log($('#select_branch_'+item.replace(/\./g,"\\.")).val())
console.log( $('#select_comp_'+item.replace(/\./g,"\\.")).val())
var array_object = {}
array_object[item] = {
'comp': $('#select_comp_'+item.replace(/\./g,"\\.")).val(),
'branch': $('#select_branch_'+item.replace(/\./g,"\\.")).val()
};
this.criterias_store_branch.push(array_object)
console.log(this.criterias_store_branch)
console.log($('input[name=operator_'+item.replace(/\./g,"\\.")+']:checked').val())
if(this.criterias_store_branch.length > 1){
this.showOperation[item] = true;
$("#operator_anyOf_"+item.replace(/\./g,"\\.")).prop("checked", true);
Expand Down Expand Up @@ -821,7 +847,6 @@
}
console.log(this.$store.state.config_yaml.sqa_criteria)
this.$router.push({name: 'Files'});
},
back(){
Expand Down Expand Up @@ -852,7 +877,7 @@
}
}else{
this.showErrorRepoCrit = false;
this.showCriteria = true;
this.disable_done = false;
this.showErrorRepo = false;
Expand All @@ -874,20 +899,26 @@
}else{
serv = this.service
}
repo={
repo_url: (this.repository!='default')?this.repository:'',
container: serv,
tools:(this.array_selected_tools.length>0)?this.array_selected_tools:''
}
this.repos["repos"].push(repo)
for(var i in this.array_selected_tools){
repo={
repo_url: (this.repository!='default')?this.repository:'',
container: serv,
// tools:(this.array_selected_tools.length>0)?this.array_selected_tools:''
tool:this.array_selected_tools[i]
}
this.repos["repos"].push(repo)
}
this.selected_criteria[this.criteria]=Object.assign({}, this.selected_criteria[this.criteria], this.repos)
this.$store.state.config_yaml.sqa_criteria[this.criteria] = Object.assign({}, this.$store.state.config_yaml.sqa_criteria[this.criteria], this.repos)
this.showErrorFile = false;
this.service = 'default'
this.builder_tool = 'default';
this.array_selected_tools = [];
this.repository = 'default';
this.disable_menu = false;
this.showBuilderTool = false;
console.log(this.selected_criteria)
console.log(this.$store.state.config_yaml.sqa_criteria)
}
},
removeCriteria(key){
Expand Down Expand Up @@ -974,10 +1005,14 @@
},
getCriteriaCallBack(response){
this.loading = false;
this.array_criterias = [];
if(response.status == 200){
this.array_criterias = response.data
for(var i in response.data){
this.array_criterias.push(response.data[i])
}
}else{
this.notifyVue("We are having problems making the request.")
this.loadingError = true;
this.notifyVue("We are having problems making the request.")
}
}
Expand All @@ -997,7 +1032,6 @@
// this.pipelineName = this.$store.state.name
var sizeRepos = this.objectSize(this.$store.state.config_yaml.config.project_repos);
var sizeServices = this.objectSize(this.$store.state.docker_compose.services)
console.log(this.$store.state.docker_compose.services)
// if(sizeRepos == 0 || sizeServices == 0){
// if(sizeServices == 0){
// this.notifyVue("Error you must add at least one service")
Expand Down

0 comments on commit b97f24a

Please sign in to comment.