Skip to content

Commit 694299f

Browse files
committed
chore: code reverted for deleteCI Node try button
1 parent ae6e7bc commit 694299f

File tree

2 files changed

+21
-18
lines changed

2 files changed

+21
-18
lines changed

src/Common/DeleteCINodeButton/DeleteCINodeButton.tsx

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -85,15 +85,11 @@ export const DeleteCINodeButton = ({
8585
name: deletePayloadConfig.pipelineName,
8686
},
8787
}
88-
try {
89-
await savePipeline(deletePayload, { isTemplateView })
90-
if (typeof onDelete === 'function') {
91-
onDelete()
92-
}
93-
await onDeleteWorkflow()
94-
} catch (error) {
95-
showError(error)
88+
await savePipeline(deletePayload, { isTemplateView })
89+
if (typeof onDelete === 'function') {
90+
onDelete()
9691
}
92+
await onDeleteWorkflow()
9793
}
9894

9995
const renderDeleteButton = () =>

src/Shared/Hooks/useUserPreferences/service.ts

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,14 @@ export const getUserPreferences = async (): Promise<UserPreferencesType> => {
4646
parsedResult.computedAppTheme === 'system-dark' || parsedResult.computedAppTheme === 'system-light'
4747
? THEME_PREFERENCE_MAP.auto
4848
: parsedResult.computedAppTheme,
49-
resources: parsedResult.resources,
49+
resources: {
50+
[ResourceKindType.devtronApplication]: {
51+
[UserPreferenceResourceActions.RECENTLY_VISITED]:
52+
parsedResult.resources?.[ResourceKindType.devtronApplication]?.[
53+
UserPreferenceResourceActions.RECENTLY_VISITED
54+
] || ([] as BaseAppMetaData[]),
55+
},
56+
},
5057
}
5158
}
5259

@@ -69,31 +76,36 @@ const resourcesObj = (recentlyVisited: BaseAppMetaData[]): UserPreferenceResourc
6976
* @throws Will throw an error if `shouldThrowError` is true and the request fails.
7077
*/
7178

79+
export type UpdateUserPreferencesProps =
80+
| { type: 'updateTheme'; value: ThemePreferenceType | null; appTheme: ThemeConfigType['appTheme'] }
81+
| { type: 'updatePipelineRBACView'; value: ViewIsPipelineRBACConfiguredRadioTabs }
82+
| { type: 'updateRecentlyVisitedApps'; value: BaseAppMetaData[] }
83+
7284
export const updateUserPreferences = async (
7385
updatedUserPreferences?: UpdatedUserPreferencesType,
7486
recentlyVisitedDevtronApps?: BaseAppMetaData[],
7587
shouldThrowError: boolean = false,
7688
): Promise<boolean> => {
7789
try {
78-
let value: UserPreferencesPayloadValueType = null
90+
let data: UserPreferencesPayloadValueType = null
7991
if (updatedUserPreferences) {
8092
const { themePreference, appTheme, pipelineRBACViewSelectedTab } = updatedUserPreferences
8193

82-
value = {
94+
data = {
8395
viewPermittedEnvOnly: pipelineRBACViewSelectedTab === ViewIsPipelineRBACConfiguredRadioTabs.ACCESS_ONLY,
8496
computedAppTheme: themePreference === THEME_PREFERENCE_MAP.auto ? `system-${appTheme}` : appTheme,
8597
}
8698
}
8799

88100
if (recentlyVisitedDevtronApps?.length) {
89-
value = {
101+
data = {
90102
resources: resourcesObj(recentlyVisitedDevtronApps),
91103
}
92104
}
93105

94106
const payload: UpdateUserPreferencesPayloadType = {
95107
key: USER_PREFERENCES_ATTRIBUTE_KEY,
96-
value: JSON.stringify(value),
108+
value: JSON.stringify(data),
97109
}
98110

99111
await patch(`${ROUTES.ATTRIBUTES_USER}/${ROUTES.PATCH}`, payload)
@@ -107,8 +119,3 @@ export const updateUserPreferences = async (
107119
return false
108120
}
109121
}
110-
111-
export type UserPreferencesUpdateType =
112-
| { type: 'updateTheme'; value: ThemePreferenceType | null; appTheme: ThemeConfigType['appTheme'] }
113-
| { type: 'updatePipelineRBACView'; value: ViewIsPipelineRBACConfiguredRadioTabs }
114-
| { type: 'updateRecentlyVisitedApps'; value: BaseAppMetaData[] }

0 commit comments

Comments
 (0)