提交 970f417d 编写于 作者: P Piotr Dabkowski 提交者: Piotr Bryk

Fixed for .. of IE 11 error. (#1187)

* =fixed for of and graph null filter exception

* Simplified GetMetrics method.
上级 aef7f257
......@@ -30,9 +30,6 @@ type MetricPromises []MetricPromise
// In case of no metrics were downloaded it does not initialise []Metric and returns nil.
func (self MetricPromises) GetMetrics() ([]Metric, error) {
result := make([]Metric, 0)
if len(self) == 0 {
return result, nil
}
for _, metricPromise := range self {
metric, err := metricPromise.GetMetric()
......
......@@ -61,7 +61,8 @@ export class GraphController {
let y1max = 1;
let y2max = 1;
// iterate over metrics and add them to graph display
for (let metric of this.metrics) {
for (let i = 0; i < this.metrics.length; i++) {
let metric = this.metrics[i];
// don't display metric if the number of its data points is smaller than 2
if (metric.dataPoints.length < 2) {
continue;
......
......@@ -29,7 +29,8 @@ export class GraphCardController {
* @return {boolean}
*/
shouldShowGraph() {
return this.metrics.filter((metric) => metric.dataPoints.length > 1).length > 0;
return this.metrics !== null &&
this.metrics.filter((metric) => metric.dataPoints.length > 1).length > 0;
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册