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