-
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 6 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; | ||
| `; | ||
|
Contributor
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. i wanted to test this change out in storybook, but i think most of it got broken along the way. doesn't seem like this PR would've broke it, or am i missing something? (i saw these stories in working state like couple weeks ago)
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. Storybook is working for me. What errors are you seeing?
Contributor
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.
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. Ah, I believe that is related to changes made here #30964
Contributor
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. Hmmm... Folks, I don't want to sound cliche, but it works for me. :D
Contributor
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. Holy cow, I think I know what the issue is. I just noticed that you are using your machine's explicit IP address, and I was always using 127.0.0.1 instead. If I substitute my machine's IP, it ends up on 404, too. It looks like that mock service worker Storybook plugin fails to load resources with a different IP. I'll take a look and see if it can be configured another way, since I'd really like to avoid moving away from it (it was the only way I could get both API calls and SVG loading to work). In the meantime, please use 127.0.0.1.
Contributor
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. I don't really know how to fix it. :( It might be related to security restrictions (apparently, service workers are not allowed for pages not running on HTTPS if they're not accessed using localhost URLs). The mystery is why then other tests work, so I'm more inclined to believe that this is plugin-specific (other tests use MSW directly). I have a more important thing to do at the moment (backporting that PR mentioned above), but perhaps I'll give it one more try in the afternoon. Perhaps upgrading Storybook will change something; the version we're using is a bit old and ratchety. |

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