Skip to content
This repository has been archived by the owner on Feb 8, 2024. It is now read-only.

Commit

Permalink
[Teleport] Fix assortment of user issues (#103)
Browse files Browse the repository at this point in the history
* Set ASC sort in NodeList on first render (issue #3827)
* Modify close dialog for terminal sessions (leave/terminate) (issue #3836)
* Prevent incrementing pages with no data (issue #3835)
* Provide description for trusted cluster token event (issue #3837)
* Update snapshots and fix unit tests
  • Loading branch information
Lisa Kim authored Jun 16, 2020
1 parent 8b9e9b2 commit d92fd00
Show file tree
Hide file tree
Showing 15 changed files with 108 additions and 89 deletions.
5 changes: 3 additions & 2 deletions packages/design/src/DataTable/Paged/Pager/Pager.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,13 @@ export default function Pager(props) {
const { startFrom = 0, endAt = 0, totalRows = 0, onPrev, onNext } = props;
const isPrevDisabled = totalRows === 0 || startFrom === 0;
const isNextDisabled = totalRows === 0 || endAt === totalRows;
const initialStartFrom = totalRows > 0 ? startFrom + 1 : 0;

return (
<>
<Text typography="body2" color="primary.contrastText">
SHOWING <strong>{startFrom + 1}</strong> to <strong>{endAt}</strong> of{' '}
<strong>{totalRows}</strong>
SHOWING <strong>{initialStartFrom}</strong> - <strong>{endAt}</strong>{' '}
of <strong>{totalRows}</strong>
</Text>
<StyledButtons>
<button
Expand Down
4 changes: 2 additions & 2 deletions packages/design/src/DataTable/Paged/Pager/Pager.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe('design/DataTable Pager', () => {
${2} | ${5} | ${10} | ${[false, false]} | ${[3, 5, 10]}
${0} | ${5} | ${10} | ${[true, false]} | ${[1, 5, 10]}
${1} | ${5} | ${5} | ${[false, true]} | ${[2, 5, 5]}
${1} | ${2} | ${0} | ${[true, true]} | ${[2, 2, 0]}
${0} | ${0} | ${0} | ${[true, true]} | ${[0, 0, 0]}
`(
'respects props: startFrom=$startFrom, endAt=$endAt, totalRows=$totalRows, disablePrevNext=$expPrevNextBtns',
({ startFrom, endAt, totalRows, expPrevNextBtns, expNumRanges }) => {
Expand All @@ -40,7 +40,7 @@ describe('design/DataTable Pager', () => {
);

expect(container.firstChild.textContent).toEqual(
`SHOWING ${expNumRanges[0]} to ${expNumRanges[1]} of ${expNumRanges[2]}`
`SHOWING ${expNumRanges[0]} - ${expNumRanges[1]} of ${expNumRanges[2]}`
);

const buttons = container.querySelectorAll('button');
Expand Down
2 changes: 1 addition & 1 deletion packages/design/src/DataTable/Table.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ describe('design/Table SortIndicator', () => {
const header1 = anchorTags[0];
const header2 = anchorTags[1];

// TableSample initially sorts with "Hostname" DESC
// TableSample initially sorts with "Hostname" ASC
fireEvent.click(screen.getByText(tableSampleHeaders[0]));
expect(
header1.querySelector('span').classList.contains('icon-chevron-up')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,12 +260,12 @@ exports[`rendering of Events 1`] = `
<strong>
1
</strong>
to
-
<strong>
37
</strong>
of
of
<strong>
37
</strong>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,12 +251,12 @@ exports[`rendering of Audit Sessions 1`] = `
<strong>
1
</strong>
to
-
<strong>
3
</strong>
of
of
<strong>
3
</strong>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -420,14 +420,14 @@ exports[`overflow 1`] = `
>
SHOWING
<strong>
1
0
</strong>
to
-
<strong>
0
</strong>
of
of
<strong>
0
</strong>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -452,12 +452,12 @@ exports[`loaded 1`] = `
<strong>
1
</strong>
to
-
<strong>
7
</strong>
of
of
<strong>
7
</strong>
Expand Down Expand Up @@ -496,7 +496,7 @@ exports[`loaded 1`] = `
<a>
Hostname
<span
class="c9 c13 icon icon-chevron-up "
class="c9 c13 icon icon-chevron-down "
color="light"
/>
</a>
Expand All @@ -519,15 +519,10 @@ exports[`loaded 1`] = `
<tbody>
<tr>
<td>
zebpecda
duzsevkig
</td>
<td>
<span
style="cursor: default;"
title="This node is connected to cluster through reverse tunnel"
>
⟵ tunnel
</span>
172.10.1.1:3022
</td>
<td>
<div
Expand Down Expand Up @@ -562,15 +557,10 @@ exports[`loaded 1`] = `
</tr>
<tr>
<td>
zebpecda
facuzguv
</td>
<td>
<span
style="cursor: default;"
title="This node is connected to cluster through reverse tunnel"
>
⟵ tunnel
</span>
172.10.1.1:3022
</td>
<td>
<div
Expand Down Expand Up @@ -605,10 +595,10 @@ exports[`loaded 1`] = `
</tr>
<tr>
<td>
zebpecda
fujedu
</td>
<td>
172.10.1.1:3022
172.10.1.20:3022
</td>
<td>
<div
Expand Down Expand Up @@ -681,10 +671,10 @@ exports[`loaded 1`] = `
</tr>
<tr>
<td>
fujedu
zebpecda
</td>
<td>
172.10.1.20:3022
172.10.1.1:3022
</td>
<td>
<div
Expand Down Expand Up @@ -719,10 +709,15 @@ exports[`loaded 1`] = `
</tr>
<tr>
<td>
facuzguv
zebpecda
</td>
<td>
172.10.1.1:3022
<span
style="cursor: default;"
title="This node is connected to cluster through reverse tunnel"
>
⟵ tunnel
</span>
</td>
<td>
<div
Expand Down Expand Up @@ -757,10 +752,15 @@ exports[`loaded 1`] = `
</tr>
<tr>
<td>
duzsevkig
zebpecda
</td>
<td>
172.10.1.1:3022
<span
style="cursor: default;"
title="This node is connected to cluster through reverse tunnel"
>
⟵ tunnel
</span>
</td>
<td>
<div
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,12 +267,12 @@ exports[`loaded 1`] = `
<strong>
1
</strong>
to
-
<strong>
1
</strong>
of
of
<strong>
1
</strong>
Expand Down
2 changes: 1 addition & 1 deletion packages/teleport/src/components/NodeList/NodeList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function NodeList(props: NodeListProps) {
const { nodes = [], onLoginMenuOpen, onLoginSelect, pageSize = 100 } = props;
const [searchValue, setSearchValue] = React.useState('');
const [sortDir, setSortDir] = React.useState<Record<string, string>>({
hostname: SortTypes.ASC,
hostname: SortTypes.DESC,
});

function sortAndFilter(search) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -633,12 +633,12 @@ exports[`render DocumentNodes 1`] = `
<strong>
1
</strong>
to
-
<strong>
5
</strong>
of
of
<strong>
5
</strong>
Expand Down Expand Up @@ -677,7 +677,7 @@ exports[`render DocumentNodes 1`] = `
<a>
Hostname
<span
class="c15 c19 icon icon-chevron-up "
class="c15 c19 icon icon-chevron-down "
color="light"
/>
</a>
Expand All @@ -700,10 +700,15 @@ exports[`render DocumentNodes 1`] = `
<tbody>
<tr>
<td>
zebpecda
duzsevkig
</td>
<td>
172.10.1.24:3022
<span
style="cursor: default;"
title="This node is connected to cluster through reverse tunnel"
>
⟵ tunnel
</span>
</td>
<td>
<div
Expand All @@ -718,30 +723,6 @@ exports[`render DocumentNodes 1`] = `
>
kernel: 4.15.0-51-generic
</div>
<div
class="c20"
kind="secondary"
>
lortavma: one
</div>
<div
class="c20"
kind="secondary"
>
lenisret: 4.15.0-51-generic
</div>
<div
class="c20"
kind="secondary"
>
lofdevod: one
</div>
<div
class="c20"
kind="secondary"
>
llhurlaz: 4.15.0-51-generic
</div>
</td>
<td
align="right"
Expand All @@ -762,15 +743,10 @@ exports[`render DocumentNodes 1`] = `
</tr>
<tr>
<td>
kuhinur
facuzguv
</td>
<td>
<span
style="cursor: default;"
title="This node is connected to cluster through reverse tunnel"
>
⟵ tunnel
</span>
172.10.1.42:3022
</td>
<td>
<div
Expand Down Expand Up @@ -843,10 +819,15 @@ exports[`render DocumentNodes 1`] = `
</tr>
<tr>
<td>
facuzguv
kuhinur
</td>
<td>
172.10.1.42:3022
<span
style="cursor: default;"
title="This node is connected to cluster through reverse tunnel"
>
⟵ tunnel
</span>
</td>
<td>
<div
Expand Down Expand Up @@ -881,15 +862,10 @@ exports[`render DocumentNodes 1`] = `
</tr>
<tr>
<td>
duzsevkig
zebpecda
</td>
<td>
<span
style="cursor: default;"
title="This node is connected to cluster through reverse tunnel"
>
⟵ tunnel
</span>
172.10.1.24:3022
</td>
<td>
<div
Expand All @@ -904,6 +880,30 @@ exports[`render DocumentNodes 1`] = `
>
kernel: 4.15.0-51-generic
</div>
<div
class="c20"
kind="secondary"
>
lortavma: one
</div>
<div
class="c20"
kind="secondary"
>
lenisret: 4.15.0-51-generic
</div>
<div
class="c20"
kind="secondary"
>
lofdevod: one
</div>
<div
class="c20"
kind="secondary"
>
llhurlaz: 4.15.0-51-generic
</div>
</td>
<td
align="right"
Expand Down
Loading

0 comments on commit d92fd00

Please # to comment.