consul/ui-v2/tests/helpers/normalizers.js
John Cowen baecab54cb ui: Support for Node Identities (#8137)
* Add all the new data required for NodeIdentities

* Add potential NodeIdentity to the token list component

* Amend the policy-form/selector to allow node identity creation

* Fix up CSS for radio buttons and select label

* Add node-identity policy template component

* Fix up and add acceptance tests for NodeIndentities

* Make sure policy previews take node identities into account

* Only show certain policy markup if those we have those policies

* Potentially temporarily hide dt's that don't have icons yet
2020-06-23 09:00:56 +00:00

31 lines
721 B
JavaScript

export const createPolicies = function(item) {
return item.Policies.map(function(item) {
return {
template: '',
...item,
};
})
.concat(
item.ServiceIdentities.map(function(item) {
const policy = {
template: 'service-identity',
Name: item.ServiceName,
};
if (typeof item.Datacenters !== 'undefined') {
policy.Datacenters = item.Datacenters;
}
return policy;
})
)
.concat(
item.NodeIdentities.map(function(item) {
const policy = {
template: 'node-identity',
Name: item.NodeName,
Datacenter: item.Datacenter,
};
return policy;
})
);
};