-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add popups * add ability to disable entity and banner when entity is disabled * re-add alias-popup template * add accpetance tests for creating entities * add more entity creation acceptance tests * add delete to edit-form * add more identity tests and associated selectors * add onSuccess hook and use UnloadModel route mixins * add ability to toggle entity disabling from the popover * fix store list cache because unloadAll isn't synchronous * fill out tests for identity items and aliases * add ability to enable entity from the detail page * toArray on the peekAll * fix other tests/behavior that relied on a RecordArray * adjust layout for disabled entity and label for disabling an entity on the edit form * add item-details integration tests * move disable field on the entity form * use ghost buttons for delete in identity and policy edit forms * adding computed macros for lazy capability fetching and using them in the identity models
- Loading branch information
Showing
85 changed files
with
1,426 additions
and
220 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
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); | ||
}), | ||
|
||
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.