1
0
mirror of https://github.com/yldio/copilot.git synced 2024-11-28 14:10:04 +02:00

Ensure joins in redux store are by uuid

This commit is contained in:
JUDIT GRESKOVITS 2017-02-09 16:10:44 +00:00
parent 8f9b892fc7
commit 2a042e77cc
3 changed files with 61 additions and 61 deletions

View File

@ -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) => (
<AddMetricButton metric={metric} onClick={onAddMetric}>
<FormattedMessage id={'metrics.add.add-label'} onClick={onAddMetric} />
@ -45,7 +45,7 @@ const AddMetrics = ({
<AddMetricLink href='http://somelink.com'>
<FormattedMessage id={'metrics.add.link-label'} />
</AddMetricLink>
{ added(metric.id) ? addedButton : addButton(metric.id) }
{ added(metric.uuid) ? addedButton : addButton(metric.uuid) }
</AddMetricTile>
));

View File

@ -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"
}]
}]

View File

@ -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,
};
};