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

UI - kv v2 versions page #5563

Merged
merged 7 commits into from
Oct 19, 2018
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
make list-item component more flexible and use hasMenu to optionally …
…render the menu
meirish committed Oct 19, 2018

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 67382850ac5c885e290d8aaef79a7c56202702bc
2 changes: 1 addition & 1 deletion ui/app/components/list-item.js
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ export default Component.extend({
tagName: '',
linkParams: null,
componentName: null,
hasMenu: false,
hasMenu: true,

callMethod: task(function*(method, model, successMessage, failureMessage, successCallback = () => {}) {
let flash = this.get('flashMessages');
2 changes: 2 additions & 0 deletions ui/app/components/list-item/popup-menu.js
Original file line number Diff line number Diff line change
@@ -2,4 +2,6 @@ import Component from '@ember/component';

export default Component.extend({
tagName: '',
item: null,
hasMenu: null,
});
6 changes: 3 additions & 3 deletions ui/app/routes/vault/cluster/secrets/backend/secret-edit.js
Original file line number Diff line number Diff line change
@@ -140,16 +140,16 @@ export default Route.extend(UnloadModelRoute, {
},

willTransition(transition) {
let model = this.controller.model;
let { mode, model } = this.controller;
let version = model.get('selectedVersion');
let changed = model.changedAttributes();
let changedKeys = Object.keys(changed);
// until we have time to move `backend` on a v1 model to a relationship,
// it's going to dirty the model state, so we need to look for it
// and explicity ignore it here
if (
(changedKeys.length && changedKeys[0] !== 'backend') ||
(version && Object.keys(version.changedAttributes()).length)
(mode !== 'show' && (changedKeys.length && changedKeys[0] !== 'backend')) ||
(mode !== 'show' && version && Object.keys(version.changedAttributes()).length)
) {
if (
window.confirm(
6 changes: 6 additions & 0 deletions ui/app/styles/core/helpers.scss
Original file line number Diff line number Diff line change
@@ -4,12 +4,18 @@
.is-underline {
text-decoration: underline;
}
.is-no-underline {
text-decoration: none;
}
.is-sideless {
box-shadow: 0 2px 0 -1px $grey-light, 0 -2px 0 -1px $grey-light;
}
.is-bottomless {
box-shadow: 0 -1px 0 0 $grey-light;
}
.has-bottom-shadow {
box-shadow: $box-shadow !important;
}
.is-borderless {
border: none !important;
}
24 changes: 9 additions & 15 deletions ui/app/templates/components/list-item.hbs
Original file line number Diff line number Diff line change
@@ -3,33 +3,27 @@
{{else if linkParams}}
<LinkedBlock @params={{linkParams}} @class="list-item-row">
<div class="level is-mobile">
<div class="level-left">
<div>
{{#link-to params=linkParams class="has-text-weight-semibold"}}
{{yield (hash content=(component "list-item/content"))}}
{{/link-to}}
</div>
</div>
<div class="level-left is-flex-1">
{{#link-to params=linkParams class="has-text-weight-semibold has-text-black is-display-flex is-flex-1 is-no-underline"}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whew, that's quite the class list. 😉

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😬 Yeah - hoping to move away from this - or at least hide it under the rug with more components

{{yield (hash content=(component "list-item/content"))}}
{{/link-to}}
</div>
<div class="level-right">
<div class="level-item">
{{#if hasBlock}}
{{yield (hash callMethod=callMethod menu=(component "list-item/popup-menu"))}}
{{/if}}
{{yield (hash callMethod=callMethod menu=(component "list-item/popup-menu" item=item hasMenu=hasMenu))}}
</div>
</div>
</div>
</LinkedBlock>
{{else}}
<div class="list-item-row">
<div class="level is-mobile">
<div class="level-left">
<div class="has-text-grey has-text-weight-semibold">
{{yield (hash content=(component "list-item/content"))}}
</div>
<div class="level-left is-flex-1 has-text-weight-semibold">
{{yield (hash content=(component "list-item/content"))}}
</div>
<div class="level-right">
<div class="level-item">
{{yield (hash callMethod=callMethod menu=(component "list-item/popup-menu"))}}
{{yield (hash callMethod=callMethod menu=(component "list-item/popup-menu" item=item hasMenu=hasMenu))}}
</div>
</div>
</div>
18 changes: 11 additions & 7 deletions ui/app/templates/components/list-item/popup-menu.hbs
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
<PopupMenu>
<nav class="menu">
<ul class="menu-list">
{{yield item}}
</ul>
</nav>
</PopupMenu>
{{#if hasMenu}}
<PopupMenu>
<nav class="menu">
<ul class="menu-list">
{{yield item}}
</ul>
</nav>
</PopupMenu>
{{else}}
{{yield item}}
{{/if}}
10 changes: 7 additions & 3 deletions ui/app/templates/partials/secret-list/item.hbs
Original file line number Diff line number Diff line change
@@ -52,13 +52,17 @@
Details
</SecretLink>
</li>
{{!-- // will add a link to the history view once it exists
{{#if backendModel.isV2KV}}
<li class="action">
Verion History
<SecretLink
@mode="versions"
@secret={{item.id}}
@class="has-text-black has-text-weight-semibold"
>
View version history
</SecretLink>
</li>
{{/if}}
--}}
{{/if}}
{{#if item.canEdit}}
<li class="action">