diff --git a/ui/web-v2/src/components/FeatureConfirmDialog/index.tsx b/ui/web-v2/src/components/FeatureConfirmDialog/index.tsx index 551109477a..cbf234e0be 100644 --- a/ui/web-v2/src/components/FeatureConfirmDialog/index.tsx +++ b/ui/web-v2/src/components/FeatureConfirmDialog/index.tsx @@ -53,7 +53,7 @@ interface FeatureConfirmDialogProps { title: string; description: string; displayResetSampling?: boolean; - isSwitchEnabledConfirm?: boolean; + // isSwitchEnabledConfirm?: boolean; isEnabled?: boolean; isArchive?: boolean; featureId?: string; @@ -78,7 +78,7 @@ export const FeatureConfirmDialog: FC = ({ title, description, displayResetSampling, - isSwitchEnabledConfirm, + // isSwitchEnabledConfirm, isEnabled, isArchive, featureId, @@ -91,12 +91,12 @@ export const FeatureConfirmDialog: FC = ({ const history = useHistory(); const [flagList, setFlagList] = useState([]); const [isFlagActive, setIsFlagActive] = useState(false); - const [selectedSwitchEnabledType, setSelectedSwitchEnabledType] = useState( - isEnabled ? SwitchEnabledType.DISABLE_NOW : SwitchEnabledType.ENABLE_NOW - ); + // const [selectedSwitchEnabledType, setSelectedSwitchEnabledType] = useState( + // isEnabled ? SwitchEnabledType.DISABLE_NOW : SwitchEnabledType.ENABLE_NOW + // ); const [saveFeatureType, setSaveFeatureType] = useState( - SaveFeatureType.SCHEDULE + SaveFeatureType.UPDATE_NOW ); const [scheduleErrorMessage, setScheduleErrorMessage] = useState(''); @@ -133,14 +133,14 @@ export const FeatureConfirmDialog: FC = ({ }, []); useEffect(() => { - if (isSwitchEnabledConfirm && isEnabled) { - dispatch( - listProgressiveRollout({ - featureId: featureId, - environmentId: currentEnvironment.id - }) - ); - } + // if (isSwitchEnabledConfirm && isEnabled) { + dispatch( + listProgressiveRollout({ + featureId: featureId, + environmentId: currentEnvironment.id + }) + ); + // } }, []); useEffect(() => { @@ -200,44 +200,44 @@ export const FeatureConfirmDialog: FC = ({ } }, [isArchive, open, feature]); - const getSubmitBtnLabel = () => { - if (isSwitchEnabledConfirm) { - return selectedSwitchEnabledType === SwitchEnabledType.ENABLE_NOW - ? f(messages.button.enable) - : selectedSwitchEnabledType === SwitchEnabledType.DISABLE_NOW - ? f(messages.button.disable) - : f(messages.button.schedule); - } - return f(messages.button.submit); - }; + // const getSubmitBtnLabel = () => { + // if (isSwitchEnabledConfirm) { + // return selectedSwitchEnabledType === SwitchEnabledType.ENABLE_NOW + // ? f(messages.button.enable) + // : selectedSwitchEnabledType === SwitchEnabledType.DISABLE_NOW + // ? f(messages.button.disable) + // : f(messages.button.schedule); + // } + // return f(messages.button.submit); + // }; - const handleScheduleSubmit = () => { - const command = new CreateAutoOpsRuleCommand(); - command.setFeatureId(featureId); - const clause = new DatetimeClause(); - command.setOpsType(OpsType.SCHEDULE); - if (isEnabled) { - clause.setActionType(ActionType.DISABLE); - } else { - clause.setActionType(ActionType.ENABLE); - } - clause.setTime(Math.round(datetime.getTime() / 1000)); - command.setDatetimeClausesList([clause]); - dispatch( - createAutoOpsRule({ - environmentId: currentEnvironment.id, - command: command - }) - ).then(() => { - dispatch( - addToast({ - message: f(messages.feature.successMessages.schedule), - severity: 'success' - }) - ); - onClose(); - }); - }; + // const handleScheduleSubmit = () => { + // const command = new CreateAutoOpsRuleCommand(); + // command.setFeatureId(featureId); + // const clause = new DatetimeClause(); + // command.setOpsType(OpsType.SCHEDULE); + // if (isEnabled) { + // clause.setActionType(ActionType.DISABLE); + // } else { + // clause.setActionType(ActionType.ENABLE); + // } + // clause.setTime(Math.round(datetime.getTime() / 1000)); + // command.setDatetimeClausesList([clause]); + // dispatch( + // createAutoOpsRule({ + // environmentId: currentEnvironment.id, + // command: command + // }) + // ).then(() => { + // dispatch( + // addToast({ + // message: f(messages.feature.successMessages.schedule), + // severity: 'success' + // }) + // ); + // onClose(); + // }); + // }; // const handleScheduleSubmit = () => { // const command = new CreateAutoOpsRuleCommand(); @@ -269,7 +269,8 @@ export const FeatureConfirmDialog: FC = ({ const checkSubmitBtnDisabled = () => { if ( - selectedSwitchEnabledType === SwitchEnabledType.SCHEDULE && + // selectedSwitchEnabledType === SwitchEnabledType.SCHEDULE && + saveFeatureType === SaveFeatureType.SCHEDULE && !scheduleErrorMessage ) { return false; @@ -281,7 +282,7 @@ export const FeatureConfirmDialog: FC = ({ = ({ )} - {selectedSwitchEnabledType !== SwitchEnabledType.SCHEDULE && ( -
-
- - -
-
-