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 node version #2631

Draft
wants to merge 21 commits into
base: master
Choose a base branch
from
3 changes: 3 additions & 0 deletions .github/workflows/frontend-admin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ on:
- 'frontend-angular/**'
- '.github/workflows/frontend-admin.yml'

env:
NODE_OPTIONS: --openssl-legacy-provider

jobs:
lint:
name: lint
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/frontend-app-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: 22
- uses: rwjblue/setup-volta@v1
- uses: H1D/actions-ember-testing@8ca8da615c2db5889b7fbd3834e4093706754435
- name: Install dependencies
working-directory: ./frontend
run: yarn install
Expand All @@ -31,8 +33,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: 22
- uses: rwjblue/setup-volta@v1
- uses: H1D/actions-ember-testing@8ca8da615c2db5889b7fbd3834e4093706754435
- name: Install dependencies
working-directory: ./frontend
run: yarn install
Expand Down
5 changes: 3 additions & 2 deletions Dockerfile_frontend
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:12 AS build-frontend
FROM node:22 AS build-frontend
ARG FIREBASE_PROJECT_ID
ENV FIREBASE_PROJECT_ID ${FIREBASE_PROJECT_ID:-}
ARG FIREBASE_AUTH_DOMAIN
Expand All @@ -10,9 +10,10 @@ WORKDIR /src
RUN yarn
RUN node node_modules/ember-cli/bin/ember deploy production

FROM node:12 AS build-frontend-angular
FROM node:22 AS build-frontend-angular
COPY frontend-angular/ /src/
WORKDIR /src
ENV NODE_OPTIONS=--openssl-legacy-provider
RUN npm ci
RUN npm run build

Expand Down
5 changes: 3 additions & 2 deletions Dockerfile_frontend_with_tls
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
FROM node:12 AS build-frontend
FROM node:22 AS build-frontend
COPY frontend/ /src/
WORKDIR /src
RUN yarn
RUN node node_modules/ember-cli/bin/ember deploy production

FROM node:12 AS build-frontend-angular
FROM node:22 AS build-frontend-angular
COPY frontend-angular/ /src/
WORKDIR /src
ENV NODE_OPTIONS=--openssl-legacy-provider
RUN npm ci
RUN npm run build

Expand Down
4 changes: 4 additions & 0 deletions frontend-angular/custom-webpack-config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { DefinePlugin } from 'webpack';

export default {
output: {
// ... other configurations
hashFunction: 'sha256',
},
plugins: [
new DefinePlugin({
process: {
Expand Down
7 changes: 4 additions & 3 deletions frontend/app/components/exercise-group.hbs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<a
<LinkTo
class="sm:m-2 m-1 overflow-hidden border-2 border-gray-200 rounded-lg shadow-lg"
{{on "mouseenter" this.mouseEnter}}
{{on "mouseleave" this.mouseLeave}}
href={{href-to "group.series.subgroup" @group.id}}
@route="group.series.subgroup"
@model={{@group.id}}
title={{@group.description}}
>
{{! template-lint-disable no-inline-styles style-concatenation }}
Expand All @@ -25,4 +26,4 @@
{{@group.name}}
</div>
</div>
</a>
</LinkTo>
6 changes: 0 additions & 6 deletions frontend/app/components/link-to/component.js

This file was deleted.

1 change: 0 additions & 1 deletion frontend/app/components/link-to/template.hbs

This file was deleted.

7 changes: 4 additions & 3 deletions frontend/app/components/ui/exercise-button/index.hbs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<a
<LinkTo
class="{{style-namespace "ui/exercise-button"}} {{this.classes}}"
disabled={{not @isAvailable}}
href={{href-to "group.series.subgroup.exercise" @exercise.id}}
@route="group.series.subgroup.exercise"
@model={{@exercise.id}}
title={{concat (t "task_link.exercise") " " @exercise.level}}
...attributes
>
Expand All @@ -16,4 +17,4 @@
@isActive={{this.isActive}}
/>
</div>
</a>
</LinkTo>
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
import Route from '@ember/routing/route';
import { inject as service } from '@ember/service';
import Ember from 'ember';
import Session from 'ember-simple-auth/services/session';
import IntlService from 'ember-intl/services/intl';
import type Transition from '@ember/routing/-private/transition';
// import Session from 'ember-simple-auth/services/session';
// import IntlService from 'ember-intl/services/intl';
// import type Transition from '@ember/routing/-private/transition';

export default class ApplicationRoute extends Route {
@service('session') session!: Session;
@service('intl') intl!: IntlService;
@service('session') session
// !: Session;
@service('intl') intl;
// !: IntlService;

beforeModel() {
async beforeModel() {
await this.session.setup();
const navigatorLanguage = navigator.languages.filter(el => el.includes('-')).map(el => el.toLowerCase())[0];
const rawLocale = localStorage.getItem('locale') || navigatorLanguage;
const locale = rawLocale === 'ru-ru' ? 'ru-ru' : 'en-us';
this.intl.setLocale([locale]);
}

redirect(_: unknown, { to }: Transition) {
redirect(_/* : unknown */, { to }/*: Transition*/) {
if (Ember.testing) {
// skip testing bahavour for now
return;
Expand Down
14 changes: 6 additions & 8 deletions frontend/app/transforms/full-date.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
// eslint-disable-next-line ember/use-ember-data-rfc-395-imports
import DS from 'ember-data';
import { DateTime } from 'luxon';
import { inject as service } from '@ember/service';
import UserDataService from 'brn/services/user-data';
const { DateTransform } = DS;
const FullDate = DateTransform.extend({
userData: service('user-data'),
class FullDate extends DateTransform {
deserialize(serialized: Record<string, never>): DateTime | null {
const locale = (this.userData as unknown as UserDataService).activeLocale as unknown as string
//
const browserLocale = (navigator && navigator.language) || 'en';
return (
(serialized &&
DateTime.fromISO(serialized as unknown as string, { zone: 'utc', locale })) ||
DateTime.fromISO(serialized as unknown as string, { zone: 'utc', locale: browserLocale })) ||
null
);
},
});
}
}

declare module 'ember-data/types/registries/transform' {
export default interface TransformRegistry {
Expand Down
61 changes: 40 additions & 21 deletions frontend/mirage/config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,26 @@
import {
discoverEmberDataModels,
} from 'ember-cli-mirage';
import { createServer } from 'miragejs';


/* eslint-disable @typescript-eslint/no-empty-function */
export default function() {
this.passthrough('/write-coverage');
export default function(config) {

let finalConfig = {
...config,
models: {
...discoverEmberDataModels(config.store),
...config.models
},
routes,
};

return createServer(finalConfig);

}
export function routes() {
this.passthrough('/write-coverage');

// These comments are here to help you get started. Feel free to delete them.

Expand All @@ -24,23 +44,22 @@ export default function() {

https://www.ember-cli-mirage.com/docs/route-handlers/shorthands
*/
this.namespace = 'api'
this.timing = 10;
this.get('/users/current', ()=>{
return {
data: {
firstName: 'First-Name',
lastName: 'Last-Name',
email: 'em@il'
}
}
});
this.get('/v2/statistics/study/week', () => {});
this.get('/v2/statistics/study/year', () => {} );
this.resource('groups');
this.resource('series');
this.resource('exercises');
this.resource('tasks');
this.resource('study-history');

this.namespace = 'api'
this.timing = 10;
this.get('/users/current', ()=>{
return {
data: {
firstName: 'First-Name',
lastName: 'Last-Name',
email: 'em@il'
}
}
});
this.get('/v2/statistics/study/week', () => {});
this.get('/v2/statistics/study/year', () => {} );
this.resource('groups');
this.resource('series');
this.resource('exercises');
this.resource('tasks');
this.resource('study-history');
}
3 changes: 2 additions & 1 deletion frontend/mirage/factories/group.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Factory, trait, } from 'ember-cli-mirage';
import { Factory, trait } from 'miragejs';


export default Factory.extend({
name: (i)=> `Group ${i+1}`,
Expand Down
2 changes: 1 addition & 1 deletion frontend/mirage/models/exercise.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Model, belongsTo, hasMany, } from 'ember-cli-mirage';
import { Model, belongsTo, hasMany, } from 'miragejs';

export default Model.extend({
series: belongsTo(),
Expand Down
2 changes: 1 addition & 1 deletion frontend/mirage/models/group.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Model, hasMany, } from 'ember-cli-mirage';
import { Model, hasMany, } from 'miragejs';

export default Model.extend({
series: hasMany(),
Expand Down
2 changes: 1 addition & 1 deletion frontend/mirage/models/series.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Model, hasMany, belongsTo,} from 'ember-cli-mirage';
import { Model, hasMany, belongsTo,} from 'miragejs';

export default Model.extend({
group: belongsTo(),
Expand Down
2 changes: 1 addition & 1 deletion frontend/mirage/models/task.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Model, belongsTo, } from 'ember-cli-mirage';
import { Model, belongsTo, } from 'miragejs';

export default Model.extend({
exercise: belongsTo(),
Expand Down
4 changes: 2 additions & 2 deletions frontend/mirage/serializers/application.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { RestSerializer, } from 'ember-cli-mirage';
import { EmberDataSerializer } from "ember-cli-mirage";

export default RestSerializer.extend({
export default EmberDataSerializer.extend({
keyForModel:()=>'data',
keyForRelationshipIds:(key)=> key,
keyForForeignKey:(key)=> key,
Expand Down
Loading
Loading