Skip to content
This repository has been archived by the owner on May 13, 2024. It is now read-only.

Commit

Permalink
Merge pull request #710 from adfinis/ember-octane
Browse files Browse the repository at this point in the history
chore: ember octane upgrade
  • Loading branch information
derrabauke authored Dec 23, 2022
2 parents ac8dbd8 + 4d0cb1f commit 374efe4
Show file tree
Hide file tree
Showing 491 changed files with 26,322 additions and 27,329 deletions.
1 change: 0 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

root = true


[*]
end_of_line = lf
charset = utf-8
Expand Down
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
/package.json.ember-try

# template lint ci config
.template-lintrc-ci.js
15 changes: 14 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
"use-strict";

module.exports = {
extends: ["@adfinis-sygroup/eslint-config/ember-app"],
rules: {}
rules: {
"ember/no-actions-hash": "warn",
"ember/no-component-lifecycle-hooks": "warn",
"ember/no-mixins": "warn",
"ember/no-new-mixins": "warn",
"ember/no-classic-classes": "warn",
"ember/no-classic-components": "warn",
"ember/no-get": "warn",
"ember/no-observers": "warn",
"qunit/no-assert-equal": "warn",
"ember/require-tagless-components": "warn",
},
};
13 changes: 11 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,22 @@ jobs:
with:
fetch-depth: 0
persist-credentials: false

- name: Install pnpm
uses: pnpm/[email protected]
with:
version: 7.17.1

- uses: actions/setup-node@v2
with:
node-version: "16"
cache: "pnpm"

- name: Install dependencies
run: yarn install
run: pnpm install

- name: Release on NPM
run: yarn semantic-release
run: pnpm semantic-release
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
40 changes: 19 additions & 21 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
- ember-octane

env:
NODE_VERSION: 14
NODE_VERSION: 16

jobs:
lint:
Expand All @@ -26,23 +26,22 @@ jobs:

steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2

- name: Install pnpm
uses: pnpm/[email protected]
with:
node-version: ${{ env.NODE_VERSION }}
version: 7.17.1

- uses: actions/cache@v2
- uses: actions/setup-node@v2
with:
path: node_modules
key: node-modules-v2-${{ hashFiles('yarn.lock') }}
restore-keys: |
node-modules-v2-${{ hashFiles('yarn.lock') }}
node-modules-v2-
node-version: ${{ env.NODE_VERSION }}
cache: "pnpm"

- name: Install dependencies
run: yarn install
run: pnpm install

- name: Lint ${{ matrix.target }}
run: yarn lint:${{ matrix.target }}
run: pnpm lint:${{ matrix.target }}

test:
name: Tests
Expand All @@ -52,26 +51,25 @@ jobs:

steps:
- uses: actions/checkout@v2

- name: Install pnpm
uses: pnpm/[email protected]
with:
version: 7.17.1

- uses: actions/setup-node@v2
with:
node-version: ${{ env.NODE_VERSION }}
cache: "pnpm"

- uses: actions/cache@v2
with:
path: node_modules
key: node-modules-v2-${{ hashFiles('yarn.lock') }}
restore-keys: |
node-modules-v2-${{ hashFiles('yarn.lock') }}
node-modules-v2-
- name: Install dependencies
run: yarn install
run: pnpm install

- name: Run tests
run: yarn test
run: pnpm test
env:
COVERAGE: true


# TODO enable this again after flaky tests are added back
# - name: Upload coverage report to Codecov
# uses: codecov/codecov-action@v1
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@

# misc
/.sass-cache
/.eslintcache
/connect.lock
/coverage/*
/libpeerconnection.log
npm-debug.log*
yarn-error.log
testem.log
*.swp
*.orig
Expand Down
5 changes: 5 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

# lint commit message
pnpm commitlint --edit $1
4 changes: 2 additions & 2 deletions .husky/pre-commit
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
# skip in CI
[ -n "$CI" ] && exit 0

# lint commit message
yarn commitlint --edit $1
# lint staged files
pnpm lint-staged
22 changes: 22 additions & 0 deletions .template-lintrc-ci.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
"use strict";

module.exports = {
extends: "recommended",
rules: {
// following rules are for temporary use only, delete when ember 4.0 ready
"no-action": "warn",
"no-curly-component-invocation": "warn",
"no-duplicate-id": "warn",
"no-link-to-positional-params": "warn",
"no-link-to-tagname": "warn",
"no-invalid-interactive": "warn",
"no-implicit-this": "warn",
"no-passed-in-event-handlers": "warn",
"no-positional-data-test-selectors": "warn",
"no-unknown-arguments-for-builtin-components": "warn",
"no-with": "warn",
"no-yield-only": "warn",
"require-input-label": "warn",
"require-has-block-helper": "warn",
},
};
5 changes: 0 additions & 5 deletions .template-lintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,4 @@

module.exports = {
extends: "recommended",

rules: {
// https://github.com/ember-template-lint/ember-template-lint/issues/509
"attribute-indentation": false
}
};
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ 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/)
- [pnpm](https://pnpm.io/)
- [Ember CLI](https://ember-cli.com/)
- [Chrome](https://www.google.com/chrome/)
- [Firefox](https://www.mozilla.org/firefox/)
Expand All @@ -24,7 +24,7 @@ Optional:

- `git clone [email protected]/adfinis-sygroup/timed-frontend`
- `cd timed-frontend`
- `yarn`
- `pnpm i`

## Running / Development

Expand All @@ -35,7 +35,7 @@ If you have a running [backend](https://github.com/adfinis-sygroup/timed-backend

- `ember server --proxy=http://localhost:8000`
or
- `yarn start`
- `pnpm start`

If you are using docker-compose you can start a static frontend and the backend by following the instructions in the [backend](https://github.com/adfinis-sygroup/timed-backend)

Expand Down
2 changes: 1 addition & 1 deletion app/abilities/absence-credit.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Ability } from "ember-can";

const AbsenceCreditAbility = Ability.extend({
canEdit: reads("user.isSuperuser"),
canCreate: reads("user.isSuperuser")
canCreate: reads("user.isSuperuser"),
});

export default AbsenceCreditAbility;
2 changes: 1 addition & 1 deletion app/abilities/overtime-credit.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Ability } from "ember-can";

const OvertimeCreditAbility = Ability.extend({
canEdit: reads("user.isSuperuser"),
canCreate: reads("user.isSuperuser")
canCreate: reads("user.isSuperuser"),
});

export default OvertimeCreditAbility;
4 changes: 2 additions & 2 deletions app/abilities/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import { Ability } from "ember-can";
export default Ability.extend({
canAccess: computed(
"user.{activeEmployment.isExternal,isReviewer}",
function() {
function () {
return (
!this.get("user.activeEmployment.isExternal") ||
(this.get("user.activeEmployment.isExternal") &&
this.get("user.isReviewer"))
);
}
)
),
});
9 changes: 6 additions & 3 deletions app/abilities/report.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@ import { Ability } from "ember-can";

export default Ability.extend({
canEdit: computed(
// eslint-disable-next-line ember/use-brace-expansion
"model.user.{id,supervisors}",
"model.verifiedBy.id",
"model.{billed,customerAssignees,projectAssignees,taskAssignees}",
"user.{id,isSuperuser}",
"model.{user.id,user.supervisors,verifiedBy,billed,taskAssignees,projectAssignees,customerAssignees}",
function() {
function () {
const isEditable =
this.get("user.isSuperuser") ||
(!this.get("model.verifiedBy.id") &&
Expand All @@ -23,5 +26,5 @@ export default Ability.extend({
.includes(this.get("user.id")) && !this.get("model.verifiedBy.id");
return isEditable || isReviewer;
}
)
),
});
8 changes: 3 additions & 5 deletions app/abilities/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@ export default Ability.extend({
canRead: computed(
"user.{id,isSuperuser}",
"model.{id,supervisors}",
function() {
function () {
return (
this.get("user.isSuperuser") ||
this.get("user.id") === this.get("model.id") ||
this.get("model.supervisors")
.mapBy("id")
.includes(this.get("user.id"))
this.get("model.supervisors").mapBy("id").includes(this.get("user.id"))
);
}
)
),
});
2 changes: 1 addition & 1 deletion app/adapters/activity-block.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,5 @@ export default ApplicationAdapter.extend({
*/
urlForCreateRecord(...args) {
return `${this._super(...args)}?include=activity`;
}
},
});
16 changes: 11 additions & 5 deletions app/adapters/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
* @submodule timed-adapters
* @public
*/
import DS from "ember-data";
import OIDCAdapterMixin from "ember-simple-auth-oidc/mixins/oidc-adapter-mixin";
import { inject as service } from "@ember/service";
import OIDCJSONAPIAdapter from "ember-simple-auth-oidc/adapters/oidc-json-api-adapter";

/**
* The application adapter
Expand All @@ -14,6 +14,12 @@ import OIDCAdapterMixin from "ember-simple-auth-oidc/mixins/oidc-adapter-mixin";
* @uses EmberSimpleAuthOIDC.OIDCAdapterMixin
* @public
*/
export default DS.JSONAPIAdapter.extend(OIDCAdapterMixin, {
namespace: "api/v1"
});
export default class ApplicationAdapter extends OIDCJSONAPIAdapter {
@service session;

namespace = "api/v1";

get headers() {
return { ...this.session.headers };
}
}
Loading

0 comments on commit 374efe4

Please sign in to comment.