mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
catch undefined and return default empty in normalizeMetrics
Signed-off-by: Sebastian Malton <smalton@mirantis.com>
This commit is contained in:
1 parent
8f0c785f58
commit
2b90d130c2
5 files changed
+31
-16
No files matched your search
@@ -56,7 +56,21 @@ export const metricsApi = {
|
||||
};
|
||||
|
||||
export function normalizeMetrics(metrics: IMetrics, frames = 60): IMetrics {
|
||||
if (!metrics?.data?.result) {
|
||||
return {
|
||||
data: {
|
||||
resultType: "",
|
||||
result: [{
|
||||
metric: {},
|
||||
values: []
|
||||
} as IMetricsResult],
|
||||
},
|
||||
status: "",
|
||||
}
|
||||
}
|
||||
|
||||
const { result } = metrics.data;
|
||||
|
||||
if (result.length) {
|
||||
if (frames > 0) {
|
||||
// fill the gaps
|
||||
|
||||
Reference in new issue
Block a user