forked from emberjs/ember-inspector
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tidy up object inspector (emberjs#1024)
* Create DependentKeys component * Call object-inspector with angle brackets * ObjectInspector:Errors * Cleanup some mixin-details property names * Move grouped props and flat list into separate components - also move errors in ObjectInspector * Create ObjectInspector::Accordion * ObjectInspector::SortedProperties * Untangle ObjectInspector child components - namespace children under ObjectInspector - do not pass parent component down to child - separate accordion logic - separate property sorting - fix calculate for “all” flat properties? * Attempt to make Code Climate happy #valueClicked function has a Cognitive Complexity dialed up to 11 * Remove unneeded component classes
- Loading branch information
Showing
24 changed files
with
382 additions
and
364 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
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,15 @@ | ||
import { action, computed } from '@ember/object'; | ||
import Component from '@ember/component'; | ||
|
||
export default Component.extend({ | ||
tagName: '', | ||
|
||
isExpanded: computed('mixin.expand', 'mixin.properties.length', function () { | ||
return this.get('mixin.expand') && this.get('mixin.properties.length') > 0; | ||
}), | ||
|
||
toggle: action(function () { | ||
this.toggleProperty('mixin.expand'); | ||
}), | ||
}); | ||
|
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,31 @@ | ||
import { action, computed } from '@ember/object'; | ||
import PropertiesBase from 'ember-inspector/components/object-inspector/properties-base'; | ||
|
||
const findMixin = function(mixins, property) { | ||
return mixins.find((m) => { | ||
return m.properties.includes(property); | ||
}); | ||
}; | ||
|
||
export default PropertiesBase.extend({ | ||
calculate: action(function(property) { | ||
const mixin = findMixin(this.get('model.mixins'), property); | ||
|
||
this.port.send('objectInspector:calculate', { | ||
objectId: this.model.objectId, | ||
mixinIndex: this.get('model.mixins').indexOf(mixin), | ||
property: property.name | ||
}); | ||
}), | ||
|
||
flatPropertyList: computed('model', function () { | ||
const props = this.get('model.mixins').map(function (mixin) { | ||
return mixin.properties.filter(function (p) { | ||
return !p.hasOwnProperty('overridden'); | ||
}); | ||
}); | ||
|
||
return props.flat(); | ||
}), | ||
}); | ||
|
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,30 @@ | ||
import Component from '@ember/component'; | ||
import { action } from '@ember/object'; | ||
|
||
export default Component.extend({ | ||
tagName: '', | ||
|
||
sendToConsole: action(function ({ name }) { | ||
this.port.send('objectInspector:sendToConsole', { | ||
objectId: this.model.objectId, | ||
property: name | ||
}); | ||
}), | ||
|
||
digDeeper: action(function({ name }) { | ||
this.port.send('objectInspector:digDeeper', { | ||
objectId: this.model.objectId, | ||
property: name | ||
}); | ||
}), | ||
|
||
saveProperty: action(function(property, value, dataType) { | ||
this.port.send('objectInspector:saveProperty', { | ||
objectId: this.model.objectId, | ||
property, | ||
value, | ||
dataType | ||
}); | ||
}), | ||
}); | ||
|
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,13 @@ | ||
import { action } from '@ember/object'; | ||
import PropertiesBase from 'ember-inspector/components/object-inspector/properties-base'; | ||
|
||
export default PropertiesBase.extend({ | ||
calculate: action(function({ name }, mixin) { | ||
this.port.send('objectInspector:calculate', { | ||
objectId: this.model.objectId, | ||
mixinIndex: this.get('model.mixins').indexOf(mixin), | ||
property: name | ||
}); | ||
}), | ||
}); | ||
|
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,9 @@ | ||
import TextField from '@ember/component/text-field'; | ||
|
||
export default TextField.extend({ | ||
didInsertElement() { | ||
this.element.select(); | ||
return this._super(...arguments); | ||
} | ||
}); | ||
|
Oops, something went wrong.