mirror of
https://github.com/status-im/consul.git
synced 2025-01-10 22:06:20 +00:00
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
This commit is contained in:
parent
a47a0b617f
commit
6398fb02c7
@ -1,6 +1,14 @@
|
|||||||
import Adapter from './application';
|
import Adapter from './application';
|
||||||
import { PRIMARY_KEY, SLUG_KEY } from 'consul-ui/models/node';
|
import { PRIMARY_KEY, SLUG_KEY } from 'consul-ui/models/node';
|
||||||
import { OK as HTTP_OK } from 'consul-ui/utils/http/status';
|
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({
|
export default Adapter.extend({
|
||||||
urlForQuery: function(query, modelName) {
|
urlForQuery: function(query, modelName) {
|
||||||
return this.appendURL('internal/ui/nodes', [], this.cleanQuery(query));
|
return this.appendURL('internal/ui/nodes', [], this.cleanQuery(query));
|
||||||
@ -14,6 +22,7 @@ export default Adapter.extend({
|
|||||||
const url = this.parseURL(requestData.url);
|
const url = this.parseURL(requestData.url);
|
||||||
switch (true) {
|
switch (true) {
|
||||||
case this.isQueryRecord(url):
|
case this.isQueryRecord(url):
|
||||||
|
response = fillSlug(response);
|
||||||
response = {
|
response = {
|
||||||
...response,
|
...response,
|
||||||
...{
|
...{
|
||||||
@ -23,9 +32,7 @@ export default Adapter.extend({
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
response = response.map((item, i, arr) => {
|
response = response.map((item, i, arr) => {
|
||||||
if (item[SLUG_KEY] === '') {
|
item = fillSlug(item);
|
||||||
item[SLUG_KEY] = item['Node'];
|
|
||||||
}
|
|
||||||
return {
|
return {
|
||||||
...item,
|
...item,
|
||||||
...{
|
...{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user