environment fix
parent
33c4608152
commit
035ebaf6a7
|
|
@ -43,7 +43,7 @@
|
|||
{
|
||||
"type": "anyComponentStyle",
|
||||
"maximumWarning": "2kb",
|
||||
"maximumError": "4kb"
|
||||
"maximumError": "6kb"
|
||||
}
|
||||
],
|
||||
"fileReplacements": [
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@
|
|||
"@angular/platform-browser-dynamic": "^16.0.0",
|
||||
"@angular/router": "^16.0.0",
|
||||
"@syncfusion/ej2-angular-gantt": "^26.2.4",
|
||||
"@syncfusion/ej2-material-theme": "^26.2.4",
|
||||
"jquery": "^3.6.1",
|
||||
"moment": "^2.29.4",
|
||||
"rxjs": "^7.8.0",
|
||||
|
|
@ -5111,12 +5110,6 @@
|
|||
"@syncfusion/ej2-popups": "~26.2.5"
|
||||
}
|
||||
},
|
||||
"node_modules/@syncfusion/ej2-material-theme": {
|
||||
"version": "26.2.7",
|
||||
"resolved": "https://registry.npmjs.org/@syncfusion/ej2-material-theme/-/ej2-material-theme-26.2.7.tgz",
|
||||
"integrity": "sha512-UeUBuUmAfiTr5UUJwlpbhTf0gDZDTbp1qpayhu3BeZeT9YThju0PkZW95cYxgzOfmdn06SVUxbFqOjIWL7IWbg==",
|
||||
"license": "SEE LICENSE IN license"
|
||||
},
|
||||
"node_modules/@syncfusion/ej2-navigations": {
|
||||
"version": "26.2.7",
|
||||
"resolved": "https://registry.npmjs.org/@syncfusion/ej2-navigations/-/ej2-navigations-26.2.7.tgz",
|
||||
|
|
|
|||
|
|
@ -3,11 +3,12 @@
|
|||
"version": "0.0.0",
|
||||
"scripts": {
|
||||
"ng": "ng",
|
||||
"start": "ng serve",
|
||||
"start": "npm run generate-env && ng serve",
|
||||
"build": "ng build",
|
||||
"watch": "ng build --watch --configuration development",
|
||||
"test": "ng test",
|
||||
"compodoc": "npx compodoc -p tsconfig.doc.json"
|
||||
"compodoc": "npx compodoc -p tsconfig.doc.json",
|
||||
"generate-env": "npx ts-node -O \"{\\\"module\\\":\\\"commonjs\\\"}\" -e \"const fs = require('fs'); const path = require('path'); const { environment } = require(path.join(process.cwd(), './src/environments/', (process.argv[1] || 'environment.ts'))); fs.writeFileSync(path.join(process.cwd(), './src/assets/environment.json'), JSON.stringify(environment));\""
|
||||
},
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,10 @@
|
|||
import { InjectionToken } from '@angular/core'
|
||||
import { AppConfig } from 'src/environments/models/environment.model'
|
||||
|
||||
// export class AppConfig {
|
||||
// serviceUrl: string
|
||||
// someSecret: string
|
||||
// toggle1: boolean
|
||||
// }
|
||||
|
||||
export let APP_CONFIG = new InjectionToken<AppConfig>('APP_CONFIG')
|
||||
|
|
@ -51,6 +51,7 @@ import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
|||
@NgModule({
|
||||
declarations: [
|
||||
AppComponent,
|
||||
|
||||
NttGanttComponent,
|
||||
StateDialogComponent,
|
||||
ImplementerDialogComponent,
|
||||
|
|
|
|||
|
|
@ -1,10 +1,12 @@
|
|||
import { JsonPipe } from '@angular/common';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Inject, Injectable } from '@angular/core';
|
||||
import { ResourceFields } from '@syncfusion/ej2-angular-gantt';
|
||||
import { LanguageService } from './language.service';
|
||||
import { ErrorService } from './error.service';
|
||||
import { Location } from '@angular/common';
|
||||
import { AppConfig } from 'src/environments/models/environment.model';
|
||||
import { APP_CONFIG } from './app.config';
|
||||
|
||||
interface Preset {
|
||||
id: string;
|
||||
|
|
@ -36,7 +38,8 @@ export class DataService {
|
|||
private totalSize: number = null;
|
||||
private user: string = null;
|
||||
public userSupportGroup: string;
|
||||
public authUrl = 'https://itsm-dev-neu-rsso.asfinag.at/rsso/start?bypass-auth=true&tenant=itsm-dev-neu&goto=https://itsm-dev-neu.asfinag.at/arsys/calendar';
|
||||
//public authUrl = 'https://itsm-dev-neu-rsso.asfinag.at/rsso/start?bypass-auth=true&tenant=itsm-dev-neu&goto=https://itsm-dev-neu.asfinag.at/arsys/calendar';
|
||||
private config: AppConfig;
|
||||
|
||||
//public selectedLanguage: string = 'DE';
|
||||
|
||||
|
|
@ -45,7 +48,7 @@ export class DataService {
|
|||
* @param languageService injection of the languageService
|
||||
* @param http representation of the HttpClient
|
||||
*/
|
||||
constructor(public languageService: LanguageService, private http: HttpClient, public errorService: ErrorService, private location: Location) {
|
||||
constructor(@Inject(APP_CONFIG) config: AppConfig, public languageService: LanguageService, private http: HttpClient, public errorService: ErrorService, private location: Location) {
|
||||
this.getUser().then((res: any )=>{
|
||||
this.user = res.userId;
|
||||
});
|
||||
|
|
@ -66,10 +69,12 @@ export class DataService {
|
|||
this.userSupportGroup = res.name;
|
||||
console.log(this.userSupportGroup);
|
||||
});
|
||||
|
||||
this.config=config;
|
||||
}
|
||||
|
||||
public redirectToAuthUrl() {
|
||||
window.location.href = this.authUrl;
|
||||
window.location.href = this.config.rssoUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -164,7 +169,7 @@ export class DataService {
|
|||
public async getUser(){
|
||||
const promise = new Promise(resolve=>{
|
||||
let res : any;
|
||||
this.http.get('http://localhost:8080/api/getUser')
|
||||
this.http.get(this.config.backendUrl+'/getUser')
|
||||
.subscribe((response: any)=>{
|
||||
res = response;
|
||||
resolve(res);
|
||||
|
|
@ -184,7 +189,7 @@ export class DataService {
|
|||
public async initPresets(){
|
||||
const promise = new Promise(resolve=>{
|
||||
let res = {presets: [], selectedPreset: '', userPreferences: {}, presetGroups: []};
|
||||
this.http.get('http://localhost:8080/api/initPresets')
|
||||
this.http.get(this.config.backendUrl+'/initPresets')
|
||||
.subscribe((response: any)=>{
|
||||
console.log(response);
|
||||
if(response.status == 500){
|
||||
|
|
@ -276,7 +281,7 @@ export class DataService {
|
|||
let strigifiedResource = JSON.stringify(serializableResource);
|
||||
let resJson = JSON.parse(strigifiedResource) as typeof strigifiedResource;
|
||||
console.log(resJson);
|
||||
this.http.post('http://localhost:8080/api/selectPreset', resJson).subscribe((response:any)=>{
|
||||
this.http.post(this.config.backendUrl+'/selectPreset', resJson).subscribe((response:any)=>{
|
||||
resolve(response);
|
||||
console.log(response);
|
||||
},(error:any)=>{
|
||||
|
|
@ -296,7 +301,7 @@ export class DataService {
|
|||
let strigifiedResource = JSON.stringify(serializableResource);
|
||||
let resJson = JSON.parse(strigifiedResource) as typeof strigifiedResource;
|
||||
console.log(resJson);
|
||||
this.http.post('http://localhost:8080/api/savePreset', resJson).subscribe((response:any)=>{
|
||||
this.http.post(this.config.backendUrl+'/savePreset', resJson).subscribe((response:any)=>{
|
||||
resolve(response);
|
||||
console.log(response);
|
||||
},(error:any)=>{
|
||||
|
|
@ -316,7 +321,7 @@ export class DataService {
|
|||
let serializableResource = {id: preset.id, definition: JSON.stringify(preset.definition)};
|
||||
let strigifiedResource = JSON.stringify(serializableResource);
|
||||
let resJson = JSON.parse(strigifiedResource) as typeof strigifiedResource;
|
||||
this.http.post('http://localhost:8080/api/updatePreset', resJson).subscribe((response:any)=>{
|
||||
this.http.post(this.config.backendUrl+'/updatePreset', resJson).subscribe((response:any)=>{
|
||||
resolve(response);
|
||||
},(error:any)=>{
|
||||
resolve(error);
|
||||
|
|
@ -334,7 +339,7 @@ export class DataService {
|
|||
let serializableResource = {id: preset.id, newName: preset.name};
|
||||
let strigifiedResource = JSON.stringify(serializableResource);
|
||||
let resJson = JSON.parse(strigifiedResource) as typeof strigifiedResource;
|
||||
this.http.post('http://localhost:8080/api/renamePreset', resJson).subscribe((response:any)=>{
|
||||
this.http.post(this.config.backendUrl+'/renamePreset', resJson).subscribe((response:any)=>{
|
||||
resolve(response);
|
||||
},(error:any)=>{
|
||||
resolve(error);
|
||||
|
|
@ -352,7 +357,7 @@ export class DataService {
|
|||
let serializableResource = {id: preset.id};
|
||||
let strigifiedResource = JSON.stringify(serializableResource);
|
||||
let resJson = JSON.parse(strigifiedResource) as typeof strigifiedResource;
|
||||
this.http.post('http://localhost:8080/api/deletePreset', resJson).subscribe((response:any)=>{
|
||||
this.http.post(this.config.backendUrl+'/deletePreset', resJson).subscribe((response:any)=>{
|
||||
resolve(response);
|
||||
},(error:any)=>{
|
||||
resolve(error);
|
||||
|
|
@ -371,7 +376,7 @@ export class DataService {
|
|||
let strigifiedResource = JSON.stringify(serializableResource);
|
||||
let resJson = JSON.parse(strigifiedResource) as typeof strigifiedResource;
|
||||
console.log(resJson);
|
||||
this.http.post('http://localhost:8080/api/editUserPreferences', resJson).subscribe((response:any)=>{
|
||||
this.http.post(this.config.backendUrl+'/editUserPreferences', resJson).subscribe((response:any)=>{
|
||||
resolve(response);
|
||||
},(error:any)=>{
|
||||
resolve(error);
|
||||
|
|
@ -387,7 +392,7 @@ export class DataService {
|
|||
public async fetchStates(){
|
||||
const promise = new Promise(resolve=>{
|
||||
let res : any[] = [];
|
||||
this.http.get('http://localhost:8080/api/getStates')
|
||||
this.http.get(this.config.backendUrl+'/getStates')
|
||||
.subscribe((response: any)=>{
|
||||
console.log("###\n");
|
||||
console.log(response);
|
||||
|
|
@ -411,7 +416,7 @@ export class DataService {
|
|||
public async fetchSupportGroups(){
|
||||
const promise = new Promise(resolve=>{
|
||||
let res : any[] = [];
|
||||
this.http.get('http://localhost:8080/api/getSupportGroups')
|
||||
this.http.get(this.config.backendUrl+'/getSupportGroups')
|
||||
.subscribe((response: any)=>{
|
||||
response.forEach(supportGroup => {
|
||||
res.push(supportGroup)
|
||||
|
|
@ -433,7 +438,7 @@ export class DataService {
|
|||
public async fetchContracts(){
|
||||
const promise = new Promise(resolve=>{
|
||||
let res : any[] = [];
|
||||
this.http.get('http://localhost:8080/api/getContracts')
|
||||
this.http.get(this.config.backendUrl+'/getContracts')
|
||||
.subscribe((response: any)=>{
|
||||
response.forEach(contract => {
|
||||
res.push(contract)
|
||||
|
|
@ -451,7 +456,7 @@ export class DataService {
|
|||
// public async fetchPaketTypes(){
|
||||
// const promise = new Promise(resolve=>{
|
||||
// let res : any[] = [];
|
||||
// this.http.get('http://localhost:8080/api/getPackageTypes')
|
||||
// this.http.get(this.config.backendUrl+'/getPackageTypes')
|
||||
// .subscribe((response: any)=>{
|
||||
// response.forEach(paketType => {
|
||||
// res.push(paketType)
|
||||
|
|
@ -469,7 +474,7 @@ export class DataService {
|
|||
public async fetchUserSupportGroup(){
|
||||
const promise = new Promise(resolve=>{
|
||||
let res : any = {};
|
||||
this.http.get('http://localhost:8080/api/getUserSupportGroup')
|
||||
this.http.get(this.config.backendUrl+'/getUserSupportGroup')
|
||||
.subscribe((response: any)=>{
|
||||
this.userSupportGroup = res.name;
|
||||
res = response;
|
||||
|
|
@ -495,7 +500,7 @@ export class DataService {
|
|||
let stringyfiedData = JSON.stringify(obj);
|
||||
let dataJson = JSON.parse(stringyfiedData) as typeof stringyfiedData;
|
||||
let res : any[] = [];
|
||||
this.http.post('http://localhost:8080/api/fetchPlanTimes', dataJson)
|
||||
this.http.post(this.config.backendUrl+'/fetchPlanTimes', dataJson)
|
||||
.subscribe((response: any[])=>{
|
||||
response.forEach(week => {
|
||||
res.push(week);
|
||||
|
|
@ -518,7 +523,7 @@ export class DataService {
|
|||
let dataJson = JSON.parse(stringyfiedData) as typeof stringyfiedData;
|
||||
// console.log(dataJson);
|
||||
let res : any[] = [];
|
||||
this.http.post('http://localhost:8080/api/getImplementer', dataJson)
|
||||
this.http.post(this.config.backendUrl+'/getImplementer', dataJson)
|
||||
.subscribe((response: any)=>{
|
||||
response.members.forEach(implementer => {
|
||||
res.push(implementer)
|
||||
|
|
@ -538,7 +543,7 @@ export class DataService {
|
|||
let serializableResource = { resourceId: change.resourceId, d2: change.tasks[1].StartDate, changeNr: change.changeNr, state: change.state};
|
||||
let strigifiedResource = JSON.stringify(serializableResource);
|
||||
let resJson = JSON.parse(strigifiedResource) as typeof strigifiedResource;
|
||||
this.http.post('http://localhost:8080/api/updateChange', resJson).subscribe((response:any)=>{
|
||||
this.http.post(this.config.backendUrl+'/updateChange', resJson).subscribe((response:any)=>{
|
||||
resolve(response);
|
||||
},(error:any)=>{
|
||||
resolve(error);
|
||||
|
|
@ -558,7 +563,7 @@ export class DataService {
|
|||
let stringyfiedData = JSON.stringify(obj);
|
||||
let dataJson = JSON.parse(stringyfiedData) as typeof stringyfiedData;
|
||||
// console.log(dataJson);
|
||||
this.http.post('http://localhost:8080/api/updateState', dataJson).subscribe((response:any)=>{
|
||||
this.http.post(this.config.backendUrl+'/updateState', dataJson).subscribe((response:any)=>{
|
||||
resolve(response);
|
||||
},(error:any)=>{
|
||||
resolve(error);
|
||||
|
|
@ -580,7 +585,7 @@ export class DataService {
|
|||
let stringyfiedData = JSON.stringify(obj);
|
||||
let dataJson = JSON.parse(stringyfiedData) as typeof stringyfiedData;
|
||||
// console.log(dataJson);
|
||||
this.http.post('http://localhost:8080/api/updateImplementer', dataJson).subscribe((response:any)=>{
|
||||
this.http.post(this.config.backendUrl+'/updateImplementer', dataJson).subscribe((response:any)=>{
|
||||
resolve(response);
|
||||
},(error:any)=>{
|
||||
console.log(error);
|
||||
|
|
@ -602,7 +607,7 @@ export class DataService {
|
|||
let stringyfiedData = JSON.stringify(obj);
|
||||
let dataJson = JSON.parse(stringyfiedData) as typeof stringyfiedData;
|
||||
console.log(dataJson);
|
||||
this.http.post('http://localhost:8080/api/updateApproval', dataJson).subscribe((response:any)=>{
|
||||
this.http.post(this.config.backendUrl+'/updateApproval', dataJson).subscribe((response:any)=>{
|
||||
resolve(response);
|
||||
},(error:any)=>{
|
||||
resolve(error);
|
||||
|
|
@ -627,7 +632,7 @@ export class DataService {
|
|||
let first : boolean = true;
|
||||
let res : any[] = [];
|
||||
console.log(dataJson);
|
||||
this.http.post('http://localhost:8080/api/getChanges', dataJson)
|
||||
this.http.post(this.config.backendUrl+'/getChanges', dataJson)
|
||||
.subscribe((response:any)=>{
|
||||
console.log("ALL CHANGES ##############\n",response);
|
||||
this.totalSize = response.totalSize;
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
{"production":false,"rssoUrl":"http://orf.at","backendUrl":"http://localhost:8080/api"}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
import { AppConfig } from './models/environment.model';
|
||||
|
||||
export const environment: AppConfig = {
|
||||
production: true,
|
||||
rssoUrl: "{{ $rssoUrl }}",
|
||||
backendUrl: "{{ $backendUrl }}"
|
||||
};
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
import { AppConfig } from './models/environment.model';
|
||||
|
||||
export const environment: AppConfig = {
|
||||
production: false,
|
||||
rssoUrl: "sadasdsadsadasd",
|
||||
backendUrl: "http://localhost:8080/api"
|
||||
};
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
export const environment = {
|
||||
production: true
|
||||
};
|
||||
|
|
@ -1,16 +1,7 @@
|
|||
// This file can be replaced during build by using the `fileReplacements` array.
|
||||
// `ng build` replaces `environment.ts` with `environment.prod.ts`.
|
||||
// The list of file replacements can be found in `angular.json`.
|
||||
import { AppConfig } from './models/environment.model';
|
||||
|
||||
export const environment = {
|
||||
production: false
|
||||
};
|
||||
|
||||
/*
|
||||
* For easier debugging in development mode, you can import the following file
|
||||
* to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`.
|
||||
*
|
||||
* This import should be commented out in production mode because it will have a negative impact
|
||||
* on performance if an error is thrown.
|
||||
*/
|
||||
// import 'zone.js/plugins/zone-error'; // Included with Angular CLI.
|
||||
export const environment: AppConfig = {
|
||||
production: false,
|
||||
rssoUrl: "http://orf.at",
|
||||
backendUrl: "http://localhost:8080/api"
|
||||
};
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
export interface AppConfig {
|
||||
production: boolean;
|
||||
rssoUrl: string;
|
||||
backendUrl: string;
|
||||
}
|
||||
|
|
@ -1,14 +1,24 @@
|
|||
import { enableProdMode } from '@angular/core';
|
||||
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
||||
import {registerLicense} from '@syncfusion/ej2-base'
|
||||
import { registerLicense } from '@syncfusion/ej2-base'
|
||||
import { AppModule } from './app/app.module';
|
||||
import { environment } from './environments/environment';
|
||||
import { AppComponent } from './app/app.component';
|
||||
import { APP_CONFIG } from './app/app.config';
|
||||
|
||||
registerLicense("Ngo9BigBOggjHTQxAR8/V1NCaF5cXmZCf1FpRmJGdld5fUVHYVZUTXxaS00DNHVRdkdnWXdedXRcQmJeVUZzV0Y=");
|
||||
if (environment.production) {
|
||||
enableProdMode();
|
||||
}
|
||||
|
||||
platformBrowserDynamic().bootstrapModule(AppModule)
|
||||
.catch(err => console.error(err));
|
||||
fetch('/assets/environment.json')
|
||||
.then((response) => response.json())
|
||||
.then((config) => {
|
||||
if (config.production) {
|
||||
enableProdMode()
|
||||
}
|
||||
|
||||
platformBrowserDynamic([{ provide: APP_CONFIG, useValue: config }]).bootstrapModule(AppModule)
|
||||
.catch(err => console.error(err));
|
||||
})
|
||||
|
||||
//bootstrapApplication(AppComponent, appConfig).catch((err) => console.error(err));
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue