delete environment.prod.ts;
use environment.ts for location + port;
This commit is contained in:
parent
42edbdd195
commit
065922b279
@ -1,7 +1,7 @@
|
|||||||
import {Component, OnInit} from '@angular/core';
|
import {Component, OnInit} from '@angular/core';
|
||||||
import {ActivatedRoute} from '@angular/router';
|
import {ActivatedRoute} from '@angular/router';
|
||||||
import {FormGroup, FormBuilder, AbstractControl} from '@angular/forms';
|
import {FormGroup, FormBuilder} from '@angular/forms';
|
||||||
import {FileInput, FileValidator} from 'ngx-material-file-input';
|
import {FileValidator} from 'ngx-material-file-input';
|
||||||
import {HttpClient} from '@angular/common/http';
|
import {HttpClient} from '@angular/common/http';
|
||||||
import {environment} from '../../../../environments/environment';
|
import {environment} from '../../../../environments/environment';
|
||||||
import {throwError} from 'rxjs';
|
import {throwError} from 'rxjs';
|
||||||
@ -28,8 +28,6 @@ export class EditierenComponent implements OnInit {
|
|||||||
keywords: String;
|
keywords: String;
|
||||||
|
|
||||||
readonly maxSize = 10240;
|
readonly maxSize = 10240;
|
||||||
private currentLocation = environment.location;
|
|
||||||
|
|
||||||
constructor(private route: ActivatedRoute,
|
constructor(private route: ActivatedRoute,
|
||||||
private formBuilder: FormBuilder,
|
private formBuilder: FormBuilder,
|
||||||
private http: HttpClient,
|
private http: HttpClient,
|
||||||
@ -55,7 +53,7 @@ export class EditierenComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public loadFeed(id) {
|
public loadFeed(id) {
|
||||||
this.http.get('http://127.0.0.1:8000/feeds/' + id + '/').subscribe(
|
this.http.get('http://' + environment.location + ':' + environment.port + '/feeds/' + id + '/').subscribe(
|
||||||
(data: any) => {
|
(data: any) => {
|
||||||
this.url = data.url;
|
this.url = data.url;
|
||||||
this.active = data.active;
|
this.active = data.active;
|
||||||
@ -88,7 +86,7 @@ export class EditierenComponent implements OnInit {
|
|||||||
form.append('icon', feedData.icon._files['0']);
|
form.append('icon', feedData.icon._files['0']);
|
||||||
}
|
}
|
||||||
if (this.id == null) {
|
if (this.id == null) {
|
||||||
this.http.post('http://127.0.0.1:8000/feeds/', form).subscribe(
|
this.http.post('http://' + environment.location + ':' + environment.port + '/feeds/', form).subscribe(
|
||||||
() => {
|
() => {
|
||||||
this._snackbar.open('Feed erfolgreich gespeichert!', 'Schließen', {duration: 3000});
|
this._snackbar.open('Feed erfolgreich gespeichert!', 'Schließen', {duration: 3000});
|
||||||
},
|
},
|
||||||
@ -99,7 +97,7 @@ export class EditierenComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
this.http.put('http://127.0.0.1:8000/feeds/' + this.id + '/', form).subscribe(
|
this.http.put('http://' + environment.location + ':' + environment.port + '/feeds/' + this.id + '/', form).subscribe(
|
||||||
() => {
|
() => {
|
||||||
this._snackbar.open('Feed erfolgreich gespeichert!', 'Schließen', {duration: 3000});
|
this._snackbar.open('Feed erfolgreich gespeichert!', 'Schließen', {duration: 3000});
|
||||||
},
|
},
|
||||||
@ -114,7 +112,7 @@ export class EditierenComponent implements OnInit {
|
|||||||
|
|
||||||
|
|
||||||
public errorDialog() {
|
public errorDialog() {
|
||||||
const dialogRef = this._dialog.open(DialogComponent, {
|
this._dialog.open(DialogComponent, {
|
||||||
data: {
|
data: {
|
||||||
title: 'Serverfehler',
|
title: 'Serverfehler',
|
||||||
body: 'Fehler beim Aufruf des Servers',
|
body: 'Fehler beim Aufruf des Servers',
|
||||||
|
|||||||
@ -8,6 +8,7 @@ import {FeedService} from '../../services/feed.service';
|
|||||||
import {ActivatedRoute} from '@angular/router';
|
import {ActivatedRoute} from '@angular/router';
|
||||||
import {DialogComponent} from '../dialog/dialog.component';
|
import {DialogComponent} from '../dialog/dialog.component';
|
||||||
import {MatDialog} from '@angular/material/dialog';
|
import {MatDialog} from '@angular/material/dialog';
|
||||||
|
import {environment} from '../../../environments/environment';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-einstellungen',
|
selector: 'app-einstellungen',
|
||||||
@ -34,7 +35,7 @@ export class EinstellungenComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
deleteFeed(id: number) {
|
deleteFeed(id: number) {
|
||||||
this.http.delete('http://127.0.0.1:8000/feeds/' + id + '/').subscribe(
|
this.http.delete('http://' + environment.location + ':' + environment.port + '/feeds/' + id + '/').subscribe(
|
||||||
() => {
|
() => {
|
||||||
this._snackbar.open('Feed erfolgreich gelöscht!', 'Schließen', {duration: 3000});
|
this._snackbar.open('Feed erfolgreich gelöscht!', 'Schließen', {duration: 3000});
|
||||||
this.feeds = this.feeds.filter(feed => feed.id !== id);
|
this.feeds = this.feeds.filter(feed => feed.id !== id);
|
||||||
@ -69,7 +70,7 @@ export class EinstellungenComponent implements OnInit {
|
|||||||
|
|
||||||
|
|
||||||
public errorDialog() {
|
public errorDialog() {
|
||||||
const dialogRef = this._dialog.open(DialogComponent, {
|
this._dialog.open(DialogComponent, {
|
||||||
data: {
|
data: {
|
||||||
title: 'Serverfehler',
|
title: 'Serverfehler',
|
||||||
body: 'Fehler beim Aufruf des Servers',
|
body: 'Fehler beim Aufruf des Servers',
|
||||||
|
|||||||
@ -1,11 +1,12 @@
|
|||||||
import {Component, OnInit} from '@angular/core';
|
import {Component, OnInit} from '@angular/core';
|
||||||
import {AuthService} from '../../services/auth.service';
|
import {AuthService} from '../../services/auth.service';
|
||||||
import {HttpClient, HttpHeaders} from '@angular/common/http';
|
import {HttpClient} from '@angular/common/http';
|
||||||
import {FeedService} from '../../services/feed.service';
|
import {FeedService} from '../../services/feed.service';
|
||||||
import {IFeed} from '../../interfaces/feed.interface';
|
import {IFeed} from '../../interfaces/feed.interface';
|
||||||
import {Observable} from 'rxjs';
|
import {Observable} from 'rxjs';
|
||||||
import {Tweet} from "../../interfaces/interface";
|
import {Tweet} from '../../interfaces/interface';
|
||||||
import {SnackbarService} from "../../services/snackbar.service";
|
import {SnackbarService} from '../../services/snackbar.service';
|
||||||
|
import {environment} from '../../../environments/environment';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@ -34,8 +35,8 @@ export class TweetsComponent implements OnInit {
|
|||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
|
|
||||||
this.fillTweets()
|
this.fillTweets();
|
||||||
console.log(this.tweets)
|
console.log(this.tweets);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,17 +44,19 @@ export class TweetsComponent implements OnInit {
|
|||||||
|
|
||||||
console.log(this.tweets);
|
console.log(this.tweets);
|
||||||
|
|
||||||
this.http.get<Tweet[]>('http://127.0.0.1:8000/getMoreTweets/'+this.tweets[this.tweets.length-1].tweet_id+'/').subscribe(data => {
|
this.http.get<Tweet[]>(
|
||||||
console.log(data)
|
'http://' + environment.location + ':' + environment.port + '/getMoreTweets/' + this.tweets[this.tweets.length - 1].tweet_id + '/'
|
||||||
|
).subscribe(data => {
|
||||||
|
console.log(data);
|
||||||
|
|
||||||
if(data.length == 0){
|
if (data.length === 0) {
|
||||||
this._snackbarService.show("Keine weiteren Tweets vorhanden","Schließen");
|
this._snackbarService.show('Keine weiteren Tweets vorhanden', 'Schließen');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
for(let tweet of data){
|
for (const tweet of data) {
|
||||||
let position = tweet.text.search(": http");
|
const position = tweet.text.search(': http');
|
||||||
tweet.text = tweet.text.substring(0,position);
|
tweet.text = tweet.text.substring(0, position);
|
||||||
this.tweets.push(tweet);
|
this.tweets.push(tweet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -61,18 +64,18 @@ export class TweetsComponent implements OnInit {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fillTweets(){
|
fillTweets() {
|
||||||
|
|
||||||
this.http.get<Tweet[]>('http://127.0.0.1:8000/getSixTweets/').subscribe(data => {
|
this.http.get<Tweet[]>('http://' + environment.location + ':' + environment.port + '/getSixTweets/').subscribe(data => {
|
||||||
console.log(data)
|
console.log(data);
|
||||||
for(let tweet of data){
|
for (const tweet of data) {
|
||||||
let position = tweet.text.search(": http");
|
const position = tweet.text.search(': http');
|
||||||
tweet.text = tweet.text.substring(0,position);
|
tweet.text = tweet.text.substring(0, position);
|
||||||
this.tweets.push(tweet);
|
this.tweets.push(tweet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,12 +3,13 @@ import {HttpClient} from '@angular/common/http';
|
|||||||
import {Observable} from 'rxjs';
|
import {Observable} from 'rxjs';
|
||||||
import {IFeed} from '../interfaces/feed.interface';
|
import {IFeed} from '../interfaces/feed.interface';
|
||||||
import {delay} from 'rxjs/operators';
|
import {delay} from 'rxjs/operators';
|
||||||
|
import {environment} from '../../environments/environment';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class FeedService {
|
export class FeedService {
|
||||||
private url = 'http://localhost:8000/feeds/';
|
private url = 'http://' + environment.location + ':' + environment.port + '/feeds/';
|
||||||
|
|
||||||
constructor(private http: HttpClient) {}
|
constructor(private http: HttpClient) {}
|
||||||
|
|
||||||
|
|||||||
@ -1,10 +0,0 @@
|
|||||||
import {NgxLoggerLevel} from 'ngx-logger';
|
|
||||||
|
|
||||||
export const environment = {
|
|
||||||
title: 'Bsp 4 Gruppe 4',
|
|
||||||
production: true,
|
|
||||||
location: window.location.hostname,
|
|
||||||
port: 8000,
|
|
||||||
ws_url_root: 'ws://' + window.location.hostname + ':' + window.location.port + '/',
|
|
||||||
log_level: NgxLoggerLevel.WARN,
|
|
||||||
};
|
|
||||||
@ -1,25 +1,10 @@
|
|||||||
// This file can be replaced during build by using the `fileReplacements` array.
|
|
||||||
// `ng build --prod` replaces `environment.ts` with `environment.prod.ts`.
|
|
||||||
// The list of file replacements can be found in `angular.json`.
|
|
||||||
|
|
||||||
import {NgxLoggerLevel} from 'ngx-logger';
|
import {NgxLoggerLevel} from 'ngx-logger';
|
||||||
|
|
||||||
export const environment = {
|
export const environment = {
|
||||||
title: 'Bsp 4 Gruppe 4',
|
title: 'Bsp 4 Gruppe 4',
|
||||||
openid_endpoint: 'https://waecm-sso.inso.tuwien.ac.at/auth/realms/waecm/protocol/openid-connect',
|
production: true,
|
||||||
production: false,
|
location: window.location.hostname,
|
||||||
location: 'http://localhost:4200',
|
|
||||||
port: 8000,
|
port: 8000,
|
||||||
ws_location: 'ws://127.0.0.1',
|
log_level: NgxLoggerLevel.WARN,
|
||||||
ws_port: 8000,
|
|
||||||
log_level: NgxLoggerLevel.DEBUG,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
|
||||||
* 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/dist/zone-error'; // Included with Angular CLI.
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user