-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add versions routes * move commands and permissions check to stand-alone menu component * add versions template * make list-item component more flexible and use hasMenu to optionally render the menu * move current check next to the version * fix linting * remove is-wide from secret list popup
- Loading branch information
Showing
16 changed files
with
345 additions
and
201 deletions.
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
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.