Skip to content

Upgrade ember 2.18->3.4 #604

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

Merged
merged 1 commit into from
Apr 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# unconventional js
/blueprints/*/files/
/vendor/

# compiled output
/dist/
/tmp/

# dependencies
/bower_components/

# misc
/coverage/

# ember-try
/.node_modules.ember-try/
/bower.json.ember-try
/package.json.ember-try
10 changes: 1 addition & 9 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ module.exports = {
// node files
{
files: [
'.template-lintrc.js',
'ember-cli-build.js',
'testem.js',
'blueprints/*/index.js',
Expand All @@ -38,15 +39,6 @@ module.exports = {
browser: false,
node: true
}
},

// test files
{
files: ['tests/**/*.js'],
excludedFiles: ['tests/dummy/**/*.js'],
env: {
embertest: true
}
}
]
};
21 changes: 13 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,22 @@ terraform.tfstate.backup
.envrc

# compiled output
/dist
/tmp
/dist/
/tmp/

# dependencies
/node_modules
/bower_components
/bower_components/
/node_modules/

# misc
/.projectile
/.sass-cache
/connect.lock
/coverage/*
/coverage/
/libpeerconnection.log
npm-debug.log*
yarn-error.log
testem.log
/npm-debug.log*
/testem.log
/yarn-error.log

public/json-docs/
public/rev-index/
Expand All @@ -36,3 +36,8 @@ package-lock.json
browserstack-local.pid
local.log
.vscode/

# ember-try
/.node_modules.ember-try/
/bower.json.ember-try
/package.json.ember-try
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,13 @@ To run a11y tests, run `test_a11y=yes ember serve`
## Staging Environment
Latest changes from master can be seen on https://ember-api-docs-frontend-staging.global.ssl.fastly.net/

---
### Linting

* `yarn run lint:hbs`
* `yarn run lint:js`
* `yarn run lint:js -- --fix`

### Building

Cross-browser testing provided by:

Expand Down
10 changes: 5 additions & 5 deletions app/adapters/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,17 @@ export default JSONAPIAdapter.extend({

async findRecord(store, {modelName}, id) {
let url;
let host = this.get('host');
let projectName = this.get('currentProject');
let host = this.host;
let projectName = this.currentProject;

if (['namespace', 'class', 'module'].indexOf(modelName) > -1) {
let [version] = id.replace(`${projectName}-`, '').split('-');
let revId = this.get('metaStore').getRevId(projectName, version, modelName, id);
let revId = this.metaStore.getRevId(projectName, version, modelName, id);

let modelNameToUse = modelName;
// To account for namespaces that are also classes but not defined properly in yuidocs
if (isBlank(revId) && modelNameToUse === 'class') {
revId = this.get('metaStore').getRevId(projectName, version, 'namespace', id);
revId = this.metaStore.getRevId(projectName, version, 'namespace', id);
modelNameToUse = 'namespace';
}

Expand All @@ -42,7 +42,7 @@ export default JSONAPIAdapter.extend({
}
} else if (modelName === 'missing') {
let version = this.get('projectService.version');
let revId = this.get('metaStore').getRevId(projectName, version, modelName, id);
let revId = this.metaStore.getRevId(projectName, version, modelName, id);
url = `json-docs/${projectName}/${version}/${pluralize(modelName)}/${revId}`;
} else if (modelName === 'project') {
this.set('currentProject', id);
Expand Down
8 changes: 4 additions & 4 deletions app/components/api-index-filter.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { computed } from '@ember/object';
import Component from '@ember/component';
import sortBy from 'npm:lodash.sortby';
import sortBy from 'lodash.sortby';

const filterDataComputedParams = 'filterData.{showInherited,showProtected,showPrivate,showDeprecated}';

Expand Down Expand Up @@ -43,9 +43,9 @@ export default Component.extend({

filteredData: computed('filteredMethods', 'filteredProperties', 'filteredEvents', function() {
return {
methods: this.get('filteredMethods'),
properties: this.get('filteredProperties'),
events: this.get('filteredEvents')
methods: this.filteredMethods,
properties: this.filteredProperties,
events: this.filteredEvents
};
}),

Expand Down
2 changes: 1 addition & 1 deletion app/components/class-field-description.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default Component.extend({
legacyModuleMappings: service(),

hasImportExample: computed('field.{name,class}', function () {
return this.get('legacyModuleMappings').hasFunctionMapping(this.get('field.name'), this.get('field.class'));
return this.legacyModuleMappings.hasFunctionMapping(this.get('field.name'), this.get('field.class'));
}),

stickyEnabled: gt('ownHeight', 200),
Expand Down
2 changes: 1 addition & 1 deletion app/components/ember-anchor.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default AnchorComponent.extend({

// This overrides Ember Anchor to support scrolling within a fixed position element
_scrollToElemPosition() {
let qp = this.get('anchorQueryParam');
let qp = this.anchorQueryParam;
let qpVal = this.get(get(this, 'attrs.a') ? 'a' : `controller.${qp}`);
let elem = $(`[data-${qp}="${qpVal}"]`);
let offset = elem.offset() ? elem.offset().top : 0;
Expand Down
4 changes: 2 additions & 2 deletions app/components/search-input.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default Component.extend({
if (get(this, 'searchService.search.isRunning')) {
return false;
}
return isPresent(get(this, 'query')) && isEmpty(get(this, 'searchService.results'));
return isPresent(this.query) && isEmpty(get(this, 'searchService.results'));
}),

search: task(function * (query) {
Expand Down Expand Up @@ -66,7 +66,7 @@ export default Component.extend({
},

onblur() {
this.get('closeMenu').perform();
this.closeMenu.perform();
}

}
Expand Down
2 changes: 1 addition & 1 deletion app/components/search-input/dropdown-result.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default Component.extend({
}),
// Left sidebar should only be displayed for the first result in the group
_primaryColumn: computed('groupPosition,groupName', function () {
const { groupName, groupPosition } = this.getProperties('groupName', 'groupPosition');
const { groupName, groupPosition } = this;
return groupPosition === 0? groupName : '';
}),
isSecondary: gt('groupPosition', 0)
Expand Down
2 changes: 1 addition & 1 deletion app/components/search-input/dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default Component.extend({
return {};
}

const lvl0Group = get(this, 'results').reduce((previous, current) => {
const lvl0Group = this.results.reduce((previous, current) => {
// Remap all lowercase usages of 'guides' to 'Guides'
let lvl0 = get(current, 'hierarchy.lvl0');
// If lvl0 doesn't exist in the resulting object, create the array
Expand Down
18 changes: 9 additions & 9 deletions app/controllers/project-version.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import { computed } from '@ember/object';
import { alias, readOnly } from '@ember/object/computed';
import { A } from '@ember/array';
import { inject as service } from '@ember/service';
import values from 'npm:lodash.values';
import groupBy from 'npm:lodash.groupby';
import semverCompare from 'npm:semver-compare';
import values from 'lodash.values';
import groupBy from 'lodash.groupby';
import semverCompare from 'semver-compare';
import getCompactVersion from '../utils/get-compact-version';

export default Controller.extend({
Expand Down Expand Up @@ -48,28 +48,28 @@ export default Controller.extend({
},

getRelations(relationship) {
return this.get('model').hasMany(relationship).ids().sort();
return this.model.hasMany(relationship).ids().sort();
},

getRelationshipIDs(relationship) {
const splitPoint = 2 + this.get('model.project.id').split('-').length - 1;
const classes = this.get('model').hasMany(relationship);
const classes = this.model.hasMany(relationship);
const sorted = A(classes.ids()).sort();
//ids come in as ember-2.16.0-@ember/object/promise-proxy-mixin
//so we take the string after the 2nd '-'
return A(sorted).toArray().map(id => id.split('-').slice(splitPoint).join('-'));
},

shownClassesIDs: computed('showPrivateClasses', 'classesIDs', 'publicClassesIDs', function() {
return this.get('showPrivateClasses') ? this.get('classesIDs') : this.get('publicClassesIDs');
return this.showPrivateClasses ? this.classesIDs : this.publicClassesIDs;
}),

shownModuleIDs: computed('showPrivateClasses', 'moduleIDs', 'publicModuleIDs', function() {
return this.get('showPrivateClasses') ? this.get('moduleIDs') : this.get('publicModuleIDs');
return this.showPrivateClasses ? this.moduleIDs : this.publicModuleIDs;
}),

shownNamespaceIDs: computed('showPrivateClasses', 'namespaceIDs', 'publicNamespaceIDs', function() {
return this.get('showPrivateClasses') ? this.get('namespaceIDs') : this.get('publicNamespaceIDs');
return this.showPrivateClasses ? this.namespaceIDs : this.publicNamespaceIDs;
}),

projectVersions: computed('metaStore.availableProjectVersions', 'model.project.id', function() {
Expand All @@ -88,7 +88,7 @@ export default Controller.extend({
urlVersion: alias('project.urlVersion'),

selectedProjectVersion:computed('projectVersions.[]', 'model.version', function() {
return this.get('projectVersions').filter(pV => pV.id === this.get('model.version'))[0];
return this.projectVersions.filter(pV => pV.id === this.get('model.version'))[0];
}),

activeProject: readOnly('model.project.id')
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/project-version/classes/class.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ export default Controller.extend(ParentNameMixin, FilterParams, {
legacyModuleMappings: service(),

hasImportExample: computed('model.name', 'legacyModuleMappings.mappings', function () {
return this.get('legacyModuleMappings').hasClassMapping(this.get('model.name'), this.get('model.module'));
return this.legacyModuleMappings.hasClassMapping(this.get('model.name'), this.get('model.module'));
}),

module: computed('model.name', 'legacyModulemappings.mappings', function () {
return this.get('legacyModuleMappings').getModule(this.get('model.name'), this.get('model.module'));
return this.legacyModuleMappings.getModule(this.get('model.name'), this.get('model.module'));
}),

actions: {
Expand Down
12 changes: 6 additions & 6 deletions app/controllers/project-version/modules/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { alias } from '@ember/object/computed';
import { computed } from '@ember/object';
import { inject as service } from '@ember/service';
import ClassController from '../classes/class';
import uniq from 'npm:lodash.uniq';
import union from 'npm:lodash.union';
import uniq from 'lodash.uniq';
import union from 'lodash.union';

export default ClassController.extend({
filterData: service(),
Expand All @@ -18,18 +18,18 @@ export default ClassController.extend({
}),

classes: computed('model', 'showPrivateClasses', function() {
if (this.get('showPrivateClasses')) {
if (this.showPrivateClasses) {
return this.get('model.publicclasses').concat(this.get('model.privateclasses'));
}
return this.get('model.publicclasses');
}),

classesAndNamespaces: computed('classes', 'namespaces', function () {
return uniq(union(this.get('namespaces'), this.get('classes')).sort(), true);
return uniq(union(this.namespaces, this.classes).sort(), true);
}),

functionHeadings: computed('model', 'showPrivateClasses', function () {
if (this.get('model.allstaticfunctions') && this.get('showPrivateClasses')) {
if (this.get('model.allstaticfunctions') && this.showPrivateClasses) {
return Object.keys(this.get('model.allstaticfunctions')).sort();
} else if (this.get('model.staticfunctions')) {
return Object.keys(this.get('model.staticfunctions')).sort();
Expand All @@ -38,7 +38,7 @@ export default ClassController.extend({
}),

functions: computed('model', 'showPrivateClasses', function () {
if (this.get('showPrivateClasses') && this.get('model.allstaticfunctions')) {
if (this.showPrivateClasses && this.get('model.allstaticfunctions')) {
return this.get('model.allstaticfunctions');
}
return this.get('model.staticfunctions');
Expand Down
2 changes: 1 addition & 1 deletion app/mixins/parent-name.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default Mixin.create({

routeName: readOnly('router.currentRouteName'),
parentName: computed('routeName', function() {
const routeName = this.get('routeName');
const routeName = this.routeName;
const routes = routeName.split('.');
return routes.slice(0, 3).join('.');
})
Expand Down
4 changes: 2 additions & 2 deletions app/mixins/scroll-tracker.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default Mixin.create({

actions: {
willTransition(transition) {
this.get('scrollPositionReset').scheduleReset(transition);
this.scrollPositionReset.scheduleReset(transition);
},

didTransition() {
Expand All @@ -22,7 +22,7 @@ export default Mixin.create({
return;
}
}
this.get('scrollPositionReset').doReset();
this.scrollPositionReset.doReset();
}
}
});
4 changes: 2 additions & 2 deletions app/models/class.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const projectNameFromClassName = key => {
const guessVersionFor = key => {
return computed(key, 'project.id', function() {

if (this.get('extendedClassProjectName') === this.get('project.id')) {
if (this.extendedClassProjectName === this.get('project.id')) {
return this.get('projectVersion.version');
}

Expand All @@ -46,7 +46,7 @@ export default DS.Model.extend({
parentClass: belongsTo('class', {async: true, inverse: null}),
projectVersion: belongsTo('project-version', {inverse: 'classes'}),
project: computed('projectVersion.id', function() {
return this.get('projectVersion').get('project');
return this.projectVersion.get('project');
}),

extendedClassProjectName: projectNameFromClassName('extends'),
Expand Down
2 changes: 1 addition & 1 deletion app/models/project-version.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ export default DS.Model.extend({
'private-namespaces': DS.hasMany('namespace', {async: true}),
project: DS.belongsTo('project'),
compactVersion: computed('version', function() {
return getCompactVersion(this.get('version'));
return getCompactVersion(this.version);
})
});
4 changes: 2 additions & 2 deletions app/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ const AppRouter = Router.extend({
}

scheduleOnce('afterRender', this, () => {
const page = this.get('url');
const page = this.url;
const title = this.getWithDefault('currentRouteName', 'unknown');

// this is constant for this app and is only used to identify page views in the GA dashboard
const hostname = config.APP.domain.replace(/(http|https)?:?\/\//g, '');

this.get('metrics').trackPage({ page, title, hostname });
this.metrics.trackPage({ page, title, hostname });
});
}
});
Expand Down
2 changes: 1 addition & 1 deletion app/routes/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export default Route.extend({
},
async afterModel() {
set(this, 'headData.cdnDomain', ENV.API_HOST);
await this.get('legacyModuleMappings').initMappings();
await this.legacyModuleMappings.initMappings();
return this._super(...arguments);
}

Expand Down
Loading