Unverified Commit 3218724e authored by gaoyan's avatar gaoyan Committed by GitHub

[Feature][Web] Add down log feature (#2706)

* fix log error * Added the download log feature * fix k8s editor bug * Removed the O&M green background
parent 217f60cc
...@@ -28,6 +28,7 @@ export type CircleButtonProps = { ...@@ -28,6 +28,7 @@ export type CircleButtonProps = {
onClick?: () => void; onClick?: () => void;
title?: string; title?: string;
key?: string; key?: string;
href?: string;
}; };
export type CircleBottomButtonProps = { export type CircleBottomButtonProps = {
icon: React.ReactNode; icon: React.ReactNode;
...@@ -51,7 +52,7 @@ export type CircleDataStudioButtonProps = { ...@@ -51,7 +52,7 @@ export type CircleDataStudioButtonProps = {
}; };
export const CircleBtn: React.FC<CircleButtonProps> = (props) => { export const CircleBtn: React.FC<CircleButtonProps> = (props) => {
const { onClick, title, icon, loading } = props; const { onClick, title, icon, loading, href } = props;
return ( return (
<Button <Button
...@@ -62,6 +63,8 @@ export const CircleBtn: React.FC<CircleButtonProps> = (props) => { ...@@ -62,6 +63,8 @@ export const CircleBtn: React.FC<CircleButtonProps> = (props) => {
type={'text'} type={'text'}
shape={'circle'} shape={'circle'}
onClick={onClick} onClick={onClick}
href={href}
download=''
/> />
); );
}; };
...@@ -158,6 +158,14 @@ const CodeShow = (props: CodeShowFormProps) => { ...@@ -158,6 +158,14 @@ const CodeShow = (props: CodeShowFormProps) => {
); );
}; };
/**
* handle get downoad url
*/
const handleDownloadLog = () => {
const blob = new Blob([code ?? 'not get content'], { type: 'text/plain' });
return URL.createObjectURL(blob);
};
/** /**
* editorDidMount * editorDidMount
* @param {editor.IStandaloneCodeEditor} editor * @param {editor.IStandaloneCodeEditor} editor
...@@ -191,7 +199,8 @@ const CodeShow = (props: CodeShowFormProps) => { ...@@ -191,7 +199,8 @@ const CodeShow = (props: CodeShowFormProps) => {
handleBackTop, handleBackTop,
handleBackBottom, handleBackBottom,
handleUpScroll, handleUpScroll,
handleDownScroll handleDownScroll,
handleDownloadLog
}; };
/** /**
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
import { CircleBtn } from '@/components/CallBackButton/CircleBtn'; import { CircleBtn } from '@/components/CallBackButton/CircleBtn';
import { l } from '@/utils/intl'; import { l } from '@/utils/intl';
import { import {
CloudDownloadOutlined,
DownCircleFilled, DownCircleFilled,
StopFilled, StopFilled,
SyncOutlined, SyncOutlined,
...@@ -46,6 +47,7 @@ type EditFloatBtnProps = { ...@@ -46,6 +47,7 @@ type EditFloatBtnProps = {
handleBackBottom?: () => void; // back to bottom callback handleBackBottom?: () => void; // back to bottom callback
handleUpScroll?: () => void; // up scroll callback handleUpScroll?: () => void; // up scroll callback
handleDownScroll?: () => void; // down scroll callback handleDownScroll?: () => void; // down scroll callback
handleDownloadLog?: () => string; // download log callback
}; };
const EditorFloatBtn: React.FC<EditFloatBtnProps> = (props) => { const EditorFloatBtn: React.FC<EditFloatBtnProps> = (props) => {
/** /**
...@@ -62,7 +64,8 @@ const EditorFloatBtn: React.FC<EditFloatBtnProps> = (props) => { ...@@ -62,7 +64,8 @@ const EditorFloatBtn: React.FC<EditFloatBtnProps> = (props) => {
handleBackTop, handleBackTop,
handleBackBottom, handleBackBottom,
handleUpScroll, handleUpScroll,
handleDownScroll handleDownScroll,
handleDownloadLog
} = props; } = props;
/** /**
...@@ -113,6 +116,11 @@ const EditorFloatBtn: React.FC<EditFloatBtnProps> = (props) => { ...@@ -113,6 +116,11 @@ const EditorFloatBtn: React.FC<EditFloatBtnProps> = (props) => {
onClick={handleDownScroll} onClick={handleDownScroll}
title={l('button.downScroll')} title={l('button.downScroll')}
/> />
<CircleBtn
icon={<CloudDownloadOutlined />}
href={handleDownloadLog ? handleDownloadLog() : '123 '}
title={'Download'}
/>
</Space> </Space>
</> </>
); );
......
...@@ -46,7 +46,7 @@ const StatisticsCard = (props: StatisticsCardParams) => { ...@@ -46,7 +46,7 @@ const StatisticsCard = (props: StatisticsCardParams) => {
return ( return (
<> <>
<ProCard <ProCard
checked={isChecked} // checked={isChecked}
boxShadow={isChecked} boxShadow={isChecked}
layout={'center'} layout={'center'}
onClick={() => (atClick ? atClick() : {})} onClick={() => (atClick ? atClick() : {})}
......
...@@ -38,18 +38,12 @@ import { l } from '@/utils/intl'; ...@@ -38,18 +38,12 @@ import { l } from '@/utils/intl';
import { ProCard } from '@ant-design/pro-components'; import { ProCard } from '@ant-design/pro-components';
import { Button, Col, Row, Space } from 'antd'; import { Button, Col, Row, Space } from 'antd';
import { useContext, useEffect, useState } from 'react'; import { useContext, useEffect, useState } from 'react';
import useHookRequest from "@/hooks/useHookRequest";
const JobOverview = (props: any) => { const JobOverview = (props: any) => {
const [statusCount, setStatusCount] = useState<StatusCountOverView>();
const { statusFilter, setStatusFilter } = useContext<any>(DevopContext); const { statusFilter, setStatusFilter } = useContext<any>(DevopContext);
const {data} = useHookRequest(getData,{defaultParams:[API_CONSTANTS.GET_STATUS_COUNT]})
useEffect(() => { const statusCount = data as StatusCountOverView;
getData(API_CONSTANTS.GET_STATUS_COUNT)
.then((res) => {
setStatusCount(res.data);
})
.catch(() => {});
}, []);
return ( return (
<Row gutter={[16, 8]}> <Row gutter={[16, 8]}>
...@@ -63,7 +57,6 @@ const JobOverview = (props: any) => { ...@@ -63,7 +57,6 @@ const JobOverview = (props: any) => {
atClick={() => { atClick={() => {
setStatusFilter(undefined); setStatusFilter(undefined);
}} }}
isChecked={!statusFilter}
extra={ extra={
<Space direction='vertical'> <Space direction='vertical'>
<Button type={'text'} icon={<BatchIcons size={20} />}> <Button type={'text'} icon={<BatchIcons size={20} />}>
......
...@@ -92,7 +92,7 @@ const FlinkK8s = (props: { type: string; value: any; form: FormInstance<Values> ...@@ -92,7 +92,7 @@ const FlinkK8s = (props: { type: string; value: any; form: FormInstance<Values>
reader.readAsText(file); reader.readAsText(file);
reader.onload = () => { reader.onload = () => {
form.setFieldValue(name, reader.result as string); form.setFieldValue(name, reader.result as string);
onChange(reader.result as string); onChange(reader.result as string + "\n");
}; };
}, },
showUploadList: false showUploadList: false
......
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