-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: implement tests sorting (#621)
* feat: implement tests sorting * refactor: simplify sorting logic * fix: make toolbar select popups stay on top of tree view * fix: adaptive select redesign, group by message fixes, perf optimisation * fix: make custom sorting groups possible * fix: fix imports * refactor: introduce tree node weight metadata, move tags logic to a helper
- Loading branch information
Showing
30 changed files
with
1,014 additions
and
254 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import {SortByExpression, SortType} from '@/static/new-ui/types/store'; | ||
|
||
export const SORT_BY_NAME: SortByExpression = {id: 'by-name', label: 'Name', type: SortType.ByName}; | ||
export const SORT_BY_FAILED_RETRIES: SortByExpression = {id: 'by-failed-runs', label: 'Failed runs count', type: SortType.ByFailedRuns}; | ||
export const SORT_BY_TESTS_COUNT: SortByExpression = {id: 'by-tests-count', label: 'Tests count', type: SortType.ByTestsCount}; |
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,19 @@ | ||
import actionNames from '@/static/modules/action-names'; | ||
import {Action} from '@/static/modules/actions/types'; | ||
import {SortDirection} from '@/static/new-ui/types/store'; | ||
|
||
type SetCurrentSortByExpressionAction = Action<typeof actionNames.SORT_TESTS_SET_CURRENT_EXPRESSION, { | ||
expressionIds: string[]; | ||
}>; | ||
export const setCurrentSortByExpression = (payload: SetCurrentSortByExpressionAction['payload']): SetCurrentSortByExpressionAction => | ||
({type: actionNames.SORT_TESTS_SET_CURRENT_EXPRESSION, payload}); | ||
|
||
type SetSortByDirectionAction = Action<typeof actionNames.SORT_TESTS_SET_DIRECTION, { | ||
direction: SortDirection | ||
}>; | ||
export const setSortByDirection = (payload: SetSortByDirectionAction['payload']): SetSortByDirectionAction => | ||
({type: actionNames.SORT_TESTS_SET_DIRECTION, payload}); | ||
|
||
export type SortTestsAction = | ||
| SetCurrentSortByExpressionAction | ||
| SetSortByDirectionAction; |
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
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
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,71 @@ | ||
import {SortByExpression, SortDirection, State} from '@/static/new-ui/types/store'; | ||
import {SomeAction} from '@/static/modules/actions/types'; | ||
import actionNames from '@/static/modules/action-names'; | ||
import {applyStateUpdate} from '@/static/modules/utils'; | ||
import {SORT_BY_FAILED_RETRIES, SORT_BY_NAME, SORT_BY_TESTS_COUNT} from '@/static/constants/sort-tests'; | ||
|
||
export default (state: State, action: SomeAction): State => { | ||
switch (action.type) { | ||
case actionNames.INIT_STATIC_REPORT: | ||
case actionNames.INIT_GUI_REPORT: { | ||
const availableExpressions: SortByExpression[] = [ | ||
SORT_BY_NAME, | ||
SORT_BY_FAILED_RETRIES | ||
]; | ||
|
||
return applyStateUpdate(state, { | ||
app: { | ||
sortTestsData: { | ||
availableExpressions, | ||
currentDirection: SortDirection.Asc, | ||
currentExpressionIds: [availableExpressions[0].id] | ||
} | ||
} | ||
}); | ||
} | ||
case actionNames.SORT_TESTS_SET_CURRENT_EXPRESSION: { | ||
return applyStateUpdate(state, { | ||
app: { | ||
sortTestsData: { | ||
currentExpressionIds: action.payload.expressionIds | ||
} | ||
} | ||
}); | ||
} | ||
case actionNames.SORT_TESTS_SET_DIRECTION: { | ||
return applyStateUpdate(state, { | ||
app: { | ||
sortTestsData: { | ||
currentDirection: action.payload.direction | ||
} | ||
} | ||
}); | ||
} | ||
case actionNames.GROUP_TESTS_SET_CURRENT_EXPRESSION: { | ||
let availableExpressions: SortByExpression[]; | ||
|
||
if (action.payload.expressionIds.length > 0) { | ||
availableExpressions = [ | ||
SORT_BY_NAME, | ||
SORT_BY_FAILED_RETRIES, | ||
SORT_BY_TESTS_COUNT | ||
]; | ||
} else { | ||
availableExpressions = [ | ||
SORT_BY_NAME, | ||
SORT_BY_FAILED_RETRIES | ||
]; | ||
} | ||
|
||
return applyStateUpdate(state, { | ||
app: { | ||
sortTestsData: { | ||
availableExpressions | ||
} | ||
} | ||
}); | ||
} | ||
default: | ||
return state; | ||
} | ||
}; |
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
39 changes: 39 additions & 0 deletions
39
lib/static/new-ui/components/AdaptiveSelect/index.module.css
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,39 @@ | ||
.select-popup { | ||
--g-color-text-info: #000; | ||
|
||
font-size: var(--g-text-body-1-font-size); | ||
} | ||
|
||
.select :global(.g-select-control__label) { | ||
margin-inline-end: 0; | ||
} | ||
|
||
.selected-option { | ||
margin-inline-start: 4px; | ||
} | ||
|
||
.label-icons-container { | ||
position: relative; | ||
padding-right: 2px; | ||
} | ||
|
||
.label-dot { | ||
display: none; | ||
position: absolute; | ||
right: 0; | ||
top: 0; | ||
height: 4px; | ||
width: 4px; | ||
border-radius: 100vh; | ||
background-color: var(--g-color-private-red-600-solid); | ||
} | ||
|
||
@container (max-width: 450px) { | ||
.select :global(.g-select-control__option-text) { | ||
display: none; | ||
} | ||
|
||
.label-dot { | ||
display: block; | ||
} | ||
} |
Oops, something went wrong.