Skip to content

Commit bab22ee

Browse files
authored
Update script-logs.js
1 parent 1ad1759 commit bab22ee

1 file changed

Lines changed: 22 additions & 9 deletions

File tree

script-logs.js

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ if(data.series[0].fields.length > 1){
44
message = data.series[0].fields[1].values;
55
subsystem = data.series[0].fields[3].values;
66
ts = data.series[0].fields[4].values;
7+
allSubsystems = data.series[1].fields[0].values;
78
}
89

910
else{
@@ -28,10 +29,6 @@ var valuesAll = [code,
2829
selected_severity = ''
2930

3031

31-
allSubsystems = subsystem.filter(function (v, i, self) {
32-
return i == self.indexOf(v);
33-
});
34-
3532
var tableAll = {
3633
type: 'table',
3734
visible: 'true',
@@ -51,9 +48,9 @@ var tableAll = {
5148
},
5249
line: {color: "black", width: 1},
5350
font: {family: "Arial", size: 14, color: ["black"]},
54-
height: 30
51+
height: 30
5552
},
56-
customdata: '',
53+
5754
}
5855

5956
function getColor(arr)
@@ -80,13 +77,23 @@ function getColor(arr)
8077

8178
function getSpecificSubsystem(arr, subsystemV){
8279
vals = arr.map(function (val, index){
83-
if(subsystem[index].includes(subsystemV)){
80+
if(subsystemV == ''){
81+
return val
82+
}
83+
else if(subsystem[index].includes(subsystemV)){
8484
return val
8585
}
8686
});
87-
return vals.filter(function( element ) {
87+
final_vals = vals.filter(function( element ) {
8888
return element !== undefined;
8989
});
90+
91+
if(final_vals.length > 0){
92+
return(final_vals)
93+
}
94+
else{
95+
return(['No Data'])
96+
}
9097
}
9198

9299

@@ -117,10 +124,16 @@ function generateData(subsystemV){
117124
function getButtons(arr){
118125
var buttons = []
119126
for(var i = 0; i < arr.length; i++){
127+
if (arr[i] == ''){
128+
label = 'All'
129+
}
130+
else{
131+
label = arr[i]
132+
}
120133
button = {
121134
method: 'update',
122135
args: [{'cells': generateData(arr[i])[0]}],
123-
label: arr[i]
136+
label: label
124137
}
125138
buttons.push(button)
126139
}

0 commit comments

Comments
 (0)