-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ui: Normalize/serialize Policies/ServiceID's in the Adapter
- Loading branch information
John Cowen
committed
Apr 16, 2019
1 parent
552e960
commit ffd11de
Showing
4 changed files
with
46 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,5 @@ | ||
import Serializer from './application'; | ||
import { PRIMARY_KEY } from 'consul-ui/models/role'; | ||
const createTemplatedPolicies = function(item) { | ||
item.ServiceIdentities.forEach(function(item) { | ||
const policy = { | ||
Name: item.ServiceName, | ||
template: 'service-identity', | ||
Datacenters: item.Datacenters, | ||
}; | ||
// if(typeof item.Datancenters !== 'undefined') { | ||
|
||
// } | ||
if (typeof item.Policies === 'undefined') { | ||
item.Policies = []; | ||
} | ||
item.Policies.push(policy); | ||
}); | ||
return item; | ||
}; | ||
export default Serializer.extend({ | ||
primaryKey: PRIMARY_KEY, | ||
normalizeResponse: function(store, primaryModelClass, payload, id, requestType) { | ||
if (requestType === 'queryRecord') { | ||
payload = createTemplatedPolicies(payload); | ||
} else { | ||
payload = payload.map(createTemplatedPolicies); | ||
} | ||
return this._super(...arguments); | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,12 @@ | ||
node_prefix "{{name}}" { | ||
|
||
} | ||
service "{{name}}" { | ||
|
||
policy = "write" | ||
} | ||
service "{{name}}-sidecar-proxy" { | ||
policy = "write" | ||
} | ||
service_prefix "" { | ||
policy = "read" | ||
} | ||
node_prefix "" { | ||
policy = "read" | ||
} |