Skip to content

Commit

Permalink
make some changes
Browse files Browse the repository at this point in the history
  • Loading branch information
bluewang committed Jan 9, 2024
1 parent 049e709 commit 23f6a7f
Show file tree
Hide file tree
Showing 10 changed files with 117 additions and 34 deletions.
4 changes: 0 additions & 4 deletions inlong-dashboard/src/configs/menus/conf.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,6 @@ const conf: MenuItemType[] = [
path: '/system',
name: i18n.t('configs.menus.ModuleAudit'),
},
{
path: '/systemId',
name: i18n.t('configs.menus.ModuleAuditID'),
},
],
},
];
Expand Down
11 changes: 6 additions & 5 deletions inlong-dashboard/src/configs/routes/conf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,12 @@ const conf: RouteProps[] = [
},
{
path: '/system',
component: () => import('@/ui/pages/ModuleAuditDashboard'),
},
{
path: '/systemId',
component: () => import('@/ui/pages/ModuleAuditID'),
childRoutes: [
{
path: '/:type?',
component: () => import('@/ui/pages/ModuleAudit'),
},
],
},
{
component: () => import('@/ui/pages/Error/404'),
Expand Down
6 changes: 2 additions & 4 deletions inlong-dashboard/src/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ const resources = {
'configs.menus.DataSynchronize': 'Synchronization',
'configs.menus.TenantManagement': 'Tenant Management',
'configs.menus.SystemOperation': 'Operation',
'configs.menus.ModuleAudit': 'Module audit (IP)',
'configs.menus.ModuleAuditID': 'Module audit (ID)',
'configs.menus.ModuleAudit': 'Module audit',
},
},
cn: {
Expand All @@ -55,8 +54,7 @@ const resources = {
'configs.menus.DataSynchronize': '数据同步',
'configs.menus.TenantManagement': '租户管理',
'configs.menus.SystemOperation': '系统运维',
'configs.menus.ModuleAudit': '模块审计 (IP)',
'configs.menus.ModuleAuditID': '模块审计 (ID)',
'configs.menus.ModuleAudit': '模块审计',
},
},
};
Expand Down
13 changes: 7 additions & 6 deletions inlong-dashboard/src/ui/locales/cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -842,10 +842,11 @@
"pages.Tenant.config.GeneralUser": "普通用户",
"pages.Tenant.config.Creator": "创建人",
"pages.Tenant.config.CreateTime": "创建时间",
"pages.ModuleAuditDashboard.config.Ip": "机器 IP",
"pages.ModuleAuditDashboard.config.BenchmarkIndicator": "基准指标",
"pages.ModuleAuditDashboard.config.ComparativeIndicators": "对比指标",
"pages.ModuleAuditDashboard.config.InlongGroupId": "数据流组ID",
"pages.ModuleAuditDashboard.config.InlongStreamId": "数据流ID"

"pages.ModuleAudit.Ip": "IP 查询",
"pages.ModuleAudit.Id": "ID 查询",
"pages.ModuleAudit.config.Ip": "机器 IP",
"pages.ModuleAudit.config.BenchmarkIndicator": "基准指标",
"pages.ModuleAudit.config.ComparativeIndicators": "对比指标",
"pages.ModuleAudit.config.InlongGroupId": "数据流组ID",
"pages.ModuleAudit.config.InlongStreamId": "数据流ID"
}
12 changes: 7 additions & 5 deletions inlong-dashboard/src/ui/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -842,9 +842,11 @@
"pages.Tenant.config.GeneralUser": "General user",
"pages.Tenant.config.Creator": "Creator",
"pages.Tenant.config.CreateTime": "Create time",
"pages.ModuleAuditDashboard.config.Ip": "Machine ip",
"pages.ModuleAuditDashboard.config.BenchmarkIndicator": "Benchmark indicator",
"pages.ModuleAuditDashboard.config.ComparativeIndicators": "Comparative indicator",
"pages.ModuleAuditDashboard.config.InlongGroupId": "Inlong group id",
"pages.ModuleAuditDashboard.config.InlongStreamId": "Inlong stream id"
"pages.ModuleAudit.Ip": "Query by ip",
"pages.ModuleAudit.Id": "Query by id",
"pages.ModuleAudit.config.Ip": "Machine ip",
"pages.ModuleAudit.config.BenchmarkIndicator": "Benchmark indicator",
"pages.ModuleAudit.config.ComparativeIndicators": "Comparative indicator",
"pages.ModuleAudit.config.InlongGroupId": "Inlong group id",
"pages.ModuleAudit.config.InlongStreamId": "Inlong stream id"
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export const toTableData = (source, sourceDataMap) => {
export const getFormContent = initialValues => [
{
type: 'select',
label: i18n.t('pages.ModuleAuditDashboard.config.InlongGroupId'),
label: i18n.t('pages.ModuleAudit.config.InlongGroupId'),
name: 'inlongGroupId',
props: {
dropdownMatchSelectWidth: false,
Expand All @@ -74,7 +74,7 @@ export const getFormContent = initialValues => [
},
{
type: 'select',
label: i18n.t('pages.ModuleAuditDashboard.config.InlongStreamId'),
label: i18n.t('pages.ModuleAudit.config.InlongStreamId'),
name: 'inlongStreamId',
props: values => ({
dropdownMatchSelectWidth: false,
Expand Down Expand Up @@ -123,7 +123,7 @@ export const getFormContent = initialValues => [
},
{
type: 'select',
label: i18n.t('pages.ModuleAuditDashboard.config.BenchmarkIndicator'),
label: i18n.t('pages.ModuleAudit.config.BenchmarkIndicator'),
name: 'benchmark',
props: {
allowClear: true,
Expand All @@ -146,7 +146,7 @@ export const getFormContent = initialValues => [
},
{
type: 'select',
label: i18n.t('pages.ModuleAuditDashboard.config.ComparativeIndicators'),
label: i18n.t('pages.ModuleAudit.config.ComparativeIndicators'),
name: 'compared',
props: {
allowClear: true,
Expand Down Expand Up @@ -177,7 +177,7 @@ export const getTableColumns = source => {
}));
return [
{
title: i18n.t('pages.ModuleAuditDashboard.config.Ip'),
title: i18n.t('pages.ModuleAudit.config.Ip'),
dataIndex: 'ip',
},
].concat(data);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ import { useRequest } from '@/ui/hooks';
import { timestampFormat } from '@/core/utils';
import { getFormContent, toTableData, getTableColumns } from './config';

export const idModule = 'id';

const Comp: React.FC = () => {
const [query, setQuery] = useState({
startDate: +new Date(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export const toTableData = (source, sourceDataMap) => {
export const getFormContent = (initialValues, onSearch) => [
{
type: 'inputsearch',
label: i18n.t('pages.ModuleAuditDashboard.config.Ip'),
label: i18n.t('pages.ModuleAudit.config.Ip'),
name: 'ip',
},
{
Expand All @@ -83,7 +83,7 @@ export const getFormContent = (initialValues, onSearch) => [
},
{
type: 'select',
label: i18n.t('pages.ModuleAuditDashboard.config.BenchmarkIndicator'),
label: i18n.t('pages.ModuleAudit.config.BenchmarkIndicator'),
name: 'benchmark',
props: {
allowClear: true,
Expand All @@ -106,7 +106,7 @@ export const getFormContent = (initialValues, onSearch) => [
},
{
type: 'select',
label: i18n.t('pages.ModuleAuditDashboard.config.ComparativeIndicators'),
label: i18n.t('pages.ModuleAudit.config.ComparativeIndicators'),
name: 'compared',
props: {
allowClear: true,
Expand Down Expand Up @@ -141,11 +141,11 @@ export const getTableColumns = source => {
dataIndex: 'logTs',
},
{
title: i18n.t('pages.ModuleAuditDashboard.config.InlongGroupId'),
title: i18n.t('pages.ModuleAudit.config.InlongGroupId'),
dataIndex: 'inlongGroupId',
},
{
title: i18n.t('pages.ModuleAuditDashboard.config.InlongStreamId'),
title: i18n.t('pages.ModuleAudit.config.InlongStreamId'),
dataIndex: 'inlongStreamId',
},
].concat(data);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ import { useRequest } from '@/ui/hooks';
import { timestampFormat } from '@/core/utils';
import { getFormContent, toTableData, getTableColumns } from './config';

export const ipModule = 'ip';

const Comp: React.FC = () => {
const [form] = useForm();

Expand Down
81 changes: 81 additions & 0 deletions inlong-dashboard/src/ui/pages/ModuleAudit/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import React, { useState } from 'react';
import { Card } from 'antd';
import { PageContainer, Container } from '@/ui/components/PageContainer';
import { useHistory, useParams } from '@/ui/hooks';
import i18n from '@/i18n';
import IpModule, { ipModule as ipModuleName } from './IpModule';
import IdModule, { idModule as idModuleName } from './IdModule';

const tabList = [
{
tab: i18n.t('pages.ModuleAudit.Id'),
key: idModuleName,
content: <IdModule />,
},
{
tab: i18n.t('pages.ModuleAudit.Ip'),
key: ipModuleName,
content: <IpModule />,
},
];

const tabListMap = tabList.reduce(
(acc, item) => ({
...acc,
[item.key]: item.content,
}),
{},
);

const Comp: React.FC = () => {
const history = useHistory();
const { type } = useParams<Record<string, string>>();

const [module, setModule] = useState(type || tabList[0].key);

const onTabsChange = value => {
setModule(value);
history.push({
pathname: `/system/${value}`,
});
};

return (
<PageContainer useDefaultBreadcrumb={false} useDefaultContainer={false}>
<Container>
<Card
tabList={tabList}
activeTabKey={module}
onTabChange={key => {
onTabsChange(key);
}}
headStyle={{ border: 'none' }}
tabProps={{ size: 'middle' }}
>
{tabListMap[module]}
</Card>
</Container>
</PageContainer>
);
};

export default Comp;

0 comments on commit 23f6a7f

Please sign in to comment.