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

Update to the latest Ember v4.7 #113

Draft
wants to merge 11 commits into
base: master
Choose a base branch
from
Draft
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
8 changes: 7 additions & 1 deletion .ember-cli
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,11 @@

Setting `disableAnalytics` to true will prevent any data from being sent.
*/
"disableAnalytics": false
"disableAnalytics": false,

/**
Setting `isTypeScriptProject` to true will force the blueprint generators to generate TypeScript
rather than JavaScript by default, when a TypeScript version of a given blueprint is available.
*/
"isTypeScriptProject": false
}
4 changes: 0 additions & 4 deletions .env-sample
Original file line number Diff line number Diff line change
@@ -1,4 +0,0 @@
API_KEY="**Update this!** Copy this file and save as .env, rewrite this value with Firebase Api Key"
AUTH_DOMAIN="**Update this!** e.g.: your-app.firebaseapp.com"
DATABASE_URL="**Update this!** e.g.: https://some-app.firebaseio.com"
PROJECT_ID="**Update this!** Add your project ID here e.g.: project-12341234"
5 changes: 5 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,13 @@
# misc
/coverage/
!.*
.*/
.eslintcache

# ember-try
/.node_modules.ember-try/
/bower.json.ember-try
/npm-shrinkwrap.json.ember-try
/package.json.ember-try
/package-lock.json.ember-try
/yarn.lock.ember-try
33 changes: 20 additions & 13 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

module.exports = {
root: true,
parser: 'babel-eslint',
Expand All @@ -8,7 +10,7 @@ module.exports = {
legacyDecorators: true,
},
},
plugins: ['ember', 'prettier'],
plugins: ['ember'],
extends: ['plugin:prettier/recommended', 'eslint:recommended', 'plugin:ember/recommended'],
env: {
browser: true,
Expand All @@ -21,14 +23,15 @@ module.exports = {
// node files
{
files: [
'.eslintrc.js',
'.template-lintrc.js',
'ember-cli-build.js',
'testem.js',
'blueprints/*/index.js',
'config/**/*.js',
'lib/*/index.js',
'server/**/*.js',
'./.eslintrc.js',
'./.prettierrc.js.js',
'./.template-lintrc.js',
'./ember-cli-build.js',
'./testem.js',
'./blueprints/*/index.js',
'./config/**/*.js',
'./lib/*/index.js',
'./server/**/*.js',
],
parserOptions: {
sourceType: 'script',
Expand All @@ -38,13 +41,17 @@ module.exports = {
node: true,
},
plugins: ['node'],
rules: Object.assign({}, require('eslint-plugin-node').configs.recommended.rules, {
// add your custom rules and overrides for node files here

extends: ['plugin:node/recommended'],
rules: {
// this can be removed once the following is fixed
// https://github.com/mysticatea/eslint-plugin-node/issues/77
'node/no-unpublished-require': 'off',
}),
},
},
{
// test files
files: ['tests/**/*-test.{js,ts}'],
extends: ['plugin:qunit/recommended'],
},
],
};
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,12 @@ jsconfig.json
# ember-try
/.node_modules.ember-try/
/bower.json.ember-try
/npm-shrinkwrap.json.ember-try
/package.json.ember-try
/package-lock.json.ember-try
/yarn.lock.ember-try

# broccoli-debug
/DEBUG/

.eslintcache
31 changes: 27 additions & 4 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,30 @@
# unconventional js
/blueprints/*/files/
/vendor/

# compiled output
/dist/
/tmp/

# dependencies
/bower_components/
/node_modules/

# misc
/coverage/
!.*
.eslintcache
.lint-todo/

# ember-try
/.node_modules.ember-try/
/bower.json.ember-try
/npm-shrinkwrap.json.ember-try
/package.json.ember-try
/package-lock.json.ember-try
/yarn.lock.ember-try


.firebase
coverage
dist
node_modules
tmp
yarn.lock
firebase.json
4 changes: 0 additions & 4 deletions .prettierrc

This file was deleted.

6 changes: 6 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
'use strict';

module.exports = {
printWidth: 120,
singleQuote: true,
};
2 changes: 1 addition & 1 deletion .template-lintrc.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';

module.exports = {
extends: ['recommended', 'octane'],
extends: 'recommended',
};
8 changes: 2 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ Live demo: [library-app.firebaseapp.com](https://library-app.firebaseapp.com/)

I assume, you have Node.js on your computer. [Node.js installation](http://yoember.com/nodejs/the-best-way-to-install-node-js/)

- Please create an app on [Firebase](http://www.firebase.com) first. You can register there with one click and create a new app. You have to setup this app name in `config/environment.js`. (This will be your own cloud based database.)

- Clone this repository in your project folder

```
Expand All @@ -41,15 +39,13 @@ $ cd library-app
- Install node packages

```
$ npm install
$ yarn install
```

- Copy `.env-sample` file and save as `.env`. Update the `API_KEY` and `PROJECT_ID`.

* Launch the application with Ember server.

```
$ ember server
$ yarn start
```

- Open the application in your browser
Expand Down
4 changes: 1 addition & 3 deletions app/adapters/application.js
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
import RealtimeDatabaseAdapter from 'emberfire/adapters/realtime-database';

export default class ApplicationAdapter extends RealtimeDatabaseAdapter {}
export { default } from 'ember-local-storage/adapters/local';
2 changes: 1 addition & 1 deletion app/app.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Application from '@ember/application';
import Resolver from 'ember-resolver';
import loadInitializers from 'ember-load-initializers';
import config from './config/environment';
import config from 'library-app/config/environment';

export default class App extends Application {
modulePrefix = config.modulePrefix;
Expand Down
6 changes: 3 additions & 3 deletions app/components/abc-buttons.hbs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{{#each this.atoz as |letter|}}
<LinkTo @query={{hash limit="abc" letter=letter}} class="btn btn-outline-secondary">{{letter}}</LinkTo>
{{/each}}
{{#each this.atoz as |letter|}}
<LinkTo @query={{hash limit='abc' letter=letter}} class='btn btn-outline-secondary'>{{letter}}</LinkTo>
{{/each}}
4 changes: 2 additions & 2 deletions app/components/author-select.hbs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<select {{on "change" this.change}} class="form-control">
<select {{on 'change' this.change}} class='form-control'>
{{#each this.authors as |author|}}
<option value={{author.id}} selected={{is-equal author.id this.default.id}}>
{{author.name}}
</option>
{{/each}}
</select>
</select>
39 changes: 22 additions & 17 deletions app/components/library-item-form.hbs
Original file line number Diff line number Diff line change
@@ -1,26 +1,31 @@
<div class="form-horizontal">
<div class="form-group has-feedback {{if @item.isValid "has-success"}}">
<label class="col-sm-2 control-label">Name*</label>
<div class="col-sm-10">
<Input @type="text" @value={{@item.name}} class="form-control" placeholder="The name of the Library" />
{{#if @item.isValid}}<span class="glyphicon glyphicon-ok form-control-feedback"></span>{{/if}}
<div class='form-horizontal'>
<div class='form-group has-feedback {{if @item.isValid "has-success"}}'>
<label class='col-sm-2 control-label'>Name*</label>
<div class='col-sm-10'>
<Input @type='text' @value={{@item.name}} class='form-control' placeholder='The name of the Library' />
{{#if @item.isValid}}<span class='glyphicon glyphicon-ok form-control-feedback'></span>{{/if}}
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">Address</label>
<div class="col-sm-10">
<Input @type="text" @value={{@item.address}} class="form-control" placeholder="The address of the Library" />
<div class='form-group'>
<label class='col-sm-2 control-label'>Address</label>
<div class='col-sm-10'>
<Input @type='text' @value={{@item.address}} class='form-control' placeholder='The address of the Library' />
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">Phone</label>
<div class="col-sm-10">
<Input @type="text" @value={{@item.phone}} class="form-control" placeholder="The phone number of the Library" />
<div class='form-group'>
<label class='col-sm-2 control-label'>Phone</label>
<div class='col-sm-10'>
<Input @type='text' @value={{@item.phone}} class='form-control' placeholder='The phone number of the Library' />
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-primary" {{on 'click' (fn this.buttonClicked @item)}} disabled={{unless @item.isValid true}}>{{@buttonLabel}}</button>
<div class='form-group'>
<div class='col-sm-offset-2 col-sm-10'>
<button
type='submit'
class='btn btn-primary'
{{on 'click' (fn this.buttonClicked @item)}}
disabled={{unless @item.isValid true}}
>{{@buttonLabel}}</button>
</div>
</div>
</div>
19 changes: 9 additions & 10 deletions app/components/library-item.hbs
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
<div class="card h-100">
<div class="card-header">
<div class='card h-100'>
<div class='card-header'>
{{@item.name}}
</div>
<div class="card-body">
<p class="card-text">Address: {{@item.address}}</p>
<p class="card-text">Phone: {{@item.phone}}</p>
<div class='card-body'>
<p class='card-text'>Address: {{@item.address}}</p>
<p class='card-text'>Phone: {{@item.phone}}</p>
</div>
<div class="card-footer">
<div class='card-footer'>
Number of books:
<span class="text-left badge">
<span class='text-left badge'>
{{@badge}}
</span>
<span class="pull-right">
<span class='pull-right'>
{{yield}}
</span>
</div>
</div>

</div>
4 changes: 2 additions & 2 deletions app/components/library-select.hbs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<select {{on "change" this.change}} class="form-control">
<select {{on 'change' this.change}} class='form-control'>
{{#each this.libraries as |library|}}
<option value={{library.id}} selected={{is-equal library.id this.default.id}}>
{{library.name}}
</option>
{{/each}}
</select>
</select>
10 changes: 5 additions & 5 deletions app/components/number-box.hbs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="card bg-info text-white">
<div class="card-body">
<h3 class="text-center">{{@title}}</h3>
<h1 class="text-center">{{if @number @number "..."}}</h1>
<div class='card bg-info text-white'>
<div class='card-body'>
<h3 class='text-center'>{{@title}}</h3>
<h1 class='text-center'>{{if @number @number '...'}}</h1>
</div>
</div>
</div>
31 changes: 20 additions & 11 deletions app/components/seeder-block.hbs
Original file line number Diff line number Diff line change
@@ -1,22 +1,31 @@
<div class="well well-sm extra-padding-bottom">
<div class='well well-sm extra-padding-bottom'>
<h3>{{@sectionTitle}}</h3>
<div class="form-inline">
<div class="form-group has-feedback {{unless this.isCounterValid "has-error"}}">
<label class="control-label">Number of new records:</label>
<Input @value={{this.counter}} class="form-control" placeholder={{this.placeholder}} />
<div class='form-inline'>
<div class='form-group has-feedback {{unless this.isCounterValid "has-error"}}'>
<label class='control-label'>Number of new records:</label>
<Input @value={{this.counter}} class='form-control' placeholder={{this.placeholder}} />
</div>
<button class="btn btn-primary" {{on 'click' this.generate}} disabled={{this.generateIsDisabled}} type="button">
<button class='btn btn-primary' {{on 'click' this.generate}} disabled={{this.generateIsDisabled}} type='button'>
{{#if @seedingInProgress}}
<span class="glyphicon glyphicon-refresh spinning"></span> Generating...
<span class='glyphicon glyphicon-refresh spinning'></span>
Generating...
{{else}}
Generate {{@sectionTitle}}
Generate
{{@sectionTitle}}
{{/if}}
</button>
<button class="btn btn-danger pull-right" {{on 'click' this.delete}} disabled={{this.deleteIsDisabled}} type="button">
<button
class='btn btn-danger pull-right'
{{on 'click' this.delete}}
disabled={{this.deleteIsDisabled}}
type='button'
>
{{#if @deletingInProgress}}
<span class="glyphicon glyphicon-refresh spinning"></span> Deleting...
<span class='glyphicon glyphicon-refresh spinning'></span>
Deleting...
{{else}}
Delete All {{@sectionTitle}}
Delete All
{{@sectionTitle}}
{{/if}}
</button>
</div>
Expand Down
6 changes: 3 additions & 3 deletions app/components/seeder-block.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Component from '@glimmer/component';
import { action } from '@ember/object';
import { lte, not, or } from '@ember/object/computed';
import { inject as service } from '@ember/service';
import { service } from '@ember/service';
import { tracked } from '@glimmer/tracking';
import classic from 'ember-classic-decorator';

Expand All @@ -24,12 +24,12 @@ export default class SeederBlockComponent extends Component {
@action
generate() {
if (this.counter && this.isCounterValid) {
this.seederTask.perform(this.counter);
this.args.seederTask.perform(this.counter);
}
}

@action
delete() {
this.destroyerTask.perform();
this.args.destroyerTask.perform();
}
}
Loading