Unverified Commit 21b2c228 authored by zhu-mingye's avatar zhu-mingye Committed by GitHub

Refactor devops alerthistory (#2345)

* Spotless Apply * refactor_devops_alerthistory --------- Co-authored-by: 's avatarzhu-mingye <zhu-mingye@users.noreply.github.com>
parent 218cb25f
...@@ -24,7 +24,6 @@ import org.dinky.data.constant.PermissionConstants; ...@@ -24,7 +24,6 @@ import org.dinky.data.constant.PermissionConstants;
import org.dinky.data.enums.BusinessType; import org.dinky.data.enums.BusinessType;
import org.dinky.data.enums.Status; import org.dinky.data.enums.Status;
import org.dinky.data.model.AlertGroup; import org.dinky.data.model.AlertGroup;
import org.dinky.data.model.AlertHistory;
import org.dinky.data.result.ProTableResult; import org.dinky.data.result.ProTableResult;
import org.dinky.data.result.Result; import org.dinky.data.result.Result;
import org.dinky.service.AlertGroupService; import org.dinky.service.AlertGroupService;
...@@ -164,22 +163,4 @@ public class AlertGroupController { ...@@ -164,22 +163,4 @@ public class AlertGroupController {
return Result.failed(Status.DELETE_FAILED); return Result.failed(Status.DELETE_FAILED);
} }
} }
/**
* list alert history
*
* @param para {@link JsonNode}
* @return {@link ProTableResult} with {@link AlertHistory}
*/
@PostMapping("/history")
@ApiImplicitParam(
name = "para",
value = "JsonNode",
dataType = "JsonNode",
required = true,
dataTypeClass = JsonNode.class)
@ApiOperation("Query AlertHistory List")
public ProTableResult<AlertHistory> listAlertHistory(@RequestBody JsonNode para) {
return alertHistoryService.selectForProTable(para);
}
} }
...@@ -21,17 +21,19 @@ package org.dinky.controller; ...@@ -21,17 +21,19 @@ package org.dinky.controller;
import org.dinky.data.annotation.Log; import org.dinky.data.annotation.Log;
import org.dinky.data.enums.BusinessType; import org.dinky.data.enums.BusinessType;
import org.dinky.data.enums.Status;
import org.dinky.data.model.AlertHistory; import org.dinky.data.model.AlertHistory;
import org.dinky.data.result.ProTableResult; import org.dinky.data.result.Result;
import org.dinky.service.AlertHistoryService; import org.dinky.service.AlertHistoryService;
import org.springframework.web.bind.annotation.PostMapping; import java.util.List;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.fasterxml.jackson.databind.JsonNode;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
...@@ -52,18 +54,45 @@ public class AlertHistoryController { ...@@ -52,18 +54,45 @@ public class AlertHistoryController {
private final AlertHistoryService alertHistoryService; private final AlertHistoryService alertHistoryService;
/** 动态查询列表 */ /**
@PostMapping * Query Alert History By Job Instance Id
* @param jobInstanceId
* @return List<AlertHistory>
*/
@GetMapping("/list")
@ApiOperation("Query Alert History") @ApiOperation("Query Alert History")
@ApiImplicitParam( @ApiImplicitParam(
name = "para", name = "jobInstanceId",
value = "Query Alert History", value = "Query Alert History By Job Instance Id",
dataTypeClass = JsonNode.class, dataTypeClass = Integer.class,
paramType = "body",
required = true, required = true,
dataType = "JsonNode") dataType = "Integer")
@Log(title = "Query Alert History", businessType = BusinessType.QUERY) @Log(title = "Query Alert History", businessType = BusinessType.QUERY)
public ProTableResult<AlertHistory> listAlertHistoryRecord(@RequestBody JsonNode para) { public Result<List<AlertHistory>> listAlertHistoryRecord(@RequestParam("jobInstanceId") Integer jobInstanceId) {
return alertHistoryService.selectForProTable(para); return Result.succeed(alertHistoryService.queryAlertHistoryRecordByJobInstanceId(jobInstanceId));
}
/**
* delete AlertInstance by id
*
* @param id {@link Integer}
* @return {@link Result} of {@link Void}
*/
@DeleteMapping("/delete")
@Log(title = "Delete Alert History By Id", businessType = BusinessType.DELETE)
@ApiOperation("Delete Alert History By Id")
@ApiImplicitParam(
name = "id",
value = "Alert History Id",
dataType = "Integer",
paramType = "query",
required = true,
dataTypeClass = Integer.class)
public Result<Void> deleteAlertInstanceById(@RequestParam("id") Integer id) {
if (alertHistoryService.removeById(id)) {
return Result.succeed(Status.DELETE_SUCCESS);
} else {
return Result.failed(Status.DELETE_FAILED);
}
} }
} }
...@@ -27,6 +27,10 @@ import com.baomidou.mybatisplus.annotation.IdType; ...@@ -27,6 +27,10 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
...@@ -56,6 +60,10 @@ public class AlertHistory implements Serializable { ...@@ -56,6 +60,10 @@ public class AlertHistory implements Serializable {
@ApiModelProperty(value = "Alert Group ID", example = "1", required = true, dataType = "Integer") @ApiModelProperty(value = "Alert Group ID", example = "1", required = true, dataType = "Integer")
private Integer alertGroupId; private Integer alertGroupId;
@ApiModelProperty(value = "Alert Group", dataType = "AlertGroup")
@TableField(exist = false)
private AlertGroup alertGroup;
@ApiModelProperty(value = "Alert Instance ID", example = "1", required = true, dataType = "Integer") @ApiModelProperty(value = "Alert Instance ID", example = "1", required = true, dataType = "Integer")
private Integer jobInstanceId; private Integer jobInstanceId;
...@@ -77,6 +85,8 @@ public class AlertHistory implements Serializable { ...@@ -77,6 +85,8 @@ public class AlertHistory implements Serializable {
example = "2022-02-24 20:12:00", example = "2022-02-24 20:12:00",
required = false, required = false,
dataType = "LocalDateTime") dataType = "LocalDateTime")
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
@JsonSerialize(using = LocalDateTimeSerializer.class)
private LocalDateTime createTime; private LocalDateTime createTime;
@TableField(fill = FieldFill.INSERT_UPDATE) @TableField(fill = FieldFill.INSERT_UPDATE)
...@@ -85,5 +95,7 @@ public class AlertHistory implements Serializable { ...@@ -85,5 +95,7 @@ public class AlertHistory implements Serializable {
example = "2022-02-24 20:12:00", example = "2022-02-24 20:12:00",
required = false, required = false,
dataType = "LocalDateTime") dataType = "LocalDateTime")
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
@JsonSerialize(using = LocalDateTimeSerializer.class)
private LocalDateTime updateTime; private LocalDateTime updateTime;
} }
...@@ -22,6 +22,8 @@ package org.dinky.service; ...@@ -22,6 +22,8 @@ package org.dinky.service;
import org.dinky.data.model.AlertHistory; import org.dinky.data.model.AlertHistory;
import org.dinky.mybatis.service.ISuperService; import org.dinky.mybatis.service.ISuperService;
import java.util.List;
/** AlertHistoryService */ /** AlertHistoryService */
public interface AlertHistoryService extends ISuperService<AlertHistory> { public interface AlertHistoryService extends ISuperService<AlertHistory> {
...@@ -32,4 +34,6 @@ public interface AlertHistoryService extends ISuperService<AlertHistory> { ...@@ -32,4 +34,6 @@ public interface AlertHistoryService extends ISuperService<AlertHistory> {
* @return {@link Boolean} * @return {@link Boolean}
*/ */
Boolean deleteByAlertGroupId(Integer alertGroupId); Boolean deleteByAlertGroupId(Integer alertGroupId);
List<AlertHistory> queryAlertHistoryRecordByJobInstanceId(Integer jobInstanceId);
} }
...@@ -22,9 +22,11 @@ package org.dinky.service.impl; ...@@ -22,9 +22,11 @@ package org.dinky.service.impl;
import org.dinky.data.model.AlertHistory; import org.dinky.data.model.AlertHistory;
import org.dinky.mapper.AlertHistoryMapper; import org.dinky.mapper.AlertHistoryMapper;
import org.dinky.mybatis.service.impl.SuperServiceImpl; import org.dinky.mybatis.service.impl.SuperServiceImpl;
import org.dinky.service.AlertGroupService;
import org.dinky.service.AlertHistoryService; import org.dinky.service.AlertHistoryService;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -38,6 +40,9 @@ import lombok.RequiredArgsConstructor; ...@@ -38,6 +40,9 @@ import lombok.RequiredArgsConstructor;
@RequiredArgsConstructor @RequiredArgsConstructor
public class AlertHistoryServiceImpl extends SuperServiceImpl<AlertHistoryMapper, AlertHistory> public class AlertHistoryServiceImpl extends SuperServiceImpl<AlertHistoryMapper, AlertHistory>
implements AlertHistoryService { implements AlertHistoryService {
private final AlertGroupService alertGroupService;
/** /**
* delete alert history by alert group id * delete alert history by alert group id
* *
...@@ -51,4 +56,19 @@ public class AlertHistoryServiceImpl extends SuperServiceImpl<AlertHistoryMapper ...@@ -51,4 +56,19 @@ public class AlertHistoryServiceImpl extends SuperServiceImpl<AlertHistoryMapper
.selectList(new LambdaQueryWrapper<AlertHistory>().eq(AlertHistory::getAlertGroupId, alertGroupId)); .selectList(new LambdaQueryWrapper<AlertHistory>().eq(AlertHistory::getAlertGroupId, alertGroupId));
return baseMapper.deleteBatchIds(alertHistoryList) > 0; return baseMapper.deleteBatchIds(alertHistoryList) > 0;
} }
/**
* @param jobInstanceId
* @return
*/
@Override
public List<AlertHistory> queryAlertHistoryRecordByJobInstanceId(Integer jobInstanceId) {
return baseMapper
.selectList(new LambdaQueryWrapper<AlertHistory>().eq(AlertHistory::getJobInstanceId, jobInstanceId))
.stream()
.peek(alertHistory ->
alertHistory.setAlertGroup(alertGroupService.getById(alertHistory.getAlertGroupId())))
.collect(Collectors.toList());
}
} }
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
"scripts": { "scripts": {
"analyze": "cross-env ANALYZE=1 max build", "analyze": "cross-env ANALYZE=1 max build",
"build": "max build ", "build": "max build ",
"deploy": "npm run build && npm run gh-pages",
"dev": " npm run start:dev ", "dev": " npm run start:dev ",
"postinstall": "max setup", "postinstall": "max setup",
"lint": "npm run lint:js && npm run lint:prettier && npm run tsc", "lint": "npm run lint:js && npm run lint:prettier && npm run tsc",
...@@ -15,7 +14,6 @@ ...@@ -15,7 +14,6 @@
"lint:fix": "eslint --fix --cache --ext .js,.jsx,.ts,.tsx --format=pretty ./src ", "lint:fix": "eslint --fix --cache --ext .js,.jsx,.ts,.tsx --format=pretty ./src ",
"lint:js": "eslint --cache --ext .js,.jsx,.ts,.tsx --format=pretty ./src", "lint:js": "eslint --cache --ext .js,.jsx,.ts,.tsx --format=pretty ./src",
"lint:prettier": "prettier -c --write \"**/**.{js,jsx,tsx,ts,less,md,json}\" --end-of-line auto", "lint:prettier": "prettier -c --write \"**/**.{js,jsx,tsx,ts,less,md,json}\" --end-of-line auto",
"openapi": "max openapi",
"prettier": "prettier -c --write \"**/**.{js,jsx,tsx,ts,less,md,json}\"", "prettier": "prettier -c --write \"**/**.{js,jsx,tsx,ts,less,md,json}\"",
"preview": "npm run build && max preview --port 8000", "preview": "npm run build && max preview --port 8000",
"serve": "umi-serve", "serve": "umi-serve",
...@@ -38,58 +36,57 @@ ...@@ -38,58 +36,57 @@
], ],
"dependencies": { "dependencies": {
"@ant-design/charts": "^1.4.2", "@ant-design/charts": "^1.4.2",
"@ant-design/icons": "^5.0.1", "@ant-design/icons": "^5.2.6",
"@ant-design/pro-components": "^2.6.3", "@ant-design/pro-components": "^2.6.27",
"@ant-design/pro-layout": "^7.13.3", "@ant-design/pro-layout": "^7.17.6",
"@ant-design/pro-table": "^3.6.9", "@ant-design/pro-table": "^3.12.11",
"@ant-design/use-emotion-css": "^1.0.4", "@ant-design/use-emotion-css": "^1.0.4",
"@antv/x6": "^2.15.1", "@antv/x6": "^2.15.1",
"@antv/x6-plugin-selection": "^2.2.1", "@antv/x6-plugin-selection": "^2.2.1",
"@antv/x6-react-shape": "^2.2.2", "@antv/x6-react-shape": "^2.2.2",
"@monaco-editor/react": "^4.5.1", "@monaco-editor/react": "^4.5.2",
"@umijs/route-utils": "^4.0.1", "@umijs/route-utils": "^4.0.1",
"antd": "^5.6.1", "antd": "^5.9.3",
"classnames": "^2.3.2", "classnames": "^2.3.2",
"dayjs": "^1.11.9", "dayjs": "^1.11.10",
"js-cookie": "^3.0.5", "js-cookie": "^3.0.5",
"lodash": "^4.17.21", "lodash": "^4.17.21",
"million": "^2.5.1-beta.3", "million": "^2.6.1",
"moment": "^2.29.4", "moment": "^2.29.4",
"monaco-editor": "^0.41.0", "monaco-editor": "^0.43.0",
"omit.js": "^2.0.2", "omit.js": "^2.0.2",
"rc-menu": "^9.8.4", "rc-menu": "^9.12.0",
"rc-util": "^5.33.0", "rc-util": "^5.37.0",
"re-resizable": "6.9.11", "re-resizable": "^6.9.11",
"react": "^18.2.0", "react": "^18.2.0",
"react-countup": "^6.4.2", "react-countup": "^6.4.2",
"react-dom": "^18.0.0", "react-dom": "^18.0.0",
"react-helmet-async": "^1.3.0", "react-helmet-async": "^1.3.0",
"react-spring": "^9.7.1", "react-markdown": "^8.0.7",
"react-spring": "^9.7.3",
"react-use-cookie": "^1.4.0", "react-use-cookie": "^1.4.0",
"redux-persist": "^6.0.0", "redux-persist": "^6.0.0",
"remark-gfm": "^4.0.0",
"screenfull": "^6.0.2", "screenfull": "^6.0.2",
"styled-components": "^6.0.0-rc.3", "styled-components": "^6.0.8",
"use-sse": "^2.0.1" "use-sse": "^2.0.1"
}, },
"devDependencies": { "devDependencies": {
"@ant-design/pro-cli": "^3.0.1", "@ant-design/pro-cli": "^3.0.1",
"@testing-library/react": "^14.0.0",
"@types/classnames": "^2.3.1", "@types/classnames": "^2.3.1",
"@types/express": "^4.17.17", "@types/express": "^4.17.18",
"@types/history": "^5.0.0", "@types/history": "^5.0.0",
"@types/lodash": "^4.14.186", "@types/lodash": "^4.14.199",
"@types/react": "^18.0.28", "@types/react": "^18.2.22",
"@types/react-dom": "^18.0.11", "@types/react-dom": "^18.0.11",
"@types/react-helmet": "^6.1.5", "@types/react-helmet": "^6.1.5",
"@umijs/lint": "^4.0.53", "@umijs/lint": "^4.0.81",
"@umijs/max": "^4.0.53", "@umijs/max": "^4.0.81",
"cross-env": "^7.0.3", "cross-env": "^7.0.3",
"eslint": "^8.35.0", "eslint": "^8.50.0",
"express": "^4.18.2", "express": "^4.18.2",
"gh-pages": "^5.0.0",
"husky": "^8", "husky": "^8",
"lint-staged": "^13", "lint-staged": "^13",
"mockjs": "^1.1.0",
"prettier": "^2", "prettier": "^2",
"react-dev-inspector": "^2.0.0", "react-dev-inspector": "^2.0.0",
"react-inspector": "^6.0.2", "react-inspector": "^6.0.2",
......
...@@ -419,3 +419,10 @@ h5 { ...@@ -419,3 +419,10 @@ h5 {
display: flex !important; display: flex !important;
align-items: baseline !important; align-items: baseline !important;
} }
.ant-pro-checkcard {
overflow: hidden;
.ant-pro-checkcard-body {
width: 100vw;
}
}
...@@ -122,7 +122,15 @@ export default { ...@@ -122,7 +122,15 @@ export default {
'devops.jobinfo.ck.taskid': 'Task ID', 'devops.jobinfo.ck.taskid': 'Task ID',
'devops.jobinfo.ck.trigger_timestamp': 'Trigger Time', 'devops.jobinfo.ck.trigger_timestamp': 'Trigger Time',
'devops.jobinfo.config.ClusterInstanceName': 'Flink Instance', 'devops.jobinfo.config.ClusterInstanceName': 'Flink Instance',
'devops.jobinfo.config.JobAlert': 'Alert', 'devops.jobinfo.config.JobAlert': 'Alert History',
'devops.jobinfo.config.JobAlert.history.group': 'Alert Group',
'devops.jobinfo.config.JobAlert.history.title': 'Alert Title',
'devops.jobinfo.config.JobAlert.history.content': 'Alert Content',
'devops.jobinfo.config.JobAlert.history.status': 'Alert Send Status',
'devops.jobinfo.config.JobAlert.history.log': 'Alert Log',
'devops.jobinfo.config.JobAlert.history.time': 'Alert Time',
'devops.jobinfo.config.JobAlert.history.delete':
'Are you sure to delete the alert history record?',
'devops.jobinfo.config.JobBaseInfo': 'Job Base Info', 'devops.jobinfo.config.JobBaseInfo': 'Job Base Info',
'devops.jobinfo.config.JobCheckpoints': 'Checkpoints Info', 'devops.jobinfo.config.JobCheckpoints': 'Checkpoints Info',
'devops.jobinfo.config.JobId': 'Flink Job ID', 'devops.jobinfo.config.JobId': 'Flink Job ID',
......
...@@ -117,6 +117,13 @@ export default { ...@@ -117,6 +117,13 @@ export default {
'devops.jobinfo.ck.trigger_timestamp': '触发时间', 'devops.jobinfo.ck.trigger_timestamp': '触发时间',
'devops.jobinfo.config.ClusterInstanceName': 'Flink实例', 'devops.jobinfo.config.ClusterInstanceName': 'Flink实例',
'devops.jobinfo.config.JobAlert': '告警记录', 'devops.jobinfo.config.JobAlert': '告警记录',
'devops.jobinfo.config.JobAlert.history.group': '告警组',
'devops.jobinfo.config.JobAlert.history.title': '告警标题',
'devops.jobinfo.config.JobAlert.history.content': '告警内容',
'devops.jobinfo.config.JobAlert.history.status': '告警发送状态',
'devops.jobinfo.config.JobAlert.history.log': '告警日志',
'devops.jobinfo.config.JobAlert.history.time': '告警时间',
'devops.jobinfo.config.JobAlert.history.delete': '你确定删除该告警记录吗?',
'devops.jobinfo.config.JobBaseInfo': '作业基本信息', 'devops.jobinfo.config.JobBaseInfo': '作业基本信息',
'devops.jobinfo.config.JobCheckpoints': '作业快照', 'devops.jobinfo.config.JobCheckpoints': '作业快照',
'devops.jobinfo.config.JobId': 'Flink Job ID', 'devops.jobinfo.config.JobId': 'Flink Job ID',
......
/*
* 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 { PopconfirmDeleteBtn } from '@/components/CallBackButton/PopconfirmDeleteBtn';
import { ShowLogBtn } from '@/components/CallBackButton/ShowLogBtn';
import CodeShow from '@/components/CustomEditor/CodeShow';
import { JobProps } from '@/pages/DevOps/JobDetail/data.d';
import { handleRemoveById, queryDataByParams } from '@/services/BusinessCrud';
import { API_CONSTANTS } from '@/services/endpoints';
import { AlertHistory } from '@/types/DevOps/data.d';
import { InitAlertHistoryState } from '@/types/DevOps/init.d';
import { AlertHistoryState } from '@/types/DevOps/state.d';
import { l } from '@/utils/intl';
import { ProColumns } from '@ant-design/pro-components';
import ProTable from '@ant-design/pro-table';
import { Modal, Tag } from 'antd';
import { useEffect, useState } from 'react';
import ReactMarkdown from 'react-markdown';
import remarkGfm from 'remark-gfm';
const AlertHistoryList = (props: JobProps) => {
const { jobDetail } = props;
const [alertHistory, setAlertHistory] = useState<AlertHistoryState>(InitAlertHistoryState);
const getAlertHistory = () => {
setAlertHistory((prevState) => ({ ...prevState, loading: true }));
queryDataByParams(API_CONSTANTS.ALERT_HISTORY_LIST, {
jobInstanceId: jobDetail.instance.id
}).then((res) => {
setAlertHistory((prevState) => ({ ...prevState, alertHistory: res as AlertHistory[] }));
});
setAlertHistory((prevState) => ({ ...prevState, loading: false }));
};
useEffect(() => {
getAlertHistory();
}, []);
const handleDelete = async (record: AlertHistory) => {
setAlertHistory((prevState) => ({ ...prevState, loading: true }));
await handleRemoveById(API_CONSTANTS.ALERT_HISTORY_DELETE, record.id);
getAlertHistory();
setAlertHistory((prevState) => ({ ...prevState, loading: false }));
};
const handleShowContent = (record: AlertHistory) => {
Modal.info({
title: l('devops.jobinfo.config.JobAlert.history.content'),
bodyStyle: { width: '100%', overflow: 'auto' },
width: '30vw',
content: (
<ReactMarkdown remarkPlugins={[remarkGfm]} key={record.id}>
{record.content}
</ReactMarkdown>
)
});
};
const handleShowLog = (record: AlertHistory) => {
Modal.info({
title: l('devops.jobinfo.config.JobAlert.history.log'),
bodyStyle: { width: '100%', overflow: 'auto' },
width: '30vw',
content: <CodeShow code={record.log} language={'java'} />
});
};
const columns: ProColumns<AlertHistory>[] = [
{
title: 'ID',
dataIndex: 'id'
},
{
title: l('devops.jobinfo.config.JobAlert.history.group'),
render: (text: any, record: AlertHistory) => {
return <Tag color={'processing'}>{record.alertGroup.name}</Tag>;
}
},
{
title: l('devops.jobinfo.config.JobAlert.history.title'),
dataIndex: 'title'
},
{
title: l('devops.jobinfo.config.JobAlert.history.content'),
render: (text: any, record: AlertHistory) => {
return <ShowLogBtn onClick={() => handleShowContent(record)} />;
}
},
{
title: l('devops.jobinfo.config.JobAlert.history.status'),
dataIndex: 'status',
render: (text: any, record: AlertHistory) => {
return (
<Tag color={record.status === 1 ? 'success' : 'error'}>
{record.status === 1 ? 'Success' : 'Failed'}{' '}
</Tag>
);
}
},
{
title: l('devops.jobinfo.config.JobAlert.history.log'),
render: (text: any, record: AlertHistory) => {
return <ShowLogBtn onClick={() => handleShowLog(record)} />;
}
},
{
title: l('devops.jobinfo.config.JobAlert.history.time'),
dataIndex: 'createTime',
valueType: 'dateTime'
},
{
title: l('global.table.operate'),
width: '2vw',
fixed: 'right',
render: (t: any, record: AlertHistory) => [
<PopconfirmDeleteBtn
key={`${record.id}_${t}_delete`}
onClick={() => handleDelete(record)}
description={l('devops.jobinfo.config.JobAlert.history.delete')}
/>
]
}
];
return (
<>
<ProTable<AlertHistory>
rowKey={'id'}
dataSource={alertHistory.alertHistory}
loading={alertHistory.loading}
pagination={{
hideOnSinglePage: true,
pageSize: 15
}}
size={'small'}
virtual
search={false}
options={false}
columns={columns}
/>
</>
);
};
export default AlertHistoryList;
/*
* 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 SlowlyAppear from '@/components/Animation/SlowlyAppear';
import AlertHistoryList from '@/pages/DevOps/JobDetail/AlertHistory/components/AlertHistoryList';
import { JobProps } from '@/pages/DevOps/JobDetail/data';
import { Card } from 'antd';
export default (props: JobProps) => {
const { jobDetail } = props;
return (
<SlowlyAppear>
<Card>
{' '}
<AlertHistoryList jobDetail={jobDetail} />
</Card>
</SlowlyAppear>
);
};
...@@ -25,7 +25,7 @@ import { ...@@ -25,7 +25,7 @@ import {
RocketOutlined, RocketOutlined,
SyncOutlined SyncOutlined
} from '@ant-design/icons'; } from '@ant-design/icons';
import { Descriptions, Tag } from 'antd'; import { Descriptions, Space, Tag } from 'antd';
const CkDesc = (props: JobProps) => { const CkDesc = (props: JobProps) => {
const { jobDetail } = props; const { jobDetail } = props;
...@@ -35,9 +35,9 @@ const CkDesc = (props: JobProps) => { ...@@ -35,9 +35,9 @@ const CkDesc = (props: JobProps) => {
let checkpointsConfigInfo = jobDetail?.jobDataDto?.checkpointsConfig; let checkpointsConfigInfo = jobDetail?.jobDataDto?.checkpointsConfig;
return ( return (
<> <>
<Descriptions bordered size='small' column={3}> <Descriptions bordered size='small' column={4}>
<Descriptions.Item label='Checkpointing Mode'> <Descriptions.Item label='Checkpoint Mode'>
<Tag color='blue' title={'Checkpointing Mode'}> <Tag color='blue' title={'Checkpoint Mode'}>
{checkpointsConfigInfo.mode.toUpperCase()} {checkpointsConfigInfo.mode.toUpperCase()}
</Tag> </Tag>
</Descriptions.Item> </Descriptions.Item>
...@@ -60,27 +60,9 @@ const CkDesc = (props: JobProps) => { ...@@ -60,27 +60,9 @@ const CkDesc = (props: JobProps) => {
</Tag> </Tag>
</Descriptions.Item> </Descriptions.Item>
<Descriptions.Item label='Persist Checkpoints Externally Enabled'> <Descriptions.Item label='Latest Restored'>
<Tag color='blue' title={'Persist Checkpoints Externally Enabled'}> <Tag color='cyan' title={'Latest Restored'}>
{checkpointsConfigInfo.externalization.enabled ? 'Enabled' : 'Disabled'} {latest.restored === null ? 'None' : latest.restored.external_path}
</Tag>
</Descriptions.Item>
<Descriptions.Item label='CheckPoint Counts'>
<Tag color='blue' title={'Total'}>
<RocketOutlined /> Total: {counts.total}
</Tag>
<Tag color='red' title={'Failed'}>
<CloseCircleOutlined /> Failed: {counts.failed}
</Tag>
<Tag color='cyan' title={'Restored'}>
<ExclamationCircleOutlined /> Restored: {counts.restored}
</Tag>
<Tag color='green' title={'Completed'}>
<CheckCircleOutlined /> Completed: {counts.completed}
</Tag>
<Tag color='orange' title={'In Progress'}>
<SyncOutlined spin /> In Progress: {counts.in_progress}
</Tag> </Tag>
</Descriptions.Item> </Descriptions.Item>
...@@ -101,22 +83,41 @@ const CkDesc = (props: JobProps) => { ...@@ -101,22 +83,41 @@ const CkDesc = (props: JobProps) => {
)} )}
</Descriptions.Item> </Descriptions.Item>
<Descriptions.Item label='Latest Restored'> <Descriptions.Item label='Latest Completed CheckPoint'>
<Tag color='cyan' title={'Latest Restored'}> <Tag color='green' title={'Latest Completed CheckPoint'}>
{latest.restored === null ? 'None' : latest.restored.external_path} {latest.completed === null ? 'None' : latest.completed.external_path}
</Tag> </Tag>
</Descriptions.Item> </Descriptions.Item>
<Descriptions.Item label='Persist Checkpoints Externally Enabled'>
<Tag color='blue' title={'Persist Checkpoints Externally Enabled'}>
{checkpointsConfigInfo.externalization.enabled ? 'Enabled' : 'Disabled'}
</Tag>
</Descriptions.Item>
<Descriptions.Item label='Latest Savepoint'> <Descriptions.Item label='Latest Savepoint'>
<Tag color='purple' title={'Latest Savepoint'}> <Tag color='purple' title={'Latest Savepoint'}>
{latest.savepoint === null ? 'None' : latest.savepoint.external_path} {latest.savepoint === null ? 'None' : latest.savepoint.external_path}
</Tag> </Tag>
</Descriptions.Item> </Descriptions.Item>
<Descriptions.Item label='Latest Completed CheckPoint'> <Descriptions.Item label='CheckPoint Counts'>
<Tag color='green' title={'Latest Completed CheckPoint'}> <Space direction={'horizontal'}>
{latest.completed === null ? 'None' : latest.completed.external_path} <Tag color='blue' title={'Total'}>
</Tag> <RocketOutlined /> Total: {counts.total}
</Tag>
<Tag color='red' title={'Failed'}>
<CloseCircleOutlined /> Failed: {counts.failed}
</Tag>
<Tag color='cyan' title={'Restored'}>
<ExclamationCircleOutlined /> Restored: {counts.restored}
</Tag>
<Tag color='green' title={'Completed'}>
<CheckCircleOutlined /> Completed: {counts.completed}
</Tag>
<Tag color='orange' title={'In Progress'}>
<SyncOutlined spin /> In Progress: {counts.in_progress}
</Tag>
</Space>
</Descriptions.Item> </Descriptions.Item>
</Descriptions> </Descriptions>
</> </>
......
...@@ -18,28 +18,28 @@ ...@@ -18,28 +18,28 @@
*/ */
import FlinkDag from '@/components/FlinkDag'; import FlinkDag from '@/components/FlinkDag';
import {JobProps} from '@/pages/DevOps/JobDetail/data'; import { JobProps } from '@/pages/DevOps/JobDetail/data';
import FlinkTable from '@/pages/DevOps/JobDetail/JobOverview/components/FlinkTable'; import FlinkTable from '@/pages/DevOps/JobDetail/JobOverview/components/FlinkTable';
import JobDesc from '@/pages/DevOps/JobDetail/JobOverview/components/JobDesc'; import JobDesc from '@/pages/DevOps/JobDetail/JobOverview/components/JobDesc';
import {ProCard} from '@ant-design/pro-components'; import { ProCard } from '@ant-design/pro-components';
import {Empty} from "antd"; import { Empty } from 'antd';
const JobConfigTab = (props: JobProps) => { const JobConfigTab = (props: JobProps) => {
const {jobDetail} = props; const { jobDetail } = props;
const job = jobDetail?.jobDataDto?.job const job = jobDetail?.jobDataDto?.job;
return ( return (
<> <>
<JobDesc jobDetail={jobDetail}/> <JobDesc jobDetail={jobDetail} />
<ProCard <ProCard
style={{ style={{
height: '40vh' height: '40vh'
}} }}
> >
{job ? <FlinkDag job={job}/> : <Empty image={Empty.PRESENTED_IMAGE_SIMPLE}/>} {job ? <FlinkDag job={job} /> : <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />}
</ProCard> </ProCard>
<FlinkTable jobDetail={jobDetail}/> <FlinkTable jobDetail={jobDetail} />
</> </>
); );
}; };
......
...@@ -32,7 +32,7 @@ const FlinkTable = (props: JobProps): JSX.Element => { ...@@ -32,7 +32,7 @@ const FlinkTable = (props: JobProps): JSX.Element => {
title: l('devops.baseinfo.name'), title: l('devops.baseinfo.name'),
dataIndex: 'name', dataIndex: 'name',
ellipsis: true, ellipsis: true,
width: 400, width: '20%',
render: (dom, entity) => { render: (dom, entity) => {
return <Link>{entity.name}</Link>; return <Link>{entity.name}</Link>;
} }
...@@ -41,30 +41,35 @@ const FlinkTable = (props: JobProps): JSX.Element => { ...@@ -41,30 +41,35 @@ const FlinkTable = (props: JobProps): JSX.Element => {
title: l('devops.baseinfo.status'), title: l('devops.baseinfo.status'),
dataIndex: 'status', dataIndex: 'status',
sorter: true, sorter: true,
width: '8%',
render: (dom, entity) => { render: (dom, entity) => {
return <StatusTag status={entity.status} />; return <StatusTag status={entity.status} />;
} }
}, },
{ {
title: l('devops.baseinfo.readbytes'), title: l('devops.baseinfo.readbytes'),
width: '7%',
render: (dom, entity) => { render: (dom, entity) => {
return parseByteStr(entity.metrics['read-bytes']); return parseByteStr(entity.metrics['read-bytes']);
} }
}, },
{ {
title: l('devops.baseinfo.readrecords'), title: l('devops.baseinfo.readrecords'),
width: '7%',
render: (dom, entity) => { render: (dom, entity) => {
return parseNumStr(entity.metrics['read-records']); return parseNumStr(entity.metrics['read-records']);
} }
}, },
{ {
title: l('devops.baseinfo.writebytes'), title: l('devops.baseinfo.writebytes'),
width: '7%',
render: (dom, entity) => { render: (dom, entity) => {
return parseByteStr(entity.metrics['write-bytes']); return parseByteStr(entity.metrics['write-bytes']);
} }
}, },
{ {
title: l('devops.baseinfo.writerecords'), title: l('devops.baseinfo.writerecords'),
width: '7%',
render: (dom, entity) => { render: (dom, entity) => {
return parseNumStr(entity.metrics['write-records']); return parseNumStr(entity.metrics['write-records']);
} }
...@@ -72,6 +77,7 @@ const FlinkTable = (props: JobProps): JSX.Element => { ...@@ -72,6 +77,7 @@ const FlinkTable = (props: JobProps): JSX.Element => {
{ {
title: l('devops.baseinfo.parallelism'), title: l('devops.baseinfo.parallelism'),
sorter: true, sorter: true,
width: '7%',
dataIndex: 'parallelism' dataIndex: 'parallelism'
}, },
{ {
...@@ -79,16 +85,16 @@ const FlinkTable = (props: JobProps): JSX.Element => { ...@@ -79,16 +85,16 @@ const FlinkTable = (props: JobProps): JSX.Element => {
dataIndex: 'start-time', dataIndex: 'start-time',
valueType: 'dateTime' valueType: 'dateTime'
}, },
{
title: l('global.table.endTime'),
dataIndex: 'end-time',
valueType: 'dateTime'
},
{ {
title: l('global.table.useTime'), title: l('global.table.useTime'),
render: (dom, entity) => { render: (dom, entity) => {
return parseMilliSecondStr(entity.duration); return parseMilliSecondStr(entity.duration);
} }
},
{
title: l('global.table.endTime'),
dataIndex: 'end-time',
valueType: 'dateTime'
} }
// { // {
// title: l('devops.baseinfo.tasks'), // title: l('devops.baseinfo.tasks'),
...@@ -102,20 +108,21 @@ const FlinkTable = (props: JobProps): JSX.Element => { ...@@ -102,20 +108,21 @@ const FlinkTable = (props: JobProps): JSX.Element => {
<> <>
<ProCard> <ProCard>
<ProTable <ProTable
defaultSize={'small'}
columns={columns} columns={columns}
style={{ width: '100%' }} style={{ width: '100%', height: '30vh' }}
dataSource={jobDetail?.jobDataDto?.job?.vertices} dataSource={jobDetail?.jobDataDto?.job?.vertices}
rowKey='name' rowKey='name'
pagination={{ pagination={{
defaultPageSize: 10, defaultPageSize: 10,
showSizeChanger: true showSizeChanger: true,
hideOnSinglePage: true
}} }}
toolBarRender={false} toolBarRender={false}
search={false} search={false}
size='small' size='small'
/> />
</ProCard> </ProCard>
<br />
</> </>
); );
}; };
......
...@@ -56,7 +56,12 @@ const JobDesc = (props: JobProps) => { ...@@ -56,7 +56,12 @@ const JobDesc = (props: JobProps) => {
return ( return (
<> <>
<ProCard> <ProCard>
<Descriptions title={l('devops.jobinfo.config.JobBaseInfo')} bordered size='small'> <Descriptions
title={l('devops.jobinfo.config.JobBaseInfo')}
bordered
size='small'
column={5}
>
<Descriptions.Item label={l('global.table.status')}> <Descriptions.Item label={l('global.table.status')}>
<StatusTag status={jobDetail?.instance?.status} /> <StatusTag status={jobDetail?.instance?.status} />
</Descriptions.Item> </Descriptions.Item>
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
*/ */
import JobLifeCycleTag from '@/components/JobTags/JobLifeCycleTag'; import JobLifeCycleTag from '@/components/JobTags/JobLifeCycleTag';
import AlertHistory from '@/pages/DevOps/JobDetail/AlertHistory';
import CheckPoints from '@/pages/DevOps/JobDetail/CheckPointsTab'; import CheckPoints from '@/pages/DevOps/JobDetail/CheckPointsTab';
import JobLogsTab from '@/pages/DevOps/JobDetail/JobLogs/JobLogsTab'; import JobLogsTab from '@/pages/DevOps/JobDetail/JobLogs/JobLogsTab';
import JobMetrics from '@/pages/DevOps/JobDetail/JobMetrics'; import JobMetrics from '@/pages/DevOps/JobDetail/JobMetrics';
...@@ -72,7 +73,7 @@ const JobDetail = (props: any) => { ...@@ -72,7 +73,7 @@ const JobDetail = (props: any) => {
[OperatorEnum.JOB_CHECKPOINTS]: <CheckPoints jobDetail={jobInfoDetail} />, [OperatorEnum.JOB_CHECKPOINTS]: <CheckPoints jobDetail={jobInfoDetail} />,
[OperatorEnum.JOB_METRICS]: <JobMetrics />, [OperatorEnum.JOB_METRICS]: <JobMetrics />,
// [OperatorEnum.JOB_LINEAGE]: <Lineage jobDetail={jobInfoDetail} />, // [OperatorEnum.JOB_LINEAGE]: <Lineage jobDetail={jobInfoDetail} />,
[OperatorEnum.JOB_ALERT]: <CheckPoints jobDetail={jobInfoDetail} />, [OperatorEnum.JOB_ALERT]: <AlertHistory jobDetail={jobInfoDetail} />,
[OperatorEnum.JOB_GRAPH]: <JobOperatorGraph jobDetail={jobInfoDetail} /> [OperatorEnum.JOB_GRAPH]: <JobOperatorGraph jobDetail={jobInfoDetail} />
}; };
......
...@@ -18,8 +18,10 @@ ...@@ -18,8 +18,10 @@
*/ */
import SlowlyAppear from '@/components/Animation/SlowlyAppear'; import SlowlyAppear from '@/components/Animation/SlowlyAppear';
import { EditBtn } from '@/components/CallBackButton/EditBtn';
import { EnableSwitchBtn } from '@/components/CallBackButton/EnableSwitchBtn'; import { EnableSwitchBtn } from '@/components/CallBackButton/EnableSwitchBtn';
import { DangerDeleteIcon } from '@/components/Icons/CustomIcons'; import { NormalDeleteBtn } from '@/components/CallBackButton/NormalDeleteBtn';
import { DataAction } from '@/components/StyledComponents';
import { Authorized, HasAuthority } from '@/hooks/useAccess'; import { Authorized, HasAuthority } from '@/hooks/useAccess';
import AlertGroupForm from '@/pages/RegCenter/Alert/AlertGroup/components/AlertGroupForm'; import AlertGroupForm from '@/pages/RegCenter/Alert/AlertGroup/components/AlertGroupForm';
import { getAlertIcon } from '@/pages/RegCenter/Alert/AlertInstance/function'; import { getAlertIcon } from '@/pages/RegCenter/Alert/AlertInstance/function';
...@@ -32,13 +34,12 @@ import { Alert, ALERT_TYPE } from '@/types/RegCenter/data.d'; ...@@ -32,13 +34,12 @@ import { Alert, ALERT_TYPE } from '@/types/RegCenter/data.d';
import { InitAlertGroupState } from '@/types/RegCenter/init.d'; import { InitAlertGroupState } from '@/types/RegCenter/init.d';
import { AlertGroupState } from '@/types/RegCenter/state.d'; import { AlertGroupState } from '@/types/RegCenter/state.d';
import { l } from '@/utils/intl'; import { l } from '@/utils/intl';
import { EditTwoTone, PlusOutlined } from '@ant-design/icons'; import { PlusOutlined } from '@ant-design/icons';
import { ProList } from '@ant-design/pro-components'; import { ProList } from '@ant-design/pro-components';
import { PageContainer } from '@ant-design/pro-layout'; import { PageContainer } from '@ant-design/pro-layout';
import { ActionType } from '@ant-design/pro-table'; import { ActionType } from '@ant-design/pro-table';
import { connect, Dispatch } from '@umijs/max'; import { connect, Dispatch } from '@umijs/max';
import { Button, Descriptions, Modal, Space, Tag, Tooltip } from 'antd'; import { Button, Descriptions, Modal, Space, Tag, Tooltip } from 'antd';
import DescriptionsItem from 'antd/es/descriptions/Item';
import React, { useEffect, useRef, useState } from 'react'; import React, { useEffect, useRef, useState } from 'react';
const AlertGroupTableList: React.FC = (props: any) => { const AlertGroupTableList: React.FC = (props: any) => {
...@@ -166,22 +167,11 @@ const AlertGroupTableList: React.FC = (props: any) => { ...@@ -166,22 +167,11 @@ const AlertGroupTableList: React.FC = (props: any) => {
*/ */
const renderAlertGroupActionButton = (item: Alert.AlertGroup) => { const renderAlertGroupActionButton = (item: Alert.AlertGroup) => {
return [ return [
<Authorized key={item.id} path='/registration/alert/group/edit'> <Authorized key={`${item.id}_auth_edit`} path='/registration/alert/group/edit'>
<Button <EditBtn key={`${item.id}_edit`} onClick={() => editClick(item)} />
className={'options-button'}
key={'AlertGroupEdit'}
icon={<EditTwoTone />}
title={l('button.edit')}
onClick={() => editClick(item)}
/>
</Authorized>, </Authorized>,
<Authorized key={item.id} path='/registration/alert/group/delete'> <Authorized key={`${item.id}_auth_delete`} path='/registration/alert/group/delete'>
<Button <NormalDeleteBtn key={`${item.id}_delete`} onClick={() => handleDeleteSubmit(item.id)} />
className={'options-button'}
key={'DeleteAlertGroupIcon'}
icon={<DangerDeleteIcon />}
onClick={() => handleDeleteSubmit(item.id)}
/>
</Authorized> </Authorized>
]; ];
}; };
...@@ -214,11 +204,11 @@ const AlertGroupTableList: React.FC = (props: any) => { ...@@ -214,11 +204,11 @@ const AlertGroupTableList: React.FC = (props: any) => {
const renderAlertGroupSubTitle = (item: Alert.AlertGroup) => { const renderAlertGroupSubTitle = (item: Alert.AlertGroup) => {
return ( return (
<Descriptions size={'small'} layout={'vertical'} column={1}> <Descriptions size={'small'} layout={'vertical'} column={1}>
<DescriptionsItem className={'hidden-overflow'} key={item.id}> <Descriptions.Item className={'hidden-overflow'} key={item.id}>
<Tooltip key={item.id} title={item.name}> <Tooltip key={item.id} title={item.name}>
<Tag color='success'>{item.name}</Tag> <Tag color='success'>{item.name}</Tag>
</Tooltip> </Tooltip>
</DescriptionsItem> </Descriptions.Item>
</Descriptions> </Descriptions>
); );
}; };
...@@ -228,7 +218,7 @@ const AlertGroupTableList: React.FC = (props: any) => { ...@@ -228,7 +218,7 @@ const AlertGroupTableList: React.FC = (props: any) => {
*/ */
const renderDataSource = alertGroupState.alertGroupList.map((item: Alert.AlertGroup) => ({ const renderDataSource = alertGroupState.alertGroupList.map((item: Alert.AlertGroup) => ({
subTitle: renderAlertGroupSubTitle(item), subTitle: renderAlertGroupSubTitle(item),
actions: renderAlertGroupActionButton(item), actions: <DataAction>{renderAlertGroupActionButton(item)}</DataAction>,
avatar: getAlertIcon(ALERT_TYPE.GROUP, 60), avatar: getAlertIcon(ALERT_TYPE.GROUP, 60),
content: renderAlertGroupContent(item) content: renderAlertGroupContent(item)
})); }));
......
...@@ -16,8 +16,10 @@ ...@@ -16,8 +16,10 @@
*/ */
import { CreateBtn } from '@/components/CallBackButton/CreateBtn'; import { CreateBtn } from '@/components/CallBackButton/CreateBtn';
import { EditBtn } from '@/components/CallBackButton/EditBtn';
import { EnableSwitchBtn } from '@/components/CallBackButton/EnableSwitchBtn'; import { EnableSwitchBtn } from '@/components/CallBackButton/EnableSwitchBtn';
import { DangerDeleteIcon } from '@/components/Icons/CustomIcons'; import { NormalDeleteBtn } from '@/components/CallBackButton/NormalDeleteBtn';
import { DataAction } from '@/components/StyledComponents';
import { Authorized, HasAuthority } from '@/hooks/useAccess'; import { Authorized, HasAuthority } from '@/hooks/useAccess';
import { import {
getAlertIcon, getAlertIcon,
...@@ -36,10 +38,9 @@ import { Alert } from '@/types/RegCenter/data.d'; ...@@ -36,10 +38,9 @@ import { Alert } from '@/types/RegCenter/data.d';
import { InitAlertInstanceState } from '@/types/RegCenter/init.d'; import { InitAlertInstanceState } from '@/types/RegCenter/init.d';
import { AlertInstanceState } from '@/types/RegCenter/state.d'; import { AlertInstanceState } from '@/types/RegCenter/state.d';
import { l } from '@/utils/intl'; import { l } from '@/utils/intl';
import { EditTwoTone } from '@ant-design/icons';
import { ProList } from '@ant-design/pro-components'; import { ProList } from '@ant-design/pro-components';
import { ActionType } from '@ant-design/pro-table'; import { ActionType } from '@ant-design/pro-table';
import { Button, Descriptions, Modal, Space, Tag, Tooltip } from 'antd'; import { Descriptions, Modal, Space, Tag, Tooltip } from 'antd';
import DescriptionsItem from 'antd/es/descriptions/Item'; import DescriptionsItem from 'antd/es/descriptions/Item';
import React, { useEffect, useRef, useState } from 'react'; import React, { useEffect, useRef, useState } from 'react';
import AlertTypeChoose from '../AlertTypeChoose'; import AlertTypeChoose from '../AlertTypeChoose';
...@@ -140,22 +141,11 @@ const AlertInstanceList: React.FC = () => { ...@@ -140,22 +141,11 @@ const AlertInstanceList: React.FC = () => {
*/ */
const renderAlertInstanceActionButton = (item: Alert.AlertInstance) => { const renderAlertInstanceActionButton = (item: Alert.AlertInstance) => {
return [ return [
<Authorized key={item.id} path='/registration/alert/instance/edit'> <Authorized key={`${item.id}_auth_edit`} path='/registration/alert/instance/edit'>
<Button <EditBtn key={`${item.id}_edit`} onClick={() => editClick(item)} />
className={'options-button'}
key={'AlertInstanceEdit'}
icon={<EditTwoTone />}
title={l('button.edit')}
onClick={() => editClick(item)}
/>
</Authorized>, </Authorized>,
<Authorized key={item.id} path='/registration/alert/instance/delete'> <Authorized key={`${item.id}_auth_delete`} path='/registration/alert/instance/delete'>
<Button <NormalDeleteBtn key={`${item.id}_delete`} onClick={() => handleDeleteSubmit(item.id)} />
className={'options-button'}
key={'DeleteAlertInstanceIcon'}
icon={<DangerDeleteIcon />}
onClick={() => handleDeleteSubmit(item.id)}
/>
</Authorized> </Authorized>
]; ];
}; };
...@@ -191,7 +181,7 @@ const AlertInstanceList: React.FC = () => { ...@@ -191,7 +181,7 @@ const AlertInstanceList: React.FC = () => {
*/ */
const renderDataSource = alertInstanceState.alertInstanceList.map((item) => ({ const renderDataSource = alertInstanceState.alertInstanceList.map((item) => ({
subTitle: renderAlertInstanceSubTitle(item), subTitle: renderAlertInstanceSubTitle(item),
actions: renderAlertInstanceActionButton(item), actions: <DataAction>{renderAlertInstanceActionButton(item)}</DataAction>,
avatar: getAlertIcon(item.type, 60), avatar: getAlertIcon(item.type, 60),
content: renderAlertInstanceContent(item) content: renderAlertInstanceContent(item)
})); }));
......
...@@ -16,7 +16,8 @@ ...@@ -16,7 +16,8 @@
* limitations under the License. * limitations under the License.
* *
*/ */
import { DangerDeleteIcon } from '@/components/Icons/CustomIcons'; import { EditBtn } from '@/components/CallBackButton/EditBtn';
import { NormalDeleteBtn } from '@/components/CallBackButton/NormalDeleteBtn';
import { Authorized } from '@/hooks/useAccess'; import { Authorized } from '@/hooks/useAccess';
import AlertTemplateForm from '@/pages/RegCenter/Alert/AlertTemplate/components/AlertTemplateForm'; import AlertTemplateForm from '@/pages/RegCenter/Alert/AlertTemplate/components/AlertTemplateForm';
import { handleAddOrUpdate, handleRemoveById } from '@/services/BusinessCrud'; import { handleAddOrUpdate, handleRemoveById } from '@/services/BusinessCrud';
...@@ -26,7 +27,7 @@ import { InitAlertTemplateState } from '@/types/RegCenter/init.d'; ...@@ -26,7 +27,7 @@ import { InitAlertTemplateState } from '@/types/RegCenter/init.d';
import { AlertTemplateState } from '@/types/RegCenter/state'; import { AlertTemplateState } from '@/types/RegCenter/state';
import { l } from '@/utils/intl'; import { l } from '@/utils/intl';
import { useRequest } from '@@/exports'; import { useRequest } from '@@/exports';
import { EditTwoTone, PlusOutlined } from '@ant-design/icons'; import { PlusOutlined } from '@ant-design/icons';
import { PageContainer } from '@ant-design/pro-layout'; import { PageContainer } from '@ant-design/pro-layout';
import { Button, Card, List, Modal, Typography } from 'antd'; import { Button, Card, List, Modal, Typography } from 'antd';
import { useState } from 'react'; import { useState } from 'react';
...@@ -99,21 +100,10 @@ export default () => { ...@@ -99,21 +100,10 @@ export default () => {
const renderAlertTemplateActionButton = (item: Alert.AlertTemplate) => { const renderAlertTemplateActionButton = (item: Alert.AlertTemplate) => {
return [ return [
<Authorized key={item.id} path='/registration/alert/template/edit'> <Authorized key={item.id} path='/registration/alert/template/edit'>
<Button <EditBtn key={`${item.id}_edit`} onClick={() => editClick(item)} />
className={'options-button'}
key={'AlertGroupEdit'}
icon={<EditTwoTone />}
title={l('button.edit')}
onClick={() => editClick(item)}
/>
</Authorized>, </Authorized>,
<Authorized key={item.id} path='/registration/alert/template/delete'> <Authorized key={item.id} path='/registration/alert/template/delete'>
<Button <NormalDeleteBtn key={`${item.id}_delete`} onClick={() => handleDeleteSubmit(item.id)} />
className={'options-button'}
key={'DeleteAlertGroupIcon'}
icon={<DangerDeleteIcon />}
onClick={() => handleDeleteSubmit(item.id)}
/>
</Authorized> </Authorized>
]; ];
}; };
......
...@@ -45,7 +45,6 @@ import { l } from '@/utils/intl'; ...@@ -45,7 +45,6 @@ import { l } from '@/utils/intl';
import { CheckCircleOutlined, ExclamationCircleOutlined, HeartTwoTone } from '@ant-design/icons'; import { CheckCircleOutlined, ExclamationCircleOutlined, HeartTwoTone } from '@ant-design/icons';
import { ActionType, ProList } from '@ant-design/pro-components'; import { ActionType, ProList } from '@ant-design/pro-components';
import { Button, Descriptions, Modal, Space, Tag, Tooltip } from 'antd'; import { Button, Descriptions, Modal, Space, Tag, Tooltip } from 'antd';
import DescriptionsItem from 'antd/es/descriptions/Item';
import { useEffect, useRef, useState } from 'react'; import { useEffect, useRef, useState } from 'react';
export default () => { export default () => {
...@@ -157,11 +156,11 @@ export default () => { ...@@ -157,11 +156,11 @@ export default () => {
const renderDataSubTitle = (item: Cluster.Config) => { const renderDataSubTitle = (item: Cluster.Config) => {
return ( return (
<Descriptions size={'small'} layout={'vertical'} column={1}> <Descriptions size={'small'} layout={'vertical'} column={1}>
<DescriptionsItem className={'hidden-overflow'} key={item.id}> <Descriptions.Item className={'hidden-overflow'} key={item.id}>
<Tooltip key={item.name} title={item.name}> <Tooltip key={item.name} title={item.name}>
{item.name} {item.name}
</Tooltip> </Tooltip>
</DescriptionsItem> </Descriptions.Item>
</Descriptions> </Descriptions>
); );
}; };
......
...@@ -107,6 +107,7 @@ export const PRO_LIST_CARD_META = { ...@@ -107,6 +107,7 @@ export const PRO_LIST_CARD_META = {
type: {}, type: {},
avatar: {}, avatar: {},
content: {}, content: {},
description: {},
actions: { actions: {
cardActionProps: 'actions' cardActionProps: 'actions'
} }
......
...@@ -229,6 +229,8 @@ export enum API_CONSTANTS { ...@@ -229,6 +229,8 @@ export enum API_CONSTANTS {
RESTART_TASK = '/api/task/restartTask', RESTART_TASK = '/api/task/restartTask',
RESTART_TASK_FROM_CHECKPOINT = '/api/task/selectSavePointRestartTask', RESTART_TASK_FROM_CHECKPOINT = '/api/task/selectSavePointRestartTask',
GET_SAVEPOINTS = '/api/savepoints', GET_SAVEPOINTS = '/api/savepoints',
ALERT_HISTORY_LIST = '/api/alertHistory/list',
ALERT_HISTORY_DELETE = '/api/alertHistory/delete',
// -- LDAP // -- LDAP
GET_LDAP_ENABLE = '/api/ldap/ldapEnableStatus', GET_LDAP_ENABLE = '/api/ldap/ldapEnableStatus',
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
*/ */
import { BaseBeanColumns } from '@/types/Public/data'; import { BaseBeanColumns } from '@/types/Public/data';
import { Alert } from '@/types/RegCenter/data.d';
/** /**
* about flink job * about flink job
...@@ -157,3 +158,17 @@ declare namespace Jobs { ...@@ -157,3 +158,17 @@ declare namespace Jobs {
taskManagerConfiguration: any; taskManagerConfiguration: any;
}; };
} }
export interface AlertHistory {
id: number;
tenantId: number;
alertGroupId: number;
alertGroup: Alert.AlertGroup;
jobInstanceId: number;
title: string;
content: string;
status: number;
log: string;
createTime: Date;
updateTime: Date;
}
/*
*
* 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 { AlertHistoryState } from '@/types/DevOps/state.d';
export const InitAlertHistoryState: AlertHistoryState = {
loading: false,
alertHistory: []
};
...@@ -16,3 +16,11 @@ ...@@ -16,3 +16,11 @@
* limitations under the License. * limitations under the License.
* *
*/ */
import { AlertHistory } from '@/types/DevOps/data';
import { BaseState } from '@/types/Public/state';
export interface AlertHistoryState extends BaseState {
alertHistory: AlertHistory[];
showContent: boolean;
}
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