Skip to content

Commit c23c225

Browse files
authored
Merge pull request #608 from devtron-labs/feat/calc-cleanup
feat: replace usage of calc
2 parents a252b07 + 2b26ba4 commit c23c225

File tree

18 files changed

+52
-43
lines changed

18 files changed

+52
-43
lines changed

package-lock.json

Lines changed: 4 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.8.10",
3+
"version": "1.8.11",
44
"description": "Supporting common component library",
55
"type": "module",
66
"main": "dist/index.js",

src/Common/EmptyState/GenericEmptyState.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ const GenericEmptyState = ({
2626
isButtonAvailable,
2727
classname,
2828
styles,
29-
heightToDeduct,
3029
imageType,
3130
renderButton,
3231
imageClassName,
@@ -53,7 +52,6 @@ const GenericEmptyState = ({
5352
className={`flex ${isRowLayout ? 'dc__gap-32' : 'column dc__gap-20'} empty-state ${classname || ''}`}
5453
style={styles}
5554
data-testid="generic-empty-state"
56-
{...(heightToDeduct >= 0 && { style: { ...styles, height: `calc(100vh - ${heightToDeduct}px)` } })}
5755
>
5856
{!SvgImage ? (
5957
!noImage && (

src/Common/ErrorPage.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import GenericEmptyState from './EmptyState/GenericEmptyState'
2020
import { ErrorPageType } from './Types'
2121
import { noop, refresh, reportIssue } from './Helper'
2222

23-
const ErrorPage = ({ code, image, title, subTitle, imageType, heightToDeduct, redirectURL, reload }: ErrorPageType) => {
23+
const ErrorPage = ({ code, image, title, subTitle, imageType, redirectURL, reload }: ErrorPageType) => {
2424
const { push } = useHistory()
2525
const redirectToHome = () => {
2626
push(redirectURL || `/${ROUTES.APP_LIST}`)
@@ -75,7 +75,6 @@ const ErrorPage = ({ code, image, title, subTitle, imageType, heightToDeduct, re
7575
isButtonAvailable={isButtonAvailable}
7676
renderButton={renderGenerateButton}
7777
imageType={imageType}
78-
heightToDeduct={heightToDeduct}
7978
/>
8079
)
8180
}

src/Common/ErrorScreenManager.tsx

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ const ErrorScreenManager = ({
2727
reload,
2828
subtitle,
2929
reloadClass,
30-
heightToDeduct,
3130
redirectURL,
3231
imageType = ImageType.Large,
3332
}: ErrorScreenManagerProps) => {
@@ -41,7 +40,6 @@ const ErrorScreenManager = ({
4140
subTitle={subtitle || ERROR_EMPTY_SCREEN.BAD_REQUEST_MESSAGE}
4241
image={badRequest}
4342
imageType={imageType}
44-
heightToDeduct={heightToDeduct}
4543
reload={reload}
4644
/>
4745
)
@@ -53,7 +51,6 @@ const ErrorScreenManager = ({
5351
subTitle={subtitle || ERROR_EMPTY_SCREEN.UNAUTHORIZED_MESSAGE}
5452
image={unauthorized}
5553
imageType={imageType}
56-
heightToDeduct={heightToDeduct}
5754
/>
5855
)
5956
case ERROR_STATUS_CODE.PERMISSION_DENIED:
@@ -64,7 +61,6 @@ const ErrorScreenManager = ({
6461
subTitle={subtitle || ERROR_EMPTY_SCREEN.FORBIDDEN_MESSAGE}
6562
image={unauthorized}
6663
imageType={imageType}
67-
heightToDeduct={heightToDeduct}
6864
/>
6965
)
7066
case ERROR_STATUS_CODE.NOT_FOUND:
@@ -75,7 +71,6 @@ const ErrorScreenManager = ({
7571
subTitle={subtitle || ERROR_EMPTY_SCREEN.PAGE_NOT_EXIST}
7672
image={notFound}
7773
imageType={imageType}
78-
heightToDeduct={heightToDeduct}
7974
redirectURL={redirectURL}
8075
/>
8176
)
@@ -87,7 +82,6 @@ const ErrorScreenManager = ({
8782
subTitle={subtitle || ERROR_EMPTY_SCREEN.INTERNAL_SERVER_ERROR_MESSAGE}
8883
image={badRequest}
8984
imageType={imageType}
90-
heightToDeduct={heightToDeduct}
9185
reload={reload}
9286
/>
9387
)
@@ -99,7 +93,6 @@ const ErrorScreenManager = ({
9993
subTitle={subtitle || ERROR_EMPTY_SCREEN.BAD_GATEWAY_MESSAGE}
10094
image={badRequest}
10195
imageType={imageType}
102-
heightToDeduct={heightToDeduct}
10396
reload={reload}
10497
/>
10598
)
@@ -111,12 +104,11 @@ const ErrorScreenManager = ({
111104
subTitle={subtitle || ERROR_EMPTY_SCREEN.SERVICE_TEMPORARY_UNAVAILABLE_MESSAGE}
112105
image={badRequest}
113106
imageType={imageType}
114-
heightToDeduct={heightToDeduct}
115107
reload={reload}
116108
/>
117109
)
118110
default:
119-
return <Reload heightToDeduct={heightToDeduct} reload={reload} className={reloadClass} />
111+
return <Reload reload={reload} className={reloadClass} />
120112
}
121113
}
122114
return getMessage()

src/Common/Markdown/markdown.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
line-height: 1.45;
6262
background-color: var(--bg-secondary);
6363
border-radius: 3px;
64+
flex-shrink: 0;
6465

6566
code {
6667
display: inline;

src/Common/Progressing.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export const DetailsProgressing = ({
5353
children,
5454
}: ProgressingProps): JSX.Element => (
5555
<div
56-
className={`details-loader bg__primary flex column fs-14 fw-6 ${fullHeight ? 'h-100' : 'details-loader-height'}`}
56+
className={`bg__primary flex column fs-14 fw-6 ${fullHeight ? 'h-100' : ''}`}
5757
style={styles}
5858
data-testid="details-progressing"
5959
>

src/Common/Reload.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,10 @@ import { refresh } from './Helper'
2121
/**
2222
* @deprecated Use APIResponseHandler (Preferred) or error screen manager instead
2323
*/
24-
export default function Reload({ reload, className = '', heightToDeduct = 0 }: ReloadType) {
24+
export default function Reload({ reload, className = '' }: ReloadType) {
2525
return (
2626
<article
2727
className={`flex w-100 h-100 ${className}`}
28-
{...(heightToDeduct > 0 && { style: { height: `calc(100vh - ${heightToDeduct}px)` } })}
2928
>
3029
<div className="flex column w-250 dc__align-center" data-testid="reload">
3130
<img src={loadingFailure} style={{ height: 'auto' }} className="w-100 mb-12" alt="load-error" />

src/Common/Types.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,6 @@ export interface GenericEmptyStateType {
162162
subTitle?: ReactNode
163163
isButtonAvailable?: boolean
164164
styles?: CSSProperties
165-
heightToDeduct?: number
166165
imageType?: string
167166
SvgImage?
168167
renderButton?: () => JSX.Element
@@ -181,7 +180,6 @@ export interface ErrorPageType
181180
extends Pick<GenericEmptyStateType, 'image' | 'title' | 'subTitle' | 'renderButton' | 'imageType'>,
182181
Pick<ErrorScreenManagerProps, 'reload' | 'redirectURL'> {
183182
code: number
184-
heightToDeduct?: number
185183
redirectURL?: string
186184
reload?: () => void
187185
}
@@ -192,7 +190,6 @@ export interface ErrorScreenManagerProps {
192190
reload?: (...args) => any
193191
subtitle?: React.ReactChild
194192
reloadClass?: string
195-
heightToDeduct?: number
196193
/**
197194
* Would be used to redirect URL in case of 404
198195
* @default - APP_LIST
@@ -260,7 +257,6 @@ export type InfoColourBarType = InfoColourBarMessageProp & {
260257
export interface ReloadType {
261258
reload?: (event?: any) => void
262259
className?: string
263-
heightToDeduct?: number
264260
}
265261

266262
export interface RadioGroupItemProps {

src/Shared/Components/CICDHistory/Artifacts.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,9 @@ const Artifacts = ({
149149
targetPlatforms,
150150
}: ArtifactType) => {
151151
const { isSuperAdmin } = useGetUserRoles()
152-
const { handleDownload } = useDownload()
152+
const { handleDownload } = useDownload({
153+
shouldOpenInNewTab: true,
154+
})
153155

154156
const { triggerId, buildId } = useParams<{
155157
triggerId: string

0 commit comments

Comments
 (0)