-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add sorting of the summary statistics table (#1068)
* add sorting of the summary statistics table * _ * buttons display * _ * _ * _ * _ * changelog + formatting * remove shadow below buttons * add tests * better icons
- Loading branch information
1 parent
37c8c70
commit a043903
Showing
12 changed files
with
252 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions
5
skrub/_reporting/_data/templates/icons/sort-alpha-down-alt.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions
4
skrub/_reporting/_data/templates/icons/sort-numeric-down-alt.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
.summary-stats-table { | ||
margin: 2px; | ||
} | ||
|
||
|
||
th.sort-button-group-wrapper { | ||
--btn-width: 2rem; | ||
--btn-group-width: calc(var(--btn-width) * 2); | ||
position: relative; | ||
padding-top: var(--micro); | ||
padding-bottom: var(--micro); | ||
padding-right: calc(var(--tiny) + var(--btn-group-width)); | ||
} | ||
|
||
.sort-button-group { | ||
position: absolute; | ||
top: -1px; | ||
bottom: 0; | ||
right: calc(-1 * var(--btn-group-width)); | ||
left: 100%; | ||
transform: translateX(calc(-1 * var(--btn-group-width) + 1px)); | ||
display: flex; | ||
gap: 0px; | ||
padding: 0px; | ||
} | ||
|
||
.sort-button { | ||
margin: 0; | ||
box-sizing: border-box; | ||
height: 100%; | ||
flex-grow: 1; | ||
border-radius: 0; | ||
border: 1px solid #aaa; | ||
background: #e0e0e0; | ||
color: #222; | ||
padding: var(--micro); | ||
} | ||
|
||
.sort-button-group > .sort-button:focus-visible { | ||
z-index: 2; | ||
} | ||
|
||
.sort-button-group > .sort-button ~ .sort-button { | ||
margin-left: -1px; | ||
} | ||
|
||
.sort-button:hover { | ||
background: #eeeeee; | ||
} | ||
|
||
.sort-button:active { | ||
background: #cccccc; | ||
} | ||
|
||
.sort-button[data-is-active]{ | ||
background: var(--lightgreen); | ||
color: black; | ||
} |
101 changes: 72 additions & 29 deletions
101
skrub/_reporting/_data/templates/summary-statistics.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
skrub/_reporting/js_tests/cypress/e2e/summary-statistics.cy.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
describe('test sorting the summary stats columns', () => { | ||
it('sorts the table when clicking arrows', () => { | ||
cy.get('@report').find('[data-test="summary-statistics-tab"]') | ||
.click(); | ||
cy.get('@report').find('.summary-stats-table').as('table'); | ||
cy.get('@table').find('tbody tr').first().should('have.attr', | ||
'data-column-name', 'gender'); | ||
cy.get('@report').contains('Column name').as('colName'); | ||
cy.get('@colName').parent().find('button').first().as('colNameButton').click(); | ||
cy.get('@colNameButton').should('have.attr', 'data-is-active'); | ||
cy.get('@table').find('tbody tr').first().should('have.attr', | ||
'data-column-name', 'assignment_category'); | ||
cy.get('@report').find('th').contains('Unique values').as( | ||
'unique'); | ||
cy.get('@unique').parent().find('button').first().as('uniqueButton').click(); | ||
cy.get('@uniqueButton').should('have.attr', 'data-is-active'); | ||
cy.get('@colNameButton').should('not.have.attr', 'data-is-active'); | ||
cy.get('@table').find('tbody tr').first().should('have.attr', | ||
'data-column-name', 'gender'); | ||
cy.get('@table').find('tbody tr').last().should('have.attr', | ||
'data-column-name', 'year_first_hired'); | ||
cy.get('@unique').parent().find('button').first().next() | ||
.click(); | ||
cy.get('@table').find('tbody tr').first().should('have.attr', | ||
'data-column-name', 'date_first_hired'); | ||
cy.get('@table').find('tbody tr').last().should('have.attr', | ||
'data-column-name', 'year_first_hired'); | ||
}); | ||
}); |