Skip to content
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

Internal update to fit ember-frost-object-browser #69

Merged
merged 22 commits into from
Nov 11, 2016
Merged

Internal update to fit ember-frost-object-browser #69

merged 22 commits into from
Nov 11, 2016

Conversation

quincyle
Copy link
Contributor

@quincyle quincyle commented Nov 9, 2016

This project uses semver, please check the scope of this pr:

  • #patch# - backwards-compatible bug fix
  • #minor# - adding functionality in a backwards-compatible manner
  • #major# - incompatible API change

CHANGELOG

  • Upgraded ember to 2.8
  • Removed sortedItems property from sort Mixin.
  • Removed filteredItems property from core Mixin.
  • Removed defaultHeight property in frost-list-core component.
  • Redesigned sort Mixin.
  • Updated dummy app based on addon changes.
  • Updated dependencies.

@coveralls
Copy link

coveralls commented Nov 9, 2016

Coverage Status

Changes Unknown when pulling 0c8a24d on quincyle:lts-rework-ob into * on ciena-frost:master*.

Copy link
Contributor

@sglanzer-deprecated sglanzer-deprecated left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need some context on a few of the decisions (defaultHeight, sortItems action behaviour)

@@ -39,7 +36,6 @@ const FrostList = Component.extend(PropTypeMixin, {
},

alwaysUseDefaultHeight: false,
defaultHeight: 45,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this no longer necessary (and why)? Also, if it's still a useful mechanism, can it be set from the component interface?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I put it here original to fix a s&m regression, and now it looks ok without it after I update the s&m from 0.4.x to 0.5.x, instead it produces a wired css issue. There's still a chain in template that user can set defaultHeightvia component interface.

@@ -44,12 +44,12 @@ export default Mixin.create(FrostListSelectionMixin, FrostListExpansionMixin, Fr
)
}),

listMixinConfig: Ember.computed('activeSorting', 'sortableProperties', 'sortedItems.[]', function () {
listMixinConfig: Ember.computed('activeSorting', 'sortableProperties', 'statefulListItems.[]', function () {
let activeSorting = this.get('activeSorting')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These lets aren't necessary, the get can be put directly into the return object

this.set('activeSorting', activeSorting)
let normalizedSortProperties = normalizeSort(filteredSortProperties)
const dataKey = this.get('listConfig.items')
this.set(dataKey, listDefaultSort(this.get(dataKey), normalizedSortProperties))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be conditional on someone providing their own sort function? I.E. can you override the default or not sort on the client at all?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently, I'm assuming consumer will replace the sortItems function entirely if they don't want the default sort or client sort. I can make an interface that takes normalizeSort out and let user only overwrites what's left over.

{{/if}}
{{component item
model=record
hook=(concat hook '-item-' index)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you have a hookQualifier below with the index, why concat the index on the hook?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I was working on the like, the hoookQualifier is already a thing but not working properly yet.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now you have both :) Maybe remove the concat at this stage?

return []
}
return sort.map(function (item) {
let key = item.value
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const or just move it into the string literal

})
}

export function listDefaultSort (items, sortProperties) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to prefix this with list and you should add a jsdoc here or in the README explaining that you're using Ember.compare and link to the documentation http://emberjs.com/api/classes/Ember.Comparable.html#method_compare

return resultArray
})

return Ember.A(items.slice().sort((itemA, itemB) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a comment here explaining that slice is used to create a copy of the array so that the sort isn't applied to the original

"ember-browserify": "1.1.12",
"ember-cli": "^2.7.0",
"ember-browserify": "1.1.13",
"ember-cli": "^2.8.0",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

~2.8.0 please. No ^

"ember-concurrency": "0.7.8",
"ember-data": "^2.4.0",
"ember-concurrency": "0.7.15",
"ember-data": "^2.8.0",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no ^ please

"ember-frost-sort": "^3.0.0",
"ember-get-config": "0.1.7",
"ember-frost-core": "0.29.1",
"ember-frost-sort": "5.0.1",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With ^ please

"ember-hash-helper-polyfill": "0.1.1",
"ember-hook": "1.3.2",
"ember-hook": "1.3.5",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

with ^ please

"ember-prop-types": "^2.1.0",
"ember-redux": "1.5.3",
"ember-one-way-controls": "1.1.1",
"ember-prop-types": "3.0.2",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

with ^

@@ -26,41 +26,43 @@
"devDependencies": {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I cant directly comment on it but please change line 18 node version to >= 6.0.0

Copy link
Contributor

@rox163 rox163 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the upgrade to 2.8 we also need a small change in .travis.yml. Remove lines 1-5 and replace with this block -

sudo: required
dist: trusty
language: node_js
node_js:
  - '6.9'
  - 'stable'

This would come before the branches statement.
Thanks.

@dafortin
Copy link
Member

dafortin commented Nov 9, 2016

  • We will also need to move to ember-cli-code-coverage@0.3.5 (can be done in the future)
  • Run test on chrome (change testem and .travis.yml)

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 33d920f on quincyle:lts-rework-ob into * on ciena-frost:master*.

1 similar comment
@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 33d920f on quincyle:lts-rework-ob into * on ciena-frost:master*.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling b80e693 on quincyle:lts-rework-ob into * on ciena-frost:master*.

1 similar comment
@coveralls
Copy link

Coverage Status

Changes Unknown when pulling b80e693 on quincyle:lts-rework-ob into * on ciena-frost:master*.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 2b1249d on quincyle:lts-rework-ob into * on ciena-frost:master*.

1 similar comment
@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 2b1249d on quincyle:lts-rework-ob into * on ciena-frost:master*.

@@ -56,7 +56,7 @@ $frost-list-content-border-bottom: 1px;
margin-right: 15px;
background-color: $frost-color-lgrey-1;
}
.container {
.-container {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this supposed to be &-container?

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 6de98ca on quincyle:lts-rework-ob into * on ciena-frost:master*.

1 similar comment
@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 6de98ca on quincyle:lts-rework-ob into * on ciena-frost:master*.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling c9202eb on quincyle:lts-rework-ob into * on ciena-frost:master*.

1 similar comment
@coveralls
Copy link

Coverage Status

Changes Unknown when pulling c9202eb on quincyle:lts-rework-ob into * on ciena-frost:master*.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 62722b2 on quincyle:lts-rework-ob into * on ciena-frost:master*.

1 similar comment
@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 62722b2 on quincyle:lts-rework-ob into * on ciena-frost:master*.

@coveralls
Copy link

coveralls commented Nov 10, 2016

Coverage Status

Changes Unknown when pulling 62722b2 on quincyle:lts-rework-ob into * on ciena-frost:master*.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling e4a4618 on quincyle:lts-rework-ob into * on ciena-frost:master*.

1 similar comment
@coveralls
Copy link

Coverage Status

Changes Unknown when pulling e4a4618 on quincyle:lts-rework-ob into * on ciena-frost:master*.

Copy link
Contributor

@sglanzer-deprecated sglanzer-deprecated left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor stuff on my end, this looks good overall

} = Ember
import computed from 'ember-computed-decorators'
import {normalizeSort, defaultSort} from 'ember-frost-list/utils/utils'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we re-export these utils from the index.js and avoid the path? If they aren't intended to be accessed externally then you can ignore this.

I might also suggest that instead of one generic utils module you would call this utils/sort since it contains sort utils

import FrostListCoreMixin from 'ember-frost-list/mixins/frost-list-core-mixin'

export default Mixin.create(FrostListCoreMixin, {
// == Event =================================================================
// TODO replace defineProperty when there's a public method available
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Raise this as an issue, you can remove the TODO

sortItems (sortProperties) {
const normalizedSortProperties = normalizeSort(sortProperties)
const customSortMethod = get(this, 'listConfig.sorting.client')
const sortMethod = typeof customSortMethod === 'function' ? customSortMethod : defaultSort
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we using prop-types for the sorting.client type? If so, we don't need this check (if not, we probably should use prop-types)

Basically I'm looking for an assertion instead of a silent fallback

{{/if}}
{{component item
model=record
hook=(concat hook '-item-' index)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now you have both :) Maybe remove the concat at this stage?


// slice is used to create a copy of the array so that the sort isn't applied to the original data in store
return Ember.A(items.slice().sort((itemA, itemB) => {
for (let i = 0; i < normalizedSortProperties.length; i++) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason to avoid a forEach?

@sglanzer-deprecated
Copy link
Contributor

sglanzer-deprecated commented Nov 11, 2016

Approved

Approved with PullApprove

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling a9b15a8 on quincyle:lts-rework-ob into * on ciena-frost:master*.

1 similar comment
@coveralls
Copy link

Coverage Status

Changes Unknown when pulling a9b15a8 on quincyle:lts-rework-ob into * on ciena-frost:master*.

@quincyle quincyle merged commit 9781cca into ciena-frost:master Nov 11, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants