mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-01 19:17:58 +00:00
kv v2 display bugs (#7307)
* fix switch css * allow breadcrumbs container to grow if it's overflowed so that it's still usable * close the dropdowns on destructive actions that cause a route refresh * use new attachCapabilities for context menus on auth methods to get rid of an error
This commit is contained in:
@@ -2,19 +2,15 @@ import { alias } from '@ember/object/computed';
|
||||
import { computed } from '@ember/object';
|
||||
import DS from 'ember-data';
|
||||
import { fragment } from 'ember-data-model-fragments/attributes';
|
||||
import { queryRecord } from 'ember-computed-query';
|
||||
import fieldToAttrs, { expandAttributeMeta } from 'vault/utils/field-to-attrs';
|
||||
import { memberAction } from 'ember-api-actions';
|
||||
import lazyCapabilities, { apiPath } from 'vault/macros/lazy-capabilities';
|
||||
|
||||
import apiPath from 'vault/utils/api-path';
|
||||
import attachCapabilities from 'vault/lib/attach-capabilities';
|
||||
|
||||
const { attr, hasMany } = DS;
|
||||
|
||||
const configPath = function configPath(strings, key) {
|
||||
return function(...values) {
|
||||
return `${strings[0]}${values[key]}${strings[1]}`;
|
||||
};
|
||||
};
|
||||
export default DS.Model.extend({
|
||||
let Model = DS.Model.extend({
|
||||
authConfigs: hasMany('auth-config', { polymorphic: true, inverse: 'backend', async: false }),
|
||||
path: attr('string'),
|
||||
accessor: attr('string'),
|
||||
@@ -95,29 +91,17 @@ export default DS.Model.extend({
|
||||
fieldGroups: computed('formFieldGroups', function() {
|
||||
return fieldToAttrs(this, this.get('formFieldGroups'));
|
||||
}),
|
||||
|
||||
configPathTmpl: computed('type', function() {
|
||||
const type = this.get('type');
|
||||
if (type === 'aws') {
|
||||
return configPath`auth/${0}/config/client`;
|
||||
} else {
|
||||
return configPath`auth/${0}/config`;
|
||||
}
|
||||
}),
|
||||
|
||||
configPath: queryRecord(
|
||||
'capabilities',
|
||||
context => {
|
||||
const { id, configPathTmpl } = context.getProperties('id', 'configPathTmpl');
|
||||
return {
|
||||
id: configPathTmpl(id),
|
||||
};
|
||||
},
|
||||
'id',
|
||||
'configPathTmpl'
|
||||
),
|
||||
|
||||
deletePath: lazyCapabilities(apiPath`sys/auth/${'id'}`, 'id'),
|
||||
canDisable: alias('deletePath.canDelete'),
|
||||
canEdit: alias('configPath.canUpdate'),
|
||||
});
|
||||
|
||||
export default attachCapabilities(Model, {
|
||||
deltePath: apiPath`sys/auth/${'id'}`,
|
||||
configPath: function(context) {
|
||||
if (context.type === 'aws') {
|
||||
return apiPath`auth/${'id'}/config/client`;
|
||||
} else {
|
||||
return apiPath`auth/${'id'}/config`;
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user