Skip to content

Commit 296593a

Browse files
committed
feat: add all resource kind constant
1 parent 3fcfff0 commit 296593a

File tree

5 files changed

+15
-8
lines changed

5 files changed

+15
-8
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@devtron-labs/devtron-fe-common-lib",
3-
"version": "0.5.8",
3+
"version": "0.5.8-beta-4",
44
"description": "Supporting common component library",
55
"type": "module",
66
"main": "dist/index.js",

src/Shared/Components/CICDHistory/AppStatusDetailsChart.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import { ReactComponent as InfoIcon } from '../../../Assets/Icon/ic-info-filled.
2222
import { ReactComponent as Chat } from '../../../Assets/Icon/ic-chat-circle-dots.svg'
2323
import { AppStatusDetailsChartType, AggregatedNodes, STATUS_SORTING_ORDER, NodeFilters } from './types'
2424
import { StatusFilterButtonComponent } from './StatusFilterButtonComponent'
25-
import { DEPLOYMENT_STATUS, APP_STATUS_HEADERS, ComponentSizeType } from '../../constants'
25+
import { DEPLOYMENT_STATUS, APP_STATUS_HEADERS, ComponentSizeType, ALL_RESOURCE_KIND_FILTER } from '../../constants'
2626
import { IndexStore } from '../../Store'
2727
import { aggregateNodes } from '../../Helpers'
2828
import { Button, ButtonStyleType, ButtonVariantType } from '../Button'
@@ -35,7 +35,7 @@ const AppStatusDetailsChart = ({
3535
}: AppStatusDetailsChartType) => {
3636
const history = useHistory()
3737
const _appDetails = IndexStore.getAppDetails()
38-
const [currentFilter, setCurrentFilter] = useState<string>('all')
38+
const [currentFilter, setCurrentFilter] = useState<string>(ALL_RESOURCE_KIND_FILTER)
3939
const [flattenedNodes, setFlattenedNodes] = useState([])
4040

4141
const { appId, environmentId: envId } = _appDetails
@@ -125,7 +125,7 @@ const AppStatusDetailsChart = ({
125125
flattenedNodes
126126
.filter(
127127
(nodeDetails) =>
128-
currentFilter === 'all' ||
128+
currentFilter === ALL_RESOURCE_KIND_FILTER ||
129129
(currentFilter === NodeFilters.drifted && nodeDetails.hasDrift) ||
130130
nodeDetails.health.status?.toLowerCase() === currentFilter,
131131
)

src/Shared/Components/CICDHistory/StatusFilterButtonComponent.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
*/
1616

1717
/* eslint-disable eqeqeq */
18+
import { ALL_RESOURCE_KIND_FILTER } from '@Shared/constants'
1819
import { ReactComponent as ICCaretDown } from '@Icons/ic-caret-down.svg'
1920
import { PopupMenu, StyledRadioGroup as RadioGroup } from '../../../Common'
2021
import { NodeFilters, NodeStatus, StatusFilterButtonType } from './types'
@@ -48,8 +49,12 @@ export const StatusFilterButtonComponent = ({ nodes, selectedTab, handleFilterCl
4849
allNodeCount += 1
4950
})
5051

52+
const handleInlineFilterClick = (e) => {
53+
handleFilterClick(e.target.value)
54+
}
55+
5156
const filterOptions = [
52-
{ status: 'all', count: allNodeCount, isSelected: selectedTab == 'all' },
57+
{ status: ALL_RESOURCE_KIND_FILTER, count: allNodeCount, isSelected: selectedTab == ALL_RESOURCE_KIND_FILTER },
5358
{ status: NodeStatus.Missing, count: missingNodeCount, isSelected: NodeStatus.Missing == selectedTab },
5459
{ status: NodeStatus.Degraded, count: failedNodeCount, isSelected: NodeStatus.Degraded == selectedTab },
5560
{
@@ -108,7 +113,7 @@ export const StatusFilterButtonComponent = ({ nodes, selectedTab, handleFilterCl
108113
name="status-filter-button"
109114
initialTab={selectedTab}
110115
disabled={false}
111-
onChange={(e) => handleFilterClick(e.target.value)}
116+
onChange={handleInlineFilterClick}
112117
>
113118
{displayedInlineFilters.map((filter, index) => (
114119
<RadioGroup.Radio

src/Shared/constants.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -497,3 +497,5 @@ export const DEFAULT_LOCKED_KEYS_CONFIG: Readonly<ConfigKeysWithLockType> = {
497497
config: [],
498498
allowed: false,
499499
}
500+
501+
export const ALL_RESOURCE_KIND_FILTER = 'all'

0 commit comments

Comments
 (0)