-
Notifications
You must be signed in to change notification settings - Fork 209
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: filters for metrics and charts in dashboard (#250)
* feat: filters for metrics and charts in dashboard * feat(console): add filter number indicator * chore: remove redundant npm package
- Loading branch information
1 parent
2060ada
commit 0dbd1ed
Showing
17 changed files
with
149 additions
and
329 deletions.
There are no files selected for viewing
183 changes: 0 additions & 183 deletions
183
apps/console/src/app/components/prompts/FunctionsEditor.tsx
This file was deleted.
Oops, something went wrong.
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
57 changes: 20 additions & 37 deletions
57
apps/console/src/app/components/requests/RequestFilters.tsx
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 |
---|---|---|
@@ -1,49 +1,32 @@ | ||
import { RequestReportItem } from "../../pages/requests/types"; | ||
import { Card, Space } from "antd"; | ||
import styled from "@emotion/styled"; | ||
import { Space } from "antd"; | ||
import { AddFilterItem, FilterItem } from "./filters/FilterItem"; | ||
import { useFiltersAndSortParams } from "../../lib/hooks/useFiltersAndSortParams"; | ||
import { | ||
NUMBER_FILTER_OPERATORS, | ||
STRING_FILTER_OPERATORS, | ||
} from "../../lib/constants/filters"; | ||
|
||
const Box = styled.div` | ||
padding: 10px 0; | ||
`; | ||
|
||
interface Props { | ||
requests: RequestReportItem[]; | ||
} | ||
|
||
export const RequestFilters = (props: Props) => { | ||
export const RequestFilters = () => { | ||
const { filters, removeFilter, addFilter } = useFiltersAndSortParams(); | ||
|
||
return ( | ||
<Box> | ||
<Card style={{ width: "100%" }}> | ||
<Space direction="vertical" style={{ width: "100%" }} size="large"> | ||
<AddFilterItem onAdd={addFilter} /> | ||
<Space | ||
direction="horizontal" | ||
style={{ width: "100%", flexWrap: "wrap" }} | ||
> | ||
{filters.map((filter) => ( | ||
<FilterItem | ||
key={`${filter.field}-${filter.operator}-${filter.value}`} | ||
field={filter.field} | ||
operator={ | ||
[...STRING_FILTER_OPERATORS, ...NUMBER_FILTER_OPERATORS].find( | ||
(op) => op.value === filter.operator | ||
)?.label | ||
} | ||
value={filter.value} | ||
onRemoveFilter={() => removeFilter(filter)} | ||
/> | ||
))} | ||
</Space> | ||
</Space> | ||
</Card> | ||
</Box> | ||
<Space direction="vertical" style={{ width: "100%" }} size="large"> | ||
<AddFilterItem onAdd={addFilter} /> | ||
<Space direction="horizontal" style={{ width: "100%", flexWrap: "wrap" }}> | ||
{filters.map((filter) => ( | ||
<FilterItem | ||
key={`${filter.field}-${filter.operator}-${filter.value}`} | ||
field={filter.field} | ||
operator={ | ||
[...STRING_FILTER_OPERATORS, ...NUMBER_FILTER_OPERATORS].find( | ||
(op) => op.value === filter.operator | ||
)?.label | ||
} | ||
value={filter.value} | ||
onRemoveFilter={() => removeFilter(filter)} | ||
/> | ||
))} | ||
</Space> | ||
</Space> | ||
); | ||
}; |
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
Oops, something went wrong.