Skip to content

Commit

Permalink
Merge pull request #28 from monarc-project/fix/359
Browse files Browse the repository at this point in the history
Fix/359
  • Loading branch information
Ruslan Baidan authored Jun 24, 2021
2 parents 5186a17 + 1ed0361 commit 8589b48
Showing 1 changed file with 1 addition and 21 deletions.
22 changes: 1 addition & 21 deletions src/ClientDashboardCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,28 +46,24 @@
max: 0
},
onClickFunction: function(d) {
let amvs = null;
let order = null;
let rolfRisks = null;
let field = null;

if (d.amvsCurrent || d.amvsTarget) {
if (d.amvsCurrent) {
amvs = "'"+ d.amvsCurrent.join() + "'";
field = 'max_risk';
order = 'maxRisk'
}else {
amvs = "'"+ d.amvsTarget.join() + "'";
field = 'target_risk';
order = 'targetRisk'
}


AnrService.getAnrRisks(anr.id,
{
order: order,
order_direction: 'desc',
limit: -1,
amvs:amvs
}
).then(function(data){
let risks = data.risks.filter(function(risk){
Expand All @@ -79,10 +75,8 @@
});
}else if(d.rolfRisksCurrent || d.rolfRisksTarget){
if (d.rolfRisksCurrent) {
rolfRisks = "'"+ d.rolfRisksCurrent.join() + "'";
field = 'cacheNetRisk';
}else {
rolfRisks = "'"+ d.rolfRisksTarget.join() + "'";
field = 'cacheTargetedRisk';
}

Expand All @@ -91,7 +85,6 @@
order: field,
order_direction: 'desc',
limit: -1,
rolfRisks:rolfRisks
}
).then(function(data){
let opRisks = data.oprisks.filter(function(risk){
Expand Down Expand Up @@ -357,16 +350,12 @@
color: ["#D6F107", "#FFBC1C", "#FD661F"],
threshold: [],
onClickFunction: function(d) {
let amvs = null;
let rolfRisks = null;
let field = null;

if (d.amvsCurrent || d.amvsTarget) {
if (d.amvsCurrent) {
amvs = "'"+ d.amvsCurrent.join() + "'";
field = 'max_risk';
}else {
amvs = "'"+ d.amvsTarget.join() + "'";
field = 'target_risk';
}

Expand All @@ -375,7 +364,6 @@
order:'instance',
order_direction: 'asc',
limit: -1,
amvs:amvs
}
).then(function(data){
let risks = data.risks.filter(function(risk){
Expand All @@ -391,7 +379,6 @@
});
}else if(d.rolfRisksCurrent || d.rolfRisksTarget){
if (d.rolfRisksCurrent) {
rolfRisks = "'"+ d.rolfRisksCurrent.join() + "'";
field = 'cacheNetRisk';
}else {
rolfRisks = "'"+ d.rolfRisksTarget.join() + "'";
Expand All @@ -403,7 +390,6 @@
order:'instance',
order_direction: 'asc',
limit: -1,
rolfRisks:rolfRisks
}
).then(function(data){
let opRisks = data.oprisks.filter(function(risk){
Expand Down Expand Up @@ -438,22 +424,18 @@
showLegend: false,
sort: true,
onClickFunction: async function(d) {
let amvs = null;
let rolfRisks = null;
let risks = [];
let opRisks = [];

if (d.amvs || d.rolfRisks) {
if (d.amvs.length > 0) {
amvs = "'"+ d.amvs.join() + "'";
field = 'max_risk';

risks = await AnrService.getAnrRisks(anr.id,
{
order:'instance',
order_direction: 'asc',
limit: -1,
amvs:amvs
}
).then(function(data){
risksRec = data.risks.filter(function(risk){
Expand All @@ -468,14 +450,12 @@
}

if (d.rolfRisks.length > 0){
rolfRisks = "'"+ d.rolfRisks.join() + "'";
field = 'target_risk';
opRisks = await AnrService.getAnrRisksOp(anr.id,
{
order:'instance',
order_direction: 'asc',
limit: -1,
rolfRisks:rolfRisks
}
).then(function(data){
opRisksRec = data.oprisks.filter(function(risk){
Expand Down

0 comments on commit 8589b48

Please sign in to comment.