Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prep ember data: relationships #24712

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ui/app/models/control-group.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import lazyCapabilities, { apiPath } from 'vault/macros/lazy-capabilities';
export default Model.extend({
approved: attr('boolean'),
requestPath: attr('string'),
requestEntity: belongsTo('identity/entity', { async: false }),
authorizations: hasMany('identity/entity', { async: false }),
requestEntity: belongsTo('identity/entity', { async: false, inverse: null }),
authorizations: hasMany('identity/entity', { async: false, inverse: null }),

authorizePath: lazyCapabilities(apiPath`sys/control-group/authorize`),
canAuthorize: alias('authorizePath.canUpdate'),
Expand Down
2 changes: 1 addition & 1 deletion ui/app/models/identity/entity-alias.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default IdentityModel.extend({
formFields: computed(function () {
return ['name', 'mountAccessor'];
}),
entity: belongsTo('identity/entity', { readOnly: true, async: false }),
entity: belongsTo('identity/entity', { readOnly: true, async: false, inverse: 'aliases' }),

name: attr('string'),
canonicalId: attr('string'),
Expand Down
2 changes: 1 addition & 1 deletion ui/app/models/identity/entity.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export default IdentityModel.extend({
lastUpdateTime: attr('string', {
readOnly: true,
}),
aliases: hasMany('identity/entity-alias', { async: false, readOnly: true }),
aliases: hasMany('identity/entity-alias', { async: false, readOnly: true, inverse: 'entity' }),
groupIds: attr({
readOnly: true,
}),
Expand Down
2 changes: 1 addition & 1 deletion ui/app/models/identity/group.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export default IdentityModel.extend({
),
policyPath: lazyCapabilities(apiPath`sys/policies`),
canCreatePolicies: alias('policyPath.canCreate'),
alias: belongsTo('identity/group-alias', { async: false, readOnly: true }),
alias: belongsTo('identity/group-alias', { async: false, readOnly: true, inverse: 'group' }),
updatePath: identityCapabilities(),
canDelete: alias('updatePath.canDelete'),
canEdit: alias('updatePath.canUpdate'),
Expand Down
2 changes: 1 addition & 1 deletion ui/app/models/kmip/ca.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import Model, { belongsTo, attr } from '@ember-data/model';

export default Model.extend({
config: belongsTo('kmip/config', { async: false }),
config: belongsTo('kmip/config', { async: false, inverse: 'ca' }),
caPem: attr('string', {
label: 'CA PEM',
}),
Expand Down
2 changes: 1 addition & 1 deletion ui/app/models/kmip/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import fieldToAttrs from 'vault/utils/field-to-attrs';

export default Model.extend({
useOpenAPI: true,
ca: belongsTo('kmip/ca', { async: false }),
ca: belongsTo('kmip/ca', { async: false, inverse: 'config' }),
getHelpUrl(path) {
return `/v1/${path}/config?help=1`;
},
Expand Down
6 changes: 3 additions & 3 deletions ui/app/models/mfa-login-enforcement.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ const validations = {
export default class MfaLoginEnforcementModel extends Model {
@service store;
@attr('string') name;
@hasMany('mfa-method') mfa_methods;
@hasMany('mfa-method', { async: true, inverse: null }) mfa_methods;
@attr('string') namespace_id;
@attr('array', { defaultValue: () => [] }) auth_method_accessors; // ["auth_approle_17a552c6"]
@attr('array', { defaultValue: () => [] }) auth_method_types; // ["userpass"]
@hasMany('identity/entity') identity_entities;
@hasMany('identity/group') identity_groups;
@hasMany('identity/entity', { async: true, inverse: null }) identity_entities;
@hasMany('identity/group', { async: true, inverse: null }) identity_groups;

get targets() {
return ArrayProxy.extend(PromiseProxyMixin).create({
Expand Down
Loading