2023-03-01 09:39:41 -06:00
|
|
|
/**
|
|
|
|
|
* Copyright (c) HashiCorp, Inc.
|
|
|
|
|
* SPDX-License-Identifier: MPL-2.0
|
|
|
|
|
*/
|
|
|
|
|
|
2021-11-04 16:05:11 -07:00
|
|
|
import ApplicationSerializer from './application';
|
2021-11-11 17:58:08 -05:00
|
|
|
export default class ManagedGroupSerializer extends ApplicationSerializer {
|
|
|
|
|
// =properties
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @type {boolean}
|
|
|
|
|
*/
|
|
|
|
|
serializeScopeID = false;
|
2022-12-02 13:44:11 -05:00
|
|
|
|
|
|
|
|
serialize() {
|
|
|
|
|
const serialized = super.serialize(...arguments);
|
|
|
|
|
|
|
|
|
|
if (serialized.attributes.filter_string !== undefined) {
|
|
|
|
|
serialized.attributes.filter = serialized.attributes.filter_string;
|
|
|
|
|
}
|
|
|
|
|
delete serialized.attributes.filter_string;
|
|
|
|
|
|
|
|
|
|
return serialized;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
normalize(typeClass, hash, ...rest) {
|
2023-02-16 14:06:37 -08:00
|
|
|
const normalizedHash = structuredClone(hash);
|
2022-12-02 13:44:11 -05:00
|
|
|
|
|
|
|
|
if (normalizedHash?.attributes?.filter) {
|
|
|
|
|
normalizedHash.attributes.filter_string =
|
|
|
|
|
normalizedHash.attributes.filter;
|
|
|
|
|
delete normalizedHash.attributes.filter;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return super.normalize(typeClass, normalizedHash, ...rest);
|
|
|
|
|
}
|
2021-11-11 17:58:08 -05:00
|
|
|
}
|