Skip to content
This repository has been archived by the owner on Aug 9, 2022. It is now read-only.

Commit

Permalink
Update Monthly Report Trigger UI (#171)
Browse files Browse the repository at this point in the history
Changed Monthly UI to mimic Alerting, only allow 1 day per month to be selected
  • Loading branch information
davidcui1225 authored Nov 5, 2020
1 parent 605514b commit 41c4b5d
Show file tree
Hide file tree
Showing 5 changed files with 115 additions and 182 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import {
EuiTextArea,
EuiLink,
EuiButton,
EuiFieldNumber,
} from '@elastic/eui';
import moment, { Moment } from 'moment';
import { reportDefinitionParams } from '../create/create_report_definition';
Expand All @@ -41,7 +42,6 @@ import {
INTERVAL_TIME_PERIODS,
WEEKLY_CHECKBOX_OPTIONS,
MONTHLY_ON_THE_OPTIONS,
MONTHLY_DAY_SELECT_OPTIONS,
TRIGGER_TYPE_OPTIONS,
SCHEDULE_TYPE_OPTIONS,
TIMEZONE_OPTIONS,
Expand Down Expand Up @@ -86,9 +86,6 @@ export function ReportTrigger(props: ReportTriggerProps) {
const [monthlySelect, setMonthlySelect] = useState(
MONTHLY_ON_THE_OPTIONS[0].value
);
const [monthlyDaySelect, setMonthlyDaySelect] = useState(
MONTHLY_DAY_SELECT_OPTIONS[0].value
);

const handleReportTriggerType = (e: string) => {
setReportTriggerType(e);
Expand Down Expand Up @@ -135,12 +132,6 @@ export function ReportTrigger(props: ReportTriggerProps) {
setMonthlySelect(e.target.value);
};

const handleMonthlyDaySelect = (e: {
target: { value: React.SetStateAction<string> };
}) => {
setMonthlyDaySelect(e.target.value);
};

const RequestTime = () => {
useEffect(() => {
let recurringDaily = {
Expand Down Expand Up @@ -397,29 +388,6 @@ export function ReportTrigger(props: ReportTriggerProps) {
setMonthlyDayNumber(e.target.value);
};

const on_the_day =
monthlySelect === 'day' ? (
<div>
<EuiFieldText
placeholder={'Day of month'}
value={monthlyDayNumber}
onChange={handleMonthlyDayNumber}
/>
</div>
) : null;

const select =
monthlySelect != 'day' ? (
<div>
<EuiSelect
id="monthlySelect"
options={MONTHLY_DAY_SELECT_OPTIONS}
value={monthlyDaySelect}
onChange={handleMonthlyDaySelect}
/>
</div>
) : null;

return (
<div>
<EuiFormRow label="On the">
Expand All @@ -433,8 +401,11 @@ export function ReportTrigger(props: ReportTriggerProps) {
/>
</EuiFlexItem>
<EuiFlexItem>
{on_the_day}
{select}
<EuiFieldNumber
placeholder={'Day of month'}
value={monthlyDayNumber}
onChange={handleMonthlyDayNumber}
/>
</EuiFlexItem>
</EuiFlexGroup>
</EuiFormRow>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@ export const SCHEDULE_RECURRING_OPTIONS = [
text: 'By interval',
},
// TODO: disable on UI. Add them back once we support
// {
// value: 'weekly',
// text: 'Weekly',
// },
// {
// value: 'monthly',
// text: 'Monthly',
// },
// {
// value: 'weekly',
// text: 'Weekly',
// },
// {
// value: 'monthly',
// text: 'Monthly',
// },
];

export const INTERVAL_TIME_PERIODS = [
Expand Down Expand Up @@ -108,69 +108,6 @@ export const MONTHLY_ON_THE_OPTIONS = [
value: 'day',
text: 'Day',
},
{
value: 'first',
text: 'First',
},
{
value: 'second',
text: 'Second',
},
{
value: 'third',
text: 'Third',
},
{
value: 'fourth',
text: 'Fourth',
},
{
value: 'last',
text: 'Last',
},
];

export const MONTHLY_DAY_SELECT_OPTIONS = [
{
value: 'day',
text: 'Day',
},
{
value: 'weekday',
text: 'Weekday',
},
{
value: 'weekendDay',
text: 'Weekend day',
},
{
value: 'sunday',
text: 'Sunday',
},
{
value: 'monday',
text: 'Monday',
},
{
value: 'tuesday',
text: 'Tuesday',
},
{
value: 'wednesday',
text: 'Wednesday',
},
{
value: 'thursday',
text: 'Thursday',
},
{
value: 'friday',
text: 'Friday',
},
{
value: 'saturday',
text: 'Saturday',
},
];

export const TIMEZONE_OPTIONS = moment.tz
Expand Down
86 changes: 86 additions & 0 deletions kibana-reports/target/public/.kbn-optimizer-cache
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,92 @@
"manifestPath": "/Users/szhongna/Desktop/reporting/kibana/plugins/kibana-reports/kibana.json"
},
"mtimes": {
"/Users/davidcui/kibana-master/kibana/node_modules/@elastic/eui/src/global_styling/functions/_colors.scss": 1597934806735,
"/Users/davidcui/kibana-master/kibana/node_modules/@elastic/eui/src/global_styling/functions/_index.scss": 1597934806735,
"/Users/davidcui/kibana-master/kibana/node_modules/@elastic/eui/src/global_styling/functions/_math.scss": 1597934806735,
"/Users/davidcui/kibana-master/kibana/node_modules/@elastic/eui/src/global_styling/mixins/_beta_badge.scss": 1597934806735,
"/Users/davidcui/kibana-master/kibana/node_modules/@elastic/eui/src/global_styling/mixins/_button.scss": 1597934806735,
"/Users/davidcui/kibana-master/kibana/node_modules/@elastic/eui/src/global_styling/mixins/_form.scss": 1597934806735,
"/Users/davidcui/kibana-master/kibana/node_modules/@elastic/eui/src/global_styling/mixins/_header.scss": 1597934806735,
"/Users/davidcui/kibana-master/kibana/node_modules/@elastic/eui/src/global_styling/mixins/_helpers.scss": 1597934806735,
"/Users/davidcui/kibana-master/kibana/node_modules/@elastic/eui/src/global_styling/mixins/_icons.scss": 1597934806735,
"/Users/davidcui/kibana-master/kibana/node_modules/@elastic/eui/src/global_styling/mixins/_index.scss": 1597934806735,
"/Users/davidcui/kibana-master/kibana/node_modules/@elastic/eui/src/global_styling/mixins/_loading.scss": 1597934806735,
"/Users/davidcui/kibana-master/kibana/node_modules/@elastic/eui/src/global_styling/mixins/_panel.scss": 1597934806735,
"/Users/davidcui/kibana-master/kibana/node_modules/@elastic/eui/src/global_styling/mixins/_popover.scss": 1597934806735,
"/Users/davidcui/kibana-master/kibana/node_modules/@elastic/eui/src/global_styling/mixins/_range.scss": 1597934806735,
"/Users/davidcui/kibana-master/kibana/node_modules/@elastic/eui/src/global_styling/mixins/_responsive.scss": 1597934806735,
"/Users/davidcui/kibana-master/kibana/node_modules/@elastic/eui/src/global_styling/mixins/_shadow.scss": 1597934806735,
"/Users/davidcui/kibana-master/kibana/node_modules/@elastic/eui/src/global_styling/mixins/_size.scss": 1597934806735,
"/Users/davidcui/kibana-master/kibana/node_modules/@elastic/eui/src/global_styling/mixins/_states.scss": 1597934806735,
"/Users/davidcui/kibana-master/kibana/node_modules/@elastic/eui/src/global_styling/mixins/_tool_tip.scss": 1597934806735,
"/Users/davidcui/kibana-master/kibana/node_modules/@elastic/eui/src/global_styling/mixins/_typography.scss": 1597934806735,
"/Users/davidcui/kibana-master/kibana/node_modules/@elastic/eui/src/global_styling/variables/_animations.scss": 1597934806735,
"/Users/davidcui/kibana-master/kibana/node_modules/@elastic/eui/src/global_styling/variables/_borders.scss": 1597934806735,
"/Users/davidcui/kibana-master/kibana/node_modules/@elastic/eui/src/global_styling/variables/_buttons.scss": 1597934806735,
"/Users/davidcui/kibana-master/kibana/node_modules/@elastic/eui/src/global_styling/variables/_colors.scss": 1597934806735,
"/Users/davidcui/kibana-master/kibana/node_modules/@elastic/eui/src/global_styling/variables/_form.scss": 1597934806735,
"/Users/davidcui/kibana-master/kibana/node_modules/@elastic/eui/src/global_styling/variables/_header.scss": 1597934806735,
"/Users/davidcui/kibana-master/kibana/node_modules/@elastic/eui/src/global_styling/variables/_index.scss": 1597934806735,
"/Users/davidcui/kibana-master/kibana/node_modules/@elastic/eui/src/global_styling/variables/_panel.scss": 1597934806735,
"/Users/davidcui/kibana-master/kibana/node_modules/@elastic/eui/src/global_styling/variables/_responsive.scss": 1597934806735,
"/Users/davidcui/kibana-master/kibana/node_modules/@elastic/eui/src/global_styling/variables/_shadows.scss": 1597934806735,
"/Users/davidcui/kibana-master/kibana/node_modules/@elastic/eui/src/global_styling/variables/_size.scss": 1597934806735,
"/Users/davidcui/kibana-master/kibana/node_modules/@elastic/eui/src/global_styling/variables/_states.scss": 1597934806735,
"/Users/davidcui/kibana-master/kibana/node_modules/@elastic/eui/src/global_styling/variables/_tool_tip.scss": 1597934806735,
"/Users/davidcui/kibana-master/kibana/node_modules/@elastic/eui/src/global_styling/variables/_typography.scss": 1597934806735,
"/Users/davidcui/kibana-master/kibana/node_modules/@elastic/eui/src/global_styling/variables/_z_index.scss": 1597934806735,
"/Users/davidcui/kibana-master/kibana/node_modules/@elastic/eui/src/themes/eui/eui_colors_dark.scss": 1597934806735,
"/Users/davidcui/kibana-master/kibana/node_modules/@elastic/eui/src/themes/eui/eui_colors_light.scss": 1597934806735,
"/Users/davidcui/kibana-master/kibana/node_modules/css-loader/package.json": 1594234807364,
"/Users/davidcui/kibana-master/kibana/node_modules/style-loader/package.json": 1594234807600,
"/Users/davidcui/kibana-master/kibana/node_modules/webpack/package.json": 1594234807691,
"/Users/davidcui/kibana-master/kibana/packages/elastic-datemath/target/index.js": 1603133618908.22,
"/Users/davidcui/kibana-master/kibana/packages/kbn-optimizer/target/worker/entry_point_creator.js": 1603133761979.948,
"/Users/davidcui/kibana-master/kibana/packages/kbn-optimizer/target/worker/postcss.config.js": 1603133761982.6355,
"/Users/davidcui/kibana-master/kibana/packages/kbn-ui-shared-deps/public_path_module_creator.js": 1594412937518.558,
"/Users/davidcui/kibana-master/kibana/plugins/kibana-reports/common/index.ts": 1602096017778.1704,
"/Users/davidcui/kibana-master/kibana/plugins/kibana-reports/kibana.json": 1601424619671.2827,
"/Users/davidcui/kibana-master/kibana/plugins/kibana-reports/node_modules/babel-polyfill/node_modules/regenerator-runtime/package.json": 1582659933736,
"/Users/davidcui/kibana-master/kibana/plugins/kibana-reports/node_modules/babel-polyfill/package.json": 1582659933621,
"/Users/davidcui/kibana-master/kibana/plugins/kibana-reports/node_modules/core-js/package.json": 1592350344152,
"/Users/davidcui/kibana-master/kibana/plugins/kibana-reports/node_modules/cron-validator/package.json": 1602110053305,
"/Users/davidcui/kibana-master/kibana/plugins/kibana-reports/node_modules/react-mde/package.json": 1597871883196,
"/Users/davidcui/kibana-master/kibana/plugins/kibana-reports/node_modules/showdown/package.json": 1597872358856,
"/Users/davidcui/kibana-master/kibana/plugins/kibana-reports/public/application.tsx": 1603138884948.4934,
"/Users/davidcui/kibana-master/kibana/plugins/kibana-reports/public/components/app.tsx": 1601668768138.834,
"/Users/davidcui/kibana-master/kibana/plugins/kibana-reports/public/components/context_menu/context_menu_helpers.js": 1603300578411.1367,
"/Users/davidcui/kibana-master/kibana/plugins/kibana-reports/public/components/context_menu/context_menu_ui.js": 1602615223597.9368,
"/Users/davidcui/kibana-master/kibana/plugins/kibana-reports/public/components/context_menu/context_menu.js": 1603300578409.5425,
"/Users/davidcui/kibana-master/kibana/plugins/kibana-reports/public/components/main/main_utils.tsx": 1603750634663.138,
"/Users/davidcui/kibana-master/kibana/plugins/kibana-reports/public/components/main/main.tsx": 1604425633624.3005,
"/Users/davidcui/kibana-master/kibana/plugins/kibana-reports/public/components/main/report_definition_details/report_definition_details.tsx": 1604444037899.4097,
"/Users/davidcui/kibana-master/kibana/plugins/kibana-reports/public/components/main/report_definitions_table.tsx": 1604444037906.0515,
"/Users/davidcui/kibana-master/kibana/plugins/kibana-reports/public/components/main/report_details/report_details.tsx": 1603756386321.6716,
"/Users/davidcui/kibana-master/kibana/plugins/kibana-reports/public/components/main/reports_table.tsx": 1604444037907.3662,
"/Users/davidcui/kibana-master/kibana/plugins/kibana-reports/public/components/report_definitions/create/create_report_definition.tsx": 1604425633626.3604,
"/Users/davidcui/kibana-master/kibana/plugins/kibana-reports/public/components/report_definitions/delivery/delivery_constants.tsx": 1603729854219.1372,
"/Users/davidcui/kibana-master/kibana/plugins/kibana-reports/public/components/report_definitions/delivery/delivery.tsx": 1603915798674.0212,
"/Users/davidcui/kibana-master/kibana/plugins/kibana-reports/public/components/report_definitions/delivery/email.tsx": 1603915571755.3118,
"/Users/davidcui/kibana-master/kibana/plugins/kibana-reports/public/components/report_definitions/delivery/index.ts": 1599059974548.1443,
"/Users/davidcui/kibana-master/kibana/plugins/kibana-reports/public/components/report_definitions/edit/edit_report_definition.tsx": 1604513545647.3865,
"/Users/davidcui/kibana-master/kibana/plugins/kibana-reports/public/components/report_definitions/report_settings/index.ts": 1599059974552.1404,
"/Users/davidcui/kibana-master/kibana/plugins/kibana-reports/public/components/report_definitions/report_settings/report_settings_constants.tsx": 1603729854230.4272,
"/Users/davidcui/kibana-master/kibana/plugins/kibana-reports/public/components/report_definitions/report_settings/report_settings_helpers.tsx": 1603830779520.467,
"/Users/davidcui/kibana-master/kibana/plugins/kibana-reports/public/components/report_definitions/report_settings/report_settings.tsx": 1604425633636.2595,
"/Users/davidcui/kibana-master/kibana/plugins/kibana-reports/public/components/report_definitions/report_settings/time_range.tsx": 1603845287269.1287,
"/Users/davidcui/kibana-master/kibana/plugins/kibana-reports/public/components/report_definitions/report_trigger/index.ts": 1599059974556.8005,
"/Users/davidcui/kibana-master/kibana/plugins/kibana-reports/public/components/report_definitions/report_trigger/report_trigger_constants.tsx": 1604522299569.5476,
"/Users/davidcui/kibana-master/kibana/plugins/kibana-reports/public/components/report_definitions/report_trigger/report_trigger.tsx": 1604521716321.3633,
"/Users/davidcui/kibana-master/kibana/plugins/kibana-reports/public/components/report_definitions/report_trigger/timezone.tsx": 1603729854238.0894,
"/Users/davidcui/kibana-master/kibana/plugins/kibana-reports/public/components/report_definitions/utils/index.ts": 1603414462623.5815,
"/Users/davidcui/kibana-master/kibana/plugins/kibana-reports/public/index.scss": 1603729854239.3784,
"/Users/davidcui/kibana-master/kibana/plugins/kibana-reports/public/index.ts": 1599059974562.8872,
"/Users/davidcui/kibana-master/kibana/plugins/kibana-reports/public/plugin.ts": 1603729854241.3765,
"/Users/davidcui/kibana-master/kibana/plugins/kibana-reports/public/types.ts": 1599059974563.6287,
"/Users/davidcui/kibana-master/kibana/src/legacy/ui/public/styles/_globals_v7dark.scss": 1601419690246.8777,
"/Users/davidcui/kibana-master/kibana/src/legacy/ui/public/styles/_globals_v7light.scss": 1601419690247.2283,
"/Users/davidcui/kibana-master/kibana/src/legacy/ui/public/styles/_mixins.scss": 1594412938523.3762
"/Users/szhongna/Desktop/reporting/kibana/node_modules/@elastic/eui/src/global_styling/functions/_colors.scss": 1598465770847,
"/Users/szhongna/Desktop/reporting/kibana/node_modules/@elastic/eui/src/global_styling/functions/_index.scss": 1598465770847,
"/Users/szhongna/Desktop/reporting/kibana/node_modules/@elastic/eui/src/global_styling/functions/_math.scss": 1598465770847,
Expand Down
Loading

0 comments on commit 41c4b5d

Please sign in to comment.