Skip to content

Commit a4c0f3c

Browse files
authored
feat: add labels to pod log navigation buttons (argoproj#10890)
1 parent 193cf76 commit a4c0f3c

2 files changed

Lines changed: 53 additions & 19 deletions

File tree

ui/src/app/applications/components/pod-logs-viewer/pod-logs-viewer.scss

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,24 @@
99
padding-left: 5px;
1010
color: black;
1111

12-
1312
&--inverted {
1413
background-color: black;
1514
color: white;
1615
}
17-
16+
1817
&__settings {
1918
display: flex;
20-
21-
.argo-checkbox, .argo-checkbox input, .argo-checkbox input:focus {
19+
20+
.argo-checkbox,
21+
.argo-checkbox input,
22+
.argo-checkbox input:focus {
2223
outline: none !important;
2324
border: none !important;
2425
width: 12px;
2526
margin-right: 8px;
26-
input:checked + span, input + span {
27-
border: none;
27+
input:checked + span,
28+
input + span {
29+
border: none;
2830
width: 12px !important;
2931
background-color: transparent;
3032
}
@@ -34,7 +36,7 @@
3436
}
3537

3638
margin-bottom: 1em;
37-
39+
3840
> * {
3941
display: flex;
4042
align-items: center;
@@ -65,13 +67,19 @@
6567
display: flex;
6668
margin-bottom: 1em;
6769
padding-left: 10px;
68-
i {
70+
.page-info {
71+
margin-left: auto;
72+
margin-right: auto;
73+
padding: 3px 8px;
74+
text-overflow: clip;
75+
white-space: nowrap;
76+
}
77+
.nav-container {
78+
display: flex;
79+
align-self: flex-start;
80+
padding: 3px 8px;
6981
cursor: pointer;
7082
border-radius: 7px;
71-
$size: 25px;
72-
width: $size;
73-
height: $size;
74-
display: flex;
7583
align-items: center;
7684
justify-content: center;
7785
border: 1px solid black;
@@ -85,6 +93,9 @@
8593
cursor: not-allowed;
8694
}
8795
}
96+
i {
97+
margin-left: 5px;
98+
}
8899

89100
&--inverted {
90101
i {

ui/src/app/applications/components/pod-logs-viewer/pod-logs-viewer.tsx

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -503,22 +503,45 @@ interface PageInfo {
503503
canPageBack: boolean;
504504
}
505505

506+
const NavButton = (props: {children: React.ReactNode; disabled?: boolean; onClick: () => void}) => {
507+
return (
508+
<div className={`nav-container ${props.disabled ? 'disabled' : ''}`} onClick={props.onClick}>
509+
{props.children}
510+
</div>
511+
);
512+
};
513+
506514
const logNavigators = (actions: NavActions, darkMode: boolean, info?: PageInfo) => {
507515
return (
508516
<div className={`pod-logs-viewer__menu ${darkMode ? 'pod-logs-viewer__menu--inverted' : ''}`}>
509-
{actions.begin && <i className='fa fa-angle-double-left' onClick={actions.begin || (() => null)} />}
510-
<i className={`fa fa-angle-left ${info && info.canPageBack ? '' : 'disabled'}`} onClick={actions.left || (() => null)} />
511-
<i className='fa fa-angle-down' onClick={actions.bottom || (() => null)} />
512-
<i className='fa fa-angle-up' onClick={actions.top || (() => null)} />
513-
<div style={{marginLeft: 'auto', marginRight: 'auto'}}>
517+
{actions.begin && (
518+
<NavButton onClick={actions.begin || (() => null)}>
519+
Begin <i className='fa fa-angle-double-left' />
520+
</NavButton>
521+
)}
522+
523+
<NavButton disabled={!(info && info.canPageBack)} onClick={actions.left || (() => null)}>
524+
Prev <i className='fa fa-angle-left' />
525+
</NavButton>
526+
<NavButton onClick={actions.bottom || (() => null)}>
527+
Bottom <i className='fa fa-angle-down' />
528+
</NavButton>
529+
<NavButton onClick={actions.top || (() => null)}>
530+
Top <i className='fa fa-angle-up' />
531+
</NavButton>
532+
<div className={`page-info`}>
514533
{info && (
515534
<React.Fragment>
516535
Page {info.curPage + 1} (Lines {info.firstLine} to {info.lastLine})
517536
</React.Fragment>
518537
)}
519538
</div>
520-
<i className={`fa fa-angle-right ${info && info.curPage > 0 ? '' : 'disabled'}`} onClick={(info && info.curPage > 0 && actions.right) || null} />
521-
<i className={`fa fa-angle-double-right ${info && info.curPage > 1 ? '' : 'disabled'}`} onClick={(info && info.curPage > 1 && actions.end) || null} />
539+
<NavButton onClick={(info && info.curPage > 0 && actions.right) || null} disabled={!(info && info.curPage > 0)}>
540+
Next <i className='fa fa-angle-right' />
541+
</NavButton>
542+
<NavButton onClick={(info && info.curPage > 1 && actions.end) || null} disabled={!(info && info.curPage > 1)}>
543+
End <i className='fa fa-angle-double-right' />
544+
</NavButton>
522545
</div>
523546
);
524547
};

0 commit comments

Comments
 (0)