Skip to content

Commit 484766f

Browse files
committed
Merge branch 'develop' of https://github.com/devtron-labs/dashboard into feat/tree-view
2 parents 4e678a4 + f694d02 commit 484766f

File tree

11 files changed

+410
-161
lines changed

11 files changed

+410
-161
lines changed

.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,5 +73,6 @@ FEATURE_ASK_DEVTRON_EXPERT=false
7373
FEATURE_MANAGE_TRAFFIC_ENABLE=false
7474
FEATURE_REDFISH_NODE_ENABLE=false
7575
FEATURE_INFRA_PROVISION_INFO_BLOCK_HIDE=false
76+
FEATURE_GROUPED_APP_LIST_FILTERS_ENABLE=false
7677
FEATURE_FLUX_DEPLOYMENTS_ENABLE=false
7778
FEATURE_LINK_EXTERNAL_FLUX_ENABLE=false

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"private": true,
55
"homepage": "/dashboard",
66
"dependencies": {
7-
"@devtron-labs/devtron-fe-common-lib": "1.17.0-pre-0",
7+
"@devtron-labs/devtron-fe-common-lib": "1.17.0-pre-1",
88
"@esbuild-plugins/node-globals-polyfill": "0.2.3",
99
"@rjsf/core": "^5.13.3",
1010
"@rjsf/utils": "^5.13.3",

src/components/app/list-new/AppListFilters.tsx

Lines changed: 264 additions & 142 deletions
Large diffs are not rendered by default.

src/components/app/list-new/AppListType.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
import {
1818
EnvironmentListHelmResponse,
19+
GroupedFilterSelectPickerProps,
1920
ResponseType,
2021
SERVER_MODE,
2122
SortingOrder,
@@ -210,3 +211,15 @@ export interface GetDevtronHelmAppListParamsType {
210211
export interface AskToClearFiltersProps extends Pick<DevtronAppListProps, 'clearAllFilters'> {
211212
showTipToSelectCluster?: boolean
212213
}
214+
215+
export type AppListFilterMenuItemType =
216+
GroupedFilterSelectPickerProps<AppListUrlFilters>['options'][number]['items'][number]
217+
218+
export interface GetAppListFiltersParams {
219+
clusterIdsCsv: string
220+
isExternalArgo: boolean
221+
isExternalFlux: boolean
222+
isArgoInstalled: boolean
223+
serverMode: SERVER_MODE
224+
selectedEnvironments: { label: string; value: string }[]
225+
}

src/components/app/list-new/Constants.ts

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
* limitations under the License.
1515
*/
1616

17+
import { GroupBase } from 'react-select'
18+
1719
import { OptionType, SelectPickerOptionType, UseUrlFiltersProps } from '@devtron-labs/devtron-fe-common-lib'
1820

1921
import { URLS } from '@Config/routes'
@@ -73,13 +75,18 @@ export const TEMPLATE_TYPE_FILTER_OPTIONS: SelectPickerOptionType[] = [
7375
{ label: FluxCDTemplateType.KUSTOMIZATION, value: FluxCDTemplateType.KUSTOMIZATION },
7476
]
7577

76-
export const APP_STATUS_FILTER_OPTIONS: SelectPickerOptionType[] = [
77-
{ label: AppStatuses.DEGRADED, value: AppStatusesDTO.DEGRADED },
78-
{ label: AppStatuses.HEALTHY, value: AppStatusesDTO.HEALTHY },
79-
{ label: AppStatuses.HIBERNATING, value: AppStatusesDTO.HIBERNATING },
80-
{ label: AppStatuses.MISSING, value: AppStatusesDTO.MISSING },
81-
{ label: AppStatuses.NOT_DEPLOYED, value: AppStatusesDTO.NOT_DEPLOYED },
82-
{ label: AppStatuses.PROGRESSING, value: AppStatusesDTO.PROGRESSING },
78+
export const APP_STATUS_FILTER_OPTIONS: GroupBase<SelectPickerOptionType>[] = [
79+
{
80+
label: 'App Status',
81+
options: [
82+
{ label: AppStatuses.DEGRADED, value: AppStatusesDTO.DEGRADED },
83+
{ label: AppStatuses.HEALTHY, value: AppStatusesDTO.HEALTHY },
84+
{ label: AppStatuses.HIBERNATING, value: AppStatusesDTO.HIBERNATING },
85+
{ label: AppStatuses.MISSING, value: AppStatusesDTO.MISSING },
86+
{ label: AppStatuses.NOT_DEPLOYED, value: AppStatusesDTO.NOT_DEPLOYED },
87+
{ label: AppStatuses.PROGRESSING, value: AppStatusesDTO.PROGRESSING },
88+
],
89+
},
8390
]
8491

8592
export const APPS_WITH_NO_PROJECT_OPTION: OptionType = {

src/components/app/list-new/list.utils.ts

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

1717
import { useMemo } from 'react'
18+
import { GroupBase } from 'react-select'
1819

1920
import {
2021
AppListConstants,
22+
GroupedFilterSelectPickerProps,
2123
GroupedOptionsType,
2224
OptionType,
2325
SelectPickerOptionType,
26+
SERVER_MODE,
2427
stringComparatorBySortOrder,
2528
Teams,
2629
} from '@devtron-labs/devtron-fe-common-lib'
@@ -31,13 +34,15 @@ import { Cluster } from '@Services/service.types'
3134

3235
import { URLS } from '../../../config'
3336
import {
37+
AppListFilterMenuItemType,
3438
AppListUrlFilters,
3539
AppListUrlFiltersType,
3640
AppStatuses,
3741
AppStatusesDTO,
42+
GetAppListFiltersParams,
3843
useFilterOptionsProps,
3944
} from './AppListType'
40-
import { APPS_WITH_NO_PROJECT_OPTION } from './Constants'
45+
import { APPS_WITH_NO_PROJECT_OPTION, SELECT_CLUSTER_TIPPY } from './Constants'
4146

4247
export const getChangeAppTabURL = (appTabType) => {
4348
switch (appTabType) {
@@ -170,11 +175,15 @@ export const useFilterOptions = ({
170175
}))
171176
.sort((a, b) => stringComparatorBySortOrder(a.label, b.label))
172177

173-
const clusterOptions: SelectPickerOptionType[] = useMemo(
174-
() =>
175-
appListFiltersResponse?.isFullMode
176-
? getClusterOptions(appListFiltersResponse?.appListFilters.result.clusters)
177-
: getClusterOptions(appListFiltersResponse?.clusterList.result),
178+
const clusterOptions: GroupBase<SelectPickerOptionType>[] = useMemo(
179+
() => [
180+
{
181+
label: 'Cluster',
182+
options: appListFiltersResponse?.isFullMode
183+
? getClusterOptions(appListFiltersResponse?.appListFilters.result.clusters)
184+
: getClusterOptions(appListFiltersResponse?.clusterList.result),
185+
},
186+
],
178187
[appListFiltersResponse, isExternalArgo, isExternalFlux],
179188
)
180189

@@ -212,3 +221,80 @@ export const getFilterChipConfig = (
212221
return { ...filterConfig, templateType: [] }
213222
}
214223
}
224+
225+
export const getAppListFilters = ({
226+
clusterIdsCsv,
227+
isExternalArgo,
228+
isExternalFlux,
229+
isArgoInstalled,
230+
serverMode,
231+
selectedEnvironments,
232+
}: GetAppListFiltersParams): GroupedFilterSelectPickerProps<AppListUrlFilters>['options'] => [
233+
{
234+
items: [
235+
...((!(isExternalArgo || isExternalFlux)
236+
? [
237+
...((isArgoInstalled
238+
? [
239+
{
240+
id: AppListUrlFilters.appStatus,
241+
label: 'App Status',
242+
startIcon: { name: 'ic-activity' },
243+
},
244+
]
245+
: []) as AppListFilterMenuItemType[]),
246+
{
247+
id: AppListUrlFilters.project,
248+
label: 'Project',
249+
startIcon: { name: 'ic-folder' },
250+
},
251+
...((serverMode === SERVER_MODE.FULL
252+
? [
253+
{
254+
id: AppListUrlFilters.environment,
255+
label: 'Environment',
256+
startIcon: { name: 'ic-environment' },
257+
isDisabled: !!clusterIdsCsv,
258+
tooltipProps: {
259+
content: clusterIdsCsv
260+
? 'Remove cluster filters to use environment filter'
261+
: null,
262+
},
263+
},
264+
]
265+
: []) as AppListFilterMenuItemType[]),
266+
]
267+
: []) as AppListFilterMenuItemType[]),
268+
...((isExternalFlux
269+
? [
270+
{
271+
id: AppListUrlFilters.templateType,
272+
label: 'Template Type',
273+
startIcon: { name: 'ic-cube' },
274+
isDisabled: !clusterIdsCsv,
275+
tooltipProps: { content: !clusterIdsCsv ? SELECT_CLUSTER_TIPPY : null },
276+
},
277+
]
278+
: []) as AppListFilterMenuItemType[]),
279+
{
280+
id: AppListUrlFilters.cluster,
281+
label: 'Cluster',
282+
startIcon: { name: 'ic-cluster' },
283+
isDisabled: !(isExternalArgo || isExternalFlux) && !!selectedEnvironments.length,
284+
tooltipProps: {
285+
content:
286+
!(isExternalArgo || isExternalFlux) && !!selectedEnvironments.length
287+
? 'Remove environment filters to use cluster filter'
288+
: null,
289+
},
290+
},
291+
{
292+
id: AppListUrlFilters.namespace,
293+
label: 'Namespace',
294+
startIcon: { name: 'ic-namespace' },
295+
isDisabled: !clusterIdsCsv,
296+
tooltipProps: { content: !clusterIdsCsv ? SELECT_CLUSTER_TIPPY : null },
297+
},
298+
],
299+
},
300+
]

src/css/base.scss

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4813,6 +4813,20 @@ textarea::placeholder {
48134813
animation-timing-function: linear;
48144814
}
48154815

4816+
// TODO: rename this to `dc__pulsating-dot` and remove existing `dc__pulsating-dot`(above class) when removing `FEATURE_GROUPED_APP_LIST_FILTERS_ENABLE` flag
4817+
.dc__pulsating-dot-new {
4818+
width: 12px;
4819+
height: 12px;
4820+
background-color: var(--O500);
4821+
top: -6px;
4822+
right: -6px;
4823+
border-radius: 50%;
4824+
animation-name: pulse;
4825+
animation-duration: 2s;
4826+
animation-iteration-count: infinite;
4827+
animation-timing-function: linear;
4828+
}
4829+
48164830
.security-policy--whitelist,
48174831
.security-policy--whitelisted {
48184832
color: var(--G500);

src/css/colorPalette.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,7 @@ $black: 0, 0, 0;
263263
--shadow-10: 0px 0px 4px 0px var(--black-20);
264264
--shadow-20: 0px 0px 7px 0px var(--black-20);
265265
--shadow-30: 0px 0px 10px 0px var(--black-20);
266+
--shadow-key: 0px 2px 0px 0px rgba(7, 17, 26, 0.15);
266267

267268
&.theme {
268269
&__light {

src/css/themeUtils.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,10 @@
131131
box-shadow: var(--shadow-drawer);
132132
}
133133

134+
&__key {
135+
box-shadow: var(--shadow-key);
136+
}
137+
134138
&__card {
135139
&--10 {
136140
box-shadow: var(--shadow-10);

src/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ if (!window || !window._env_) {
175175
FEATURE_MANAGE_TRAFFIC_ENABLE: true,
176176
FEATURE_REDFISH_NODE_ENABLE: false,
177177
FEATURE_INFRA_PROVISION_INFO_BLOCK_HIDE: false,
178+
FEATURE_GROUPED_APP_LIST_FILTERS_ENABLE: true,
178179
FEATURE_FLUX_DEPLOYMENTS_ENABLE: false,
179180
FEATURE_LINK_EXTERNAL_FLUX_ENABLE: false,
180181
}

0 commit comments

Comments
 (0)