ui: Change partitions to expect `[]` from the API (#11791)

This commit is contained in:
John Cowen 2021-12-10 14:41:08 +00:00 committed by GitHub
parent 374be91fa6
commit c6c1b9f13a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 29 additions and 28 deletions

3
.changelog/11791.txt Normal file
View File

@ -0,0 +1,3 @@
```release-note:bugfix
ui: Change partitions to expect [] from the listing API
```

View File

@ -11,7 +11,7 @@ export default class PartitionSerializer extends Serializer {
respond((headers, body) => {
return cb(
headers,
body.Partitions.map(item => {
body.map(item => {
item.Partition = '*';
item.Namespace = '*';
return item;

View File

@ -1,30 +1,28 @@
{
"Partitions": [
{
"Name": "default",
"Description": "Builtin Default Partition"
}
[
{
"Name": "default",
"Description": "Builtin Default Partition"
}
${range(
env(
'CONSUL_PARTITION_COUNT',
Math.floor(
(
Math.random() * env('CONSUL_PARTITION_MAX', 10)
) + parseInt(env('CONSUL_PARTITION_MIN', 1))
)
) - 1
env(
'CONSUL_PARTITION_COUNT',
Math.floor(
(
Math.random() * env('CONSUL_PARTITION_MAX', 10)
) + parseInt(env('CONSUL_PARTITION_MIN', 1))
)
) - 1
).map(i => `
${i === 0 ? `
,
,
` : ``}
{
"Name": "${fake.hacker.noun()}-partition-${i}",
${fake.random.boolean() ? `
"Description": "${fake.lorem.sentence()}",
` : ``}
"CreateIndex": 12,
"ModifyIndex": 16
}
`)}
]
}
{
"Name": "${fake.hacker.noun()}-partition-${i}",
${fake.random.boolean() ? `
"Description": "${fake.lorem.sentence()}",
` : ``}
"CreateIndex": 12,
"ModifyIndex": 16
}
`)}
]

View File

@ -13,7 +13,7 @@ module('Integration | Serializer | partition', function(hooks) {
url: `/v1/partitions?dc=${dc}`,
};
return get(request.url).then(function(payload) {
const expected = payload.Partitions.map(item =>
const expected = payload.map(item =>
Object.assign({}, item, {
Datacenter: dc,
Namespace: '*',