Skip to content

Commit

Permalink
cluster list and mapById sync
Browse files Browse the repository at this point in the history
  • Loading branch information
TristanWright committed Jun 22, 2016
1 parent efcdcae commit fce36b4
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/redux/reducers/clusters.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,12 @@ export default function clustersReducer(state = initialState, action) {
const list = [].concat(state.list);
const mapById = Object.assign({}, state.mapById);
mapById[newCluster._id] = newCluster;
console.log(newCluster.config.ssh.publicKey);
if (newCluster.type === 'trad' && list.some((el) => el._id === newCluster._id)) {
for (let i = 0; i < list.length; i++) {
if (list[i]._id === newCluster._id) {
list[i].status = newCluster.status;
list[i] = newCluster;
updateIcon(list);
break;
}
}
Expand Down Expand Up @@ -178,7 +180,8 @@ export default function clustersReducer(state = initialState, action) {
if (cluster.type === 'trad') {
for (let i = 0; i < list.length; i++) {
if (list[i]._id === action.id) {
list[i].status = action.status;
list[i] = cluster;
updateIcon(list);
break;
}
}
Expand Down

0 comments on commit fce36b4

Please sign in to comment.