Skip to content

Commit

Permalink
Merge pull request #460 from quincyle/master
Browse files Browse the repository at this point in the history
  • Loading branch information
quincyle authored Aug 2, 2017
2 parents 07b0685 + 7e56486 commit 7eaedc6
Show file tree
Hide file tree
Showing 23 changed files with 198 additions and 233 deletions.
11 changes: 4 additions & 7 deletions .eslintrc → .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
{
"extends": ["frost-standard"],
"globals": {
"URL": false
},
"rules": {
module.exports = {
extends: 'frost-standard',
rules: {
"ocd/sort-import-declarations": [
2,
{
"localPrefixes": [
localPrefixes: [
"../",
"./",
"dummy/",
Expand Down
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# See http://help.github.com/ignore-files/ for more about ignoring files.
# See https://help.github.com/ignore-files/ for more about ignoring files.

# compiled output
/dist
Expand All @@ -14,7 +14,7 @@
/coverage/*
/libpeerconnection.log
coverage.json
npm-debug.log
npm-debug.log*
testem.log
.idea
ge.json
Expand Down
21 changes: 11 additions & 10 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
.travis/
bower_components/
coverage/
dist/
node_modules/
tests/
tmp/
/.travis
/bower_components
/config/ember-try.js
/coverage
/dist
/tests
/tmp

**/.gitkeep

Expand All @@ -13,14 +13,15 @@ tmp/
.editorconfig
.ember-cli
.eslintignore
.eslintrc
.eslintrc.js
.gitignore
.idea
.npmignore
.pullapprove.yml
.remarkrc
.sass-lint.yml
.travis.yml
.watchmanconfig
bower.json
Brocfile.js
ember-cli-build.js
testem.js
testem.json
9 changes: 3 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ dist: trusty
language: node_js
node_js:
- '6.9.1'
- '7.10.0'
- 'stable'
addons:
apt:
sources:
Expand All @@ -13,13 +13,10 @@ addons:
- google-chrome-stable
- g++-4.8
firefox: 'latest-esr'
cache:
directories:
- node_modules
env:
matrix:
- EMBER_TRY_SCENARIO=ember-2-8
- EMBER_TRY_SCENARIO=default
- EMBER_TRY_SCENARIO=ember-default
global:
- CXX=g++-4.8
- secure: UAeyuAKSROuXqFhNeMMMKhSTwyO7J1o/dyT7p/nVVlxagujCD2A4ggzREg+HBCWDurDqdmN5tVYTC+crVVgjmX9lIpukDGAomXR5wln8niSlu4H0rxqBdbjuCKFbS8EPKy56c/n50TNMjMCkCejAU8sdZLbJT8OMHpLMdl+WkyCGEzBgNiTbxUFu5AkuVAhhS0xBChiBh6uCLXqOku9B2UDIs9U9qYV99B0HLOeksZS/errOtVpaJr+qQOP0tm+cbtUxeI+Ub+uEnnuoKjbEtJwnzaToZPA2i9X+Xe9WR0sIXFmS/vF1syVYdvZE2z/fCCydjwczM93Td/Oq9KluFikwX+y807MmgjFiv1rSeBRLob8wKQBlNoEc+NydDsRdQjsFjOQWG0yc/C78Xqi7PHipZw/Wf5GzOgxmxqjOvM2s16VBI9UJPcMme7FykDeHwoROi4xCGvjFLyxJ3UjsthwY+uRS1YVmGIlqMUJEdSUquAeVevRaEaPmH4n6qdXsTjMw+75UPfw4SgBZuO0DFnC8Tgr4UZY6IkL7NQxWenZZje1pkjTkBHLy7SitNjugEYqukVf5SGUyC2mtMbbBDOlZBQML9/s7jbmGFENbAc2+EtvVq2Hu+u+DciN9IRSwZtmI06p8d1ifCwoU1NU7RCdchu22n0D8/EG6aDuOwDI=
Expand Down Expand Up @@ -49,7 +46,7 @@ deploy:
secure: ESPMbZwhsrfGfO/p+f5ykZFWImTxNHe8Wab2+EZge87P8ZojO0JhkpnpCM8p9mrHOz+gp2exzGViyjS1FoIRw8yr0kV2fbuCUhZy014nft9WtGnwGs/f9y7odFBOGIlRg4i23VtRjKtE9xsNdS6bOORtxg6IK/b9l25sd+dEhhPG29HkWmGGnjCeWFGTRum0jF7HMCRAp1FSKvELIdDegBs9qxMuv5yu5ozGRyjufwXRSkWd9o0FQDTweJPqGF+izkf5am8q0jbYRlZdUBCMw4Ew4bhtmx1oDOmUO+WgPUCPzfXirvwsMTQaaK2em5PIF78S2yQNh8PTziRcOOMmXGnKmZwcypsQ2Bd6GDOOG6vsXZ9cMpWpnCpPPx44bR2jwuwUrSfjSPv3OJgZIo4RP75NIPv46tST0JdFqth+kEBtCzHNgpQWyBUUFIyoqSjkTKk4WHA/JVHIrOamp0WoZnG/e9CwuC3IXh4fIlyjI6rTMjP9U82Z+rxNmk149WoQ9ilYqlcVv+xUjQsb4zRda7LGeHGzG5f4onwdv4Pg0BiHkKAwYLClwV1GAK6+oQsyw2jpyW4dRuR79zp0dw+cluad78x4mKhqJkf5HmqTsrwDdfAn27WzOW8YT12iaULnn/IE1xBfVNEp8AqMUAxPcEUjusOx3o+TAb4m9ale7cg=
on:
all_branches: true
condition: "$EMBER_TRY_SCENARIO = 'default'"
condition: "$EMBER_TRY_SCENARIO = 'ember-default'"
node: '6.9.1'
tags: true
notifications:
Expand Down
2 changes: 1 addition & 1 deletion .travis/maybe-bump-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ then
exit 0
fi

if [ "$EMBER_TRY_SCENARIO" != "default" ]
if [ "$EMBER_TRY_SCENARIO" != "ember-default" ]
then
echo "Skipping version bump for EMBER_TRY_SCENARIO ${EMBER_TRY_SCENARIO}"
exit 0
Expand Down
2 changes: 1 addition & 1 deletion .travis/maybe-publish-coverage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ then
exit 0
fi

if [ "$EMBER_TRY_SCENARIO" != "default" ]
if [ "$EMBER_TRY_SCENARIO" != "ember-default" ]
then
echo "Skipping coverage publish for EMBER_TRY_SCENARIO ${EMBER_TRY_SCENARIO}"
exit 0
Expand Down
7 changes: 5 additions & 2 deletions addon/components/cell.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,10 @@ export default Component.extend(HookMixin, PropTypeMixin, {
}
},
/* eslint-disable complexity */
didReceiveAttrs (attrs) {
didReceiveAttrs () {
const valueChangeSet = this.get('valueChangeSet')
const oldCellConfig = get(attrs, 'oldAttrs.cellConfig.value')

const oldCellConfig = this.get('_oldCellConfig.value')
const newCellConfig = this.get('cellConfig')

let isDirty = false
Expand Down Expand Up @@ -110,6 +111,8 @@ export default Component.extend(HookMixin, PropTypeMixin, {
if (!_.isEqual(newClassNames, oldClassNames)) {
this.set('classNames', newClassNames)
}

this.set('_oldCellConfig', newCellConfig)
},
/* eslint-enable complexity */

Expand Down
37 changes: 17 additions & 20 deletions addon/components/detail.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const {
const {getSubModel} = utils

import Ember from 'ember'
const {A, Component, Logger, RSVP, get, getOwner, isEmpty, run, typeOf} = Ember
const {A, Component, Logger, RSVP, getOwner, isEmpty, run, typeOf} = Ember
import computed, {readOnly} from 'ember-computed-decorators'
import {HookMixin} from 'ember-hook'
import PropTypeMixin, {PropTypes} from 'ember-prop-types'
Expand Down Expand Up @@ -51,15 +51,6 @@ function getAlias (cell) {
return Ember.String.capitalize(words)
}

function getAttr (attrs, key) {
attrs = attrs || {}

return (
get(attrs, `${key}.value`) ||
get(attrs, `options.value.${key}`)
)
}

/**
* Determine if an object is an Ember.Object or not
* @param {Object|Ember.Object} object - object to check
Expand Down Expand Up @@ -543,16 +534,13 @@ export default Component.extend(SpreadMixin, HookMixin, PropTypeMixin, {
/* eslint-disable complexity */
/**
* Determines if the any of the schema attrs has changed
* @param {String} schemaName - the name of the schema attribute
* @param {Object} oldAttrs - the old attributes
* @param {Object} newAttrs - the new attributes
* @param {Object} oldSchema - the old schema
* @param {Object} newSchema - the new schema
* @returns {Object} the old and new schemas
*/
getSchema (schemaName, oldAttrs, newAttrs) {
const newSchema = getAttr(newAttrs, schemaName)
const newSchemaPojo = isEmberObject(newSchema) ? deemberify(newSchema) : newSchema
const oldSchema = getAttr(oldAttrs, schemaName)
getSchema (oldSchema, newSchema) {
const oldSchemaPojo = isEmberObject(oldSchema) ? deemberify(oldSchema) : oldSchema
const newSchemaPojo = isEmberObject(newSchema) ? deemberify(newSchema) : newSchema

return {
hasChanged: !_.isEqual(oldSchemaPojo, newSchemaPojo),
Expand Down Expand Up @@ -617,19 +605,25 @@ export default Component.extend(SpreadMixin, HookMixin, PropTypeMixin, {
/**
* Keep value in sync with store and validate properties
*/
didReceiveAttrs ({newAttrs, oldAttrs}) {
didReceiveAttrs () {
this._super(...arguments)

let dispatchValue

const oldAttrBunsenModel = this.get('_oldAttrBunsenModel')
const newAttrBunsenModel = this.get('bunsenModel') || this.get('options.bunsenModel')

const oldAttrBunsenView = this.get('_oldAttrBunsenView')
const newAttrBunsenView = this.get('bunsenView') || this.get('options.bunsenView')

const reduxStore = this.get('reduxStore')
const reduxStoreValue = reduxStore.getState().value
const value = this.get('value')
const plainObjectValue = isEmberObject(value) ? deemberify(value) : value
const hasUserProvidedValue = [null, undefined].indexOf(plainObjectValue) === -1
const isReduxStoreValueEmpty = [null, undefined].indexOf(reduxStoreValue) !== -1
const {hasChanged: hasModelChanged, newSchema: newBunsenModel} = this.getSchema('bunsenModel', oldAttrs, newAttrs)
const {hasChanged: hasViewChanged, newSchema: newView} = this.getSchema('bunsenView', oldAttrs, newAttrs)
const {hasChanged: hasModelChanged, newSchema: newBunsenModel} = this.getSchema(oldAttrBunsenModel, newAttrBunsenModel) // eslint-disable-line max-len
const {hasChanged: hasViewChanged, newSchema: newView} = this.getSchema(oldAttrBunsenView, newAttrBunsenView)
const allValidators = this.getAllValidators()
const mergeDefaults = this.get('mergeDefaults')

Expand Down Expand Up @@ -674,6 +668,9 @@ export default Component.extend(SpreadMixin, HookMixin, PropTypeMixin, {
}

this.updateSelectedTab()

this.set('_oldAttrBunsenModel', newAttrBunsenModel)
this.set('_oldAttrBunsenView', newAttrBunsenView)
},
/* eslint-enable complexity */

Expand Down
Loading

0 comments on commit 7eaedc6

Please sign in to comment.