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

kv v2 display bugs #7307

Merged
merged 4 commits into from
Aug 13, 2019
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
1 change: 1 addition & 0 deletions ui/app/components/secret-link.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export function linkParams({ mode, secret, queryParams }) {
}

export default Component.extend({
onLinkClick() {},
tagName: '',
// so that ember-test-selectors doesn't log a warning
supportsDataTestProperties: true,
Expand Down
1 change: 1 addition & 0 deletions ui/app/lib/attach-capabilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export default function attachCapabilities(modelClass, capabilities) {
return ret;
}, {});

//TODO: move this to the application serializer and do it JIT instead of on app boot
debug(`adding new relationships: ${capabilityKeys.join(', ')} to ${modelClass.toString()}`);
modelClass.reopen(newRelationships);
modelClass.reopenClass({
Expand Down
44 changes: 14 additions & 30 deletions ui/app/models/auth-method.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand Down Expand Up @@ -95,29 +91,17 @@ export default DS.Model.extend({
fieldGroups: computed('formFieldGroups', function() {
return fieldToAttrs(this, this.get('formFieldGroups'));
}),
canDisable: alias('deletePath.canDelete'),
canEdit: alias('configPath.canUpdate'),
});

configPathTmpl: computed('type', function() {
const type = this.get('type');
if (type === 'aws') {
return configPath`auth/${0}/config/client`;
export default attachCapabilities(Model, {
deltePath: apiPath`sys/auth/${'id'}`,
configPath: function(context) {
if (context.type === 'aws') {
return apiPath`auth/${'id'}/config/client`;
} else {
return configPath`auth/${0}/config`;
return apiPath`auth/${'id'}/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'),
},
});
2 changes: 1 addition & 1 deletion ui/app/styles/components/toolbar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
min-width: 190px;
}

label {
label[for='namespace'] {
padding: $spacing-xs;
color: $grey;
}
Expand Down
2 changes: 1 addition & 1 deletion ui/app/styles/core/breadcrumb.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
-ms-user-select: text;
-webkit-user-select: text;
user-select: text;
height: 1.5rem;
min-height: 1.5rem;
margin: 0;
overflow-x: auto;

Expand Down
3 changes: 2 additions & 1 deletion ui/app/templates/components/secret-edit.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
@mode="versions"
@secret={{this.model.id}}
@class="has-text-black has-text-weight-semibold has-bottom-shadow"
@onLinkClick={{action D.actions.close}}
>
View version history
</SecretLink>
Expand All @@ -75,7 +76,7 @@
<ul class="menu-list">
{{#each (reverse this.model.versions) as |secretVersion|}}
<li class="action">
<LinkTo class="link" @params={{array (query-params version=secretVersion.version)}}>
<LinkTo class="link" @params={{array (query-params version=secretVersion.version)}} @invokeAction={{action D.actions.close}} >
Version {{secretVersion.version}}
{{#if (eq secretVersion.version this.model.currentVersion)}}
<Icon @glyph="check-circle-outline" class="has-text-success is-pulled-right" />
Expand Down
1 change: 1 addition & 0 deletions ui/app/templates/components/secret-link.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
data-test-transit-link=data-test-transit-link
data-test-transit-key-actions-link=data-test-transit-key-actions-link
data-test-transit-action-link=data-test-transit-action-link
invokeAction=(action onLinkClick)
}}
{{yield}}
{{/link-to}}
6 changes: 3 additions & 3 deletions ui/app/templates/components/secret-version-menu.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<li class="action">
{{#if this.version.deleted}}
{{#if canUndeleteVersion}}
<button type="button" class="link" {{action "deleteVersion" "undelete"}}>
<button type="button" class="link" {{action (queue (action D.actions.close) (action "deleteVersion" "undelete"))}}>
Undelete version
</button>
{{else}}
Expand All @@ -52,7 +52,7 @@
@buttonClasses="link is-destroy"
@confirmTitle="Delete version?"
@confirmMessage="This version will no longer be able to be read, but the underlying data will not be removed and can still be undeleted."
@onConfirmAction={{action "deleteVersion" "delete"}}
@onConfirmAction={{action (queue (action D.actions.close) (action "deleteVersion" "delete"))}}
data-test-secret-v2-delete="true"
>
Delete version
Expand All @@ -69,7 +69,7 @@
@buttonClasses="link is-destroy"
@confirmTitle="Permanently delete?"
@confirmMessage="This version will no longer be able to be read, and cannot be undeleted."
@onConfirmAction={{action "deleteVersion" "destroy"}}
@onConfirmAction={{action (queue (action D.actions.close) (action "deleteVersion" "destroy"))}}
data-test-secret-v2-destroy="true"
>
Permanently destroy version
Expand Down