Skip to content

Commit

Permalink
feat: events tab integration
Browse files Browse the repository at this point in the history
  • Loading branch information
YounixM committed Dec 10, 2024
1 parent 0128763 commit 0d7daa7
Show file tree
Hide file tree
Showing 18 changed files with 963 additions and 132 deletions.
1 change: 1 addition & 0 deletions frontend/src/api/infraMonitoring/getK8sPodsList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export interface K8sPodsData {
k8s_pod_name: string;
k8s_pod_uid: string;
k8s_statefulset_name: string;
k8s_cluster_name: string;
};
countByPhase: {
pending: number;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
display: flex;
align-items: center;
justify-content: space-between;
width: 100%;
width: calc(100% - 24px);
cursor: pointer;

&.filter-disabled {
Expand Down
4 changes: 4 additions & 0 deletions frontend/src/components/QuickFilters/QuickFilters.styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
display: flex;
align-items: center;
gap: 6px;
width: 100%;
justify-content: flex-start;

.text {
color: var(--bg-vanilla-400);
Expand Down Expand Up @@ -50,6 +52,8 @@
display: flex;
align-items: center;
gap: 12px;
width: 100%;
justify-content: flex-end;

.divider-filter {
width: 1px;
Expand Down
27 changes: 19 additions & 8 deletions frontend/src/components/QuickFilters/QuickFilters.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,11 @@ export interface IQuickFiltersConfig {
interface IQuickFiltersProps {
config: IQuickFiltersConfig[];
handleFilterVisibilityChange: () => void;
source?: string | null;
}

export default function QuickFilters(props: IQuickFiltersProps): JSX.Element {
const { config, handleFilterVisibilityChange } = props;
const { config, handleFilterVisibilityChange, source } = props;

const {
currentQuery,
Expand Down Expand Up @@ -83,16 +84,22 @@ export default function QuickFilters(props: IQuickFiltersProps): JSX.Element {

const lastQueryName =
currentQuery.builder.queryData?.[lastUsedQuery || 0]?.queryName;

const isInfraMonitoring = source === 'infra-monitoring';

return (
<div className="quick-filters">
<section className="header">
<section className="left-actions">
<FilterOutlined />
<Typography.Text className="text">Filters for</Typography.Text>
<Tooltip title={`Filter currently in sync with query ${lastQueryName}`}>
<Typography.Text className="sync-tag">{lastQueryName}</Typography.Text>
</Tooltip>
</section>
{!isInfraMonitoring && (
<section className="left-actions">
<FilterOutlined />
<Typography.Text className="text">Filters for</Typography.Text>
<Tooltip title={`Filter currently in sync with query ${lastQueryName}`}>
<Typography.Text className="sync-tag">{lastQueryName}</Typography.Text>
</Tooltip>
</section>
)}

<section className="right-actions">
<Tooltip title="Reset All">
<SyncOutlined className="sync-icon" onClick={handleReset} />
Expand Down Expand Up @@ -122,3 +129,7 @@ export default function QuickFilters(props: IQuickFiltersProps): JSX.Element {
</div>
);
}

QuickFilters.defaultProps = {
source: null,
};
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,23 @@
.quick-filters {
overflow-y: auto;
overflow-x: hidden;

&::-webkit-scrollbar {
width: 0.1rem;
height: 0.1rem;
}

&::-webkit-scrollbar-track {
background: transparent;
}

&::-webkit-scrollbar-thumb {
background: var(--bg-slate-300);
}

&::-webkit-scrollbar-thumb:hover {
background: var(--bg-slate-200);
}
}
}

Expand Down Expand Up @@ -55,6 +72,7 @@
flex: 1;

display: flex;
align-items: center;
gap: 8px;

.k8s-qb-search-container {
Expand All @@ -72,17 +90,17 @@
display: flex;
align-items: center;
gap: 4px;
}

.periscope-btn {
padding: 4px 8px;
.periscope-btn {
padding: 4px 8px;

&.ghost {
border: none;
background: transparent;
&.ghost {
border: none;
background: transparent;

&:hover {
color: var(--bg-vanilla-100);
}
&:hover {
color: var(--bg-vanilla-100);
}
}
}
Expand Down Expand Up @@ -228,6 +246,14 @@
}
}
}

.k8s-list-container-filters-visible {
.k8s-list-table {
.ant-pagination {
width: calc(100% - 340px);
}
}
}
}

.infra-monitoring-tags {
Expand Down
37 changes: 27 additions & 10 deletions frontend/src/container/InfraMonitoringK8s/InfraMonitoringK8s.tsx
Original file line number Diff line number Diff line change
@@ -1,26 +1,43 @@
import './InfraMonitoringK8s.styles.scss';

import * as Sentry from '@sentry/react';
import QuickFilters from 'components/QuickFilters/QuickFilters';
import ErrorBoundaryFallback from 'pages/ErrorBoundaryFallback/ErrorBoundaryFallback';
import { useState } from 'react';

import K8sPodLists from './Pods/K8sPodLists';
import { K8sQuickFiltersConfig } from './utils';

export default function InfraMonitoringK8s(): JSX.Element {
const [showFilters, setShowFilters] = useState(true);

const handleFilterVisibilityChange = (): void => {
setShowFilters(!showFilters);
};

return (
<Sentry.ErrorBoundary fallback={<ErrorBoundaryFallback />}>
<div className="infra-monitoring-container">
<div className="k8s-container">
{/* <div className="k8s-quick-filters-container">
<QuickFilters
config={K8sQuickFiltersConfig}
handleFilterVisibilityChange={(): void => {
console.log('filter visibility changed');
}}
/>
</div> */}
{showFilters && (
<div className="k8s-quick-filters-container">
<QuickFilters
source="infra-monitoring"
config={K8sQuickFiltersConfig}
handleFilterVisibilityChange={handleFilterVisibilityChange}
/>
</div>
)}

<div className="k8s-list-container">
<K8sPodLists />
<div
className={`k8s-list-container ${
showFilters ? 'k8s-list-container-filters-visible' : ''
}`}
>
<K8sPodLists
isFiltersVisible={showFilters}
handleFilterVisibilityChange={handleFilterVisibilityChange}
/>
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

position: absolute;
width: 320px;
right: 12px;
right: 4px;
top: 48px;
z-index: 2;

Expand Down
19 changes: 18 additions & 1 deletion frontend/src/container/InfraMonitoringK8s/K8sHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Button, Input } from 'antd';
import QueryBuilderSearch from 'container/QueryBuilder/filters/QueryBuilderSearch';
import DateTimeSelectionV2 from 'container/TopNav/DateTimeSelectionV2';
import { useQueryBuilder } from 'hooks/queryBuilder/useQueryBuilder';
import { SlidersHorizontal } from 'lucide-react';
import { Filter, SlidersHorizontal } from 'lucide-react';
import { useCallback, useMemo, useState } from 'react';
import { IBuilderQuery } from 'types/api/queryBuilder/queryBuilderData';

Expand All @@ -18,13 +18,17 @@ function K8sHeader({
handleFiltersChange,
onAddColumn,
onRemoveColumn,
handleFilterVisibilityChange,
isFiltersVisible,
}: {
defaultAddedColumns: IPodColumn[];
addedColumns: IPodColumn[];
availableColumns: IPodColumn[];
handleFiltersChange: (value: IBuilderQuery['filters']) => void;
onAddColumn: (column: IPodColumn) => void;
onRemoveColumn: (column: IPodColumn) => void;
handleFilterVisibilityChange: () => void;
isFiltersVisible: boolean;
}): JSX.Element {
const [isFiltersSidePanelOpen, setIsFiltersSidePanelOpen] = useState(false);

Expand Down Expand Up @@ -59,6 +63,19 @@ function K8sHeader({
return (
<div className="k8s-list-controls">
<div className="k8s-list-controls-left">
{!isFiltersVisible && (
<div className="quick-filters-toggle-container">
<Button
className="periscope-btn ghost"
type="text"
size="small"
onClick={handleFilterVisibilityChange}
>
<Filter size={14} />
</Button>
</div>
)}

<div className="k8s-qb-search-container">
<QueryBuilderSearch
query={query}
Expand Down
10 changes: 9 additions & 1 deletion frontend/src/container/InfraMonitoringK8s/Pods/K8sPodLists.tsx

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 0d7daa7

Please sign in to comment.