Skip to content

Commit

Permalink
feat: [SIG-582]: code refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
SagarRajput-7 committed May 19, 2024
1 parent f377402 commit 67fb1d4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ export function PlannedDowntimeForm(
const response = await createEditDowntimeSchedule({ ...createEditProps });

if (response.statusCode === 200) {
setIsOpen(false);
notifications.success({
message: 'Success',
description: 'created',
Expand All @@ -149,7 +150,7 @@ export function PlannedDowntimeForm(
}
setSaveLoading(false);
},
[initialValues.id, isEditMode, notifications, refetchAllSchedules],
[initialValues.id, isEditMode, notifications, refetchAllSchedules, setIsOpen],
);
const onFinish = async (values: PlannedDowntimeFormData): Promise<void> => {
const recurrenceData: Recurrence | undefined =
Expand Down Expand Up @@ -183,7 +184,6 @@ export function PlannedDowntimeForm(
const handleOk = async (): Promise<void> => {
try {
await form.validateFields();
setIsOpen(false);
} catch (error) {
// error
}
Expand Down Expand Up @@ -330,8 +330,6 @@ export function PlannedDowntimeForm(
>
<Select.Option value="m">Mins</Select.Option>
<Select.Option value="h">Hours</Select.Option>
<Select.Option value="d">Days</Select.Option>
<Select.Option value="w">Weeks</Select.Option>
</Select>
}
className="duration-input"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ function HeaderComponent({
<div className="action-btn">
<PenLine
size={14}
// className={isEditDeleteSupported ? '' : 'hidden'}
onClick={(e): void => {
e.preventDefault();
e.stopPropagation();
Expand All @@ -101,7 +100,6 @@ function HeaderComponent({
/>
<Trash2
size={14}
// className={isEditDeleteSupported ? '' : 'hidden'}
color={Color.BG_CHERRY_500}
onClick={(e): void => {
e.preventDefault();
Expand Down Expand Up @@ -234,7 +232,11 @@ export function CustomCollapseList(
<Panel
header={
<HeaderComponent
duration={getDuration(schedule?.startTime, schedule?.endTime)}
duration={
schedule?.recurrence?.duration
? schedule?.recurrence?.duration
: getDuration(schedule?.startTime, schedule?.endTime)
}
name={defaultTo(name, '')}
handleEdit={(): void => {
setInitialValues({ ...props });
Expand Down

0 comments on commit 67fb1d4

Please sign in to comment.