chore: remove unused code and adjust UI (#159)

This commit is contained in:
silenceqi 2025-02-21 15:18:06 +08:00 committed by GitHub
parent ca52a5b00d
commit 6c9e8d28c7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 6 additions and 47 deletions

View File

@ -8,7 +8,6 @@ import { formatMessage } from "umi/locale";
import { getDocPathByLang, getWebsitePathByLang } from "@/utils/utils"; import { getDocPathByLang, getWebsitePathByLang } from "@/utils/utils";
export default ({autoInit = false}) => { export default ({autoInit = false}) => {
const { loading, value } = useFetch(`/instance/_search`);
const [tokenLoading, setTokenLoading] = useState(false); const [tokenLoading, setTokenLoading] = useState(false);
@ -18,7 +17,6 @@ export default ({autoInit = false}) => {
const fetchTokenInfo = async () => { const fetchTokenInfo = async () => {
setTokenInfo() setTokenInfo()
// if (seletedGateways.length === 0) return;
setTokenLoading(true) setTokenLoading(true)
const res = await request('/instance/_generate_install_script', { const res = await request('/instance/_generate_install_script', {
method: "POST", method: "POST",
@ -35,32 +33,10 @@ export default ({autoInit = false}) => {
} }
}, []) }, [])
const gateways = value?.hits?.hits || []
return ( return (
<Spin spinning={loading || tokenLoading}> <Spin spinning={tokenLoading}>
<div className={styles.installAgent}> <div className={styles.installAgent}>
{/* <Form className={styles.gateway} layout="vertical">
<Form.Item label="选择接入网关" required>
<Select
mode="multiple"
style={{ width: '100%' }}
onChange={(value) => setSeletedGateways(value)}
onBlur={() => fetchTokenInfo()}
>
{
gateways.map((item) => (
<Select.Option key={item._source.endpoint}>
<span>
<span style={{marginRight: 4}}>{item._source.name}</span>
<span>[{item._source.endpoint}]</span>
</span>
</Select.Option>
))
}
</Select>
</Form.Item>
</Form> */}
{!autoInit && <Button className={styles.gateway} type="primary" onClick={() => fetchTokenInfo()}> {!autoInit && <Button className={styles.gateway} type="primary" onClick={() => fetchTokenInfo()}>
{formatMessage({ {formatMessage({
id:"agent.install.label.get_cmd" id:"agent.install.label.get_cmd"

View File

@ -682,14 +682,6 @@ const Index = (props) => {
gap: 10, gap: 10,
}} }}
> >
<Button
icon="redo"
onClick={() => {
onRefreshClick();
}}
>
{formatMessage({ id: "form.button.refresh" })}
</Button>
{hasAuthority("alerting.message:all") ? ( {hasAuthority("alerting.message:all") ? (
<Dropdown overlay={batchMenu}> <Dropdown overlay={batchMenu}>
<Button type="primary"> <Button type="primary">

View File

@ -123,18 +123,6 @@ const MessageDetail = (props) => {
recentlyUsedRangesKey={"rule-detail"} recentlyUsedRangesKey={"rule-detail"}
/> />
</div> </div>
<Button
onClick={() => {
handleTimeChange({
start: timeRange.min,
end: timeRange.max,
});
}}
icon={"reload"}
type="primary"
>
{formatMessage({ id: "form.button.refresh" })}
</Button>
</div> </div>
<div style={{marginTop: 15,display:"flex", gap: 15, marginBottom:10}}> <div style={{marginTop: 15,display:"flex", gap: 15, marginBottom:10}}>
<div style={{flex: "1 1 50%"}}> <div style={{flex: "1 1 50%"}}>

View File

@ -20,7 +20,7 @@
position: absolute; position: absolute;
display: none; display: none;
right: 0px; right: 0px;
top: 0px; bottom: 0px;
width: 24px; width: 24px;
height: 24px; height: 24px;
border-radius: 4px; border-radius: 4px;

View File

@ -13,6 +13,7 @@ import Side from "../Side";
import { WidgetRender } from "@/pages/DataManagement/View/WidgetLoader"; import { WidgetRender } from "@/pages/DataManagement/View/WidgetLoader";
import { cloneDeep } from "lodash"; import { cloneDeep } from "lodash";
import { Link } from "umi"; import { Link } from "umi";
import InstallAgent from "@/components/InstallAgent";
const COLORS = { const COLORS = {
'INFO': '#e8eef2', 'INFO': '#e8eef2',
@ -317,7 +318,9 @@ export default (props) => {
<Empty <Empty
image={Empty.PRESENTED_IMAGE_SIMPLE} image={Empty.PRESENTED_IMAGE_SIMPLE}
description={formatMessage({ id: `cluster.monitor.logs.empty.${isAgent ? 'agent' : 'agentless'}` })} description={formatMessage({ id: `cluster.monitor.logs.empty.${isAgent ? 'agent' : 'agentless'}` })}
/> >
<div style={{width: 644}}>{!isAgent && <InstallAgent autoInit={false}/>}</div>
</Empty>
) )
} }
</div> </div>