Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(webui): multiline display in event list & min width of page #162

Merged
merged 1 commit into from
Jan 26, 2024
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
1 change: 1 addition & 0 deletions webui/src/global.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

body {
-webkit-font-smoothing: antialiased;
min-width: 1100px;
}

.next-loading {
Expand Down
2 changes: 1 addition & 1 deletion webui/src/pages/config/types.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"metric_probe": [
{
"name": "virtcmdLatency"
"name": "virtcmdlatency"
},
{
"name": "flow"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,26 @@
background-color: rgb(235, 245, 255);
font-size: 15px;
display: flex;
align-items: center;
height: 4em;
/* align-items: center; */
min-height: 4em;
margin-bottom: 10px;
padding: 5px 0;
}

.eventInfo {
margin-right: 20px;
height: 4em;
}

.eventMessage {
display: inline-block;
white-space: pre-wrap;
/* height: 1em; */
overflow: hidden;
}

.expandBtn {
display: inline-block;
}

.eventType {
Expand Down
12 changes: 9 additions & 3 deletions webui/src/pages/monitoring/events/components/EventList/index.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
import { EventData } from "@/services/event";
import { List, Tag } from "@alifd/next";
import { Button, List, Tag } from "@alifd/next";
import styles from './index.module.css'

interface EventListProps {
data: EventData[]
};

const EventMessage = ({msg}): JSX.Element => {
return <div>
<span className={styles.eventMessage}>{msg}</span>
</div>;
};

const renderListItem = (ev: EventData, i: number): JSX.Element => {
// convert nanosecond timestamp to date
const date = new Date(ev.timestamp / 1000000);
Expand All @@ -18,9 +24,9 @@ const renderListItem = (ev: EventData, i: number): JSX.Element => {
</div>
<div>
<div>
{ev.labels.map(i => <Tag key={i.name} className={styles.tag} size="small" color="blue">{`${i.name}: ${i.value}`}</Tag>)}
{ev.labels.filter(i => i.value !== '').map(i => <Tag key={i.name} className={styles.tag} size="small" color="blue">{`${i.name}: ${i.value}`}</Tag>)}
</div>
<div className={styles.eventMessage}>{ev.msg}</div>
<EventMessage msg={ev.msg}/>
</div>
</div>
)
Expand Down
2 changes: 2 additions & 0 deletions webui/src/pages/monitoring/events/index.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
.title {
margin-right: 10px;
margin-left: 20px;
width: 80px;
min-width: 80px;
}

.box {
Expand Down
10 changes: 6 additions & 4 deletions webui/src/pages/monitoring/events/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export default function Events() {
return filteredNamespaces?.length ?
pods.filter((i) => {
return filteredNamespaces.includes(i.namespace)
}).map(i => i.name) : pods.map(i => i.name) ;
}).map(i => i.name) : pods.map(i => i.name);
}, [pods, filteredNamespaces])

const nodeNames = useMemo(() => nodes.map(i => i.name), [nodes])
Expand All @@ -112,13 +112,15 @@ export default function Events() {
<Box direction="row" className={styles.box}>
<span className={styles.title}>Event Type</span>
<Select className={styles.select} mode="tag" dataSource={eventTypes} onChange={v => setFilteredTypes(v)} disabled={isLive} />
<span className={styles.title}>Nodes</span>
<span className={styles.title} style={{width: 50, minWidth: 50}}>Nodes</span>
<Select className={styles.select} mode="tag" dataSource={nodeNames} onChange={v => setFilteredNodes(v)} disabled={isLive} />
</Box>
<Box direction="row" className={styles.box}>
<span className={styles.title}>Namespaces</span>
<Select className={styles.select} mode="tag" dataSource={namespaces} onChange={v => setFilteredNamespaces(v)} disabled={isLive} />
<span className={styles.title}>Pods</span>
<span className={styles.title} style={{width: 50, minWidth: 50}}>Pods</span>
<Select className={styles.select} mode="tag" dataSource={podNames} onChange={v => setFilteredPods(v)} disabled={isLive} />
<div style={{ marginLeft: "auto" }}>
<div style={{ marginLeft: "auto", paddingLeft: 10, display: 'flex' }}>
<Button
disabled={isLive}
className={styles.btn}
Expand Down
Loading