[webapp] 批量处理eslint格式告警

This commit is contained in:
tomsun28
2021-12-23 15:59:49 +08:00
parent 1469e85443
commit 7e41f64491
72 changed files with 1724 additions and 2170 deletions

View File

@@ -1,9 +1,10 @@
import { HttpClient, HttpParams } from '@angular/common/http';
import { Injectable } from '@angular/core';
import {HttpClient, HttpParams} from "@angular/common/http";
import {Observable} from "rxjs";
import {Message} from "../pojo/Message";
import {Page} from "../pojo/Page";
import {Alert} from "../pojo/Alert";
import { Observable } from 'rxjs';
import { Alert } from '../pojo/Alert';
import { Message } from '../pojo/Message';
import { Page } from '../pojo/Page';
const alerts_uri = '/alerts';
@@ -13,35 +14,39 @@ const alerts_status_uri = '/alerts/status';
providedIn: 'root'
})
export class AlertService {
constructor(private http: HttpClient) {}
constructor(private http : HttpClient) { }
public getAlerts(pageIndex: number, pageSize: number) : Observable<Message<Page<Alert>>> {
public getAlerts(pageIndex: number, pageSize: number): Observable<Message<Page<Alert>>> {
pageIndex = pageIndex ? pageIndex : 0;
pageSize = pageSize ? pageSize : 8;
// 注意HttpParams是不可变对象 需要保存set后返回的对象为最新对象
let httpParams = new HttpParams();
httpParams = httpParams.appendAll({
'sort': 'id',
'order': 'desc',
'pageIndex': pageIndex,
'pageSize': pageSize
sort: 'id',
order: 'desc',
pageIndex: pageIndex,
pageSize: pageSize
});
const options = { params: httpParams };
return this.http.get<Message<Page<Alert>>>(alerts_uri, options);
}
public searchAlerts(status: number | undefined, priority: number | undefined, content: string | undefined,
pageIndex: number, pageSize: number) : Observable<Message<Page<Alert>>> {
public searchAlerts(
status: number | undefined,
priority: number | undefined,
content: string | undefined,
pageIndex: number,
pageSize: number
): Observable<Message<Page<Alert>>> {
pageIndex = pageIndex ? pageIndex : 0;
pageSize = pageSize ? pageSize : 8;
// 注意HttpParams是不可变对象 需要保存set后返回的对象为最新对象
let httpParams = new HttpParams();
httpParams = httpParams.appendAll({
'sort': 'id',
'order': 'desc',
'pageIndex': pageIndex,
'pageSize': pageSize
sort: 'id',
order: 'desc',
pageIndex: pageIndex,
pageSize: pageSize
});
if (status != undefined && status != 9) {
httpParams = httpParams.append('status', status);
@@ -56,26 +61,25 @@ export class AlertService {
return this.http.get<Message<Page<Alert>>>(alerts_uri, options);
}
public deleteAlerts(alertIds: Set<number>) : Observable<Message<any>> {
public deleteAlerts(alertIds: Set<number>): Observable<Message<any>> {
let httpParams = new HttpParams();
alertIds.forEach(alertId => {
// 注意HttpParams是不可变对象 需要保存append后返回的对象为最新对象
// append方法可以叠加同一key, set方法会把key之前的值覆盖只留一个key-value
httpParams = httpParams.append('ids', alertId);
})
});
const options = { params: httpParams };
return this.http.delete<Message<any>>(alerts_uri, options);
}
public applyAlertsStatus(alertIds: Set<number>, status: number) : Observable<Message<any>> {
public applyAlertsStatus(alertIds: Set<number>, status: number): Observable<Message<any>> {
let httpParams = new HttpParams();
alertIds.forEach(alertId => {
// 注意HttpParams是不可变对象 需要保存append后返回的对象为最新对象
// append方法可以叠加同一key, set方法会把key之前的值覆盖只留一个key-value
httpParams = httpParams.append('ids', alertId);
})
});
const options = { params: httpParams };
return this.http.put<Message<any>>(`${alerts_status_uri}/${status}`, null, options);
}
}