Skip to content

Commit 677f525

Browse files
committed
feat: add prop image type in error screen manager
1 parent de7d433 commit 677f525

File tree

7 files changed

+19
-14
lines changed

7 files changed

+19
-14
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": "1.0.3",
3+
"version": "1.0.3-beta-4",
44
"description": "Supporting common component library",
55
"type": "module",
66
"main": "dist/index.js",

src/Common/Constants.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ export enum ERROR_STATUS_CODE {
138138
PERMISSION_DENIED = 403,
139139
NOT_FOUND = 404,
140140
EXPECTATION_FAILED = 417,
141+
UNPROCESSABLE_ENTITY = 422,
141142
INTERNAL_SERVER_ERROR = 500,
142143
BAD_GATEWAY = 502,
143144
SERVICE_TEMPORARY_UNAVAILABLE = 503,
@@ -512,6 +513,7 @@ export const API_STATUS_CODES = {
512513
PERMISSION_DENIED: 403,
513514
NOT_FOUND: 404,
514515
EXPECTATION_FAILED: 417,
516+
UNPROCESSABLE_ENTITY: 422,
515517
LOCKED: 423,
516518
}
517519

src/Common/ErrorScreenManager.tsx

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ const ErrorScreenManager = ({
2929
reloadClass,
3030
heightToDeduct,
3131
redirectURL,
32+
imageType = ImageType.Large,
3233
}: ErrorScreenManagerProps) => {
3334
const getMessage = () => {
3435
switch (code) {
@@ -39,7 +40,7 @@ const ErrorScreenManager = ({
3940
title={ERROR_EMPTY_SCREEN.BAD_REQUEST}
4041
subTitle={subtitle || ERROR_EMPTY_SCREEN.BAD_REQUEST_MESSAGE}
4142
image={badRequest}
42-
imageType={ImageType.Large}
43+
imageType={imageType}
4344
heightToDeduct={heightToDeduct}
4445
reload={reload}
4546
/>
@@ -51,7 +52,7 @@ const ErrorScreenManager = ({
5152
title={ERROR_EMPTY_SCREEN.UNAUTHORIZED}
5253
subTitle={subtitle || ERROR_EMPTY_SCREEN.UNAUTHORIZED_MESSAGE}
5354
image={unauthorized}
54-
imageType={ImageType.Large}
55+
imageType={imageType}
5556
heightToDeduct={heightToDeduct}
5657
/>
5758
)
@@ -62,7 +63,7 @@ const ErrorScreenManager = ({
6263
title={ERROR_EMPTY_SCREEN.FORBIDDEN}
6364
subTitle={subtitle || ERROR_EMPTY_SCREEN.FORBIDDEN_MESSAGE}
6465
image={unauthorized}
65-
imageType={ImageType.Large}
66+
imageType={imageType}
6667
heightToDeduct={heightToDeduct}
6768
/>
6869
)
@@ -73,7 +74,7 @@ const ErrorScreenManager = ({
7374
title={ERROR_EMPTY_SCREEN.PAGE_NOT_FOUND}
7475
subTitle={subtitle || ERROR_EMPTY_SCREEN.PAGE_NOT_EXIST}
7576
image={notFound}
76-
imageType={ImageType.Large}
77+
imageType={imageType}
7778
heightToDeduct={heightToDeduct}
7879
redirectURL={redirectURL}
7980
/>
@@ -85,7 +86,7 @@ const ErrorScreenManager = ({
8586
title={ERROR_EMPTY_SCREEN.INTERNAL_SERVER_ERROR}
8687
subTitle={subtitle || ERROR_EMPTY_SCREEN.INTERNAL_SERVER_ERROR_MESSAGE}
8788
image={badRequest}
88-
imageType={ImageType.Large}
89+
imageType={imageType}
8990
heightToDeduct={heightToDeduct}
9091
reload={reload}
9192
/>
@@ -97,7 +98,7 @@ const ErrorScreenManager = ({
9798
title={ERROR_EMPTY_SCREEN.BAD_GATEWAY}
9899
subTitle={subtitle || ERROR_EMPTY_SCREEN.BAD_GATEWAY_MESSAGE}
99100
image={badRequest}
100-
imageType={ImageType.Large}
101+
imageType={imageType}
101102
heightToDeduct={heightToDeduct}
102103
reload={reload}
103104
/>
@@ -109,7 +110,7 @@ const ErrorScreenManager = ({
109110
title={ERROR_EMPTY_SCREEN.SERVICE_TEMPORARY_UNAVAILABLE}
110111
subTitle={subtitle || ERROR_EMPTY_SCREEN.SERVICE_TEMPORARY_UNAVAILABLE_MESSAGE}
111112
image={badRequest}
112-
imageType={ImageType.Large}
113+
imageType={imageType}
113114
heightToDeduct={heightToDeduct}
114115
reload={reload}
115116
/>

src/Common/Types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ export interface ErrorPageType
173173

174174
export interface ErrorScreenManagerProps {
175175
code?: number
176+
imageType?: ImageType
176177
reload?: (...args) => any
177178
subtitle?: React.ReactChild
178179
reloadClass?: string

src/Shared/Components/Header/constants.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,13 @@
1414
* limitations under the License.
1515
*/
1616

17+
import { OPEN_NEW_TICKET, RAISE_ISSUE, VIEW_ALL_TICKETS } from '@Shared/constants'
1718
import { HelpOptionType } from './types'
1819
import { ReactComponent as Chat } from '../../../Assets/Icon/ic-chat-circle-dots.svg'
1920
import { ReactComponent as EditFile } from '../../../Assets/Icon/ic-edit-file.svg'
2021
import { ReactComponent as Files } from '../../../Assets/Icon/ic-files.svg'
2122
import { DISCORD_LINK } from '../../../Common'
2223

23-
const OPEN_NEW_TICKET = 'https://enterprise.devtron.ai/portal/en/newticket'
24-
const VIEW_ALL_TICKETS = 'https://enterprise.devtron.ai/portal/en/myarea'
25-
const RAISE_ISSUE = 'https://github.com/devtron-labs/devtron/issues/new/choose'
26-
2724
export const EnterpriseHelpOptions: HelpOptionType[] = [
2825
{
2926
name: 'Open new ticket',

src/Shared/constants.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -499,3 +499,7 @@ export const DEFAULT_LOCKED_KEYS_CONFIG: Readonly<ConfigKeysWithLockType> = {
499499
}
500500

501501
export const ALL_RESOURCE_KIND_FILTER = 'all'
502+
503+
export const OPEN_NEW_TICKET = 'https://enterprise.devtron.ai/portal/en/newticket'
504+
export const VIEW_ALL_TICKETS = 'https://enterprise.devtron.ai/portal/en/myarea'
505+
export const RAISE_ISSUE = 'https://github.com/devtron-labs/devtron/issues/new/choose'

0 commit comments

Comments
 (0)