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