From addbf89c63cb2294060f0fb5e5bee28b0cb270d3 Mon Sep 17 00:00:00 2001 From: John Cowen Date: Tue, 3 Jul 2018 14:48:04 +0100 Subject: [PATCH] Ensure we catch empty ID's for single nodes also I don't think this would have a large effect on the UI whichever but best to make sure --- ui-v2/app/adapters/node.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/ui-v2/app/adapters/node.js b/ui-v2/app/adapters/node.js index 22460875a..902687ff4 100644 --- a/ui-v2/app/adapters/node.js +++ b/ui-v2/app/adapters/node.js @@ -1,6 +1,14 @@ import Adapter from './application'; import { PRIMARY_KEY, SLUG_KEY } from 'consul-ui/models/node'; import { OK as HTTP_OK } from 'consul-ui/utils/http/status'; +// TODO: Looks like ID just isn't used at all +// consider just using .Node for the SLUG_KEY +const fillSlug = function(item) { + if (item[SLUG_KEY] === '') { + item[SLUG_KEY] = item['Node']; + } + return item; +}; export default Adapter.extend({ urlForQuery: function(query, modelName) { return this.appendURL('internal/ui/nodes', [], this.cleanQuery(query)); @@ -14,6 +22,7 @@ export default Adapter.extend({ const url = this.parseURL(requestData.url); switch (true) { case this.isQueryRecord(url): + response = fillSlug(response); response = { ...response, ...{ @@ -23,9 +32,7 @@ export default Adapter.extend({ break; default: response = response.map((item, i, arr) => { - if (item[SLUG_KEY] === '') { - item[SLUG_KEY] = item['Node']; - } + item = fillSlug(item); return { ...item, ...{