Skip to content

Commit 622ff0e

Browse files
committed
chore: version bump
1 parent 1cb13de commit 622ff0e

File tree

4 files changed

+47
-42
lines changed

4 files changed

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

src/Common/DeleteCINodeButton/DeleteCINodeButton.tsx

Lines changed: 42 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,17 @@
1616

1717
import { useState } from 'react'
1818
import { ERROR_STATUS_CODE } from '@Common/Constants'
19-
import { Button, ButtonStyleType, ButtonVariantType, DeleteConfirmationModal } from '@Shared/Components'
19+
import { Button, ButtonStyleType, ButtonVariantType, DeleteConfirmationModal, Icon } from '@Shared/Components'
2020
import { ComponentSizeType, DeleteComponentsName } from '@Shared/constants'
2121
import { ToastManager, ToastVariantType } from '@Shared/index'
22-
import { ReactComponent as ICDelete } from '@IconsV2/ic-delete.svg'
2322
import { deleteWorkflow, savePipeline } from './utils'
2423
import { DeleteCINodeButtonProps } from './types'
2524
import { preventDefault, showError, stopPropagation } from '..'
2625

2726
export const DeleteCINodeButton = ({
2827
testId,
29-
isCIPipeline,
30-
disabled,
28+
showIconOnly = true,
29+
disabled = false,
3130
title,
3231
isJobView,
3332
deletePayloadConfig,
@@ -47,29 +46,31 @@ export const DeleteCINodeButton = ({
4746
}
4847

4948
const onDeleteWorkflow = async () => {
50-
await deleteWorkflow(String(deletePayloadConfig.appId), Number(deletePayloadConfig.appWorkflowId))
51-
.then((response) => {
52-
if (response.errors) {
53-
const { errors } = response
54-
const { userMessage } = errors[0]
55-
ToastManager.showToast({
56-
variant: ToastVariantType.error,
57-
description: userMessage,
58-
})
59-
return
60-
}
49+
try {
50+
const response = await deleteWorkflow(
51+
String(deletePayloadConfig.appId),
52+
Number(deletePayloadConfig.appWorkflowId),
53+
)
54+
if (response.errors) {
55+
const { errors } = response
56+
const { userMessage } = errors[0]
57+
ToastManager.showToast({
58+
variant: ToastVariantType.error,
59+
description: userMessage,
60+
})
61+
return
62+
}
6163

62-
if (response.status.toLowerCase() === 'ok') {
63-
ToastManager.showToast({
64-
variant: ToastVariantType.success,
65-
description: 'Workflow Deleted',
66-
})
67-
getWorkflows()
68-
}
69-
})
70-
.catch((errors) => {
71-
showError(errors)
72-
})
64+
if (response.status.toLowerCase() === 'ok') {
65+
ToastManager.showToast({
66+
variant: ToastVariantType.success,
67+
description: 'Workflow Deleted',
68+
})
69+
getWorkflows()
70+
}
71+
} catch (error) {
72+
showError(error)
73+
}
7374
}
7475

7576
const onClickDelete = async () => {
@@ -86,20 +87,11 @@ export const DeleteCINodeButton = ({
8687
if (typeof onDelete === 'function') {
8788
onDelete()
8889
}
89-
9090
await onDeleteWorkflow()
9191
}
9292

9393
const renderDeleteButton = () =>
94-
isCIPipeline ? (
95-
<Button
96-
dataTestId={testId}
97-
disabled={disabled}
98-
onClick={onClickDeleteShowModal}
99-
text="Delete Pipeline"
100-
style={ButtonStyleType.negative}
101-
/>
102-
) : (
94+
showIconOnly ? (
10395
<Button
10496
ariaLabel="Delete pipeline"
10597
variant={ButtonVariantType.borderLess}
@@ -108,8 +100,21 @@ export const DeleteCINodeButton = ({
108100
showAriaLabelInTippy
109101
onClick={onClickDeleteShowModal}
110102
style={ButtonStyleType.negativeGrey}
111-
icon={<ICDelete />}
103+
icon={<Icon name="ic-delete" color={null} strokeWidth={1} size={12} />}
112104
disabled={disabled}
105+
showTooltip
106+
tooltipProps={{
107+
placement: 'right',
108+
content: 'Delete Pipeline',
109+
}}
110+
/>
111+
) : (
112+
<Button
113+
dataTestId={testId}
114+
disabled={disabled}
115+
onClick={onClickDeleteShowModal}
116+
text="Delete Pipeline"
117+
style={ButtonStyleType.negative}
113118
/>
114119
)
115120

src/Common/DeleteCINodeButton/types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ interface DeletePayloadConfig {
77

88
export interface DeleteCINodeButtonProps {
99
testId: string
10-
isCIPipeline?: boolean
11-
disabled: boolean
1210
title: string
11+
showIconOnly?: boolean
12+
disabled?: boolean
1313
isJobView?: boolean
1414
deletePayloadConfig: DeletePayloadConfig
1515
onDelete?: () => void

0 commit comments

Comments
 (0)