mirror of
https://github.com/valitydev/redash.git
synced 2024-11-06 09:05:17 +00:00
ScheduleDialog: Filter empty interval groups (#5196)
This commit is contained in:
parent
f4dcb2918a
commit
2992c382d1
@ -5,7 +5,7 @@ import DatePicker from "antd/lib/date-picker";
|
||||
import TimePicker from "antd/lib/time-picker";
|
||||
import Select from "antd/lib/select";
|
||||
import Radio from "antd/lib/radio";
|
||||
import { capitalize, clone, isEqual, omitBy, isNil } from "lodash";
|
||||
import { capitalize, clone, isEqual, omitBy, isNil, isEmpty } from "lodash";
|
||||
import moment from "moment";
|
||||
import { secondsToInterval, durationHumanize, pluralize, IntervalEnum, localizeTime } from "@/lib/utils";
|
||||
import { wrap as wrapDialog, DialogPropType } from "@/components/DialogWrapper";
|
||||
@ -207,15 +207,17 @@ class ScheduleDialog extends React.Component {
|
||||
<Option value={null} key="never">
|
||||
Never
|
||||
</Option>
|
||||
{Object.keys(this.intervals).map(int => (
|
||||
<OptGroup label={capitalize(pluralize(int))} key={int}>
|
||||
{this.intervals[int].map(([cnt, secs]) => (
|
||||
<Option value={secs} key={`${int}-${cnt}`}>
|
||||
{durationHumanize(secs)}
|
||||
</Option>
|
||||
))}
|
||||
</OptGroup>
|
||||
))}
|
||||
{Object.keys(this.intervals)
|
||||
.filter(int => !isEmpty(this.intervals[int]))
|
||||
.map(int => (
|
||||
<OptGroup label={capitalize(pluralize(int))} key={int}>
|
||||
{this.intervals[int].map(([cnt, secs]) => (
|
||||
<Option value={secs} key={`${int}-${cnt}`}>
|
||||
{durationHumanize(secs)}
|
||||
</Option>
|
||||
))}
|
||||
</OptGroup>
|
||||
))}
|
||||
</Select>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -84,15 +84,6 @@ exports[`ScheduleDialog Sets correct schedule settings Sets to "1 Day 22:15" Set
|
||||
"groupOption": false,
|
||||
"key": "never",
|
||||
},
|
||||
Object {
|
||||
"data": Object {
|
||||
"key": "__RC_SELECT_GRP__Never__",
|
||||
"label": "Nevers",
|
||||
"options": Array [],
|
||||
},
|
||||
"group": true,
|
||||
"key": "__RC_SELECT_GRP__Never__",
|
||||
},
|
||||
Object {
|
||||
"data": Object {
|
||||
"key": "__RC_SELECT_GRP__minute__",
|
||||
@ -309,11 +300,6 @@ exports[`ScheduleDialog Sets correct schedule settings Sets to "1 Day 22:15" Set
|
||||
"key": "never",
|
||||
"value": null,
|
||||
},
|
||||
Object {
|
||||
"key": "__RC_SELECT_GRP__Never__",
|
||||
"label": "Nevers",
|
||||
"options": Array [],
|
||||
},
|
||||
Object {
|
||||
"key": "__RC_SELECT_GRP__minute__",
|
||||
"label": "Minutes",
|
||||
@ -502,15 +488,6 @@ exports[`ScheduleDialog Sets correct schedule settings Sets to "1 Day 22:15" Set
|
||||
"groupOption": false,
|
||||
"key": "never",
|
||||
},
|
||||
Object {
|
||||
"data": Object {
|
||||
"key": "__RC_SELECT_GRP__Never__",
|
||||
"label": "Nevers",
|
||||
"options": Array [],
|
||||
},
|
||||
"group": true,
|
||||
"key": "__RC_SELECT_GRP__Never__",
|
||||
},
|
||||
Object {
|
||||
"data": Object {
|
||||
"key": "__RC_SELECT_GRP__minute__",
|
||||
@ -727,11 +704,6 @@ exports[`ScheduleDialog Sets correct schedule settings Sets to "1 Day 22:15" Set
|
||||
"key": "never",
|
||||
"value": null,
|
||||
},
|
||||
Object {
|
||||
"key": "__RC_SELECT_GRP__Never__",
|
||||
"label": "Nevers",
|
||||
"options": Array [],
|
||||
},
|
||||
Object {
|
||||
"key": "__RC_SELECT_GRP__minute__",
|
||||
"label": "Minutes",
|
||||
@ -2057,15 +2029,6 @@ exports[`ScheduleDialog Sets correct schedule settings Sets to "2 Hours" 1`] = `
|
||||
"groupOption": false,
|
||||
"key": "never",
|
||||
},
|
||||
Object {
|
||||
"data": Object {
|
||||
"key": "__RC_SELECT_GRP__Never__",
|
||||
"label": "Nevers",
|
||||
"options": Array [],
|
||||
},
|
||||
"group": true,
|
||||
"key": "__RC_SELECT_GRP__Never__",
|
||||
},
|
||||
Object {
|
||||
"data": Object {
|
||||
"key": "__RC_SELECT_GRP__minute__",
|
||||
@ -2282,11 +2245,6 @@ exports[`ScheduleDialog Sets correct schedule settings Sets to "2 Hours" 1`] = `
|
||||
"key": "never",
|
||||
"value": null,
|
||||
},
|
||||
Object {
|
||||
"key": "__RC_SELECT_GRP__Never__",
|
||||
"label": "Nevers",
|
||||
"options": Array [],
|
||||
},
|
||||
Object {
|
||||
"key": "__RC_SELECT_GRP__minute__",
|
||||
"label": "Minutes",
|
||||
@ -2475,15 +2433,6 @@ exports[`ScheduleDialog Sets correct schedule settings Sets to "2 Hours" 1`] = `
|
||||
"groupOption": false,
|
||||
"key": "never",
|
||||
},
|
||||
Object {
|
||||
"data": Object {
|
||||
"key": "__RC_SELECT_GRP__Never__",
|
||||
"label": "Nevers",
|
||||
"options": Array [],
|
||||
},
|
||||
"group": true,
|
||||
"key": "__RC_SELECT_GRP__Never__",
|
||||
},
|
||||
Object {
|
||||
"data": Object {
|
||||
"key": "__RC_SELECT_GRP__minute__",
|
||||
@ -2700,11 +2649,6 @@ exports[`ScheduleDialog Sets correct schedule settings Sets to "2 Hours" 1`] = `
|
||||
"key": "never",
|
||||
"value": null,
|
||||
},
|
||||
Object {
|
||||
"key": "__RC_SELECT_GRP__Never__",
|
||||
"label": "Nevers",
|
||||
"options": Array [],
|
||||
},
|
||||
Object {
|
||||
"key": "__RC_SELECT_GRP__minute__",
|
||||
"label": "Minutes",
|
||||
@ -3234,15 +3178,6 @@ exports[`ScheduleDialog Sets correct schedule settings Sets to "2 Weeks 22:15 Tu
|
||||
"groupOption": false,
|
||||
"key": "never",
|
||||
},
|
||||
Object {
|
||||
"data": Object {
|
||||
"key": "__RC_SELECT_GRP__Never__",
|
||||
"label": "Nevers",
|
||||
"options": Array [],
|
||||
},
|
||||
"group": true,
|
||||
"key": "__RC_SELECT_GRP__Never__",
|
||||
},
|
||||
Object {
|
||||
"data": Object {
|
||||
"key": "__RC_SELECT_GRP__minute__",
|
||||
@ -3459,11 +3394,6 @@ exports[`ScheduleDialog Sets correct schedule settings Sets to "2 Weeks 22:15 Tu
|
||||
"key": "never",
|
||||
"value": null,
|
||||
},
|
||||
Object {
|
||||
"key": "__RC_SELECT_GRP__Never__",
|
||||
"label": "Nevers",
|
||||
"options": Array [],
|
||||
},
|
||||
Object {
|
||||
"key": "__RC_SELECT_GRP__minute__",
|
||||
"label": "Minutes",
|
||||
@ -3652,15 +3582,6 @@ exports[`ScheduleDialog Sets correct schedule settings Sets to "2 Weeks 22:15 Tu
|
||||
"groupOption": false,
|
||||
"key": "never",
|
||||
},
|
||||
Object {
|
||||
"data": Object {
|
||||
"key": "__RC_SELECT_GRP__Never__",
|
||||
"label": "Nevers",
|
||||
"options": Array [],
|
||||
},
|
||||
"group": true,
|
||||
"key": "__RC_SELECT_GRP__Never__",
|
||||
},
|
||||
Object {
|
||||
"data": Object {
|
||||
"key": "__RC_SELECT_GRP__minute__",
|
||||
@ -3877,11 +3798,6 @@ exports[`ScheduleDialog Sets correct schedule settings Sets to "2 Weeks 22:15 Tu
|
||||
"key": "never",
|
||||
"value": null,
|
||||
},
|
||||
Object {
|
||||
"key": "__RC_SELECT_GRP__Never__",
|
||||
"label": "Nevers",
|
||||
"options": Array [],
|
||||
},
|
||||
Object {
|
||||
"key": "__RC_SELECT_GRP__minute__",
|
||||
"label": "Minutes",
|
||||
@ -5581,15 +5497,6 @@ exports[`ScheduleDialog Sets correct schedule settings Sets to "5 Minutes" 1`] =
|
||||
"groupOption": false,
|
||||
"key": "never",
|
||||
},
|
||||
Object {
|
||||
"data": Object {
|
||||
"key": "__RC_SELECT_GRP__Never__",
|
||||
"label": "Nevers",
|
||||
"options": Array [],
|
||||
},
|
||||
"group": true,
|
||||
"key": "__RC_SELECT_GRP__Never__",
|
||||
},
|
||||
Object {
|
||||
"data": Object {
|
||||
"key": "__RC_SELECT_GRP__minute__",
|
||||
@ -5806,11 +5713,6 @@ exports[`ScheduleDialog Sets correct schedule settings Sets to "5 Minutes" 1`] =
|
||||
"key": "never",
|
||||
"value": null,
|
||||
},
|
||||
Object {
|
||||
"key": "__RC_SELECT_GRP__Never__",
|
||||
"label": "Nevers",
|
||||
"options": Array [],
|
||||
},
|
||||
Object {
|
||||
"key": "__RC_SELECT_GRP__minute__",
|
||||
"label": "Minutes",
|
||||
@ -5999,15 +5901,6 @@ exports[`ScheduleDialog Sets correct schedule settings Sets to "5 Minutes" 1`] =
|
||||
"groupOption": false,
|
||||
"key": "never",
|
||||
},
|
||||
Object {
|
||||
"data": Object {
|
||||
"key": "__RC_SELECT_GRP__Never__",
|
||||
"label": "Nevers",
|
||||
"options": Array [],
|
||||
},
|
||||
"group": true,
|
||||
"key": "__RC_SELECT_GRP__Never__",
|
||||
},
|
||||
Object {
|
||||
"data": Object {
|
||||
"key": "__RC_SELECT_GRP__minute__",
|
||||
@ -6224,11 +6117,6 @@ exports[`ScheduleDialog Sets correct schedule settings Sets to "5 Minutes" 1`] =
|
||||
"key": "never",
|
||||
"value": null,
|
||||
},
|
||||
Object {
|
||||
"key": "__RC_SELECT_GRP__Never__",
|
||||
"label": "Nevers",
|
||||
"options": Array [],
|
||||
},
|
||||
Object {
|
||||
"key": "__RC_SELECT_GRP__minute__",
|
||||
"label": "Minutes",
|
||||
@ -6755,15 +6643,6 @@ exports[`ScheduleDialog Sets correct schedule settings Sets to "Never" 1`] = `
|
||||
"groupOption": false,
|
||||
"key": "never",
|
||||
},
|
||||
Object {
|
||||
"data": Object {
|
||||
"key": "__RC_SELECT_GRP__Never__",
|
||||
"label": "Nevers",
|
||||
"options": Array [],
|
||||
},
|
||||
"group": true,
|
||||
"key": "__RC_SELECT_GRP__Never__",
|
||||
},
|
||||
Object {
|
||||
"data": Object {
|
||||
"key": "__RC_SELECT_GRP__minute__",
|
||||
@ -6980,11 +6859,6 @@ exports[`ScheduleDialog Sets correct schedule settings Sets to "Never" 1`] = `
|
||||
"key": "never",
|
||||
"value": null,
|
||||
},
|
||||
Object {
|
||||
"key": "__RC_SELECT_GRP__Never__",
|
||||
"label": "Nevers",
|
||||
"options": Array [],
|
||||
},
|
||||
Object {
|
||||
"key": "__RC_SELECT_GRP__minute__",
|
||||
"label": "Minutes",
|
||||
@ -7169,15 +7043,6 @@ exports[`ScheduleDialog Sets correct schedule settings Sets to "Never" 1`] = `
|
||||
"groupOption": false,
|
||||
"key": "never",
|
||||
},
|
||||
Object {
|
||||
"data": Object {
|
||||
"key": "__RC_SELECT_GRP__Never__",
|
||||
"label": "Nevers",
|
||||
"options": Array [],
|
||||
},
|
||||
"group": true,
|
||||
"key": "__RC_SELECT_GRP__Never__",
|
||||
},
|
||||
Object {
|
||||
"data": Object {
|
||||
"key": "__RC_SELECT_GRP__minute__",
|
||||
@ -7394,11 +7259,6 @@ exports[`ScheduleDialog Sets correct schedule settings Sets to "Never" 1`] = `
|
||||
"key": "never",
|
||||
"value": null,
|
||||
},
|
||||
Object {
|
||||
"key": "__RC_SELECT_GRP__Never__",
|
||||
"label": "Nevers",
|
||||
"options": Array [],
|
||||
},
|
||||
Object {
|
||||
"key": "__RC_SELECT_GRP__minute__",
|
||||
"label": "Minutes",
|
||||
|
Loading…
Reference in New Issue
Block a user