Skip to content

Commit

Permalink
Using pia lib v4 (#50)
Browse files Browse the repository at this point in the history
* fix: pia lib v4 plus corrections

* fix: use an observable for getting translations

* fix: testing

* fix: bff path configuration

* fix: displaying buttons in designer
  • Loading branch information
HenryT-CG authored Jan 30, 2024
1 parent e8aef6c commit 7a5a583
Show file tree
Hide file tree
Showing 38 changed files with 414 additions and 554 deletions.
4 changes: 2 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@
"error",
{
"type": "attribute",
"prefix": "tm",
"prefix": "app",
"style": "camelCase"
}
],
"@angular-eslint/component-selector": [
"warn",
{
"type": "element",
"prefix": "tm",
"prefix": "app",
"style": "kebab-case"
}
],
Expand Down
2 changes: 1 addition & 1 deletion angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"schematics": {},
"root": "",
"sourceRoot": "src",
"prefix": "tm",
"prefix": "app",
"architect": {
"build": {
"builder": "ngx-build-plus:browser",
Expand Down
2 changes: 1 addition & 1 deletion nginx/locations.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
location @@APP_BASE_HREF {
location @@APP_BASE_HREFbff {
proxy_pass @@BFF_URL;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $remote_addr;
Expand Down
95 changes: 56 additions & 39 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@
"@ngneat/falso": "^6.4.0",
"@ngx-translate/core": "^14.0.0",
"@ngx-translate/http-loader": "^7.0.0",
"@onecx/accelerator": "^3.7.1",
"@onecx/integration-interface": "^3.7.1",
"@onecx/keycloak-auth": "^3.7.1",
"@onecx/portal-integration-angular": "^3.7.1",
"@onecx/portal-layout-styles": "^3.7.1",
"@onecx/accelerator": "^4.1.2",
"@onecx/integration-interface": "^4.1.2",
"@onecx/keycloak-auth": "^4.1.2",
"@onecx/portal-integration-angular": "^4.1.2",
"@onecx/portal-layout-styles": "^4.1.2",
"file-saver": "^2.0.5",
"i18n-iso-countries": "^7.6.0",
"ngx-color": "^8.0.3",
Expand Down Expand Up @@ -90,7 +90,7 @@
"@swc-node/register": "^1.6.5",
"@swc/cli": "~0.1.63",
"@swc/core": "^1.3.56",
"@swc/helpers": "0.5.1",
"@swc/helpers": "0.5.3",
"@types/jasmine": "~3.10.0",
"@types/node": "18.16.3",
"@typescript-eslint/eslint-plugin": "5.48.2",
Expand Down Expand Up @@ -122,12 +122,12 @@
"ngx-build-plus": "^14.0.0",
"ngx-translate-testing": "^6.1.0",
"postcss": "8.4.23",
"postcss-import": "~15.1.0",
"postcss-import": "~16.0.0",
"postcss-preset-env": "~9.3.0",
"postcss-url": "~10.1.3",
"prettier": "^2.8.8",
"sonarqube-scanner": "^3.3.0",
"style-loader": "^3.3.2",
"style-loader": "^3.3.4",
"stylus": "^0.59.0",
"stylus-loader": "^7.1.0",
"tailwindcss": "3.3.2",
Expand Down
4 changes: 2 additions & 2 deletions proxy.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ const bypassFn = function (req, res) {
}

const PROXY_CONFIG = {
'/theme-bff': {
'/bff': {
target: 'http://onecx-theme-bff',
secure: false,
pathRewrite: {
'^.*/theme-bff': ''
'^.*/bff': ''
},
changeOrigin: true,
logLevel: 'debug',
Expand Down
5 changes: 3 additions & 2 deletions src/app/app.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { NO_ERRORS_SCHEMA } from '@angular/core'
import { TestBed } from '@angular/core/testing'
import { AppComponent } from './app.component'
import { RouterTestingModule } from '@angular/router/testing'
import { NO_ERRORS_SCHEMA } from '@angular/core'

import { AppComponent } from './app.component'

describe('AppComponent', () => {
beforeEach(async () => {
Expand Down
2 changes: 1 addition & 1 deletion src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Component } from '@angular/core'
@Component({
selector: 'tm-root',
selector: 'app-root',
templateUrl: './app.component.html'
})
export class AppComponent {
Expand Down
62 changes: 44 additions & 18 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
@@ -1,35 +1,61 @@
import { APP_INITIALIZER, CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA, NgModule } from '@angular/core'
import { CommonModule } from '@angular/common'
import { HttpClient, HttpClientModule } from '@angular/common/http'
import { RouterModule, Routes } from '@angular/router'
import { BrowserModule } from '@angular/platform-browser'
import { BrowserAnimationsModule } from '@angular/platform-browser/animations'
import { TranslateService } from '@ngx-translate/core'
import { DialogService } from 'primeng/dynamicdialog'
import { Observable } from 'rxjs'
import { TranslateLoader, TranslateModule, TranslateService } from '@ngx-translate/core'

import { APP_CONFIG, PortalCoreModule } from '@onecx/portal-integration-angular'
import {
APP_CONFIG,
AppStateService,
createTranslateLoader,
translateServiceInitializer,
PortalCoreModule,
UserService
} from '@onecx/portal-integration-angular'
import { KeycloakAuthModule } from '@onecx/keycloak-auth'

import { AppComponent } from './app.component'
import { environment } from '../environments/environment'

// standalone app: ensure translations are loaded during app init
function initializer(translate: TranslateService): () => Observable<any> {
console.log('App module initializer')
return () => {
translate.addLangs(['en', 'de'])
const browserLang = translate.getBrowserLang()
return translate.use(browserLang?.match(/en|de/) ? browserLang : 'en')
}
}

const routes: Routes = [{ path: '', pathMatch: 'full' }]
@NgModule({
bootstrap: [AppComponent],
declarations: [AppComponent],
imports: [BrowserModule, KeycloakAuthModule, BrowserAnimationsModule, PortalCoreModule.forRoot('onecx-theme-ui')],
imports: [
CommonModule,
BrowserModule,
HttpClientModule,
KeycloakAuthModule,
BrowserAnimationsModule,
RouterModule.forRoot(routes, {
initialNavigation: 'enabledBlocking',
enableTracing: true
}),
PortalCoreModule.forRoot('onecx-theme-ui'),
TranslateModule.forRoot({
isolate: true,
loader: {
provide: TranslateLoader,
useFactory: createTranslateLoader,
deps: [HttpClient, AppStateService]
}
})
],
providers: [
DialogService,
{ provide: APP_CONFIG, useValue: environment },
{ provide: APP_INITIALIZER, useFactory: initializer, multi: true, deps: [TranslateService] }
{
provide: APP_INITIALIZER,
useFactory: translateServiceInitializer,
multi: true,
deps: [UserService, TranslateService]
}
],
schemas: [NO_ERRORS_SCHEMA, CUSTOM_ELEMENTS_SCHEMA]
})
export class AppModule {}
export class AppModule {
constructor() {
console.info('App Module constructor')
}
}
Loading

0 comments on commit 7a5a583

Please sign in to comment.