-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from hashicorp/feature/initializers-mixins
Move away from using `reopen` to using Mixins
- Loading branch information
Showing
11 changed files
with
65 additions
and
70 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,12 @@ | ||
import Mixin from '@ember/object/mixin'; | ||
import { inject as service } from '@ember/service'; | ||
|
||
export default Mixin.create({ | ||
feedback: service('feedback'), | ||
init: function() { | ||
this._super(...arguments); | ||
this.set('feedback', { | ||
execute: this.get('feedback').execute.bind(this), | ||
}); | ||
}, | ||
}); |
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,17 @@ | ||
import Mixin from '@ember/object/mixin'; | ||
|
||
export default Mixin.create({ | ||
rootKey: '-', | ||
actions: { | ||
// Used to link to keys that are not objects, | ||
// like parents and grandParents | ||
// TODO: This is a view thing, should possibly be a helper | ||
linkToKey: function(key) { | ||
if (key.slice(-1) === '/' || key === this.rootKey) { | ||
this.transitionTo('dc.kv.show', key); | ||
} else { | ||
this.transitionTo('dc.kv.edit', key); | ||
} | ||
}, | ||
}, | ||
}); |
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
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 was deleted.
Oops, something went wrong.
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,12 @@ | ||
import EmberObject from '@ember/object'; | ||
import WithFeedbackMixin from 'consul-ui/mixins/with-feedback'; | ||
import { module, test } from 'qunit'; | ||
|
||
module('Unit | Mixin | with feedback'); | ||
|
||
// Replace this with your real tests. | ||
test('it works', function(assert) { | ||
let WithFeedbackObject = EmberObject.extend(WithFeedbackMixin); | ||
let subject = WithFeedbackObject.create(); | ||
assert.ok(subject); | ||
}); |
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,12 @@ | ||
import EmberObject from '@ember/object'; | ||
import WithKeyUtilsMixin from 'consul-ui/mixins/with-key-utils'; | ||
import { module, test } from 'qunit'; | ||
|
||
module('Unit | Mixin | with key utils'); | ||
|
||
// Replace this with your real tests. | ||
test('it works', function(assert) { | ||
let WithKeyUtilsObject = EmberObject.extend(WithKeyUtilsMixin); | ||
let subject = WithKeyUtilsObject.create(); | ||
assert.ok(subject); | ||
}); |