Sha256: b64e030d035cb809a120fb8e99bcbe17cbd9ca977950ddf3c8d376daf1a70899

Contents?: true

Size: 1.53 KB

Versions: 36

Compression:

Stored size: 1.53 KB

Contents

import React, { useEffect } from 'react';
import PropTypes from 'prop-types';
import { TextInput, FormGroup, ValidatedOptions } from '@patternfly/react-core';
import { translate as __ } from 'foremanReact/common/I18n';
import { helpLabel } from '../form/FormHelpers';

export const RepeatCron = ({ repeatData, setRepeatData, setValid }) => {
  const { cronline } = repeatData;
  useEffect(() => {
    if (cronline) {
      setValid(true);
    } else {
      setValid(false);
    }
    return () => setValid(true);
  }, [setValid, cronline]);
  return (
    <FormGroup
      label={__('Cron line')}
      labelIcon={helpLabel(
        <div>
          {__("Cron line format 'a b c d e', where:")}
          <br />
          <ol>
            <li>{__('is minute (range: 0-59)')}</li>
            <li>{__('is hour (range: 0-23)')}</li>
            <li>{__('is day of month (range: 1-31)')}</li>
            <li>{__('is month (range: 1-12)')}</li>
            <li>{__('is day of week (range: 0-6)')}</li>
          </ol>
        </div>
      )}
      isRequired
    >
      <TextInput
        isRequired
        validated={cronline ? ValidatedOptions.noval : ValidatedOptions.error}
        aria-label="cronline"
        placeholder="* * * * *"
        type="text"
        value={cronline || ''}
        onChange={newTime => {
          setRepeatData({ cronline: newTime });
        }}
      />
    </FormGroup>
  );
};
RepeatCron.propTypes = {
  repeatData: PropTypes.object.isRequired,
  setRepeatData: PropTypes.func.isRequired,
  setValid: PropTypes.func.isRequired,
};

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
foreman_remote_execution-8.0.0 webpack/JobWizard/steps/Schedule/RepeatCron.js
foreman_remote_execution-7.1.1 webpack/JobWizard/steps/Schedule/RepeatCron.js
foreman_remote_execution-7.1.0 webpack/JobWizard/steps/Schedule/RepeatCron.js
foreman_remote_execution-7.0.0 webpack/JobWizard/steps/Schedule/RepeatCron.js
foreman_remote_execution-5.0.7 webpack/JobWizard/steps/Schedule/RepeatCron.js
foreman_remote_execution-5.0.6 webpack/JobWizard/steps/Schedule/RepeatCron.js
foreman_remote_execution-6.2.0 webpack/JobWizard/steps/Schedule/RepeatCron.js
foreman_remote_execution-5.0.5 webpack/JobWizard/steps/Schedule/RepeatCron.js
foreman_remote_execution-6.1.0 webpack/JobWizard/steps/Schedule/RepeatCron.js
foreman_remote_execution-5.0.4 webpack/JobWizard/steps/Schedule/RepeatCron.js
foreman_remote_execution-5.0.3 webpack/JobWizard/steps/Schedule/RepeatCron.js
foreman_remote_execution-6.0.0 webpack/JobWizard/steps/Schedule/RepeatCron.js
foreman_remote_execution-5.0.2 webpack/JobWizard/steps/Schedule/RepeatCron.js
foreman_remote_execution-5.1.0 webpack/JobWizard/steps/Schedule/RepeatCron.js
foreman_remote_execution-5.0.1 webpack/JobWizard/steps/Schedule/RepeatCron.js
foreman_remote_execution-5.0.0 webpack/JobWizard/steps/Schedule/RepeatCron.js