[DEBUG] correct the production environement

This commit is contained in:
Edouard DUPIN 2020-01-06 21:34:41 +01:00
parent 46d9bb3092
commit 4e041c5bea
5 changed files with 32 additions and 89 deletions

View File

@ -20,7 +20,7 @@ ENV PATH /application/node_modules/.bin:$PATH
RUN npm install
# generate build
RUN ng build --output-path=dist --configuration=production
RUN ng build --output-path=dist --configuration=production --deploy-url=/karideo/
############
### prod ###

View File

@ -10,6 +10,7 @@ import { Injectable, Component, OnInit, Input } from '@angular/core';
import { Router } from "@angular/router";
import { ActivatedRoute, Params } from '@angular/router';
import { VideoService } from '../video.service';
import { HttpWrapperService } from '../http-wrapper.service';
@Component({
selector: 'app-element-video',
@ -37,7 +38,8 @@ export class ElementVideoComponent implements OnInit {
video_source:string = ""
video_enable:boolean = false;
constructor(private router: Router,
private videoService: VideoService) {
private videoService: VideoService,
private httpService: HttpWrapperService) {
}
ngOnInit() {
@ -57,7 +59,7 @@ export class ElementVideoComponent implements OnInit {
self.time = response.time;
self.generated_name = response.generated_name;
if (self.data_id != -1) {
self.video_source = "http://localhost:15080/data/" + self.data_id;
self.video_source = self.httpService.createRESTCall("data/" + self.data_id);
self.video_enable = true;
} else {
self.video_source = "";

View File

@ -3,7 +3,7 @@ import { Injectable } from '@angular/core';
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { catchError, map, tap } from 'rxjs/operators';
import { createRESTCall } from 'environments/environment';
import { environment } from 'environments/environment';
@Injectable()
export class HttpWrapperService {
@ -12,8 +12,29 @@ export class HttpWrapperService {
}
createRESTCall(_api:string, _options:any = undefined) {
let basePage = environment.apiUrl;
let addressServerRest = basePage + "/";
let out;
if (typeof _options === 'undefined') {
_options = [];
}
out = addressServerRest + _api;
let first = true;
for (let iii=0; iii<_options.length; iii++) {
if (first ==false) {
out += "&";
} else {
out += "?";
first = false;
}
out += _options[iii];
}
return out;
}
get(_uriRest:string, _headerOption:any, _params:any) {
let connectionAdresse = createRESTCall(_uriRest, {});
let connectionAdresse = this.createRESTCall(_uriRest, {});
let config = {
params: _params,
headers: new HttpHeaders(_headerOption)
@ -49,7 +70,7 @@ export class HttpWrapperService {
}
post(_uriRest:string, _headerOption:any, _data:any) {
let connectionAdresse = createRESTCall(_uriRest, {});
let connectionAdresse = this.createRESTCall(_uriRest, {});
const httpOption = {
headers: new HttpHeaders(_headerOption)
};

View File

@ -6,29 +6,7 @@
export const environment = {
production: false,
// URL of development API
apiUrl: 'http://192.168.1.157/karideo/api/',
//apiMode: "QUERRY"
apiMode: "REWRITE"
apiUrl: 'http://192.168.1.157/karideo/api',
apiMode: "QUERRY"
//apiMode: "REWRITE"
}
export let createRESTCall = function(api, options) {
let basePage = environment.apiUrl;
let addressServerRest = basePage + "/";
let out;
if (typeof options === 'undefined') {
options = [];
}
out = addressServerRest + api;
let first = true;
for (let iii=0; iii<options.length; iii++) {
if (first ==false) {
out += "&";
} else {
out += "?";
first = false;
}
out += options[iii];
}
return out;
}

View File

@ -10,61 +10,3 @@ export const environment = {
//apiMode: "QUERRY"
apiMode: "REWRITE"
}
/**
* @brief create the rest call element of the link
*/
/*
export let createRESTCall = function(api, options) {
let basePage = environment.apiUrl;
let addressServerRest = basePage + "/api/v1/";
let out;
if (environment.apiMode == "QUERRY") {
out = addressServerRest + "?REST=" + api
if (typeof options === 'undefined') {
options = [];
}
for (let iii=0; iii<options.length; iii++) {
out += "&" + options[iii];
}
} else {
if (typeof options === 'undefined') {
options = [];
}
out = addressServerRest + api;
let first = true;
for (let iii=0; iii<options.length; iii++) {
if (first ==false) {
out += "&";
} else {
out += "?";
first = false;
}
out += options[iii];
}
}
return out;
}
*/
export let createRESTCall = function(api, options) {
let basePage = environment.apiUrl;
let addressServerRest = basePage + "/";
let out;
if (typeof options === 'undefined') {
options = [];
}
out = addressServerRest + api;
let first = true;
for (let iii=0; iii<options.length; iii++) {
if (first ==false) {
out += "&";
} else {
out += "?";
first = false;
}
out += options[iii];
}
return out;
}