Skip to content

Commit 38c3967

Browse files
authored
Merge pull request #150 from devtron-labs/feat/artifact-release-mapping
feat: add artifact release mapping info in cd material type
2 parents 6c2a055 + 3c1e321 commit 38c3967

File tree

7 files changed

+43
-9
lines changed

7 files changed

+43
-9
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.0.82",
3+
"version": "0.0.82-beta-2",
44
"description": "Supporting common component library",
55
"type": "module",
66
"main": "dist/index.js",

src/Common/Api.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,4 +247,4 @@ export const abortPreviousRequests = <T>(
247247
*/
248248
export const getIsRequestAborted = (error) =>
249249
// The 0 code is common for aborted and blocked requests
250-
error && error.code === 0 && error.message === 'The user aborted a request.'
250+
error && error.code === 0 && (error.message === 'The user aborted a request.' || error.message === 'signal is aborted without reason')

src/Common/Common.service.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ const cdMaterialListModal = (artifacts: any[], offset: number, artifactId?: numb
144144
promotionApprovalMetadata: material.promotionApprovalMetadata,
145145
deployedOnEnvironments: material.deployedOnEnvironments ?? [],
146146
deploymentWindowArtifactMetadata: material.deploymentWindowArtifactMetadata ?? null,
147+
configuredInReleases: material.configuredInReleases ?? [],
147148
}
148149
})
149150
return materials
@@ -174,6 +175,7 @@ const processCDMaterialsMetaInfo = (cdMaterialsResult): CDMaterialsMetaInfo => {
174175
resourceFilters: [],
175176
totalCount: 0,
176177
requestedUserId: 0,
178+
appWorkflowId: 0,
177179
}
178180
}
179181

@@ -184,6 +186,7 @@ const processCDMaterialsMetaInfo = (cdMaterialsResult): CDMaterialsMetaInfo => {
184186
resourceFilters: cdMaterialsResult.resourceFilters ?? [],
185187
totalCount: cdMaterialsResult.totalCount ?? 0,
186188
requestedUserId: cdMaterialsResult.requestedUserId,
189+
appWorkflowId: cdMaterialsResult.appWorkflowId,
187190
}
188191
}
189192

src/Common/ErrorPage.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ import GenericEmptyState from './EmptyState/GenericEmptyState'
44
import { ErrorPageType } from './Types'
55
import { noop, refresh, reportIssue } from './Helper'
66

7-
const ErrorPage = ({ code, image, title, subTitle, imageType, heightToDeduct, reload }: ErrorPageType) => {
7+
const ErrorPage = ({ code, image, title, subTitle, imageType, heightToDeduct, reload, redirectURL }: ErrorPageType) => {
88
const { push } = useHistory()
99
const redirectToHome = () => {
10-
push(`/${ROUTES.APP_LIST}`)
10+
push(redirectURL || `/${ROUTES.APP_LIST}`)
1111
}
1212

1313
const getErrorPageProps = (

src/Common/ErrorScreenManager.tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
import notFound from '../Assets/Img/ic-not-found.svg'
22
import badRequest from '../Assets/Img/ic-page-not-found.svg'
33
import unauthorized from '../Assets/Img/ic-not-authorized.svg'
4-
import { ERROR_STATUS_CODE, ERROR_EMPTY_SCREEN } from './Constants'
4+
import { ERROR_STATUS_CODE, ERROR_EMPTY_SCREEN, ROUTES } from './Constants'
55
import Reload from './Reload'
66
import ErrorPage from './ErrorPage'
77
import { ErrorScreenManagerProps, ImageType } from './Types'
88

9-
const ErrorScreenManager = ({ code, reload, subtitle, reloadClass, heightToDeduct }: ErrorScreenManagerProps) => {
9+
const ErrorScreenManager = ({
10+
code,
11+
reload,
12+
subtitle,
13+
reloadClass,
14+
heightToDeduct,
15+
redirectURL = ROUTES.APP_LIST,
16+
}: ErrorScreenManagerProps) => {
1017
const getMessage = () => {
1118
switch (code) {
1219
case ERROR_STATUS_CODE.BAD_REQUEST:
@@ -52,6 +59,7 @@ const ErrorScreenManager = ({ code, reload, subtitle, reloadClass, heightToDeduc
5259
image={notFound}
5360
imageType={ImageType.Large}
5461
heightToDeduct={heightToDeduct}
62+
redirectURL={redirectURL}
5563
/>
5664
)
5765
case ERROR_STATUS_CODE.INTERNAL_SERVER_ERROR:
@@ -63,6 +71,7 @@ const ErrorScreenManager = ({ code, reload, subtitle, reloadClass, heightToDeduc
6371
image={badRequest}
6472
imageType={ImageType.Large}
6573
heightToDeduct={heightToDeduct}
74+
reload={reload}
6675
/>
6776
)
6877
case ERROR_STATUS_CODE.BAD_GATEWAY:

src/Common/Types.ts

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ export interface GenericEmptyStateType {
139139
}
140140

141141
export interface ErrorPageType
142-
extends Pick<GenericEmptyStateType, 'image' | 'title' | 'subTitle' | 'renderButton' | 'imageType'>, Pick<ErrorScreenManagerProps, 'reload'> {
142+
extends Pick<GenericEmptyStateType, 'image' | 'title' | 'subTitle' | 'renderButton' | 'imageType'>, Pick<ErrorScreenManagerProps, 'reload' | 'redirectURL'> {
143143
code: number
144144
heightToDeduct?: number
145145
}
@@ -150,6 +150,11 @@ export interface ErrorScreenManagerProps {
150150
subtitle?: React.ReactChild
151151
reloadClass?: string
152152
heightToDeduct?: number
153+
/**
154+
* Would be used to redirect URL in case of 404
155+
* @default - APP_LIST
156+
*/
157+
redirectURL?: string
153158
}
154159

155160
export interface ErrorScreenNotAuthorizedProps {
@@ -353,6 +358,15 @@ export interface DeploymentWindowArtifactMetadata {
353358
type: DEPLOYMENT_WINDOW_TYPE
354359
}
355360

361+
export interface ArtifactReleaseMappingType {
362+
id : number,
363+
identifier: string,
364+
releaseVersion: string,
365+
name: string
366+
kind: string
367+
version: string
368+
}
369+
356370
export interface CDMaterialType {
357371
index: number
358372
id: string
@@ -397,6 +411,10 @@ export interface CDMaterialType {
397411
promotionApprovalMetadata?: PromotionApprovalMetadataType
398412
deployedOnEnvironments?: string[]
399413
deploymentWindowArtifactMetadata?: DeploymentWindowArtifactMetadata
414+
/**
415+
* Will only be present in case of release
416+
*/
417+
configuredInReleases: ArtifactReleaseMappingType[]
400418
}
401419

402420
export enum CDMaterialServiceEnum {
@@ -577,6 +595,10 @@ export interface CDMaterialsMetaInfo {
577595
* This is the ID of user that has request the material
578596
*/
579597
requestedUserId: number
598+
/**
599+
* Would currently only be received in case of release
600+
*/
601+
appWorkflowId: number
580602
}
581603

582604
export interface ImagePromotionMaterialInfo {

0 commit comments

Comments
 (0)