mintsweet commented on code in PR #3792:
URL: 
https://github.com/apache/incubator-devlake/pull/3792#discussion_r1043333574


##########
config-ui/src/pages/blueprint/create/step-four/index.tsx:
##########
@@ -0,0 +1,182 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+import React, { useState, useEffect } from 'react'
+import {
+  RadioGroup,
+  Radio,
+  Checkbox,
+  InputGroup,
+  Icon,
+  Position
+} from '@blueprintjs/core'
+import { Popover2 } from '@blueprintjs/popover2'
+
+import { Divider } from '@/components'
+import CronHelp from '@/images/cron-help.png'
+
+import { useBlueprint } from '../hooks'
+
+import * as S from './styled'
+
+const cronPresets = [
+  {
+    label: 'Hourly',
+    config: '59 * * * *',
+    desc: 'At minute 59 on every day-of-week from Monday through Sunday.'
+  },
+  {
+    label: 'Daily',
+    config: '0 0 * * *',
+    desc: 'At 00:00 (Midnight) on every day-of-week from Monday through 
Sunday.'
+  },
+  {
+    label: 'Weekly',
+    config: '0 0 * * 1',
+    desc: 'At 00:00 (Midnight) on Monday.'
+  },
+  {
+    label: 'Monthly',
+    config: '0 0 1 * *',
+    desc: 'At 00:00 (Midnight) on day-of-month 1.'
+  }
+]
+
+export const StepFour = () => {
+  const [desc, setDesc] = useState('')
+  const [frequency, setFrequency] = useState('')
+
+  const {
+    cronConfig,
+    isManual,
+    skipOnFail,
+    onChangeCronConfig,
+    onChangeIsManual,
+    onChangeSkipOnFail
+  } = useBlueprint()
+
+  useEffect(() => {
+    if (frequency === 'manual') {
+      setDesc('Manual')
+    } else if (frequency === 'custom') {
+      setDesc('Custom')
+    } else {
+      const targetCron = cronPresets.find((it) => it.config === frequency)
+      setDesc(targetCron?.desc ?? '')
+    }
+  }, [frequency])
+
+  useEffect(() => {
+    if (isManual) {
+      setFrequency('manual')
+    } else if (frequency !== 'custom') {
+      setFrequency(cronConfig)

Review Comment:
   I tried following your steps, and it didn't happen as you expected.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to