Skip to content

Commit 05bc379

Browse files
committed
Merge branch 'develop' of https://github.com/devtron-labs/dashboard into feat/security-summary-card
2 parents 5b2c9de + 2321758 commit 05bc379

File tree

78 files changed

+2719
-4618
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+2719
-4618
lines changed

.eslintignore

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
.eslintrc.js
66
vite.config.mts
77

8-
# The following files have eslint errors/warningssrc/App.tsx
8+
# The following files have eslint errors/warnings
99
src/App.tsx
1010
src/Pages/GlobalConfigurations/Authorization/APITokens/__tests__/ApiTokens.test.tsx
1111
src/components/AppSelector/AppSelector.tsx
@@ -82,9 +82,7 @@ src/components/ClusterNodes/constants.ts
8282
src/components/Hotjar/Hotjar.tsx
8383
src/components/Jobs/ExpandedRow/ExpandedRow.tsx
8484
src/components/Jobs/JobDetails/JobDetails.tsx
85-
src/components/Jobs/JobList/JobListContainer.tsx
8685
src/components/Jobs/JobList/JobListView.tsx
87-
src/components/Jobs/JobList/JobsList.tsx
8886
src/components/Jobs/Jobs.tsx
8987
src/components/Jobs/JobsEmptyState.tsx
9088
src/components/Jobs/Service.ts
@@ -159,16 +157,12 @@ src/components/app/details/triggerView/workflow/nodes/triggerCINode.tsx
159157
src/components/app/details/triggerView/workflow/nodes/triggerPrePostCDNode.tsx
160158
src/components/app/details/triggerView/workflow/nodes/workflow.utils.tsx
161159
src/components/app/grepSSEworker.ts
162-
src/components/app/list-new/AppList.tsx
163160
src/components/app/list-new/AppListService.ts
164161
src/components/app/list-new/GenericAppList.tsx
165162
src/components/app/list-new/HelmAppList.tsx
166-
src/components/app/list/AppListView.tsx
167-
src/components/app/list/DevtronAppListContainer.tsx
168163
src/components/app/list/TriggerUrl.tsx
169164
src/components/app/list/__tests__/AppListView.test.tsx
170165
src/components/app/list/appList.modal.ts
171-
src/components/app/list/appStatus/AppStatus.tsx
172166
src/components/app/list/emptyView/Empty.tsx
173167
src/components/app/list/expandedRow/ExpandedRow.tsx
174168
src/components/app/service.ts
@@ -286,7 +280,6 @@ src/components/common/eaEmptyState/EAEmptyState.tsx
286280
src/components/common/edge/rectangularEdge.tsx
287281
src/components/common/edge/straightEdge.tsx
288282
src/components/common/errorBoundary.tsx
289-
src/components/common/filter/filters.tsx
290283
src/components/common/formFields/CopyButton.tsx
291284
src/components/common/formFields/CustomPassword.tsx
292285
src/components/common/formFields/DevtronSwitch.tsx

src/App.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@ export default function App() {
9898
}
9999
} else {
100100
didMountRef.current = true
101+
// Removing any toast explicitly due to race condition of offline toast for some users
102+
ToastManager.dismissToast(onlineToastRef.current)
101103
}
102104
}, [isOnline])
103105

-63.1 KB
Binary file not shown.
Lines changed: 1 addition & 0 deletions
Loading

src/components/ApplicationGroup/AppGroup.service.ts

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,15 @@ import {
2424
PipelineType,
2525
CommonNodeAttr,
2626
WorkflowType,
27+
getUrlWithSearchParams,
2728
} from '@devtron-labs/devtron-fe-common-lib'
2829
import { CdPipelineResult, CiPipelineResult, WorkflowResult, CiPipeline } from '../app/details/triggerView/types'
2930
import { WebhookListResponse } from '../ciPipeline/Webhook/types'
3031
import { processWorkflow } from '../app/details/triggerView/workflow.service'
3132
import { WorkflowTrigger } from '../app/details/triggerView/config'
3233
import { ModuleNameMap, Routes, URLS } from '../../config'
3334
import {
35+
AppGroupFilterConfig,
3436
AppGroupList,
3537
CIConfigListType,
3638
CheckPermissionResponse,
@@ -41,6 +43,7 @@ import {
4143
EnvDeploymentStatusType,
4244
EnvGroupListResponse,
4345
EnvGroupResponse,
46+
GetEnvAppListParamsType,
4447
WorkflowsResponseType,
4548
} from './AppGroup.types'
4649
import { getModuleConfigured } from '../app/details/appDetails/appDetails.service'
@@ -190,26 +193,20 @@ export const getConfigAppList = (envId: number, appIds: string): Promise<ConfigA
190193
}
191194

192195
export const getEnvAppList = (
193-
params?: {
194-
envName?: string
195-
clusterIds?: string
196-
offset?: string
197-
size?: string
198-
},
196+
filterConfig?: Partial<AppGroupFilterConfig>,
199197
signal?: AbortSignal,
200198
): Promise<EnvAppType> => {
201199
const options = signal ? { signal } : null
202-
203-
if (params) {
204-
const urlParams = Object.entries(params).map(([key, value]) => {
205-
if (!value) {
206-
return
207-
}
208-
return `${key}=${value}`
209-
})
210-
return get(`${Routes.ENVIRONMENT_APPS}?${urlParams.filter((s) => s).join('&')}`, options)
200+
const { searchKey = '', cluster = [], offset = 0, pageSize = 20 } = filterConfig ?? {}
201+
const params: GetEnvAppListParamsType = {
202+
envName: searchKey,
203+
clusterIds: cluster?.join(),
204+
offset,
205+
size: pageSize,
211206
}
212-
return get(Routes.ENVIRONMENT_APPS, options)
207+
208+
const url = getUrlWithSearchParams(Routes.ENVIRONMENT_APPS, params)
209+
return get(url, options)
213210
}
214211

215212
export const getDeploymentStatus = (envId: number, appIds: string): Promise<EnvDeploymentStatusType> => {

src/components/ApplicationGroup/AppGroup.types.ts

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import {
2727
AppInfoListType,
2828
GVKType,
2929
RuntimeParamsListItemType,
30+
UseUrlFiltersReturnType,
3031
} from '@devtron-labs/devtron-fe-common-lib'
3132
import { MultiValue } from 'react-select'
3233
import { WebhookPayloads } from '../app/details/triggerView/types'
@@ -254,9 +255,21 @@ export interface ApplicationRouteType {
254255
fetchEnvConfig: () => void
255256
}
256257

257-
export interface EnvironmentsListViewType {
258-
removeAllFilters: () => void
258+
export interface AppGroupFilterConfig
259+
extends Pick<UseUrlFiltersReturnType<never>, 'searchKey' | 'offset' | 'pageSize'> {
260+
cluster: string[]
261+
}
262+
263+
export interface GetEnvAppListParamsType extends Pick<AppGroupFilterConfig, 'offset'> {
264+
size: number
265+
envName: string
266+
clusterIds: string
267+
}
268+
269+
export interface EnvironmentsListViewType
270+
extends Pick<UseUrlFiltersReturnType<never>, 'changePage' | 'changePageSize' | 'clearFilters'> {
259271
isSuperAdmin: boolean
272+
filterConfig: AppGroupFilterConfig
260273
}
261274

262275
export interface EnvironmentLinkProps {
@@ -591,3 +604,9 @@ export interface ManageAppsResponseType {
591604
id: string
592605
error: string
593606
}
607+
608+
export enum AppGroupUrlFilters {
609+
cluster = 'cluster',
610+
}
611+
612+
export interface AppGroupUrlFiltersType extends Record<AppGroupUrlFilters, string[]> {}

src/components/ApplicationGroup/AppGroup.utils.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import {
2727
} from '@devtron-labs/devtron-fe-common-lib'
2828
import { DEFAULT_GIT_BRANCH_VALUE, DOCKER_FILE_ERROR_TITLE, SOURCE_NOT_CONFIGURED } from '../../config'
2929
import { getEnvAppList } from './AppGroup.service'
30-
import { CDWorkflowStatusType, CIWorkflowStatusType, ProcessWorkFlowStatusType } from './AppGroup.types'
30+
import { AppGroupUrlFilters, CDWorkflowStatusType, CIWorkflowStatusType, ProcessWorkFlowStatusType } from './AppGroup.types'
3131

3232
let timeoutId
3333

@@ -151,7 +151,7 @@ export const envListOptions = (inputValue: string, signal?: AbortSignal): Promis
151151
resolve([])
152152
return
153153
}
154-
getEnvAppList({ envName: inputValue }, signal)
154+
getEnvAppList({ searchKey: inputValue }, signal)
155155
.then((response) => {
156156
let appList = []
157157
if (response.result) {
@@ -283,3 +283,7 @@ export const processConsequenceData = (data: BlockedStateData): ConsequenceType
283283
}
284284
return data.ciBlockState
285285
}
286+
287+
export const parseSearchParams = (searchParams: URLSearchParams) => ({
288+
[AppGroupUrlFilters.cluster]: searchParams.getAll(AppGroupUrlFilters.cluster),
289+
})

src/components/ApplicationGroup/AppGroupDetailsRoute.tsx

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -204,16 +204,19 @@ export default function AppGroupDetailsRoute({ isSuperAdmin }: AppGroupAdminType
204204
setAppGroupListData(result)
205205
setDescription(result.description)
206206
if (result.apps?.length) {
207-
setAppListOptions(
208-
result.apps
209-
.map((app): OptionType => {
210-
return {
211-
value: `${app.appId}`,
212-
label: app.appName,
213-
}
214-
})
215-
.sort(sortOptionsByLabel),
216-
)
207+
const _appListOptions = result.apps
208+
.map((app): OptionType => {
209+
return {
210+
value: `${app.appId}`,
211+
label: app.appName,
212+
}
213+
})
214+
.sort(sortOptionsByLabel)
215+
216+
setAppListOptions(_appListOptions)
217+
if (selectedGroupFilter.length) {
218+
setSelectedAppList(_appListOptions.filter((app) => selectedGroupFilter[0].appIds.includes(+app.value)))
219+
}
217220
}
218221
setAppListLoading(false)
219222
}

0 commit comments

Comments
 (0)