-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: extract quick filter empty state into a separate component
- Loading branch information
1 parent
e96068f
commit a103c97
Showing
3 changed files
with
59 additions
and
41 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
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
53 changes: 53 additions & 0 deletions
53
frontend/src/components/QuickFilters/FilterRenderers/Checkbox/QuickFilterEmptyState.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 |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import { Color } from '@signozhq/design-tokens'; | ||
import { Button } from 'antd'; | ||
import EmptyQuickFilterIcon from 'assets/CustomIcons/EmptyQuickFilterIcon'; | ||
import { ArrowUpRight } from 'lucide-react'; | ||
|
||
const QUICK_FILTER_DOC_PATHS: Record<string, string> = { | ||
severity_text: 'severity-text', | ||
'deployment.environment': 'environment', | ||
'service.name': 'service-name', | ||
'host.name': 'hostname', | ||
'k8s.cluster.name': 'k8s-cluster-name', | ||
'k8s.deployment.name': 'k8s-deployment-name', | ||
'k8s.namespace.name': 'k8s-namespace-name', | ||
'k8s.pod.name': 'k8s-pod-name', | ||
}; | ||
|
||
function QuickFilterEmptyState({ | ||
attributeKey, | ||
}: { | ||
attributeKey: string; | ||
}): JSX.Element { | ||
const handleLearnMoreClick = (): void => { | ||
const section = QUICK_FILTER_DOC_PATHS[attributeKey]; | ||
|
||
window.open( | ||
`https://signoz.io/docs/logs-management/features/logs-quick-filters#${section}`, | ||
'_blank', | ||
); | ||
}; | ||
return ( | ||
<section className="go-to-docs"> | ||
<div className="go-to-docs__container"> | ||
<div className="go-to-docs__container-icon"> | ||
<EmptyQuickFilterIcon /> | ||
</div> | ||
<div className="go-to-docs__container-message"> | ||
{`You'd need to parse out this attribute to start getting them as a fast | ||
filter.`} | ||
</div> | ||
</div> | ||
<Button | ||
type="link" | ||
className="go-to-docs__button" | ||
onClick={handleLearnMoreClick} | ||
> | ||
<div className="go-to-docs__button-text">Learn more</div> | ||
<ArrowUpRight size={14} color={Color.BG_ROBIN_400} /> | ||
</Button> | ||
</section> | ||
); | ||
} | ||
|
||
export default QuickFilterEmptyState; |