mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-10-29 17:52:32 +00:00
UI: Fix Expected a stable identifier error when leaving & reentering a route (#22483)
This commit is contained in:
@@ -8,10 +8,9 @@ import { computed } from '@ember/object';
|
||||
import { alias } from '@ember/object/computed';
|
||||
import IdentityModel from './_base';
|
||||
import apiPath from 'vault/utils/api-path';
|
||||
import attachCapabilities from 'vault/lib/attach-capabilities';
|
||||
import lazyCapabilities from 'vault/macros/lazy-capabilities';
|
||||
|
||||
const Model = IdentityModel.extend({
|
||||
export default IdentityModel.extend({
|
||||
formFields: computed(function () {
|
||||
return ['name', 'disabled', 'policies', 'metadata'];
|
||||
}),
|
||||
@@ -45,15 +44,12 @@ const Model = IdentityModel.extend({
|
||||
inheritedGroupIds: attr({
|
||||
readOnly: true,
|
||||
}),
|
||||
updatePath: lazyCapabilities(apiPath`identity/entity/id/${'id'}`, 'id'),
|
||||
canDelete: alias('updatePath.canDelete'),
|
||||
canEdit: alias('updatePath.canUpdate'),
|
||||
canRead: alias('updatePath.canRead'),
|
||||
aliasPath: lazyCapabilities(apiPath`identity/entity-alias`),
|
||||
canAddAlias: alias('aliasPath.canCreate'),
|
||||
policyPath: lazyCapabilities(apiPath`sys/policies`),
|
||||
canCreatePolicies: alias('policyPath.canCreate'),
|
||||
});
|
||||
|
||||
export default attachCapabilities(Model, {
|
||||
updatePath: apiPath`identity/entity/id/${'id'}`,
|
||||
aliasPath: apiPath`identity/entity-alias`,
|
||||
});
|
||||
|
||||
@@ -7,9 +7,9 @@ import Model, { attr } from '@ember-data/model';
|
||||
import fieldToAttrs from 'vault/utils/field-to-attrs';
|
||||
import { computed } from '@ember/object';
|
||||
import apiPath from 'vault/utils/api-path';
|
||||
import attachCapabilities from 'vault/lib/attach-capabilities';
|
||||
import lazyCapabilities from 'vault/macros/lazy-capabilities';
|
||||
|
||||
const ModelExport = Model.extend({
|
||||
export default Model.extend({
|
||||
backend: attr({ readOnly: true }),
|
||||
scope: attr({ readOnly: true }),
|
||||
role: attr({ readOnly: true }),
|
||||
@@ -33,8 +33,10 @@ const ModelExport = Model.extend({
|
||||
|
||||
return fieldToAttrs(this, groups);
|
||||
}),
|
||||
});
|
||||
|
||||
export default attachCapabilities(ModelExport, {
|
||||
deletePath: apiPath`${'backend'}/scope/${'scope'}/role/${'role'}/credentials/revoke`,
|
||||
deletePath: lazyCapabilities(
|
||||
apiPath`${'backend'}/scope/${'scope'}/role/${'role'}/credentials/revoke`,
|
||||
'backend',
|
||||
'scope',
|
||||
'role'
|
||||
),
|
||||
});
|
||||
|
||||
@@ -7,7 +7,7 @@ import Model, { attr } from '@ember-data/model';
|
||||
import { computed } from '@ember/object';
|
||||
import fieldToAttrs, { expandAttributeMeta } from 'vault/utils/field-to-attrs';
|
||||
import apiPath from 'vault/utils/api-path';
|
||||
import attachCapabilities from 'vault/lib/attach-capabilities';
|
||||
import lazyCapabilities from 'vault/macros/lazy-capabilities';
|
||||
|
||||
export const COMPUTEDS = {
|
||||
operationFields: computed('newFields', function () {
|
||||
@@ -34,7 +34,7 @@ export const COMPUTEDS = {
|
||||
}),
|
||||
};
|
||||
|
||||
const ModelExport = Model.extend(COMPUTEDS, {
|
||||
export default Model.extend(COMPUTEDS, {
|
||||
useOpenAPI: true,
|
||||
backend: attr({ readOnly: true }),
|
||||
scope: attr({ readOnly: true }),
|
||||
@@ -85,8 +85,6 @@ const ModelExport = Model.extend(COMPUTEDS, {
|
||||
fields: computed('defaultFields', function () {
|
||||
return expandAttributeMeta(this, this.defaultFields);
|
||||
}),
|
||||
});
|
||||
|
||||
export default attachCapabilities(ModelExport, {
|
||||
updatePath: apiPath`${'backend'}/scope/${'scope'}/role/${'id'}`,
|
||||
updatePath: lazyCapabilities(apiPath`${'backend'}/scope/${'scope'}/role/${'id'}`, 'backend', 'scope', 'id'),
|
||||
});
|
||||
|
||||
@@ -6,18 +6,15 @@
|
||||
import Model, { attr } from '@ember-data/model';
|
||||
import { computed } from '@ember/object';
|
||||
import apiPath from 'vault/utils/api-path';
|
||||
import attachCapabilities from 'vault/lib/attach-capabilities';
|
||||
|
||||
import { expandAttributeMeta } from 'vault/utils/field-to-attrs';
|
||||
import lazyCapabilities from 'vault/macros/lazy-capabilities';
|
||||
|
||||
const ModelExport = Model.extend({
|
||||
export default Model.extend({
|
||||
name: attr('string'),
|
||||
backend: attr({ readOnly: true }),
|
||||
attrs: computed(function () {
|
||||
return expandAttributeMeta(this, ['name']);
|
||||
}),
|
||||
});
|
||||
|
||||
export default attachCapabilities(ModelExport, {
|
||||
updatePath: apiPath`${'backend'}/scope/${'id'}`,
|
||||
updatePath: lazyCapabilities(apiPath`${'backend'}/scope/${'id'}`, 'id'),
|
||||
});
|
||||
|
||||
@@ -5,9 +5,8 @@
|
||||
|
||||
import Model, { attr } from '@ember-data/model';
|
||||
import { computed } from '@ember/object';
|
||||
import { apiPath } from 'vault/macros/lazy-capabilities';
|
||||
import lazyCapabilities, { apiPath } from 'vault/macros/lazy-capabilities';
|
||||
import { expandAttributeMeta } from 'vault/utils/field-to-attrs';
|
||||
import attachCapabilities from 'vault/lib/attach-capabilities';
|
||||
|
||||
// these arrays define the order in which the fields will be displayed
|
||||
// see
|
||||
@@ -38,7 +37,7 @@ const TWEAK_SOURCE = [
|
||||
},
|
||||
];
|
||||
|
||||
const ModelExport = Model.extend({
|
||||
export default Model.extend({
|
||||
name: attr('string', {
|
||||
// CBS TODO: make this required for making a transformation
|
||||
label: 'Name',
|
||||
@@ -97,8 +96,5 @@ const ModelExport = Model.extend({
|
||||
backend: attr('string', {
|
||||
readOnly: true,
|
||||
}),
|
||||
});
|
||||
|
||||
export default attachCapabilities(ModelExport, {
|
||||
updatePath: apiPath`${'backend'}/transformation/${'id'}`,
|
||||
updatePath: lazyCapabilities(apiPath`${'backend'}/transformation/${'id'}`, 'id'),
|
||||
});
|
||||
|
||||
@@ -5,11 +5,10 @@
|
||||
|
||||
import Model, { attr } from '@ember-data/model';
|
||||
import { computed } from '@ember/object';
|
||||
import { apiPath } from 'vault/macros/lazy-capabilities';
|
||||
import attachCapabilities from 'vault/lib/attach-capabilities';
|
||||
import lazyCapabilities, { apiPath } from 'vault/macros/lazy-capabilities';
|
||||
import { expandAttributeMeta } from 'vault/utils/field-to-attrs';
|
||||
|
||||
const M = Model.extend({
|
||||
export default Model.extend({
|
||||
idPrefix: 'alphabet/',
|
||||
idForNav: computed('id', 'idPrefix', function () {
|
||||
const modelId = this.id || '';
|
||||
@@ -32,8 +31,5 @@ const M = Model.extend({
|
||||
}),
|
||||
|
||||
backend: attr('string', { readOnly: true }),
|
||||
});
|
||||
|
||||
export default attachCapabilities(M, {
|
||||
updatePath: apiPath`${'backend'}/alphabet/${'id'}`,
|
||||
updatePath: lazyCapabilities(apiPath`${'backend'}/alphabet/${'id'}`, 'backend', 'id'),
|
||||
});
|
||||
|
||||
@@ -5,11 +5,10 @@
|
||||
|
||||
import Model, { attr } from '@ember-data/model';
|
||||
import { computed } from '@ember/object';
|
||||
import { apiPath } from 'vault/macros/lazy-capabilities';
|
||||
import lazyCapabilities, { apiPath } from 'vault/macros/lazy-capabilities';
|
||||
import { expandAttributeMeta } from 'vault/utils/field-to-attrs';
|
||||
import attachCapabilities from 'vault/lib/attach-capabilities';
|
||||
|
||||
const ModelExport = Model.extend({
|
||||
export default Model.extend({
|
||||
// used for getting appropriate options for backend
|
||||
idPrefix: 'role/',
|
||||
// the id prefixed with `role/` so we can use it as the *secret param for the secret show route
|
||||
@@ -40,8 +39,5 @@ const ModelExport = Model.extend({
|
||||
}),
|
||||
|
||||
backend: attr('string', { readOnly: true }),
|
||||
});
|
||||
|
||||
export default attachCapabilities(ModelExport, {
|
||||
updatePath: apiPath`${'backend'}/role/${'id'}`,
|
||||
updatePath: lazyCapabilities(apiPath`${'backend'}/role/${'id'}`, 'backend', 'id'),
|
||||
});
|
||||
|
||||
@@ -5,11 +5,10 @@
|
||||
|
||||
import Model, { attr } from '@ember-data/model';
|
||||
import { computed } from '@ember/object';
|
||||
import { apiPath } from 'vault/macros/lazy-capabilities';
|
||||
import attachCapabilities from 'vault/lib/attach-capabilities';
|
||||
import lazyCapabilities, { apiPath } from 'vault/macros/lazy-capabilities';
|
||||
import { expandAttributeMeta } from 'vault/utils/field-to-attrs';
|
||||
|
||||
const M = Model.extend({
|
||||
export default Model.extend({
|
||||
idPrefix: 'template/',
|
||||
idForNav: computed('id', 'idPrefix', function () {
|
||||
const modelId = this.id || '';
|
||||
@@ -47,8 +46,5 @@ const M = Model.extend({
|
||||
writeAttrs: computed(function () {
|
||||
return expandAttributeMeta(this, ['name', 'pattern', 'alphabet']);
|
||||
}),
|
||||
});
|
||||
|
||||
export default attachCapabilities(M, {
|
||||
updatePath: apiPath`${'backend'}/template/${'id'}`,
|
||||
updatePath: lazyCapabilities(apiPath`${'backend'}/template/${'id'}`, 'backend', 'id'),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user