-
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 - identity details #4502
Merged
Merged
UI - identity details #4502
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
4637e10
add popup to entity / group list
meirish efba180
add alias popover menu
meirish e6362c2
add metadata popover
meirish d247f37
more metadata popups
meirish 173d532
use base popup component and convert identity popups to use it
meirish 2cc75f5
add group members popup
meirish 12d35f4
add ability to disable entity and banner when entity is disabled
meirish 73bc868
re-add alias-popup template
meirish 855043e
add accpetance tests for creating entities
meirish 00ac6ee
add more entity creation acceptance tests
meirish bc98ae1
add delete to edit-form
meirish e3a251c
add more identity tests and associated selectors
meirish bf748cc
add onSuccess hook and use UnloadModel route mixins
meirish 02a0cae
add ability to toggle entity disabling from the popover
meirish b546c7a
fix store list cache because unloadAll isn't synchronous
meirish 3da2e1d
fill out tests for identity items and aliases
meirish 700bfe7
add ability to enable entity from the detail page
meirish c660e07
toArray on the peekAll
meirish 07811f2
fix other tests/behavior that relied on a RecordArray
meirish f290211
adjust layout for disabled entity and label for disabling an entity o…
meirish e9314ca
add item-details integration tests
meirish 6b531b3
move disable field on the entity form
meirish b050f5f
use ghost buttons for delete in identity and policy edit forms
meirish f317154
review feedback
meirish feba7a9
adding computed macros for lazy capability fetching and using them in…
meirish d195251
prettier
meirish 8c5aefd
Merge branch 'master' into ui-identity-details
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import Ember from 'ember'; | ||
const { assert, inject, Component } = Ember; | ||
|
||
export default Component.extend({ | ||
tagName: '', | ||
flashMessages: inject.service(), | ||
params: null, | ||
successMessage() { | ||
return 'Save was successful'; | ||
}, | ||
errorMessage() { | ||
return 'There was an error saving'; | ||
}, | ||
onError(model) { | ||
if (model && model.rollbackAttributes) { | ||
model.rollbackAttributes(); | ||
} | ||
}, | ||
onSuccess(){}, | ||
// override and return a promise | ||
transaction() { | ||
assert('override transaction call in an extension of popup-base', false); | ||
}, | ||
|
||
actions: { | ||
performTransaction() { | ||
let args = [...arguments]; | ||
let messageArgs = this.messageArgs(...args); | ||
return this.transaction(...args) | ||
.then(() => { | ||
this.get('onSuccess')(); | ||
this.get('flashMessages').success(this.successMessage(...messageArgs)); | ||
}) | ||
.catch(e => { | ||
this.onError(...messageArgs); | ||
this.get('flashMessages').success(this.errorMessage(e, ...messageArgs)); | ||
}); | ||
}, | ||
}, | ||
}); |
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,23 @@ | ||
import Ember from 'ember'; | ||
|
||
const { inject } = Ember; | ||
|
||
export default Ember.Component.extend({ | ||
flashMessages: inject.service(), | ||
|
||
actions: { | ||
enable(model) { | ||
model.set('disabled', false); | ||
|
||
model.save(). | ||
then(() => { | ||
this.get('flashMessages').success(`Successfully enabled entity: ${model.id}`); | ||
}) | ||
.catch(e => { | ||
this.get('flashMessages').success( | ||
`There was a problem enabling the entity: ${model.id} - ${e.error.join(' ') || e.message}` | ||
); | ||
}); | ||
} | ||
} | ||
}); |
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,22 @@ | ||
import Base from './_popup-base'; | ||
|
||
export default Base.extend({ | ||
messageArgs(model) { | ||
let type = model.get('identityType'); | ||
let id = model.id; | ||
return [type, id]; | ||
}, | ||
|
||
successMessage(type, id) { | ||
return `Successfully deleted ${type}: ${id}`; | ||
}, | ||
|
||
errorMessage(e, type, id) { | ||
let error = e.errors ? e.errors.join(' ') : e.message; | ||
return `There was a problem deleting ${type}: ${id} - ${error}`; | ||
}, | ||
|
||
transaction(model) { | ||
return model.destroyRecord(); | ||
}, | ||
}); |
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,34 @@ | ||
import Base from './_popup-base'; | ||
import Ember from 'ember'; | ||
const { computed } = Ember; | ||
|
||
export default Base.extend({ | ||
model: computed.alias('params.firstObject'), | ||
|
||
groupArray: computed('params', function() { | ||
return this.get('params').objectAt(1); | ||
}), | ||
|
||
memberId: computed('params', function() { | ||
return this.get('params').objectAt(2); | ||
}), | ||
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. In the event that |
||
|
||
messageArgs(/*model, groupArray, memberId*/) { | ||
return [...arguments]; | ||
}, | ||
|
||
successMessage(model, groupArray, memberId) { | ||
return `Successfully removed '${memberId}' from the group`; | ||
}, | ||
|
||
errorMessage(e, model, groupArray, memberId) { | ||
let error = e.errors ? e.errors.join(' ') : e.message; | ||
return `There was a problem removing '${memberId}' from the group - ${error}`; | ||
}, | ||
|
||
transaction(model, groupArray, memberId) { | ||
let members = model.get(groupArray); | ||
model.set(groupArray, members.without(memberId)); | ||
return model.save(); | ||
}, | ||
}); |
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,29 @@ | ||
import Base from './_popup-base'; | ||
import Ember from 'ember'; | ||
const { computed } = Ember; | ||
|
||
export default Base.extend({ | ||
model: computed.alias('params.firstObject'), | ||
key: computed('params', function() { | ||
return this.get('params').objectAt(1); | ||
}), | ||
|
||
messageArgs(model, key) { | ||
return [model, key]; | ||
}, | ||
|
||
successMessage(model, key) { | ||
return `Successfully removed '${key}' from metadata`; | ||
}, | ||
errorMessage(e, model, key) { | ||
let error = e.errors ? e.errors.join(' ') : e.message; | ||
return `There was a problem removing '${key}' from the metadata - ${error}`; | ||
}, | ||
|
||
transaction(model, key) { | ||
let metadata = model.get('metadata'); | ||
delete metadata[key]; | ||
model.set('metadata', { ...metadata }); | ||
return model.save(); | ||
}, | ||
}); |
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,29 @@ | ||
import Base from './_popup-base'; | ||
import Ember from 'ember'; | ||
const { computed } = Ember; | ||
|
||
export default Base.extend({ | ||
model: computed.alias('params.firstObject'), | ||
policyName: computed('params', function() { | ||
return this.get('params').objectAt(1); | ||
}), | ||
|
||
messageArgs(model, policyName) { | ||
return [model, policyName]; | ||
}, | ||
|
||
successMessage(model, policyName) { | ||
return `Successfully removed '${policyName}' policy from ${model.id} `; | ||
}, | ||
|
||
errorMessage(e, model, policyName) { | ||
let error = e.errors ? e.errors.join(' ') : e.message; | ||
return `There was a problem removing '${policyName}' policy - ${error}`; | ||
}, | ||
|
||
transaction(model, policyName) { | ||
let policies = model.get('policies'); | ||
model.set('policies', policies.without(policyName)); | ||
return model.save(); | ||
}, | ||
}); |
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 |
---|---|---|
|
@@ -9,6 +9,4 @@ export default Ember.Component.extend({ | |
baseKey: null, | ||
backendCrumb: null, | ||
model: null, | ||
|
||
|
||
}); |
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
8 changes: 7 additions & 1 deletion
8
ui/app/controllers/vault/cluster/access/identity/aliases/index.js
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,4 +1,10 @@ | ||
import Ember from 'ember'; | ||
import ListController from 'vault/mixins/list-controller'; | ||
|
||
export default Ember.Controller.extend(ListController); | ||
export default Ember.Controller.extend(ListController, { | ||
actions: { | ||
onDelete() { | ||
this.send('reload'); | ||
} | ||
} | ||
}); |
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,4 +1,46 @@ | ||
import Ember from 'ember'; | ||
import ListController from 'vault/mixins/list-controller'; | ||
|
||
export default Ember.Controller.extend(ListController); | ||
const { inject } = Ember; | ||
|
||
export default Ember.Controller.extend(ListController, { | ||
flashMessages: inject.service(), | ||
|
||
actions: { | ||
delete(model) { | ||
let type = model.get('identityType'); | ||
let id = model.id; | ||
return model | ||
.destroyRecord() | ||
.then(() => { | ||
this.send('reload'); | ||
this.get('flashMessages').success(`Successfully deleted ${type}: ${id}`); | ||
}) | ||
.catch(e => { | ||
this.get('flashMessages').success( | ||
`There was a problem deleting ${type}: ${id} - ${e.error.join(' ') || e.message}` | ||
); | ||
}); | ||
}, | ||
|
||
toggleDisabled(model) { | ||
let action = model.get('disabled') ? ['enabled', 'enabling'] : ['disabled', 'disabling']; | ||
let type = model.get('identityType'); | ||
let id = model.id; | ||
model.toggleProperty('disabled'); | ||
|
||
model.save(). | ||
then(() => { | ||
this.get('flashMessages').success(`Successfully ${action[0]} ${type}: ${id}`); | ||
}) | ||
.catch(e => { | ||
this.get('flashMessages').success( | ||
`There was a problem ${action[1]} ${type}: ${id} - ${e.error.join(' ') || e.message}` | ||
); | ||
}); | ||
}, | ||
reloadRecord(model) { | ||
model.reload(); | ||
}, | ||
}, | ||
}); |
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.
Was there a particular motivation for assigning true rather than assigning it nothing?
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.
Oh ha, just habit from components 😬