mirror of
https://github.com/hansjone/netx.git
synced 2026-10-18 15:00:45 +08:00
feat(ume): collapse NE and alarms panels by default
Default the UME NE list and current alarms sections to collapsed state and add explicit expand/collapse toggles for cleaner initial layout. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
d512679425
commit
5b77c6f327
3 changed files with 30 additions and 2 deletions
|
|
@ -260,6 +260,8 @@ const en = {
|
||||||
},
|
},
|
||||||
ne: {
|
ne: {
|
||||||
title: "Network elements",
|
title: "Network elements",
|
||||||
|
showPanel: "Expand",
|
||||||
|
hidePanel: "Collapse",
|
||||||
keywordPh: "keyword(ne_id/ne_name/user_label/ip/host_name)",
|
keywordPh: "keyword(ne_id/ne_name/user_label/ip/host_name)",
|
||||||
clearTitle: "Clear keyword and reset to page 1",
|
clearTitle: "Clear keyword and reset to page 1",
|
||||||
expand: "Expand details",
|
expand: "Expand details",
|
||||||
|
|
@ -267,6 +269,8 @@ const en = {
|
||||||
},
|
},
|
||||||
alarms: {
|
alarms: {
|
||||||
title: "Current alarms",
|
title: "Current alarms",
|
||||||
|
showPanel: "Expand",
|
||||||
|
hidePanel: "Collapse",
|
||||||
keywordPh: "keyword(alarm key/cause/ne_name/host_name/ip…)",
|
keywordPh: "keyword(alarm key/cause/ne_name/host_name/ip…)",
|
||||||
hostNamePh: "host_name (contains)",
|
hostNamePh: "host_name (contains)",
|
||||||
allSeverity: "All severities",
|
allSeverity: "All severities",
|
||||||
|
|
|
||||||
|
|
@ -259,6 +259,8 @@ const zh = {
|
||||||
},
|
},
|
||||||
ne: {
|
ne: {
|
||||||
title: "网元清单",
|
title: "网元清单",
|
||||||
|
showPanel: "展开",
|
||||||
|
hidePanel: "收起",
|
||||||
keywordPh: "keyword(ne_id/ne_name/user_label/ip/host_name)",
|
keywordPh: "keyword(ne_id/ne_name/user_label/ip/host_name)",
|
||||||
clearTitle: "清空 keyword,回到第 1 页",
|
clearTitle: "清空 keyword,回到第 1 页",
|
||||||
expand: "展开详情",
|
expand: "展开详情",
|
||||||
|
|
@ -266,6 +268,8 @@ const zh = {
|
||||||
},
|
},
|
||||||
alarms: {
|
alarms: {
|
||||||
title: "当前告警",
|
title: "当前告警",
|
||||||
|
showPanel: "展开",
|
||||||
|
hidePanel: "收起",
|
||||||
keywordPh: "keyword(告警键/原因/ne_name/host_name/ip 等)",
|
keywordPh: "keyword(告警键/原因/ne_name/host_name/ip 等)",
|
||||||
hostNamePh: "host_name(含匹配)",
|
hostNamePh: "host_name(含匹配)",
|
||||||
allSeverity: "全部级别",
|
allSeverity: "全部级别",
|
||||||
|
|
|
||||||
|
|
@ -34,12 +34,14 @@ export function UmePage() {
|
||||||
const [nePage, setNePage] = useState(1);
|
const [nePage, setNePage] = useState(1);
|
||||||
const [nePageSize, setNePageSize] = useState(50);
|
const [nePageSize, setNePageSize] = useState(50);
|
||||||
const [expandedNeId, setExpandedNeId] = useState("");
|
const [expandedNeId, setExpandedNeId] = useState("");
|
||||||
|
const [nePanelOpen, setNePanelOpen] = useState(false);
|
||||||
const [curSeverity, setCurSeverity] = useState("");
|
const [curSeverity, setCurSeverity] = useState("");
|
||||||
const [curCleared, setCurCleared] = useState("");
|
const [curCleared, setCurCleared] = useState("");
|
||||||
const [curHostName, setCurHostName] = useState("");
|
const [curHostName, setCurHostName] = useState("");
|
||||||
const [curKeyword, setCurKeyword] = useState("");
|
const [curKeyword, setCurKeyword] = useState("");
|
||||||
const [curPage, setCurPage] = useState(1);
|
const [curPage, setCurPage] = useState(1);
|
||||||
const [curPageSize, setCurPageSize] = useState(50);
|
const [curPageSize, setCurPageSize] = useState(50);
|
||||||
|
const [alarmsPanelOpen, setAlarmsPanelOpen] = useState(false);
|
||||||
|
|
||||||
const syncMutation = useMutation({
|
const syncMutation = useMutation({
|
||||||
mutationFn: async (domains: string[]) => apiPost<{ ok: boolean; jobs: unknown[] }>("/v1/ume/sync", { domains }),
|
mutationFn: async (domains: string[]) => apiPost<{ ok: boolean; jobs: unknown[] }>("/v1/ume/sync", { domains }),
|
||||||
|
|
@ -700,7 +702,14 @@ export function UmePage() {
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section className="panel">
|
<section className="panel">
|
||||||
|
<div className="panel__toolbar">
|
||||||
<h2>{t("ume.ne.title")}</h2>
|
<h2>{t("ume.ne.title")}</h2>
|
||||||
|
<button type="button" className="link-btn" onClick={() => setNePanelOpen((x) => !x)}>
|
||||||
|
{nePanelOpen ? t("ume.ne.hidePanel") : t("ume.ne.showPanel")}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
{nePanelOpen ? (
|
||||||
|
<>
|
||||||
<div className="filter-inline">
|
<div className="filter-inline">
|
||||||
<input value={neKeyword} placeholder={t("ume.ne.keywordPh")} onChange={(e) => setNeKeyword(e.target.value)} />
|
<input value={neKeyword} placeholder={t("ume.ne.keywordPh")} onChange={(e) => setNeKeyword(e.target.value)} />
|
||||||
<button type="button" onClick={() => queryClient.invalidateQueries({ queryKey: queryKeys.umeNEAll })}>
|
<button type="button" onClick={() => queryClient.invalidateQueries({ queryKey: queryKeys.umeNEAll })}>
|
||||||
|
|
@ -801,10 +810,19 @@ export function UmePage() {
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</>
|
||||||
|
) : null}
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section className="panel">
|
<section className="panel">
|
||||||
|
<div className="panel__toolbar">
|
||||||
<h2>{t("ume.alarms.title")}</h2>
|
<h2>{t("ume.alarms.title")}</h2>
|
||||||
|
<button type="button" className="link-btn" onClick={() => setAlarmsPanelOpen((x) => !x)}>
|
||||||
|
{alarmsPanelOpen ? t("ume.alarms.hidePanel") : t("ume.alarms.showPanel")}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
{alarmsPanelOpen ? (
|
||||||
|
<>
|
||||||
<div className="filter-inline">
|
<div className="filter-inline">
|
||||||
<input value={curKeyword} placeholder={t("ume.alarms.keywordPh")} onChange={(e) => setCurKeyword(e.target.value)} />
|
<input value={curKeyword} placeholder={t("ume.alarms.keywordPh")} onChange={(e) => setCurKeyword(e.target.value)} />
|
||||||
<input value={curHostName} placeholder={t("ume.alarms.hostNamePh")} onChange={(e) => setCurHostName(e.target.value)} />
|
<input value={curHostName} placeholder={t("ume.alarms.hostNamePh")} onChange={(e) => setCurHostName(e.target.value)} />
|
||||||
|
|
@ -903,6 +921,8 @@ export function UmePage() {
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</>
|
||||||
|
) : null}
|
||||||
</section>
|
</section>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue