-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Unified Resources UI: Various Fixes #32064
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
Changes from all commits
f4cd2f5
f2b67bd
3512e4b
527a4b0
c0c694e
cb2affb
6c33fcf
642be8c
91cb348
a05331c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,6 +15,7 @@ | |
| */ | ||
|
|
||
| import React, { useState } from 'react'; | ||
| import styled from 'styled-components'; | ||
| import { ButtonBorder, ButtonPrimary, ButtonSecondary } from 'design/Button'; | ||
| import { SortDir } from 'design/DataTable/types'; | ||
| import { Text } from 'design'; | ||
|
|
@@ -151,6 +152,14 @@ const FilterTypesMenu = ({ | |
| setKinds(newKinds); | ||
| }; | ||
|
|
||
| const handleSelectAll = () => { | ||
| setKinds(kindOptions.map(k => k.value)); | ||
| }; | ||
|
|
||
| const handleClearAll = () => { | ||
| setKinds([]); | ||
| }; | ||
|
|
||
|
Comment on lines
+155
to
+162
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These methods seem a bit simple atm, but when we start to add more filter types besides just |
||
| const applyFilters = () => { | ||
| onChange(kinds); | ||
| handleClose(); | ||
|
|
@@ -167,8 +176,9 @@ const FilterTypesMenu = ({ | |
| size="small" | ||
| onClick={handleOpen} | ||
| > | ||
| Type | ||
| Types {kindsFromParams.length > 0 ? `(${kindsFromParams.length})` : ''} | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similarly, this will change once we add more filters but abstracting now seemed a bit frivolous |
||
| <ChevronDown ml={2} size="small" color="text.slightlyMuted" /> | ||
| {kindsFromParams.length > 0 && <FiltersExistIndicator />} | ||
| </ButtonSecondary> | ||
| <Menu | ||
| popoverCss={() => `margin-top: 36px;`} | ||
|
|
@@ -184,6 +194,30 @@ const FilterTypesMenu = ({ | |
| open={Boolean(anchorEl)} | ||
| onClose={cancelUpdate} | ||
| > | ||
| <Flex gap={2} p={2}> | ||
| <ButtonSecondary | ||
| size="small" | ||
| onClick={handleSelectAll} | ||
| textTransform="none" | ||
| css={` | ||
| background-color: transparent; | ||
| `} | ||
| px={2} | ||
| > | ||
| Select All | ||
| </ButtonSecondary> | ||
| <ButtonSecondary | ||
| size="small" | ||
| onClick={handleClearAll} | ||
| textTransform="none" | ||
| css={` | ||
| background-color: transparent; | ||
| `} | ||
| px={2} | ||
| > | ||
| Clear All | ||
| </ButtonSecondary> | ||
| </Flex> | ||
| {kindOptions.map(kind => ( | ||
| <MenuItem | ||
| px={2} | ||
|
|
@@ -320,3 +354,14 @@ function kindArraysEqual(arr1: string[], arr2: string[]) { | |
|
|
||
| return true; | ||
| } | ||
|
|
||
| const FiltersExistIndicator = styled.div` | ||
| position: absolute; | ||
| top: -4px; | ||
| right: -4px; | ||
| height: 12px; | ||
| width: 12px; | ||
| background-color: ${props => props.theme.colors.brand}; | ||
| border-radius: 50%; | ||
| display: inline-block; | ||
| `; | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea. I believe I have the test testing what we want 91cb348