Skip to content

Commit

Permalink
Merge pull request #2255 from kanselarij-vlaanderen/feature/ember-upg…
Browse files Browse the repository at this point in the history
…rade-attempt

Feature/ember upgrade attempt to v5.0.0
  • Loading branch information
ValenberghsSven authored Nov 28, 2024
2 parents 054812f + 9a051ba commit 49abad4
Show file tree
Hide file tree
Showing 25 changed files with 9,224 additions and 5,745 deletions.
9 changes: 1 addition & 8 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,20 +1,13 @@
# unconventional js
/blueprints/*/files/
/vendor/

# compiled output
/dist/
/tmp/

# dependencies
/bower_components/
/node_modules/

# misc
/coverage/
!.*
.*/
.eslintcache

# ember-try
/.node_modules.ember-try/
Expand All @@ -23,4 +16,4 @@
/package.json.ember-try

# Jenkins-setup
.cache
.cache
47 changes: 47 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: CI

on:
push:
branches:
- main
- master
pull_request: {}

concurrency:
group: ci-${{ github.head_ref || github.ref }}
cancel-in-progress: true

jobs:
lint:
name: "Lint"
runs-on: ubuntu-latest
timeout-minutes: 10

steps:
- uses: actions/checkout@v3
- name: Install Node
uses: actions/setup-node@v3
with:
node-version: 16
cache: npm
- name: Install Dependencies
run: npm ci
- name: Lint
run: npm run lint

test:
name: "Test"
runs-on: ubuntu-latest
timeout-minutes: 10

steps:
- uses: actions/checkout@v3
- name: Install Node
uses: actions/setup-node@v3
with:
node-version: 16
cache: npm
- name: Install Dependencies
run: npm ci
- name: Run Tests
run: npm test
8 changes: 0 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,28 +1,20 @@
# See https://help.github.com/ignore-files/ for more about ignoring files.

# compiled output
/dist/
/tmp/

# dependencies
/bower_components/
/node_modules/

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

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

Expand Down
11 changes: 2 additions & 9 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,25 +1,18 @@
# 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

/app/utils/cabinet-submission-email.js
/app/utils/cabinet-submission-email.js
2 changes: 1 addition & 1 deletion .watchmanconfig
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"ignore_dirs": ["tmp", "dist"]
"ignore_dirs": ["dist"]
}
4 changes: 2 additions & 2 deletions app/adapters/agendaitem.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ export default ApplicationAdapter.extend({
findHasMany(store, snapshot, url, relationship) {
let newUrl = url;
// Workaround for Ember Data not taking paging into account when fetching a hasMany
if (relationship.meta.key === 'pieces') {
if (relationship.key === 'pieces') {
newUrl += '?page[size]=999';
}
if (relationship.meta.key === 'linkedPieces') {
if (relationship.key === 'linkedPieces') {
newUrl += '?page[size]=999';
}
return this._super(store, snapshot, newUrl, relationship);
Expand Down
2 changes: 1 addition & 1 deletion app/adapters/news-item.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default ApplicationAdapter.extend({
findHasMany(store, snapshot, url, relationship) {
let newUrl = url;
// Workaround for Ember Data not taking paging into account when fetching a hasMany
if (relationship.meta.key === 'pieces') {
if (relationship.key === 'pieces') {
newUrl += '?page[size]=9999';
}
return this._super(store, snapshot, newUrl, relationship);
Expand Down
4 changes: 2 additions & 2 deletions app/adapters/subcase.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ export default ApplicationAdapter.extend({
let newUrl = url;
// Workaround for Ember Data not taking paging into account when fetching a hasMany
// subcase no longer have pieces, this comes from submission-activities
if (relationship.meta.key === 'pieces') {
if (relationship.key === 'pieces') {
newUrl += '?page[size]=9999';
}
if (relationship.meta.key === 'linkedPieces') {
if (relationship.key === 'linkedPieces') {
newUrl += '?page[size]=9999';
}
return this._super(store, snapshot, newUrl, relationship);
Expand Down
4 changes: 2 additions & 2 deletions app/adapters/submission.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ export default ApplicationAdapter.extend({
findHasMany(store, snapshot, url, relationship) {
let newUrl = url;
// Workaround for Ember Data not taking paging into account when fetching a hasMany
if (relationship.meta.key === 'pieces') {
if (relationship.key === 'pieces') {
newUrl += '?page[size]=999';
}
if (relationship.meta.key === 'statusChangeActivities') {
if (relationship.key === 'statusChangeActivities') {
newUrl += '?page[size]=999';
}
return this._super(store, snapshot, newUrl, relationship);
Expand Down
3 changes: 1 addition & 2 deletions app/components/m-header.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import { tracked } from '@glimmer/tracking';
import Component from '@glimmer/component';
import { task } from 'ember-concurrency';
import CONSTANTS from 'frontend-kaleidos/config/constants';
import { isEnabledImpersonation } from 'frontend-kaleidos/utils/feature-flag';
import { isEnabledCabinetSubmissions } from 'frontend-kaleidos/utils/feature-flag';
import { isEnabledImpersonation, isEnabledCabinetSubmissions } from 'frontend-kaleidos/utils/feature-flag';

const environmentNames = {
localhost: 'LOCAL',
Expand Down
4 changes: 0 additions & 4 deletions app/errors/modified-old-data-error.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
import EmberError from '@ember/error';

class ModifiedOldDataError {
constructor(errors, message = 'This error is result of my custom logic.') {
EmberError.call(this, message);

this.errors = errors || [
{
title: 'You tried to save old data.',
Expand Down
4 changes: 2 additions & 2 deletions app/models/concept-scheme.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default class ConceptSchemeModel extends Model {
@attr uri;
@attr label;

@hasMany('concept', { inverse: 'conceptSchemes', async: true }) concepts;
@hasMany('concept', { inverse: 'topConceptSchemes', async: true })
@hasMany('concept', { inverse: 'conceptSchemes', async: true, polymorphic: true, as: 'concept-scheme' }) concepts;
@hasMany('concept', { inverse: 'topConceptSchemes', async: true, polymorphic: true, as: 'concept-scheme' })
topConcepts;
}
8 changes: 4 additions & 4 deletions app/models/concept.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ export default class Concept extends Model {

// The idea behind also using broader is because ember was automatically connecting the broader parent under the narrower relation
// Resulting in all concepts with 1 inverse narrower to break length == 0 checks on narrower
@belongsTo('concept', { inverse: 'narrower', async: true }) broader;
@belongsTo('concept', { inverse: 'narrower', async: true, as: 'concept', polymorphic: true }) broader;

@hasMany('concept', { inverse: 'broader', async: true }) narrower;
@hasMany('concept-scheme', { inverse: 'concepts', async: true })
@hasMany('concept', { inverse: 'broader', async: true, as: 'concept', polymorphic: true }) narrower;
@hasMany('concept-scheme', { inverse: 'concepts', async: true, as: 'concept', polymorphic: false })
conceptSchemes;
@hasMany('concept-scheme', { inverse: 'topConcepts', async: true })
@hasMany('concept-scheme', { inverse: 'topConcepts', async: true, as: 'concept', polymorphic: false })
topConceptSchemes;
}
2 changes: 1 addition & 1 deletion app/models/document-container.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default class DocumentContainerModel extends Model {
@attr('number') position;
@attr('datetime') created;

@belongsTo('concept', { inverse: null, async: true, polymorphic: true }) type;
@belongsTo('document-type', { inverse: null , async: true, polymorphic: true }) type;

@hasMany('piece', {
inverse: 'documentContainer',
Expand Down
2 changes: 1 addition & 1 deletion app/models/document-type.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { hasMany } from '@ember-data/model';
import Concept from './concept';
export default class DocumentType extends Concept {
@hasMany('document', { inverse: null, async: true }) documents;
@hasMany('document-container', {inverse: 'type', async: true}) documents;
}
3 changes: 1 addition & 2 deletions app/routes/cases/submissions/submission.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import Route from '@ember/routing/route';
import { inject as service } from '@ember/service';
import CONSTANTS from 'frontend-kaleidos/config/constants';
import { sortPieces } from 'frontend-kaleidos/utils/documents';
import { sortPieces, containsConfidentialPieces } from 'frontend-kaleidos/utils/documents';
import { TrackedArray } from 'tracked-built-ins';
import { containsConfidentialPieces } from 'frontend-kaleidos/utils/documents';

export default class CasesSubmissionsSubmissionRoute extends Route {
@service currentSession;
Expand Down
3 changes: 2 additions & 1 deletion app/services/agenda-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ export default class AgendaService extends Service {
}

createInternalReview = async(subcase, submissions, privateComment) => {
const submissionsToSet = submissions || await subcase?.submissions;
const subcaseSubmissions = await subcase?.submissions;
const submissionsToSet = submissions || subcaseSubmissions;
const internalReview = await this.store.createRecord('submission-internal-review', {
created: new Date(),
privateComment: privateComment, // default to the CONSTANTS? diff between nota and mededeling somewhere?
Expand Down
3 changes: 1 addition & 2 deletions app/services/responsive.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import Service from '@ember/service';
import { run } from '@ember/runloop';
import { classify, dasherize } from '@ember/string';
import { classify, dasherize, camelize } from '@ember/string';
import Evented from '@ember/object/evented';
import { tracked, TrackedObject } from 'tracked-built-ins';
import { camelize } from '@ember/string';
import { BREAKPOINTS } from 'frontend-kaleidos/config/config';

export default class ResponsiveService extends Service.extend(Evented) {
Expand Down
3 changes: 2 additions & 1 deletion app/services/store.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Store from '@ember-data/store';
/* eslint-disable ember/use-ember-data-rfc-395-imports */
import Store from 'ember-data/store';
import ArrayProxy from '@ember/array/proxy';

export default class ExtendedStoreService extends Store {
Expand Down
Loading

0 comments on commit 49abad4

Please sign in to comment.