Commit 456bc3e4 authored by zheng liu's avatar zheng liu

Merged in dev (pull request #44)

fix: update
parents 411689e0 766228c6
......@@ -4,7 +4,7 @@
"license": "GPLv3",
"scripts": {
"ng": "ng",
"start": "ng serve --proxy-config proxy.conf.json --preserve-symlinks --port 4202",
"start": "ng serve --proxy-config proxy.conf.json",
"build": "ng build -prod --base-href=/luna/ --deploy '/luna/'",
"test": "ng test",
"lint": "ng lint",
......
......@@ -6,14 +6,12 @@
* @author liuzheng <liuzheng712@gmail.com>
*/
import {Component, OnInit} from '@angular/core';
import {NGXLogger} from 'ngx-logger';
import {AppService, HttpService} from '../../app.service';
import {AppService, HttpService, LogService} from '../../app.service';
import {NgForm} from '@angular/forms';
import {Router} from '@angular/router';
import {DataStore, User} from '../../globals';
import * as jQuery from 'jquery/dist/jquery.min.js';
@Component({
selector: 'app-login',
templateUrl: './login.component.html',
......@@ -27,7 +25,7 @@ export class LoginComponent implements OnInit {
constructor(private _appService: AppService,
private _http: HttpService,
private _router: Router,
private _logger: NGXLogger) {
private _logger: LogService) {
this._logger.log('login.ts:LoginComponent');
DataStore.NavShow = false;
}
......
......@@ -8,8 +8,7 @@
*/
import {Component, OnInit} from '@angular/core';
import {NGXLogger} from 'ngx-logger';
import {AppService, HttpService} from '../../app.service';
import {AppService, HttpService, LogService} from '../../app.service';
import {SearchComponent} from '../search/search.component';
import {DataStore} from '../../globals';
import {version} from '../../../environments/environment';
......@@ -83,7 +82,7 @@ export class CleftbarComponent implements OnInit {
constructor(private _appService: AppService,
private _http: HttpService,
private _search: SearchComponent,
private _logger: NGXLogger,
private _logger: LogService,
private _menu: ElementServerMenuComponent) {
this._logger.log('nav.ts:NavComponent');
// this._appService.getnav()
......
......@@ -7,8 +7,7 @@
*/
import {Component, OnChanges, Input, Pipe, PipeTransform} from '@angular/core';
import {AppService, HttpService} from '../../app.service';
import {NGXLogger} from 'ngx-logger';
import {AppService, HttpService, LogService} from '../../app.service';
export let Q = '';
......@@ -24,7 +23,7 @@ export class SearchComponent implements OnChanges {
constructor(private _appService: AppService,
private _http: HttpService,
private _logger: NGXLogger) {
private _logger: LogService) {
this._logger.log('LeftbarComponent.ts:SearchBar');
}
......
......@@ -6,8 +6,7 @@
* @author liuzheng <liuzheng712@gmail.com>
*/
import {Component, OnInit} from '@angular/core';
import {AppService} from '../../app.service';
import {NGXLogger} from 'ngx-logger';
import {AppService, LogService} from '../../app.service';
@Component({
selector: 'app-ileftbar',
......@@ -17,7 +16,7 @@ import {NGXLogger} from 'ngx-logger';
export class IleftbarComponent implements OnInit {
constructor(private _appService: AppService,
private _logger:NGXLogger) {
private _logger: LogService) {
this._logger.log('nav.ts:NavComponent');
// this._appService.getnav()
}
......
......@@ -10,16 +10,16 @@
* @author liuzheng <liuzheng712@gmail.com>
*/
import {BrowserModule} from '@angular/platform-browser';
import {NgModule} from '@angular/core';
import {ClassProvider, NgModule} from '@angular/core';
import {FormsModule} from '@angular/forms'; // <-- NgModel lives here
import {NGXLogger, LoggerConfig, NgxLoggerLevel as LoggerLevel} from 'ngx-logger';
// import {NGXLogger, LoggerConfig, NgxLoggerLevel as LoggerLevel} from 'ngx-logger';
import {HttpModule} from '@angular/http';
import {AppRoutingModule} from './app-routing.module';
import {AppComponent} from './app.component';
// service
import {AppService, HttpService} from './app.service';
import {AppService, HttpService, LogService} from './app.service';
import {LayerService} from './elements/layer/layer.service';
// Elements
......@@ -50,10 +50,9 @@ import {UtcDatePipe} from './app.pipe';
import {MonitorPageComponent} from './monitor-page/monitor-page.component';
import {LinuxComponent} from './monitor-page/linux/linux.component';
import {WindowsComponent} from './monitor-page/windows/windows.component';
import {BrowserXhr} from '@angular/http';
import {NgProgressModule, NgProgressBrowserXhr} from 'ngx-progressbar';
import {NgProgressModule} from 'ngx-progressbar';
import {TestPageComponent} from './test-page/test-page.component';
import {HttpClient, HttpHandler} from '@angular/common/http';
// import {NgxLayerModule} from 'ngx-layer';
@NgModule({
......@@ -98,14 +97,12 @@ import {HttpClient, HttpHandler} from '@angular/common/http';
],
bootstrap: [AppComponent],
providers: [
{provide: LoggerConfig, useValue: {level: LoggerLevel.WARN}},
{provide: BrowserXhr, useClass: NgProgressBrowserXhr},
// {provide: LoggerConfig, useValue: {level: LoggerLevel.WARN}},
// {provide: BrowserXhr, useClass: NgProgressBrowserXhr},
AppService,
HttpService,
LayerService,
HttpClient,
HttpHandler,
NGXLogger
LogService,
LayerService
]
})
export class AppModule {
......
......@@ -9,10 +9,10 @@ import {Injectable, OnInit} from '@angular/core';
import {Http, RequestOptionsArgs, Headers} from '@angular/http';
import {Router} from '@angular/router';
// import {Cookie} from 'ng2-cookies/ng2-cookies';
import {NGXLogger} from 'ngx-logger';
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/catch';
import {DataStore, User, Browser} from './globals';
import {environment} from '../environments/environment';
declare function unescape(s: string): string;
......@@ -89,13 +89,44 @@ export class HttpService {
}
@Injectable()
export class LogService {
constructor() {
}
trace(message: any, ...additional: any[]) {
console.log(message, additional.join(' '));
}
debug(message: any, ...additional: any[]) {
console.log(message, additional.join(' '));
}
info(message: any, ...additional: any[]) {
console.log(message, additional.join(' '));
}
log(message: any, ...additional: any[]) {
console.log(message, additional.join(' '));
}
warn(message: any, ...additional: any[]) {
console.log(message, additional.join(' '));
}
error(message: any, ...additional: any[]) {
console.log(message, additional.join(' '));
}
}
@Injectable()
export class AppService implements OnInit {
// user:User = user ;
constructor(private _http: HttpService,
private _router: Router,
private _logger: NGXLogger) {
private _logger: LogService) {
// if (Cookie.get('loglevel')) {
// // 0.- Level.OFF
// // 1.- Level.ERROR
......@@ -115,13 +146,14 @@ export class AppService implements OnInit {
// this._logger.level = 0;
// }
this.checklogin();
if (environment.production) {
this.checklogin();
}
}
ngOnInit() {
}
checklogin() {
this._logger.log('service.ts:AppService,checklogin');
if (DataStore.Path) {
......@@ -182,7 +214,6 @@ export class AppService implements OnInit {
}
}
browser() {
this._http.post('/api/browser', JSON.stringify(Browser)).map(res => res.json()).subscribe();
}
......@@ -314,3 +345,4 @@ export class AppService implements OnInit {
//
// }
}
......@@ -6,8 +6,7 @@
* @author liuzheng <liuzheng712@gmail.com>
*/
import {Component, OnInit} from '@angular/core';
import {AppService} from '../../app.service';
import {NGXLogger} from 'ngx-logger';
import {AppService, LogService} from '../../app.service';
import {DataStore, User} from '../../globals';
import {version} from '../../../environments/environment';
......@@ -22,7 +21,7 @@ export class ElementFooterComponent implements OnInit {
version = version;
constructor(private _appService: AppService,
private _logger: NGXLogger) {
private _logger: LogService) {
this._logger.log('nav.ts:NavComponent');
// this._appService.getnav()
}
......
......@@ -6,9 +6,7 @@
* @author liuzheng <liuzheng712@gmail.com>
*/
import {Component, OnInit} from '@angular/core';
import {NGXLogger} from 'ngx-logger';
import {AppService, HttpService} from '../../app.service';
import {AppService, HttpService, LogService} from '../../app.service';
import {CleftbarComponent} from '../../ControlPage/cleftbar/cleftbar.component';
import {ControlComponent, NavList} from '../../ControlPage/control/control.component';
import {DataStore} from '../../globals';
......@@ -30,7 +28,7 @@ export class ElementNavComponent implements OnInit {
constructor(private _appService: AppService,
private _http: HttpService,
private _logger: NGXLogger) {
private _logger: LogService) {
this._logger.log('nav.ts:NavComponent');
this.getnav();
}
......
import {Component, OnInit} from '@angular/core';
import {ActivatedRoute, Params} from '@angular/router';
import {NGXLogger} from 'ngx-logger';
import {HttpService} from '../app.service';
import {HttpService, LogService} from '../app.service';
import {Video, DataStore} from '../globals';
@Component({
......@@ -14,7 +13,7 @@ export class ReplayPageComponent implements OnInit {
constructor(private activatedRoute: ActivatedRoute,
private _http: HttpService,
private _logger: NGXLogger) {
private _logger: LogService) {
// this.video = {'type': 'none'};
DataStore.NavShow = false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment