Fix pipeline #26
|
@ -3,6 +3,7 @@ pipeline {
|
|||
|
||||
environment {
|
||||
DatabaseUrl = sh(returnStdout: true, script: 'bash /var/lib/jenkins/variables/CureNet/var.sh ${BRANCH_NAME} DatabaseUrl').trim()
|
||||
DatabaseUrlTesting = sh(returnStdout: true, script: 'bash /var/lib/jenkins/variables/CureNet/var.sh test DatabaseUrl').trim()
|
||||
}
|
||||
|
||||
stages {
|
||||
|
@ -58,7 +59,7 @@ pipeline {
|
|||
}
|
||||
}
|
||||
|
||||
stage('Configure') {
|
||||
stage('Configure for tests') {
|
||||
parallel {
|
||||
stage('Frontend') {
|
||||
steps {
|
||||
|
@ -73,8 +74,9 @@ pipeline {
|
|||
steps {
|
||||
dir(path: 'src/backend') {
|
||||
sh 'APP_SECRET=`php8.0 -r "echo md5(\\"branch=${BRANCH_NAME};\\");"` && sed -i "s/APP_SECRET=.*/APP_SECRET=${APP_SECRET}/g" .env'
|
||||
sh 'sed -i "s/DATABASE_URL=.*/DATABASE_URL=${DatabaseUrl}/g" .env.dev'
|
||||
sh 'composer dump-env dev'
|
||||
sh 'sed -i "s/DATABASE_URL=.*/DATABASE_URL=${DatabaseUrlTesting}/g" .env.test'
|
||||
sh 'composer dump-env test'
|
||||
sh 'php bin/console doctrine:schema:update --force';
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -106,6 +108,31 @@ pipeline {
|
|||
}
|
||||
}
|
||||
|
||||
stage('Configure') {
|
||||
parallel {
|
||||
stage('Frontend') {
|
||||
steps {
|
||||
dir(path: 'src/frontend') {
|
||||
sh 'echo skip'
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
stage('Backend') {
|
||||
steps {
|
||||
dir(path: 'src/backend') {
|
||||
sh 'APP_SECRET=`php8.0 -r "echo md5(\\"branch=${BRANCH_NAME};\\");"` && sed -i "s/APP_SECRET=.*/APP_SECRET=${APP_SECRET}/g" .env'
|
||||
sh 'sed -i "s/DATABASE_URL=.*/DATABASE_URL=${DatabaseUrl}/g" .env.dev'
|
||||
sh 'composer dump-env dev'
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
stage('Build') {
|
||||
parallel {
|
||||
stage('Frontend') {
|
||||
|
|
|
@ -4,3 +4,4 @@ APP_SECRET='$ecretf0rt3st'
|
|||
SYMFONY_DEPRECATIONS_HELPER=999999
|
||||
PANTHER_APP_ENV=panther
|
||||
PANTHER_ERROR_SCREENSHOT_DIR=./var/error-screenshots
|
||||
DATABASE_URL="postgresql://db_user:db_password@127.0.0.1:5432/db_name?serverVersion=13&charset=utf8"
|
||||
|
|
|
@ -36,7 +36,7 @@ export class AppComponent {
|
|||
avatar: 'https://www.gravatar.com/avatar/81b206a89f89d5b1123b87606075c6a8?s=514&d=robohash',
|
||||
};
|
||||
|
||||
get isSidebarOpen() {
|
||||
get isSidebarOpen(): boolean {
|
||||
switch (this.sidebarOpen) {
|
||||
case SidebarOpenEnum.Open:
|
||||
return true;
|
||||
|
@ -86,7 +86,7 @@ export class AppComponent {
|
|||
}
|
||||
}
|
||||
|
||||
onThemeChanged(theme: string) {
|
||||
onThemeChanged(theme: string): void {
|
||||
if (theme === undefined) {
|
||||
return;
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ export class AppComponent {
|
|||
this.isDark = theme.indexOf('dark') !== -1;
|
||||
}
|
||||
|
||||
onResize(size: WindowSize) {
|
||||
onResize(size: WindowSize): void {
|
||||
if (size === undefined) {
|
||||
return;
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ export class AppComponent {
|
|||
this.sidebarMode = this.isMobile ? 'over' : 'side';
|
||||
}
|
||||
|
||||
onLangChanged(lang: string) {
|
||||
onLangChanged(lang: string): void {
|
||||
if (lang === undefined) {
|
||||
return;
|
||||
}
|
||||
|
@ -112,12 +112,12 @@ export class AppComponent {
|
|||
this.langControl.setValue(lang);
|
||||
}
|
||||
|
||||
toggleSidebar() {
|
||||
toggleSidebar(): void {
|
||||
this.sidebarOpen = this.isSidebarOpen ? SidebarOpenEnum.Closed : SidebarOpenEnum.Open;
|
||||
this.browserStorageService.setItem('sidebar.open', this.sidebarOpen);
|
||||
}
|
||||
|
||||
onSidebarOpenedChange(opened: boolean) {
|
||||
onSidebarOpenedChange(opened: boolean): void {
|
||||
this.sidebarOpen = opened ? SidebarOpenEnum.Open : SidebarOpenEnum.Closed;
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|||
import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
|
||||
import { TranslateHttpLoader } from '@ngx-translate/http-loader';
|
||||
|
||||
export function HttpLoaderFactory(http: HttpClient) {
|
||||
export function HttpLoaderFactory(http: HttpClient): TranslateHttpLoader {
|
||||
return new TranslateHttpLoader(http, '/assets/lang/', '.json');
|
||||
}
|
||||
|
||||
|
|
|
@ -13,13 +13,14 @@ export class WindowSize {
|
|||
this.isMobile = this.width <= 700;
|
||||
}
|
||||
|
||||
update() {
|
||||
this.width = window.innerWidth;
|
||||
this.height = window.innerHeight;
|
||||
static generate(): WindowSize {
|
||||
return new WindowSize(window.innerWidth, window.innerHeight);
|
||||
}
|
||||
|
||||
static generate() {
|
||||
return new WindowSize(window.innerWidth, window.innerHeight);
|
||||
update(): WindowSize {
|
||||
this.width = window.innerWidth;
|
||||
this.height = window.innerHeight;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -41,29 +42,29 @@ export class AppService {
|
|||
});
|
||||
this.sizeChange.subscribe(size => this.size = size);
|
||||
this.sizeChange.next(WindowSize.generate());
|
||||
let lang = browserStorageService.getItem('language');
|
||||
if (!lang) {
|
||||
lang = this.defaultLang;
|
||||
let language = browserStorageService.getItem('language');
|
||||
if (!language) {
|
||||
language = this.defaultLang;
|
||||
}
|
||||
this.translate.setDefaultLang(this.defaultLang);
|
||||
this.changeLang(lang);
|
||||
this.changeLang(language);
|
||||
fromEvent(window, 'resize').subscribe(e => {
|
||||
this.sizeChange.next(WindowSize.generate());
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
changeLang(lang: string) {
|
||||
changeLang(lang: string): void {
|
||||
if (lang !== this.lang) {
|
||||
this.translate.use(lang);
|
||||
this.langChange.next(lang);
|
||||
}
|
||||
}
|
||||
|
||||
getLang() {
|
||||
getLang(): string {
|
||||
return this.lang;
|
||||
}
|
||||
|
||||
getLangs() {
|
||||
getLangs(): string[] {
|
||||
return [
|
||||
'pl',
|
||||
'en',
|
||||
|
|
|
@ -5,12 +5,13 @@ export class BrowserStorageService {
|
|||
|
||||
private storage: Storage;
|
||||
private namespace: string;
|
||||
|
||||
constructor() {
|
||||
this.storage = localStorage;
|
||||
this.namespace = 'default';
|
||||
}
|
||||
|
||||
setNamespace(namespace: string) {
|
||||
setNamespace(namespace: string): void {
|
||||
this.namespace = namespace;
|
||||
}
|
||||
|
||||
|
@ -18,7 +19,7 @@ export class BrowserStorageService {
|
|||
return namespace ?? this.namespace;
|
||||
}
|
||||
|
||||
setItem(key: string, value: any, namespace: string | null = null) {
|
||||
setItem(key: string, value: any, namespace: string | null = null): void {
|
||||
namespace = this.getNamespace(namespace);
|
||||
const path = `${namespace}.${key}`;
|
||||
this.storage.setItem(path, JSON.stringify(value));
|
||||
|
|
|
@ -21,11 +21,11 @@ export class ThemeService {
|
|||
this.setTheme(userTheme);
|
||||
}
|
||||
|
||||
getTheme() {
|
||||
getTheme(): string {
|
||||
return this.theme;
|
||||
}
|
||||
|
||||
setTheme(theme: string) {
|
||||
setTheme(theme: string): void {
|
||||
if (theme !== this.theme) {
|
||||
this.themeChange.next(theme);
|
||||
document.getElementById('current-theme').setAttribute('href', `/${theme}.css`);
|
||||
|
@ -37,5 +37,5 @@ export class ThemeService {
|
|||
'light',
|
||||
'dark',
|
||||
];
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue