Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5,972 changes: 2,185 additions & 3,787 deletions package-lock.json

Large diffs are not rendered by default.

11 changes: 5 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,12 @@
"pinyin-pro": "^3.20.4",
"query-string": "^7.0.1",
"re-resizable": "^6.9.9",
"react": "^17.0.0",
"react": "^18.3.1",
"react-ace": "^10.1.0",
"react-beforeunload": "^2.6.0",
"react-color": "^2.19.3",
"react-data-grid": "7.0.0-beta.16",
"react-dom": "^17.0.0",
"react-dom": "^18.3.1",
"react-draggable": "^4.4.5",
"react-fast-compare": "^3.2.0",
"react-grid-layout": "^1.2.5",
Expand Down Expand Up @@ -126,8 +126,8 @@
"@types/jest": "^29.5.14",
"@types/lodash": "^4.14.191",
"@types/node": "^18.19.100",
"@types/react": "^17.0.14",
"@types/react-dom": "^17.0.9",
"@types/react": "^18.3.31",
"@types/react-dom": "^18.3.7",
"@types/react-router-dom": "^5.1.7",
"@types/spark-md5": "^3.0.5",
"@vitejs/plugin-react": "^4.4.1",
Expand All @@ -151,7 +151,6 @@
"vite-plugin-svgr": "^4.3.0"
},
"overrides": {
"@types/react": "^17.0.14",
"@types/d3-dispatch": "3.0.6"
}
}
}
10 changes: 5 additions & 5 deletions src/components/ModalHOC.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import ReactDOM from 'react-dom';
import { createRoot, Root } from 'react-dom/client';
import { BrowserRouter as Router } from 'react-router-dom';
import _ from 'lodash';
import { ConfigProvider } from 'antd';
Expand All @@ -20,24 +20,24 @@ export default function ModalHOC<T>(Component: React.FC<T & ModalWrapProps>) {
const div = document.createElement('div');
document.body.appendChild(div);
div.className = 'theme-dark';
const root: Root = createRoot(div);

function destroy() {
const unmountResult = ReactDOM.unmountComponentAtNode(div);
if (unmountResult && div.parentNode) {
root.unmount();
if (div.parentNode) {
div.parentNode.removeChild(div);
}
}

const language = config.language ? config.language : window.localStorage.getItem('language') || 'zh_CN';

function render(props: any) {
ReactDOM.render(
root.render(
<ConfigProvider locale={getAntdLocale(language)}>
<Router>
<Component {...props} />
</Router>
</ConfigProvider>,
div,
);
}

Expand Down
6 changes: 3 additions & 3 deletions src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*
*/
import React from 'react';
import ReactDOM from 'react-dom';
import { createRoot } from 'react-dom/client';
import { i18nInit } from './i18n'; // loaded and initialized first
import App from './App';
import { I18nextProvider } from 'react-i18next';
Expand All @@ -28,9 +28,9 @@ initTheme();
// 指向官网/Flashduty 的链接统一携带 from=n9e-user 渠道参数
initFlashcatFrom();

ReactDOM.render(
const root = createRoot(document.getElementById('root')!);
root.render(
<I18nextProvider i18n={i18nInit}>
<App />
</I18nextProvider>,
document.getElementById('root'),
);
10 changes: 5 additions & 5 deletions src/pages/dashboard/Components/ModalHOC.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*
*/
import React from 'react';
import ReactDOM from 'react-dom';
import { createRoot, Root } from 'react-dom/client';
import _ from 'lodash';
import { BrowserRouter as Router } from 'react-router-dom';

Expand All @@ -32,20 +32,20 @@ export default function ModalHOC(Component: any) {
return function ModalControl(config: any) {
const div = document.createElement('div');
document.body.appendChild(div);
const root: Root = createRoot(div);

function destroy() {
const unmountResult = ReactDOM.unmountComponentAtNode(div);
if (unmountResult && div.parentNode) {
root.unmount();
if (div.parentNode) {
div.parentNode.removeChild(div);
}
}

function render(props: any) {
ReactDOM.render(
root.render(
<Router>
<Component {...props} />
</Router>,
div,
);
}

Expand Down
21 changes: 16 additions & 5 deletions src/pages/dashboard/Renderer/Renderer/TimeSeriesNG/Main.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useState, useRef, useMemo, useEffect } from 'react';
import ReactDOM from 'react-dom';
import { createRoot, Root } from 'react-dom/client';
import { AlignedData, Options } from 'uplot';
import _ from 'lodash';
import moment from 'moment';
Expand Down Expand Up @@ -83,6 +83,7 @@ export default function index(props: Props) {
const yScaleInitMinMaxRef = useRef<[number, number]>();
const [showResetZoomBtn, setShowResetZoomBtn] = useState(false);
const [annotationSettingUp, setAnnotationSettingUp] = useState(false);
const rootRefs = useRef<Map<HTMLElement, Root>>(new Map());
const xMinMax = useMemo(() => {
return getScalesXMinMax({ range, queryOptionsTime });
}, [range, JSON.stringify(queryOptionsTime)]);
Expand Down Expand Up @@ -122,7 +123,12 @@ export default function index(props: Props) {
graphTooltip: dashboardMeta.graphTooltip as any,
timeZone: timezone,
renderFooter: (domNode: HTMLDivElement, closeOverlay: () => void) => {
ReactDOM.render(
let root = rootRefs.current.get(domNode);
if (!root) {
root = createRoot(domNode);
rootRefs.current.set(domNode, root);
}
root.render(
<AddAnnotationButton
panelID={id}
timeZone={timezone}
Expand All @@ -135,7 +141,6 @@ export default function index(props: Props) {
}
}}
/>,
domNode,
);
},
pointNameformatter: (val, point) => {
Expand Down Expand Up @@ -174,7 +179,12 @@ export default function index(props: Props) {
annotationsPlugin({
annotations,
renderMarkers: (xAxisEle) => {
ReactDOM.render(
let root = rootRefs.current.get(xAxisEle);
if (!root) {
root = createRoot(xAxisEle);
rootRefs.current.set(xAxisEle, root);
}
root.render(
<AddAnnotatsMarkers
annotations={annotations}
uplotRef={uplotRef}
Expand All @@ -190,7 +200,6 @@ export default function index(props: Props) {
}
}}
/>,
xAxisEle,
);
},
}),
Expand Down Expand Up @@ -354,6 +363,8 @@ export default function index(props: Props) {
}}
onDelete={(id) => {
uplotsMap.delete(id);
rootRefs.current.forEach((r) => r.unmount());
rootRefs.current.clear();
}}
/>
{!hideResetBtn && (
Expand Down
2 changes: 1 addition & 1 deletion src/pages/embeddedProduct/pages/List/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import EmbeddedProductModal from '../../components/EmbeddedProductModal';

import './style.less';

const DragHandle = SortableHandle((props: { disabled?: boolean }) => {
const DragHandle = SortableHandle<{ disabled?: boolean }>((props) => {
return <Button type='text' size='small' icon={<MenuOutlined />} className='embedded-product-row-drag-handle' disabled={props.disabled} />;
});

Expand Down
2 changes: 1 addition & 1 deletion src/pages/explorer/Elasticsearch/QueryBuilder.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ export default function QueryBuilder(props: Props) {
return (
<span key={key}>
<span className='bg-[var(--fc-fill-1)] inline-block p-1 mr-1'>{t(`datasource:es.${key}`)}:</span>
<span className='pr-1'>{key === 'syntax' ? _.find(SYNTAX_OPTIONS, { value: value as string })?.label ?? value : value}</span>
<span className='pr-1'>{key === 'syntax' ? _.find(SYNTAX_OPTIONS, { value: value as string })?.label ?? String(value) : String(value)}</span>
</span>
);
})}
Expand Down
2 changes: 1 addition & 1 deletion src/pages/explorer/Loki/component/context/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ function LogContext(props: IProps & ModalWrapProps) {
const res2 = await getLogsQuery(datasourceValue, twoHoursLaterQueryParams);
setData(_.concat(parseResponse(res2.result || []).dataRows, parseResponse(res1.result || []).dataRows));
} catch (err) {
message.error(err);
message.error(err as string);
} finally {
setLoading(false);
}
Expand Down
2 changes: 1 addition & 1 deletion src/pages/explorer/Loki/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ export default function index(props: IProps) {
}
}
} catch (err) {
message.error(err);
message.error(err as string);
} finally {
setLoading(false);
}
Expand Down
18 changes: 10 additions & 8 deletions src/pages/hosts/pages/List/OperationModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -281,14 +281,16 @@ export default function OperationModal(props: OperateionModalProps) {
form.resetFields();
}}
>
{/* 基础展示表单项 */}
<Form form={form} labelCol={{ span: 4 }} wrapperCol={{ span: 20 }}>
<Form.Item label={t('targets')} name='idents' rules={[{ required: true }]}>
<Input.TextArea autoSize={{ minRows: 3, maxRows: 10 }} placeholder={t('targets_placeholder')} onBlur={formatValue} />
</Form.Item>
{isFormItem && render()}
</Form>
{!isFormItem && render()}
<>
{/* 基础展示表单项 */}
<Form form={form} labelCol={{ span: 4 }} wrapperCol={{ span: 20 }}>
<Form.Item label={t('targets')} name='idents' rules={[{ required: true }]}>
<Input.TextArea autoSize={{ minRows: 3, maxRows: 10 }} placeholder={t('targets_placeholder')} onBlur={formatValue} />
</Form.Item>
{isFormItem ? render() ?? null : null}
</Form>
{!isFormItem ? render() ?? null : null}
</>
</Modal>
<Modal
visible={errorModal.visible}
Expand Down
2 changes: 1 addition & 1 deletion src/pages/log/IndexPatterns/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import EditField from './EditField';
import { useQuery } from '@/utils';
import './style.less';

const DragHandle = SortableHandle((props: { disabled?: boolean }) => {
const DragHandle = SortableHandle<{ disabled?: boolean }>((props) => {
return <Button type='text' size='small' icon={<MenuOutlined />} className='index-pattern-row-drag-handle' disabled={props.disabled} />;
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,9 @@ function TokenWithContext(props: Props & { indexData: Field[] }) {
setPopoverVisible(false);
}, []);

const getPopupContainer = useCallback((triggerNode?: HTMLElement) => {
const getPopupContainer = useCallback((triggerNode: HTMLElement) => {
const host = triggerNode || hostRef.current;
return host?.closest(`.${LOG_VIEWER_IGNORE_CLICK_AWAY_CLASS}`) || host?.closest('.ant-drawer-content') || document.body;
return (host?.closest(`.${LOG_VIEWER_IGNORE_CLICK_AWAY_CLASS}`) || host?.closest('.ant-drawer-content') || document.body) as HTMLElement;
}, []);

const handleTextSelectMouseDownCapture = useCallback(() => {
Expand Down
18 changes: 10 additions & 8 deletions src/pages/targets/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -313,14 +313,16 @@ const OperationModal: React.FC<OperateionModalProps> = ({ operateType, setOperat
form.resetFields();
}}
>
{/* 基础展示表单项 */}
<Form form={form} labelCol={{ span: 4 }} wrapperCol={{ span: 20 }}>
<Form.Item label={t('targets')} name='idents' rules={[{ required: true }]}>
<TextArea autoSize={{ minRows: 3, maxRows: 10 }} placeholder={t('targets_placeholder')} onBlur={formatValue} />
</Form.Item>
{isFormItem && render()}
</Form>
{!isFormItem && render()}
<>
{/* 基础展示表单项 */}
<Form form={form} labelCol={{ span: 4 }} wrapperCol={{ span: 20 }}>
<Form.Item label={t('targets')} name='idents' rules={[{ required: true }]}>
<TextArea autoSize={{ minRows: 3, maxRows: 10 }} placeholder={t('targets_placeholder')} onBlur={formatValue} />
</Form.Item>
{isFormItem ? render() ?? null : null}
</Form>
{!isFormItem ? render() ?? null : null}
</>
</Modal>
);
};
Expand Down
5 changes: 0 additions & 5 deletions src/pages/taskOutput/host.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@ export default class index extends Component {
document.body.style.color = '#000';
};

componentWillMount = () => {
document.body.style.backgroundColor = '#f0f2f5';
document.body.style.color = 'rgba(0, 0, 0, 0.65)';
};

fetchData() {
const busiId = _.get(this.props, 'match.params.busiId');
const taskId = _.get(this.props, 'match.params.taskId');
Expand Down
5 changes: 0 additions & 5 deletions src/pages/taskOutput/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@ export default class index extends Component {
document.body.style.color = '#000';
};

componentWillMount = () => {
document.body.style.backgroundColor = '#f0f2f5';
document.body.style.color = 'rgba(0, 0, 0, 0.65)';
};

fetchData() {
const busiId = _.get(this.props, 'match.params.busiId');
const taskId = _.get(this.props, 'match.params.taskId');
Expand Down
2 changes: 1 addition & 1 deletion src/pages/user/component/businessForm/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { debounce } from 'lodash';
import { CommonStateContext } from '@/App';

const { Option } = Select;
const TeamForm = React.forwardRef<ReactNode, TeamProps>((props, ref) => {
const TeamForm = React.forwardRef<any, TeamProps>((props, ref) => {
const { siteInfo } = useContext(CommonStateContext);
const { t } = useTranslation('user');
const { businessId, action } = props;
Expand Down
2 changes: 1 addition & 1 deletion src/pages/user/component/passwordForm/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import React, { useImperativeHandle, ReactNode } from 'react';
import { Form, Input } from 'antd';
import { UserAndPasswordFormProps } from '@/store/manageInterface';
import { useTranslation } from 'react-i18next';
const PasswordForm = React.forwardRef<ReactNode, UserAndPasswordFormProps>((props, ref) => {
const PasswordForm = React.forwardRef<any, UserAndPasswordFormProps>((props, ref) => {
const { t } = useTranslation();
const [form] = Form.useForm();
useImperativeHandle(ref, () => ({
Expand Down
2 changes: 1 addition & 1 deletion src/pages/user/component/teamForm/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { TeamProps, Team, TeamInfo } from '@/store/manageInterface';
import { useTranslation, Trans } from 'react-i18next';
import { CommonStateContext } from '@/App';

const TeamForm = React.forwardRef<ReactNode, TeamProps>((props, ref) => {
const TeamForm = React.forwardRef<any, TeamProps>((props, ref) => {
const { siteInfo } = useContext(CommonStateContext);
const { t } = useTranslation('user');
const { teamId } = props;
Expand Down
2 changes: 1 addition & 1 deletion src/pages/user/component/userForm/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import ContactDrawer from '@/components/Contacts';
import { CommonStateContext } from '@/App';

const { Option } = Select;
const UserForm = React.forwardRef<ReactNode, UserAndPasswordFormProps>((props, ref) => {
const UserForm = React.forwardRef<any, UserAndPasswordFormProps>((props, ref) => {
const { t } = useTranslation();
const { profile } = useContext(CommonStateContext);
const { userId } = props;
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/clickHouse/Explorer/Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export default function TableCpt(props: Props) {
});
const { components, resizableColumns, tableWidth, resetColumns } = useAntdResizableHeader({
columns: useMemo(() => columns, [columnsKeys]),
tooltipRender: (props) => <Tooltip {...props} />,
tooltipRender: (props: any) => <Tooltip {...props} />,
defaultWidth: 150,
Comment on lines 51 to 54
});

Expand Down
2 changes: 1 addition & 1 deletion src/plugins/doris/Explorer/Query/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ export default function index(props: Props) {
return (
<span key={key} className='whitespace-nowrap'>
<span className='bg-[var(--fc-fill-1)] inline-block p-1 mr-1'>{t(`query.${key}`)}:</span>
<span className='pr-1'>{value}</span>
<span className='pr-1'>{String(value)}</span>
</span>
);
})}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export default function QueryInputAddonAfter(props: Props) {
return (
<span key={key} className='whitespace-nowrap'>
<span className='bg-[var(--fc-fill-1)] inline-block p-1 mr-1'>{t(`query.${key}`)}:</span>
<span className='pr-1'>{value}</span>
<span className='pr-1'>{String(value)}</span>
</span>
);
})}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export default function QueryInputAddonAfter(props: Props) {
return (
<span key={key} className='whitespace-nowrap'>
<span className='bg-[var(--fc-fill-1)] inline-block p-1 mr-1'>{t(`query.${key}`)}:</span>
<span className='pr-1'>{displayValue}</span>
<span className='pr-1'>{String(displayValue)}</span>
</span>
);
})}
Expand Down
Loading