geido commented on code in PR #24449:
URL: https://github.com/apache/superset/pull/24449#discussion_r1502947003


##########
superset-frontend/src/dashboard/components/RefreshIntervalModal.tsx:
##########
@@ -91,6 +100,49 @@ class RefreshIntervalModal extends React.PureComponent<
     this.setState({
       refreshFrequency: value || refreshIntervalOptions[0][0],
     });
+
+    this.setState({
+      custom_block: value === -1,
+    });
+
+    if (value === -1) {
+      this.setState({
+        custom_hour: 0,
+        custom_min: 0,
+        custom_sec: 0,
+      });
+    }
+  }
+
+  onSaveValue(value: number) {
+    this.props.onChange(value, this.props.editMode);
+    this.modalRef?.current?.close();
+    this.props.addSuccessToast(t('Refresh interval saved'));
+  }
+
+  createIntervalOptions(refreshIntervalOptions: [number, string][]) {
+    const refresh_options = [];
+    if (!refreshIntervalOptions.length) {
+      refresh_options.push({ value: -1, label: 'Custom interval' });
+      return refresh_options;
+    }
+
+    refresh_options.push({ value: -1, label: 'Custom interval' });

Review Comment:
   The label needs to be localized. Also, aren't you adding this two times as 
you are adding it when the above condition triggers too?



##########
superset-frontend/src/dashboard/components/RefreshIntervalModal.tsx:
##########
@@ -111,17 +169,78 @@ class RefreshIntervalModal extends React.PureComponent<
         modalTitle={t('Refresh interval')}
         modalBody={
           <div>
-            <FormLabel>{t('Refresh frequency')}</FormLabel>
-            <Select
-              ariaLabel={t('Refresh interval')}
-              options={refreshIntervalOptions.map(option => ({
-                value: option[0],
-                label: t(option[1]),
-              }))}
-              value={refreshFrequency}
-              onChange={this.handleFrequencyChange}
-              sortComparator={propertyComparator('value')}
-            />
+            <div id="refresh_from_dropdown">
+              <FormLabel>
+                <b>{t('Refresh frequency')}</b>
+              </FormLabel>
+              <Select
+                ariaLabel={t('Refresh interval')}
+                options={this.createIntervalOptions(refreshIntervalOptions)}
+                value={refreshFrequency}
+                onChange={this.handleFrequencyChange}
+                sortComparator={propertyComparator('value')}
+              />
+            </div>
+            <div
+              style={{

Review Comment:
   Not sure why we are still resorting to style visibility rather than 
rendering conditionally?



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to