Merge branch 'main' into host-set-filter-ui

This commit is contained in:
Dharini Jeeva authored and GitHub committed 2022-02-14 14:02:21 -08:00
commit 50aa6f5c17
5 files changed
+14 -32

No files matched your search

@@ -39,11 +39,6 @@ export default class GeneratedHostCatalogModel extends BaseModel {
})
disabled;
@attr({
description: 'Attributes specific to the catalog type',
})
attributes;
@attr('number', {
description: 'Current version number of this resource.',
})
+9 -14
View File
@@ -234,11 +234,13 @@ export default class ApplicationSerializer extends RESTSerializer {
*/
normalizeNestedAttributes(typeClass, hash) {
typeClass.attributes.forEach((attribute) => {
const { isNestedAttribute } = attribute.options;
const attributeValue = hash.attributes?.[attribute.name];
if (isNestedAttribute && typeof attributeValue != 'undefined') {
hash[attribute.name] = attributeValue;
}
const {
name,
options: { isNestedAttribute },
} = attribute;
const value = hash.attributes?.[name];
const isUndefined = value === undefined;
if (isNestedAttribute && !isUndefined) hash[name] = value;
});
return hash;
}
@@ -261,15 +263,8 @@ export default class ApplicationSerializer extends RESTSerializer {
name,
options: { isNestedSecret },
} = attribute;
const attributeValue = hash.secrets?.[name];
// FIXME: This could be improved
if (isNestedSecret) {
hash[name] = null;
if (typeof attributeValue != 'undefined') {
hash[name] = attributeValue;
}
}
const value = hash.secrets?.[name];
if (isNestedSecret) hash[name] = value || null;
});
return hash;
}
@@ -1,5 +1,4 @@
import ApplicationSerializer from './application';
import { copy } from 'ember-copy';
const fieldsByType = {
aws: [
@@ -57,11 +56,4 @@ export default class HostCatalogSerializer extends ApplicationSerializer {
delete serialized.secrets;
return serialized;
}
normalize(typeClass, hash, ...rest) {
let normalizedHash = copy(hash, true);
const normalized = super.normalize(typeClass, normalizedHash, ...rest);
delete normalized.data.attributes.attributes;
return normalized;
}
}
@@ -56,16 +56,16 @@
<form.input
@name='address'
@type='text'
@value={{@model.attributes.address}}
@value={{@model.address}}
@label={{t 'form.address.label'}}
@error={{@model.errors.name}}
@error={{@model.errors.address}}
@helperText={{t 'form.address.help'}}
readonly={{false}}
as |field|
>
{{#if @model.errors.name}}
{{#if @model.errors.address}}
<field.errors as |errors|>
{{#each @model.errors.name as |error|}}
{{#each @model.errors.address as |error|}}
<errors.message>{{error.message}}</errors.message>
{{/each}}
</field.errors>
@@ -57,7 +57,7 @@
</Copyable>
</row.cell>
<row.cell>
<code>{{host.attributes.address}}</code>
<code>{{host.address}}</code>
</row.cell>
</body.row>
{{/each}}