From 2a042e77ccc6706ad4926eef4bf020e057eba3e8 Mon Sep 17 00:00:00 2001 From: JUDIT GRESKOVITS Date: Thu, 9 Feb 2017 16:10:44 +0000 Subject: [PATCH] Ensure joins in redux store are by uuid --- .../components/metric-charts/add-metrics.js | 4 +- frontend/src/mock-state.json | 114 +++++++++--------- frontend/src/state/selectors.js | 4 +- 3 files changed, 61 insertions(+), 61 deletions(-) diff --git a/frontend/src/components/metric-charts/add-metrics.js b/frontend/src/components/metric-charts/add-metrics.js index d7532ead..63bfe387 100644 --- a/frontend/src/components/metric-charts/add-metrics.js +++ b/frontend/src/components/metric-charts/add-metrics.js @@ -22,7 +22,7 @@ const AddMetrics = ({ }) => { const added = (metric) => - Boolean(datasets.filter((dataset) => dataset.type.id === metric).length); + Boolean(datasets.filter((dataset) => dataset.type.uuid === metric).length); const addButton = (metric) => ( @@ -45,7 +45,7 @@ const AddMetrics = ({ - { added(metric.id) ? addedButton : addButton(metric.id) } + { added(metric.uuid) ? addedButton : addButton(metric.uuid) } )); diff --git a/frontend/src/mock-state.json b/frontend/src/mock-state.json index e9464ab9..0678afd7 100644 --- a/frontend/src/mock-state.json +++ b/frontend/src/mock-state.json @@ -634,13 +634,13 @@ "project": "e0ea0c02-55cc-45fe-8064-3e5176a59401", "instances": 1, "metrics": [{ - "type": "cpu-agg-usage", + "type": "2aaa237d-42b3-442f-9094-a17aa470014b", "dataset": "3e6ee79a-7453-4fc6-b9da-7ae1e41138ec" }, { - "type": "zfs-used", + "type": "dca08514-72e5-46ce-ad91-e68b3b0914d7", "dataset": "4e6ee79a-7453-4fc6-b9da-7ae1e41138ed" }, { - "type": "mem-agg-usage", + "type": "dca08514-72e5-46ce-ad92-e68b3b0914d4", "dataset": "3e6ee79a-7453-4fc6-b9da-7ae1e41138ec" }] }, { @@ -650,13 +650,13 @@ "project": "e0ea0c02-55cc-45fe-8064-3e5176a59401", "instances": 1, "metrics": [{ - "type": "cpu-agg-usage", + "type": "2aaa237d-42b3-442f-9094-a17aa470014b", "dataset": "3e6ee79a-7453-4fc6-b9da-7ae1e41138ec" }, { - "type": "zfs-used", + "type": "dca08514-72e5-46ce-ad91-e68b3b0914d7", "dataset": "4e6ee79a-7453-4fc6-b9da-7ae1e41138ed" }, { - "type": "mem-agg-usage", + "type": "dca08514-72e5-46ce-ad92-e68b3b0914d4", "dataset": "3e6ee79a-7453-4fc6-b9da-7ae1e41138ec" }] }, { @@ -666,13 +666,13 @@ "project": "e0ea0c02-55cc-45fe-8064-3e5176a59401", "instances": 1, "metrics": [{ - "type": "cpu-agg-usage", + "type": "2aaa237d-42b3-442f-9094-a17aa470014b", "dataset": "3e6ee79a-7453-4fc6-b9da-7ae1e41138ec" }, { - "type": "zfs-used", + "type": "dca08514-72e5-46ce-ad91-e68b3b0914d7", "dataset": "4e6ee79a-7453-4fc6-b9da-7ae1e41138ed" }, { - "type": "mem-agg-usage", + "type": "dca08514-72e5-46ce-ad92-e68b3b0914d4", "dataset": "3e6ee79a-7453-4fc6-b9da-7ae1e41138ec" }] }, { @@ -682,13 +682,13 @@ "project": "e0ea0c02-55cc-45fe-8064-3e5176a59401", "instances": 5, "metrics": [{ - "type": "cpu-agg-usage", + "type": "2aaa237d-42b3-442f-9094-a17aa470014b", "dataset": "3e6ee79a-7453-4fc6-b9da-7ae1e41138ec" }, { - "type": "zfs-used", + "type": "dca08514-72e5-46ce-ad91-e68b3b0914d7", "dataset": "4e6ee79a-7453-4fc6-b9da-7ae1e41138ed" }, { - "type": "mem-agg-usage", + "type": "dca08514-72e5-46ce-ad92-e68b3b0914d4", "dataset": "3e6ee79a-7453-4fc6-b9da-7ae1e41138ec" }] }, { @@ -698,13 +698,13 @@ "project": "e0ea0c02-55cc-45fe-8064-3e5176a59401", "instances": 5, "metrics": [{ - "type": "cpu-agg-usage", + "type": "2aaa237d-42b3-442f-9094-a17aa470014b", "dataset": "3e6ee79a-7453-4fc6-b9da-7ae1e41138ec" }, { - "type": "zfs-used", + "type": "dca08514-72e5-46ce-ad91-e68b3b0914d7", "dataset": "4e6ee79a-7453-4fc6-b9da-7ae1e41138ed" }, { - "type": "mem-agg-usage", + "type": "dca08514-72e5-46ce-ad92-e68b3b0914d4", "dataset": "3e6ee79a-7453-4fc6-b9da-7ae1e41138ec" }] }, { @@ -715,13 +715,13 @@ "project": "e0ea0c02-55cc-45fe-8064-3e5176a59401", "instances": 1, "metrics": [{ - "type": "cpu-agg-usage", + "type": "2aaa237d-42b3-442f-9094-a17aa470014b", "dataset": "3e6ee79a-7453-4fc6-b9da-7ae1e41138ec" }, { - "type": "zfs-used", + "type": "dca08514-72e5-46ce-ad91-e68b3b0914d7", "dataset": "4e6ee79a-7453-4fc6-b9da-7ae1e41138ed" }, { - "type": "mem-agg-usage", + "type": "dca08514-72e5-46ce-ad92-e68b3b0914d4", "dataset": "3e6ee79a-7453-4fc6-b9da-7ae1e41138ec" }] }, { @@ -732,13 +732,13 @@ "project": "e0ea0c02-55cc-45fe-8064-3e5176a59401", "instances": 4, "metrics": [{ - "type": "cpu-agg-usage", + "type": "2aaa237d-42b3-442f-9094-a17aa470014b", "dataset": "3e6ee79a-7453-4fc6-b9da-7ae1e41138ec" }, { - "type": "zfs-used", + "type": "dca08514-72e5-46ce-ad91-e68b3b0914d7", "dataset": "4e6ee79a-7453-4fc6-b9da-7ae1e41138ed" }, { - "type": "mem-agg-usage", + "type": "dca08514-72e5-46ce-ad92-e68b3b0914d4", "dataset": "3e6ee79a-7453-4fc6-b9da-7ae1e41138ec" }] }, { @@ -748,13 +748,13 @@ "project": "e0ea0c02-55cc-45fe-8064-3e5176a59401", "instances": 1, "metrics": [{ - "type": "cpu-agg-usage", + "type": "2aaa237d-42b3-442f-9094-a17aa470014b", "dataset": "3e6ee79a-7453-4fc6-b9da-7ae1e41138ec" }, { - "type": "zfs-used", + "type": "dca08514-72e5-46ce-ad91-e68b3b0914d7", "dataset": "4e6ee79a-7453-4fc6-b9da-7ae1e41138ed" }, { - "type": "mem-agg-usage", + "type": "dca08514-72e5-46ce-ad92-e68b3b0914d4", "dataset": "3e6ee79a-7453-4fc6-b9da-7ae1e41138ec" }] }] @@ -770,13 +770,13 @@ "service": "be227788-74f1-4e5b-a85f-b5c71cbae8d8", "project": "e0ea0c02-55cc-45fe-8064-3e5176a59401", "metrics": [{ - "type": "cpu-agg-usage", + "type": "2aaa237d-42b3-442f-9094-a17aa470014b", "dataset": "3e6ee79a-7453-4fc6-b9da-7ae1e41138ec" }, { - "type": "zfs-used", + "type": "dca08514-72e5-46ce-ad91-e68b3b0914d7", "dataset": "4e6ee79a-7453-4fc6-b9da-7ae1e41138ed" }, { - "type": "mem-agg-usage", + "type": "dca08514-72e5-46ce-ad92-e68b3b0914d4", "dataset": "3e6ee79a-7453-4fc6-b9da-7ae1e41138ec" }] }, { @@ -786,13 +786,13 @@ "service": "6a0eee76-c019-413b-9d5f-44712b55b993", "project": "e0ea0c02-55cc-45fe-8064-3e5176a59401", "metrics": [{ - "type": "cpu-agg-usage", + "type": "2aaa237d-42b3-442f-9094-a17aa470014b", "dataset": "3e6ee79a-7453-4fc6-b9da-7ae1e41138ec" }, { - "type": "zfs-used", + "type": "dca08514-72e5-46ce-ad91-e68b3b0914d7", "dataset": "4e6ee79a-7453-4fc6-b9da-7ae1e41138ed" }, { - "type": "mem-agg-usage", + "type": "dca08514-72e5-46ce-ad92-e68b3b0914d4", "dataset": "3e6ee79a-7453-4fc6-b9da-7ae1e41138ec" }] }, { @@ -802,13 +802,13 @@ "service": "97c68055-db88-45c9-ad49-f26da4264777", "project": "e0ea0c02-55cc-45fe-8064-3e5176a59401", "metrics": [{ - "type": "cpu-agg-usage", + "type": "2aaa237d-42b3-442f-9094-a17aa470014b", "dataset": "3e6ee79a-7453-4fc6-b9da-7ae1e41138ec" }, { - "type": "zfs-used", + "type": "dca08514-72e5-46ce-ad91-e68b3b0914d7", "dataset": "4e6ee79a-7453-4fc6-b9da-7ae1e41138ed" }, { - "type": "mem-agg-usage", + "type": "dca08514-72e5-46ce-ad92-e68b3b0914d4", "dataset": "3e6ee79a-7453-4fc6-b9da-7ae1e41138ec" }] }, { @@ -818,13 +818,13 @@ "service": "6d31aff4-de1e-4042-a983-fbd23d5c530c", "project": "e0ea0c02-55cc-45fe-8064-3e5176a59401", "metrics": [{ - "type": "cpu-agg-usage", + "type": "2aaa237d-42b3-442f-9094-a17aa470014b", "dataset": "3e6ee79a-7453-4fc6-b9da-7ae1e41138ec" }, { - "type": "zfs-used", + "type": "dca08514-72e5-46ce-ad91-e68b3b0914d7", "dataset": "4e6ee79a-7453-4fc6-b9da-7ae1e41138ed" }, { - "type": "mem-agg-usage", + "type": "dca08514-72e5-46ce-ad92-e68b3b0914d4", "dataset": "3e6ee79a-7453-4fc6-b9da-7ae1e41138ec" }] }, { @@ -834,13 +834,13 @@ "service": "6d31aff4-de1e-4042-a983-fbd23d5c530c", "project": "e0ea0c02-55cc-45fe-8064-3e5176a59401", "metrics": [{ - "type": "cpu-agg-usage", + "type": "2aaa237d-42b3-442f-9094-a17aa470014b", "dataset": "3e6ee79a-7453-4fc6-b9da-7ae1e41138ec" }, { - "type": "zfs-used", + "type": "dca08514-72e5-46ce-ad91-e68b3b0914d7", "dataset": "4e6ee79a-7453-4fc6-b9da-7ae1e41138ed" }, { - "type": "mem-agg-usage", + "type": "dca08514-72e5-46ce-ad92-e68b3b0914d4", "dataset": "3e6ee79a-7453-4fc6-b9da-7ae1e41138ec" }] }, { @@ -850,13 +850,13 @@ "service": "6d31aff4-de1e-4042-a983-fbd23d5c530c", "project": "e0ea0c02-55cc-45fe-8064-3e5176a59401", "metrics": [{ - "type": "cpu-agg-usage", + "type": "2aaa237d-42b3-442f-9094-a17aa470014b", "dataset": "3e6ee79a-7453-4fc6-b9da-7ae1e41138ec" }, { - "type": "zfs-used", + "type": "dca08514-72e5-46ce-ad91-e68b3b0914d7", "dataset": "4e6ee79a-7453-4fc6-b9da-7ae1e41138ed" }, { - "type": "mem-agg-usage", + "type": "dca08514-72e5-46ce-ad92-e68b3b0914d4", "dataset": "3e6ee79a-7453-4fc6-b9da-7ae1e41138ec" }] }, { @@ -866,13 +866,13 @@ "service": "6d31aff4-de1e-4042-a983-fbd23d5c530c", "project": "e0ea0c02-55cc-45fe-8064-3e5176a59401", "metrics": [{ - "type": "cpu-agg-usage", + "type": "2aaa237d-42b3-442f-9094-a17aa470014b", "dataset": "3e6ee79a-7453-4fc6-b9da-7ae1e41138ec" }, { - "type": "zfs-used", + "type": "dca08514-72e5-46ce-ad91-e68b3b0914d7", "dataset": "4e6ee79a-7453-4fc6-b9da-7ae1e41138ed" }, { - "type": "mem-agg-usage", + "type": "dca08514-72e5-46ce-ad92-e68b3b0914d4", "dataset": "3e6ee79a-7453-4fc6-b9da-7ae1e41138ec" }] }, { @@ -882,13 +882,13 @@ "service": "6d31aff4-de1e-4042-a983-fbd23d5c530c", "project": "e0ea0c02-55cc-45fe-8064-3e5176a59401", "metrics": [{ - "type": "cpu-agg-usage", + "type": "2aaa237d-42b3-442f-9094-a17aa470014b", "dataset": "3e6ee79a-7453-4fc6-b9da-7ae1e41138ec" }, { - "type": "zfs-used", + "type": "dca08514-72e5-46ce-ad91-e68b3b0914d7", "dataset": "4e6ee79a-7453-4fc6-b9da-7ae1e41138ed" }, { - "type": "mem-agg-usage", + "type": "dca08514-72e5-46ce-ad92-e68b3b0914d4", "dataset": "3e6ee79a-7453-4fc6-b9da-7ae1e41138ec" }] }, { @@ -898,13 +898,13 @@ "service": "081a792c-47e0-4439-924b-2efa9788ae9e", "project": "e0ea0c02-55cc-45fe-8064-3e5176a59401", "metrics": [{ - "type": "cpu-agg-usage", + "type": "2aaa237d-42b3-442f-9094-a17aa470014b", "dataset": "3e6ee79a-7453-4fc6-b9da-7ae1e41138ec" }, { - "type": "zfs-used", + "type": "dca08514-72e5-46ce-ad91-e68b3b0914d7", "dataset": "4e6ee79a-7453-4fc6-b9da-7ae1e41138ed" }, { - "type": "mem-agg-usage", + "type": "dca08514-72e5-46ce-ad92-e68b3b0914d4", "dataset": "3e6ee79a-7453-4fc6-b9da-7ae1e41138ec" }] }, { @@ -914,13 +914,13 @@ "service": "4ee4103e-1a52-4099-a48e-01588f597c70", "project": "e0ea0c02-55cc-45fe-8064-3e5176a59401", "metrics": [{ - "type": "cpu-agg-usage", + "type": "2aaa237d-42b3-442f-9094-a17aa470014b", "dataset": "3e6ee79a-7453-4fc6-b9da-7ae1e41138ec" }, { - "type": "zfs-used", + "type": "dca08514-72e5-46ce-ad91-e68b3b0914d7", "dataset": "4e6ee79a-7453-4fc6-b9da-7ae1e41138ed" }, { - "type": "mem-agg-usage", + "type": "dca08514-72e5-46ce-ad92-e68b3b0914d4", "dataset": "3e6ee79a-7453-4fc6-b9da-7ae1e41138ec" }] }, { @@ -930,13 +930,13 @@ "service": "4ee4103e-1a52-4099-a48e-01588f597c70", "project": "e0ea0c02-55cc-45fe-8064-3e5176a59401", "metrics": [{ - "type": "cpu-agg-usage", + "type": "2aaa237d-42b3-442f-9094-a17aa470014b", "dataset": "3e6ee79a-7453-4fc6-b9da-7ae1e41138ec" }, { - "type": "zfs-used", + "type": "dca08514-72e5-46ce-ad91-e68b3b0914d7", "dataset": "4e6ee79a-7453-4fc6-b9da-7ae1e41138ed" }, { - "type": "mem-agg-usage", + "type": "dca08514-72e5-46ce-ad92-e68b3b0914d4", "dataset": "3e6ee79a-7453-4fc6-b9da-7ae1e41138ec" }] }] diff --git a/frontend/src/state/selectors.js b/frontend/src/state/selectors.js index eb33976a..27ab3dca 100644 --- a/frontend/src/state/selectors.js +++ b/frontend/src/state/selectors.js @@ -68,7 +68,7 @@ const isCollapsed = (collapsed, uuid) => collapsed.indexOf(uuid) >= 0; const datasets = (metricsData, serviceOrInstanceMetrics, metricsUI) => serviceOrInstanceMetrics.map((soim) => ({ ...find(metricsData.datasets, ['uuid', soim.dataset]), - type: find(metricsData.types, ['id', soim.type]), + type: find(metricsData.types, ['uuid', soim.type]), ...metricsUI[soim.dataset] })); @@ -189,4 +189,4 @@ module.exports = { peopleByProjectIdSelector: peopleByProjectId, projectUISelector: projectsUI, projectIndexByIdSelect: projectIndexById, -}; \ No newline at end of file +};