Skip to content

Commit

Permalink
feat: rewrite of the Ember frontend
Browse files Browse the repository at this point in the history
As discussed this my attempt to overcome the burdens of a legacy
application that resisted my attempts to update.
  • Loading branch information
fkm-adfinis committed Oct 15, 2020
1 parent 4123766 commit 7912826
Show file tree
Hide file tree
Showing 316 changed files with 10,039 additions and 11,034 deletions.
4 changes: 0 additions & 4 deletions frontend/.bowerrc

This file was deleted.

14 changes: 14 additions & 0 deletions frontend/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# EditorConfig.org

root = true

[*]
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
indent_style = space
indent_size = 2

[*.{diff,md}]
trim_trailing_whitespace = false
21 changes: 20 additions & 1 deletion frontend/.eslintignore
Original file line number Diff line number Diff line change
@@ -1 +1,20 @@
/blueprints/*/files/**/*.js
# unconventional js
/blueprints/*/files/
/vendor/

# compiled output
/dist/
/tmp/

# dependencies
/bower_components/
/node_modules/

# misc
/coverage/
!.*

# ember-try
/.node_modules.ember-try/
/bower.json.ember-try
/package.json.ember-try
45 changes: 9 additions & 36 deletions frontend/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,39 +1,12 @@
"use strict";

module.exports = {
globals: {
server: true
},
root: true,
parserOptions: {
ecmaVersion: 2017,
sourceType: 'module'
},
parser: 'babel-eslint',
env: {
browser: true
},
plugins: ['ember', 'prettier'],
extends: ['eslint:recommended', 'plugin:ember/recommended', 'prettier'],
extends: "@adfinis-sygroup/eslint-config/ember-app",

rules: {
'prettier/prettier': 'error'
"no-unused-vars": "off",
"prefer-rest-params": "off",
"ember/use-brace-expansion": "off",
"ember/no-get": "off",
},
overrides: [
// node files
{
files: [
'ember-cli-build.js',
'testem.js',
'blueprints/*/index.js',
'config/**/*.js',
'lib/*/index.js'
],
parserOptions: {
sourceType: 'script',
ecmaVersion: 2015
},
env: {
browser: false,
node: true
}
}
]
}
};
24 changes: 13 additions & 11 deletions frontend/.gitignore
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
# See https://help.github.com/ignore-files/ for more about ignoring files.

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

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

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

# ember-try
.node_modules.ember-try/
bower.json.ember-try
package.json.ember-try
/.node_modules.ember-try/
/bower.json.ember-try
/package.json.ember-try
4 changes: 0 additions & 4 deletions frontend/.prettierrc

This file was deleted.

9 changes: 9 additions & 0 deletions frontend/.template-lintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
"use strict";

module.exports = {
extends: "octane",

rules: {
"no-bare-strings": true,
},
};
28 changes: 28 additions & 0 deletions frontend/.travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
language: node_js
node_js:
- "10"

dist: xenial

addons:
chrome: stable

cache:
yarn: true

env:
global:
# See https://git.io/vdao3 for details.
- JOBS=1

branches:
only:
- master

before_install:
- curl -o- -L https://yarnpkg.com/install.sh | bash
- export PATH=$HOME/.yarn/bin:$PATH

script:
- yarn test
2 changes: 1 addition & 1 deletion frontend/.watchmanconfig
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"ignore_dirs": ["tmp", "dist", "node_modules"]
"ignore_dirs": ["node_modules", "tmp", "dist", "build"]
}
47 changes: 47 additions & 0 deletions frontend/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# customer-center

Rewrite of the never release Adfinis customer center.

## Prerequisites

You will need the following things properly installed on your computer.

* [Git](https://git-scm.com/)
* [Node.js](https://nodejs.org/)
* [Yarn](https://yarnpkg.com/)
* [Ember CLI](https://ember-cli.com/)
* [Google Chrome](https://google.com/chrome/)

## Running / Development

* `ember serve`
* Visit your app at [http://localhost:4200](http://localhost:4200).
* Visit your tests at [http://localhost:4200/tests](http://localhost:4200/tests).

### Code Generators

Make use of the many generators for code, try `ember help generate` for more details

### Running Tests

* `ember test`
* `ember test --server`

### Linting

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

### Building

* `ember build` (development)
* `yarn build` (production)

## Further Reading / Useful Links

* [ember.js](https://emberjs.com/)
* [ember-cli](https://ember-cli.com/)
* Development Browser Extensions
* [ember inspector for chrome](https://chrome.google.com/webstore/detail/ember-inspector/bmdblncegkenkacieihfhpjfppoconhi)
* [ember inspector for firefox](https://addons.mozilla.org/en-US/firefox/addon/ember-inspector/)
27 changes: 16 additions & 11 deletions frontend/app/adapters/application.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
import DS from 'ember-data'
import DataAdapterMixin from 'ember-simple-auth/mixins/data-adapter-mixin'

export default DS.JSONAPIAdapter.extend(DataAdapterMixin, {
authorize(xhr) {
if (this.get('session.data.authenticated.data.token')) {
xhr.setRequestHeader(
'X-Authorization',
this.get('session.data.authenticated.data.token')
)
import JSONAPIAdapter from "@ember-data/adapter/json-api";
import { computed } from "@ember/object";
import { inject as service } from "@ember/service";

export default class ApplicationAdapter extends JSONAPIAdapter {
@service session;

@computed("session.data.authenticated.token", "session.isAuthenticated")
get headers() {
const headers = {};

if (this.session.isAuthenticated) {
headers["X-Authorization"] = this.session.data.authenticated.token;
}

return headers;
}
})
}
10 changes: 6 additions & 4 deletions frontend/app/adapters/timed-billing-type.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import TimedAdapter from './timed'
import ApplicationAdapter from "./application";

export default TimedAdapter.extend({
pathForType: () => 'billing-types'
})
export default class TimedBillingTypeAdapter extends ApplicationAdapter {
namespace = "/api/proxy/timed";

pathForType = () => "billing-types";
}
10 changes: 6 additions & 4 deletions frontend/app/adapters/timed-customer.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import TimedAdapter from './timed'
import ApplicationAdapter from "./application";

export default TimedAdapter.extend({
pathForType: () => 'customers'
})
export default class TimedCustomerAdapter extends ApplicationAdapter {
namespace = "/api/proxy/timed";

pathForType = () => "customers";
}
10 changes: 6 additions & 4 deletions frontend/app/adapters/timed-report.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import TimedAdapter from './timed'
import ApplicationAdapter from "./application";

export default TimedAdapter.extend({
pathForType: () => 'reports'
})
export default class TimedReportAdapter extends ApplicationAdapter {
namespace = "/api/proxy/timed";

pathForType = () => "reports";
}
10 changes: 6 additions & 4 deletions frontend/app/adapters/timed-subscription-order.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import TimedAdapter from './timed'
import ApplicationAdapter from "./application";

export default TimedAdapter.extend({
pathForType: () => 'subscription-orders'
})
export default class TimedSubscriptionOrderAdapter extends ApplicationAdapter {
namespace = "/api/proxy/timed";

pathForType = () => "subscription-orders";
}
10 changes: 6 additions & 4 deletions frontend/app/adapters/timed-subscription-package.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import TimedAdapter from './timed'
import ApplicationAdapter from "./application";

export default TimedAdapter.extend({
pathForType: () => 'subscription-packages'
})
export default class TimedSubscriptionPackageAdapter extends ApplicationAdapter {
namespace = "/api/proxy/timed";

pathForType = () => "subscription-packages";
}
10 changes: 6 additions & 4 deletions frontend/app/adapters/timed-subscription-project.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import TimedAdapter from './timed'
import ApplicationAdapter from "./application";

export default TimedAdapter.extend({
pathForType: () => 'subscription-projects'
})
export default class TimedSubscriptionProjectAdapter extends ApplicationAdapter {
namespace = "/api/proxy/timed";

pathForType = () => "subscription-projects";
}
10 changes: 6 additions & 4 deletions frontend/app/adapters/timed-user.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import TimedAdapter from './timed'
import ApplicationAdapter from "./application";

export default TimedAdapter.extend({
pathForType: () => 'users'
})
export default class TimedUserAdapter extends ApplicationAdapter {
namespace = "/api/proxy/timed";

pathForType = () => "users";
}
5 changes: 0 additions & 5 deletions frontend/app/adapters/timed.js

This file was deleted.

Loading

0 comments on commit 7912826

Please sign in to comment.