-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
UI - kv v2 versions page #5563
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
afb258d
add versions routes
meirish 795f626
move commands and permissions check to stand-alone menu component
meirish 30bfea9
add versions template
meirish 6738285
make list-item component more flexible and use hasMenu to optionally …
meirish df5bf54
move current check next to the version
meirish 0260e4f
fix linting
meirish afd8b27
remove is-wide from secret list popup
meirish File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import { maybeQueryRecord } from 'vault/macros/maybe-query-record'; | ||
import Component from '@ember/component'; | ||
import { inject as service } from '@ember/service'; | ||
import { alias, or } from '@ember/object/computed'; | ||
|
||
export default Component.extend({ | ||
tagName: '', | ||
store: service(), | ||
version: null, | ||
useDefaultTrigger: false, | ||
|
||
deleteVersionPath: maybeQueryRecord( | ||
'capabilities', | ||
context => { | ||
let [backend, id] = JSON.parse(context.version.id); | ||
return { | ||
id: `${backend}/delete/${id}`, | ||
}; | ||
}, | ||
'version.id' | ||
), | ||
canDeleteVersion: alias('deleteVersionPath.canUpdate'), | ||
destroyVersionPath: maybeQueryRecord( | ||
'capabilities', | ||
context => { | ||
let [backend, id] = JSON.parse(context.version.id); | ||
return { | ||
id: `${backend}/destroy/${id}`, | ||
}; | ||
}, | ||
'version.id' | ||
), | ||
canDestroyVersion: alias('destroyVersionPath.canUpdate'), | ||
undeleteVersionPath: maybeQueryRecord( | ||
'capabilities', | ||
context => { | ||
let [backend, id] = JSON.parse(context.version.id); | ||
return { | ||
id: `${backend}/undelete/${id}`, | ||
}; | ||
}, | ||
'version.id' | ||
), | ||
canUndeleteVersion: alias('undeleteVersionPath.canUpdate'), | ||
|
||
isFetchingVersionCapabilities: or( | ||
'deleteVersionPath.isPending', | ||
'destroyVersionPath.isPending', | ||
'undeleteVersionPath.isPending' | ||
), | ||
actions: { | ||
deleteVersion(deleteType = 'destroy') { | ||
return this.store | ||
.adapterFor('secret-v2-version') | ||
.v2DeleteOperation(this.store, this.version.id, deleteType); | ||
}, | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default } from './version'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import Route from '@ember/routing/route'; | ||
import utils from 'vault/lib/key-utils'; | ||
import UnloadModelRoute from 'vault/mixins/unload-model-route'; | ||
|
||
export default Route.extend(UnloadModelRoute, { | ||
templateName: 'vault/cluster/secrets/backend/versions', | ||
|
||
beforeModel() { | ||
let backendModel = this.modelFor('vault.cluster.secrets.backend'); | ||
const { secret } = this.paramsFor(this.routeName); | ||
const parentKey = utils.parentKeyForKey(secret); | ||
if (backendModel.get('isV2KV')) { | ||
return; | ||
} | ||
if (parentKey) { | ||
return this.transitionTo('vault.cluster.secrets.backend.list', parentKey); | ||
} else { | ||
return this.transitionTo('vault.cluster.secrets.backend.list-root'); | ||
} | ||
}, | ||
|
||
model(params) { | ||
let { secret } = params; | ||
const { backend } = this.paramsFor('vault.cluster.secrets.backend'); | ||
return this.store.queryRecord('secret-v2', { id: secret, backend }); | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"}} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. whew, that's quite the class list. 😉 There was a problem hiding this comment. Choose a reason for hiding this commentThe 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> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most of this was in
secret-edit
and is now moved to its own component so that we could use it on the show page, and now on the version history page.