From fec8689a659c95335aebd37e18d25498221bd5e3 Mon Sep 17 00:00:00 2001 From: wangjun Date: Sun, 2 Jul 2023 21:44:26 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0ElasticSearch?= =?UTF-8?q?=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vben28/src/router/routes/modules/admin.ts | 20 -- vben28/src/services/ServiceProxies.ts | 273 ------------------ .../admin/elasticSearch/ElasticSearch.ts | 56 ---- .../admin/elasticSearch/ElasticSearch.vue | 81 ------ 4 files changed, 430 deletions(-) delete mode 100644 vben28/src/views/admin/elasticSearch/ElasticSearch.ts delete mode 100644 vben28/src/views/admin/elasticSearch/ElasticSearch.vue diff --git a/vben28/src/router/routes/modules/admin.ts b/vben28/src/router/routes/modules/admin.ts index 0c47d663..b8a5d318 100644 --- a/vben28/src/router/routes/modules/admin.ts +++ b/vben28/src/router/routes/modules/admin.ts @@ -64,16 +64,6 @@ const admin: AppRouteModule = { icon: 'ant-design:snippets-twotone', }, }, - { - path: 'esLogs', - name: 'ESLogs', - component: () => import('/@/views/admin/elasticSearch/ElasticSearch.vue'), - meta: { - title: t('routes.admin.esLogs'), - policy: 'AbpIdentity.ES', - icon: 'ant-design:snippets-twotone', - }, - }, { path: 'dataDictionary', name: 'dataDictionary', @@ -104,16 +94,6 @@ const admin: AppRouteModule = { policy: 'AbpIdentity.LanguageTexts', }, }, - // { - // path: 'files', - // name: 'files', - // component: () => import('/@/views/admin/files/File.vue'), - // meta: { - // title: t('routes.admin.fileNameManagement'), - // icon: 'ant-design:snippets-outlined', - // policy: 'AbpIdentity.FileManagement', - // }, - // }, ], }; diff --git a/vben28/src/services/ServiceProxies.ts b/vben28/src/services/ServiceProxies.ts index 861fff15..c0a368ed 100644 --- a/vben28/src/services/ServiceProxies.ts +++ b/vben28/src/services/ServiceProxies.ts @@ -2485,119 +2485,6 @@ export class LanguageTextsServiceProxy extends ServiceProxyBase { } } -export class EsLogServiceProxy extends ServiceProxyBase { - private instance: AxiosInstance; - private baseUrl: string; - protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined; - - constructor(baseUrl?: string, instance?: AxiosInstance) { - super(); - this.instance = instance ? instance : axios.create(); - this.baseUrl = baseUrl !== undefined && baseUrl !== null ? baseUrl : ""; - } - - /** - * 分页获取Es日志 - * @param body (optional) - * @return Success - */ - page(body: PagingElasticSearchLogInput | undefined , cancelToken?: CancelToken | undefined): Promise { - let url_ = this.baseUrl + "/EsLog/page"; - url_ = url_.replace(/[?&]$/, ""); - - const content_ = JSON.stringify(body); - - let options_ = { - data: content_, - method: "POST", - url: url_, - headers: { - "Content-Type": "application/json", - "Accept": "text/plain" - }, - cancelToken - }; - - return this.transformOptions(options_).then(transformedOptions_ => { - return this.instance.request(transformedOptions_); - }).catch((_error: any) => { - if (isAxiosError(_error) && _error.response) { - return _error.response; - } else { - throw _error; - } - }).then((_response: AxiosResponse) => { - return this.transformResult(url_, _response, (_response: AxiosResponse) => this.processPage(_response)); - }); - } - - protected processPage(response: AxiosResponse): Promise { - const status = response.status; - let _headers: any = {}; - if (response.headers && typeof response.headers === "object") { - for (let k in response.headers) { - if (response.headers.hasOwnProperty(k)) { - _headers[k] = response.headers[k]; - } - } - } - if (status === 200) { - const _responseText = response.data; - let result200: any = null; - let resultData200 = _responseText; - result200 = PagingElasticSearchLogOutputCustomPagedResultDto.fromJS(resultData200); - return Promise.resolve(result200); - - } else if (status === 403) { - const _responseText = response.data; - let result403: any = null; - let resultData403 = _responseText; - result403 = RemoteServiceErrorResponse.fromJS(resultData403); - return throwException("Forbidden", status, _responseText, _headers, result403); - - } else if (status === 401) { - const _responseText = response.data; - let result401: any = null; - let resultData401 = _responseText; - result401 = RemoteServiceErrorResponse.fromJS(resultData401); - return throwException("Unauthorized", status, _responseText, _headers, result401); - - } else if (status === 400) { - const _responseText = response.data; - let result400: any = null; - let resultData400 = _responseText; - result400 = RemoteServiceErrorResponse.fromJS(resultData400); - return throwException("Bad Request", status, _responseText, _headers, result400); - - } else if (status === 404) { - const _responseText = response.data; - let result404: any = null; - let resultData404 = _responseText; - result404 = RemoteServiceErrorResponse.fromJS(resultData404); - return throwException("Not Found", status, _responseText, _headers, result404); - - } else if (status === 501) { - const _responseText = response.data; - let result501: any = null; - let resultData501 = _responseText; - result501 = RemoteServiceErrorResponse.fromJS(resultData501); - return throwException("Server Error", status, _responseText, _headers, result501); - - } else if (status === 500) { - const _responseText = response.data; - let result500: any = null; - let resultData500 = _responseText; - result500 = RemoteServiceErrorResponse.fromJS(resultData500); - return throwException("Server Error", status, _responseText, _headers, result500); - - } else if (status !== 200 && status !== 204) { - const _responseText = response.data; - return throwException("An unexpected server error occurred.", status, _responseText, _headers); - } - return Promise.resolve(null as any); - } -} - export class NotificationServiceProxy extends ServiceProxyBase { private instance: AxiosInstance; private baseUrl: string; @@ -13779,166 +13666,6 @@ export interface IPagingDataDictionaryOutputPagedResultDto { totalCount: number; } -export class PagingElasticSearchLogInput implements IPagingElasticSearchLogInput { - /** 当前页面.默认从1开始 */ - pageIndex!: number; - /** 每页多少条.每页显示多少记录 */ - pageSize!: number; - /** 跳过多少条 */ - readonly skipCount!: number; - filter!: string | undefined; - startCreationTime!: dayjs.Dayjs | undefined; - endCreationTime!: dayjs.Dayjs | undefined; - - constructor(data?: IPagingElasticSearchLogInput) { - if (data) { - for (var property in data) { - if (data.hasOwnProperty(property)) - (this)[property] = (data)[property]; - } - } - } - - init(_data?: any) { - if (_data) { - this.pageIndex = _data["pageIndex"]; - this.pageSize = _data["pageSize"]; - (this).skipCount = _data["skipCount"]; - this.filter = _data["filter"]; - this.startCreationTime = _data["startCreationTime"] ? dayjs(_data["startCreationTime"].toString()) : undefined; - this.endCreationTime = _data["endCreationTime"] ? dayjs(_data["endCreationTime"].toString()) : undefined; - } - } - - static fromJS(data: any): PagingElasticSearchLogInput { - data = typeof data === 'object' ? data : {}; - let result = new PagingElasticSearchLogInput(); - result.init(data); - return result; - } - - toJSON(data?: any) { - data = typeof data === 'object' ? data : {}; - data["pageIndex"] = this.pageIndex; - data["pageSize"] = this.pageSize; - data["skipCount"] = this.skipCount; - data["filter"] = this.filter; - data["startCreationTime"] = this.startCreationTime ? this.startCreationTime.toISOString() : undefined; - data["endCreationTime"] = this.endCreationTime ? this.endCreationTime.toISOString() : undefined; - return data; - } -} - -export interface IPagingElasticSearchLogInput { - /** 当前页面.默认从1开始 */ - pageIndex: number; - /** 每页多少条.每页显示多少记录 */ - pageSize: number; - /** 跳过多少条 */ - skipCount: number; - filter: string | undefined; - startCreationTime: dayjs.Dayjs | undefined; - endCreationTime: dayjs.Dayjs | undefined; -} - -export class PagingElasticSearchLogOutput implements IPagingElasticSearchLogOutput { - /** 日志级别 */ - level!: string | undefined; - /** 日志内容 */ - message!: string | undefined; - /** 创建时间 */ - creationTime!: dayjs.Dayjs; - - constructor(data?: IPagingElasticSearchLogOutput) { - if (data) { - for (var property in data) { - if (data.hasOwnProperty(property)) - (this)[property] = (data)[property]; - } - } - } - - init(_data?: any) { - if (_data) { - this.level = _data["level"]; - this.message = _data["message"]; - this.creationTime = _data["creationTime"] ? dayjs(_data["creationTime"].toString()) : undefined; - } - } - - static fromJS(data: any): PagingElasticSearchLogOutput { - data = typeof data === 'object' ? data : {}; - let result = new PagingElasticSearchLogOutput(); - result.init(data); - return result; - } - - toJSON(data?: any) { - data = typeof data === 'object' ? data : {}; - data["level"] = this.level; - data["message"] = this.message; - data["creationTime"] = this.creationTime ? this.creationTime.toISOString() : undefined; - return data; - } -} - -export interface IPagingElasticSearchLogOutput { - /** 日志级别 */ - level: string | undefined; - /** 日志内容 */ - message: string | undefined; - /** 创建时间 */ - creationTime: dayjs.Dayjs; -} - -export class PagingElasticSearchLogOutputCustomPagedResultDto implements IPagingElasticSearchLogOutputCustomPagedResultDto { - items!: PagingElasticSearchLogOutput[] | undefined; - totalCount!: number; - - constructor(data?: IPagingElasticSearchLogOutputCustomPagedResultDto) { - if (data) { - for (var property in data) { - if (data.hasOwnProperty(property)) - (this)[property] = (data)[property]; - } - } - } - - init(_data?: any) { - if (_data) { - if (Array.isArray(_data["items"])) { - this.items = [] as any; - for (let item of _data["items"]) - this.items!.push(PagingElasticSearchLogOutput.fromJS(item)); - } - this.totalCount = _data["totalCount"]; - } - } - - static fromJS(data: any): PagingElasticSearchLogOutputCustomPagedResultDto { - data = typeof data === 'object' ? data : {}; - let result = new PagingElasticSearchLogOutputCustomPagedResultDto(); - result.init(data); - return result; - } - - toJSON(data?: any) { - data = typeof data === 'object' ? data : {}; - if (Array.isArray(this.items)) { - data["items"] = []; - for (let item of this.items) - data["items"].push(item.toJSON()); - } - data["totalCount"] = this.totalCount; - return data; - } -} - -export interface IPagingElasticSearchLogOutputCustomPagedResultDto { - items: PagingElasticSearchLogOutput[] | undefined; - totalCount: number; -} - export class PagingEntityChangeOutput implements IPagingEntityChangeOutput { id!: string; auditLogId!: string; diff --git a/vben28/src/views/admin/elasticSearch/ElasticSearch.ts b/vben28/src/views/admin/elasticSearch/ElasticSearch.ts deleted file mode 100644 index bc605440..00000000 --- a/vben28/src/views/admin/elasticSearch/ElasticSearch.ts +++ /dev/null @@ -1,56 +0,0 @@ -import { FormSchema } from '/@/components/Table'; -import { BasicColumn } from '/@/components/Table'; -import { useI18n } from '/@/hooks/web/useI18n'; - -const { t } = useI18n(); -import { formatToDateTime, dateUtil } from '/@/utils/dateUtil'; -import { EsLogServiceProxy, PagingElasticSearchLogInput } from '/@/services/ServiceProxies'; - -export const searchFormSchema: FormSchema[] = [ - { - field: 'filter', - component: 'Input', - label: t('common.key'), - labelWidth: 120, - colProps: { - span: 6, - }, - }, - { - field: 'time', - component: 'RangePicker', - label: t('common.creationTime'), - labelWidth: 80, - colProps: { span: 6 }, - defaultValue: [dateUtil().subtract(0, 'days'), dateUtil().add(1, 'days')], - }, -]; -export const tableColumns: BasicColumn[] = [ - { - title: t('routes.admin.logLevel'), - dataIndex: 'level', - width: 200, - }, - { - title: t('common.creationTime'), - dataIndex: 'creationTime', - customRender: ({ text }) => { - return formatToDateTime(text); - }, - width: 200, - }, - { - title: t('routes.admin.logContent'), - dataIndex: 'message', - }, -]; - -/** - * ES日志 - * @param request - * @returns - */ -export async function getElasticSearchLogAsync(request: PagingElasticSearchLogInput) { - const _elasticSearchServiceProxy = new EsLogServiceProxy(); - return await _elasticSearchServiceProxy.page(request); -} diff --git a/vben28/src/views/admin/elasticSearch/ElasticSearch.vue b/vben28/src/views/admin/elasticSearch/ElasticSearch.vue deleted file mode 100644 index c11c833a..00000000 --- a/vben28/src/views/admin/elasticSearch/ElasticSearch.vue +++ /dev/null @@ -1,81 +0,0 @@ - - - - -