<commit_before>import React, { Component } from "react";
import PropTypes from "prop-types";
import { connect } from "react-redux";
import "./style.less";
import { 
    Label,
    Button,
    Switch,
    Dropdown,
    DatePicker,
    SingleLineInputWithError
} from "@dnnsoftware/dnn-react-common";
import History from "../../history";
import {
    task as TaskActions
} from "../../../actions";
import util from "../../../utils";
import resx from "../../../resources";

const re = /^[1-9][0-9]?[0-9]?[0-9]?[0-9]?[0-9]?$/;
let retainHistoryNumOptions = [];
let timeLapseMeasurementOptions = [];
let attachToEventOptions = [];
let catchUpEnabledOptions = [];

class SchedulerEditor extends Component {
    constructor() {
        super();

        this.state = {
            error: {
                name: true,
                frequency: true,
                retry: false
            },
            triedToSubmit: false
        };
    }

    componentDidMount() {
        const { props } = this;
        if (props.scheduleId) {
            props.dispatch(TaskActions.getGetScheduleItem({
                scheduleId: props.scheduleId
            }));
        }

        retainHistoryNumOptions = [];
        retainHistoryNumOptions.push({ "value": "0", "label": resx.get("None") });
        retainHistoryNumOptions.push({ "value": "1", "label": "1" });
        retainHistoryNumOptions.push({ "value": "5", "label": "5" });
        retainHistoryNumOptions.push({ "value": "10", "label": "10" });
        retainHistoryNumOptions.push({ "value": "25", "label": "25" });
        retainHistoryNumOptions.push({ "value": "50", "label": "50" });
        retainHistoryNumOptions.push({ "value": "60", "label": "60" });
        retainHistoryNumOptions.push({ "value": "100", "label": "100" });
        retainHistoryNumOptions.push({ "value": "250", "label": "250" });
        retainHistoryNumOptions.push({ "value": "500", "label": "500" });
        retainHistoryNumOptions.push({ "value": "-1", "label": resx.get("All") });

        if (timeLapseMeasurementOptions.length === 0) {
            timeLapseMeasurementOptions.push({ "value": "s", "label": resx.get("Seconds") });
            timeLapseMeasurementOptions.push({ "value": "m", "label": resx.get("Minutes") });
            timeLapseMeasurementOptions.push({ "value": "h", "label": resx.get("Hours") });
            timeLapseMeasurementOptions.push({ "value": "d", "label": resx.get("Days") });
            timeLapseMeasurementOptions.push({ "value": "w", "label": resx.get("Weeks") });
            timeLapseMeasurementOptions.push({ "value": "mo", "label": resx.get("Months") });
            timeLapseMeasurementOptions.push({ "value": "y", "label": resx.get("Years") });
        }

        if (attachToEventOptions.length === 0) {
            attachToEventOptions.push({ "value": "", "label": resx.get("None") });
            attachToEventOptions.push({ "value": "APPLICATION_START", "label": "APPLICATION_START" });
        }

        if (catchUpEnabledOptions.length === 0) {
            catchUpEnabledOptions.push({ "value": "false", "label": resx.get("Disabled") });
            catchUpEnabledOptions.push({ "value": "true", "label": resx.get("Enabled.Label") });
        }

        this.setState({
            triedToSubmit: false,
            error: {}
        });
    }

    runSchedule() {
        const { props } = this;
        let { scheduleItemDetail } = props;
        props.dispatch(TaskActions.runScheduleItem(scheduleItemDetail, () => {
            util.utilities.notify(resx.get("RunNow"));
        }, () => {
            util.utilities.notify(resx.get("RunNowError"));
        }));
    }

    isEmptyDate(date) {
        return !date || new Date(date).getFullYear() < 1970;
    }

    getDefaultIfNull(obj, key, defaultValue) {
        if (obj === undefined || key === undefined || obj[key] === undefined) {
            return defaultValue;
        }
        return obj[key].toString();
    }
<commit_msg>DNN-29207 Scheduler - resetting date/time value (#404)<commit_after>import React, { Component } from "react";
import PropTypes from "prop-types";
import { connect } from "react-redux";
import "./style.less";
import { 
    Label,
    Button,
    Switch,
    Dropdown,
    DatePicker,
    SingleLineInputWithError
} from "@dnnsoftware/dnn-react-common";
import History from "../../history";
import {
    task as TaskActions
} from "../../../actions";
import util from "../../../utils";
import resx from "../../../resources";

const re = /^[1-9][0-9]?[0-9]?[0-9]?[0-9]?[0-9]?$/;
let retainHistoryNumOptions = [];
let timeLapseMeasurementOptions = [];
let attachToEventOptions = [];
let catchUpEnabledOptions = [];

class SchedulerEditor extends Component {
    constructor() {
        super();

        this.state = {
            error: {
                name: true,
                frequency: true,
                retry: false
            },
            triedToSubmit: false
        };
    }

    componentDidMount() {
        const { props } = this;
        if (props.scheduleId) {
            props.dispatch(TaskActions.getGetScheduleItem({
                scheduleId: props.scheduleId
            }));
        }

        retainHistoryNumOptions = [];
        retainHistoryNumOptions.push({ "value": "0", "label": resx.get("None") });
        retainHistoryNumOptions.push({ "value": "1", "label": "1" });
        retainHistoryNumOptions.push({ "value": "5", "label": "5" });
        retainHistoryNumOptions.push({ "value": "10", "label": "10" });
        retainHistoryNumOptions.push({ "value": "25", "label": "25" });
        retainHistoryNumOptions.push({ "value": "50", "label": "50" });
        retainHistoryNumOptions.push({ "value": "60", "label": "60" });
        retainHistoryNumOptions.push({ "value": "100", "label": "100" });
        retainHistoryNumOptions.push({ "value": "250", "label": "250" });
        retainHistoryNumOptions.push({ "value": "500", "label": "500" });
        retainHistoryNumOptions.push({ "value": "-1", "label": resx.get("All") });

        if (timeLapseMeasurementOptions.length === 0) {
            timeLapseMeasurementOptions.push({ "value": "s", "label": resx.get("Seconds") });
            timeLapseMeasurementOptions.push({ "value": "m", "label": resx.get("Minutes") });
            timeLapseMeasurementOptions.push({ "value": "h", "label": resx.get("Hours") });
            timeLapseMeasurementOptions.push({ "value": "d", "label": resx.get("Days") });
            timeLapseMeasurementOptions.push({ "value": "w", "label": resx.get("Weeks") });
            timeLapseMeasurementOptions.push({ "value": "mo", "label": resx.get("Months") });
            timeLapseMeasurementOptions.push({ "value": "y", "label": resx.get("Years") });
        }

        if (attachToEventOptions.length === 0) {
            attachToEventOptions.push({ "value": "", "label": resx.get("None") });
            attachToEventOptions.push({ "value": "APPLICATION_START", "label": "APPLICATION_START" });
        }

        if (catchUpEnabledOptions.length === 0) {
            catchUpEnabledOptions.push({ "value": "false", "label": resx.get("Disabled") });
            catchUpEnabledOptions.push({ "value": "true", "label": resx.get("Enabled.Label") });
        }

        this.setState({
            triedToSubmit: false,
            error: {}
        });
    }

    runSchedule() {
        const { props } = this;
        let { scheduleItemDetail } = props;
        props.dispatch(TaskActions.runScheduleItem(scheduleItemDetail, () => {
            util.utilities.notify(resx.get("RunNow"));
        }, () => {
            util.utilities.notify(resx.get("RunNowError"));
        }));
    }

    isEmptyDate(date) {
        return !date || new Date(date).getFullYear() < 1970;
    }

    getDefaultIfNull(obj, key, defaultValue) {
        if (obj && key && obj[key]) {
            return obj[key].toString();
        }
        return defaultValue;
    }

{'fraction_non_alphanumeric': 0.18283629042405938, 'fraction_numerical': 0.015855039637599093, 'mean_word_length': 2.573741007194245, 'pattern_counts': {'":': 88, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2150359', 'n_tokens_mistral': 2412, 'n_tokens_neox': 2352, 'n_words': 464}