Skip to content

Commit 82057e1

Browse files
authored
Merge pull request #401 from devtron-labs/feat/error-screen-image
feat: add prop image type in error screen manager
2 parents de7d433 + cd19537 commit 82057e1

File tree

8 files changed

+20
-16
lines changed

8 files changed

+20
-16
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.4",
44
"description": "Supporting common component library",
55
"type": "module",
66
"main": "dist/index.js",

src/Common/Constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -512,6 +512,7 @@ export const API_STATUS_CODES = {
512512
PERMISSION_DENIED: 403,
513513
NOT_FOUND: 404,
514514
EXPECTATION_FAILED: 417,
515+
UNPROCESSABLE_ENTITY: 422,
515516
LOCKED: 423,
516517
}
517518

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/DeploymentConfigDiff/DeploymentConfigDiff.utils.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,8 +232,8 @@ const getCodeEditorData = (
232232
const { compareToObfuscatedData, compareWithObfuscatedData } = getObfuscatedData(
233233
compareToConfigData ?? {},
234234
compareWithConfigData ?? {},
235-
compareToIsAdmin,
236-
compareWithIsAdmin,
235+
compareToIsAdmin || compareToValue?.external,
236+
compareWithIsAdmin || compareWithValue?.external,
237237
)
238238

239239
compareToCodeEditorData = {

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)