[web-app] http拦截器修改,新增监控页面编码

This commit is contained in:
tomsun28
2021-11-30 22:16:38 +08:00
parent 619e407158
commit 090e6e8c16
37 changed files with 663 additions and 172 deletions

View File

@@ -0,0 +1,16 @@
import { TestBed } from '@angular/core/testing';
import { AppDefineService } from './app-define.service';
describe('AppDefineService', () => {
let service: AppDefineService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(AppDefineService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});

View File

@@ -0,0 +1,22 @@
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import {Message} from "../pojo/Message";
import {Observable} from "rxjs";
@Injectable({
providedIn: 'root'
})
export class AppDefineService {
constructor(private http : HttpClient) { }
public getAppParamsDefine(app: string | undefined | null) : Observable<Message> {
if (app === null || app === undefined) {
console.log("getAppParamsDefine app can not null");
}
const paramDefineUri = `/apps/${app}/params`;
return this.http.get<Message>(paramDefineUri);
}
}

View File

@@ -0,0 +1,16 @@
import { TestBed } from '@angular/core/testing';
import { LocalStorageService } from './local-storage.service';
describe('LocalStorageService', () => {
let service: LocalStorageService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(LocalStorageService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});

View File

@@ -0,0 +1,29 @@
import { Injectable } from '@angular/core';
const Authorization = 'Authorization';
@Injectable({
providedIn: 'root'
})
export class LocalStorageService {
constructor() { }
public putData(key: string, value: string) {
localStorage.setItem(key, value);
}
public getData(key: string): string | null {
const data = localStorage.getItem(key);
return data === null ? null : data;
}
public getAuthorizationToken(): string | null {
return this.getData(Authorization);
}
public storageAuthorizationToken(token: string) {
return this.putData(Authorization, token);
}
}

View File

@@ -0,0 +1,16 @@
import { TestBed } from '@angular/core/testing';
import { MonitorService } from './monitor.service';
describe('MonitorService', () => {
let service: MonitorService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(MonitorService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});

View File

@@ -0,0 +1,19 @@
import { Injectable } from '@angular/core';
import {HttpClient} from "@angular/common/http";
import {Observable} from "rxjs";
import {Message} from "../pojo/Message";
const monitor_uri = "/monitor";
@Injectable({
providedIn: 'root'
})
export class MonitorService {
constructor(private http : HttpClient) { }
public newMonitor(body: any) : Observable<Message> {
return this.http.post<Message>(monitor_uri, body);
}
}

View File

@@ -0,0 +1,16 @@
import { TestBed } from '@angular/core/testing';
import { MyServiceService } from './my-service.service';
describe('MyServiceService', () => {
let service: MyServiceService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(MyServiceService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});

View File

@@ -0,0 +1,9 @@
import { Injectable } from '@angular/core';
@Injectable({
providedIn: 'root'
})
export class MyServiceService {
constructor() { }
}