<commit_before><template>
  <div>
    <div class="input-group">
      <input type="text" class="form-control" placeholder="Recurrence Rule" v-model="rruleString" disabled="true">
      <input type="hidden" v-model="rruleRaw" :name="name">
      <span class="input-group-btn">
        <a href="#" class="btn btn-default" data-toggle="modal" data-target="#recurrModal"><i class="fa fa-calendar"></i></a>
      </span>
    </div>
    <div class="recurrence-container modal" id="recurrModal" tabindex="-1" role="dialog">
      <div class="modal-dialog" role="document">
        <div class="modal-content">
          <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
            <h4 class="modal-title" id="myModalLabel">Configure recurrence</h4>
          </div>

          <div class="modal-body">
           <div class="row">
            <div class="frequencies-container col-xs-12">
              <ul class="list-inline">
                <li v-for="freq in frequencies" :key="freq.value">
                  <label>
                    <input type="radio" :value="freq.value" v-model="frequency">
                    {{freq.name}}
                  </label>
                </li>
              </ul>
              <hr/>
            </div>
          </div>
          <div class="row">
            <div class="weekdays col-xs-12">
              <ul class="list-inline">
                <li v-for="weekday in weekdays" :key="weekday.value">
                  <label><input type="checkbox" :value="weekday.value" v-model="byweekday">{{weekday.name}}</label>
                </li>
              </ul>
            </div>
          </div> <!-- .row -->
          <hr/>

          <div class="row">
            <div class="count col-xs-6 col-md-6">
              <div class="form-group">
                <label>Number of Times:</label>
                <input type="text" class="form-control" placeholder="e.g. 3 times" v-model="count">
              </div>
            </div>

            <div class="interval col-xs-6 col-md-6">
               <div class="form-group">
                <label>Occurrences:</label>
                <input type="text" class="form-control" placeholder="# of Occurrences" v-model="interval">
              </div>
            </div>
          </div>
          <hr/>
          <div class="row">
            <div class="col-xs-12">
              <ul class="list-inline">
                <li v-for="month in months" :key="month.value">
                  <label>
                    <input type="checkbox" :value="month.value" v-model="bymonth">
                    {{month.name}}
                  </label>
                </li>
              </ul>
            </div>
          </div>
          <hr/>
          <div class="row">
            <div class="col-xs-12">
                <strong>Recurrence:</strong> <em>{{rruleString}}</em><br/>
                <strong>Rule:</strong> <em>{{rruleRaw}}</em>
            </div>
          </div>

          </div>
          <div class="modal-footer">
            <button type="button" class="btn btn-default" @click="clearRRule">Clear</button>
            <button type="button" class="btn btn-primary" data-dismiss="modal">Save</button>
          </div>
        </div> <!-- modal-content -->
      </div> <!-- modal-dialog -->
     </div> <!-- recurrence-container -->
  </div> <!-- global container -->
</template>

<script>
import RRule from 'rrule'

export default {
  props: ['name', 'recurrenceData'],
  data () {
    return {
      rruleString: null,
      rruleRaw: null,
      count: null,
      interval: 1,
      frequency: null,
      byweekday: [],
      bymonth: [],
      months: [
        { name: 'Jan', value: 1 },
        { name: 'Feb', value: 2 },
        { name: 'Mar', value: 3 },
        { name: 'Apr', value: 4 },
        { name: 'May', value: 5 },
        { name: 'Jun', value: 6 },
        { name: 'Jul', value: 7 },
        { name: 'Aug', value: 8 },
        { name: 'Sep', value: 9 },
        { name: 'Oct', value: 10 },
        { name: 'Nov', value: 11 },
        { name: 'Dec', value: 12 }
      ],
      weekdays: [
        { name: 'MO', value: 'MO' },
        { name: 'TU', value: 'TU' },
        { name: 'WE', value: 'WE' },
        { name: 'TH', value: 'TH' },
        { name: 'FR', value: 'FR' },
        { name: 'SA', value: 'SA' },
        { name: 'SU', value: 'SU' }
      ],
      frequencies: [
        { name: 'Yearly', value: 0 },
        { name: 'Monthly', value: 1 },
        { name: 'Weekly', value: 2 },
        { name: 'Daily', value: 3 },
        { name: 'Hourly', value: 4 },
        { name: 'Minutely', value: 5 }
      ]
    }
  },
  computed: {
    recurrenceFields () {
      return [this.frequency, this.interval, this.count, this.byweekday, this.bymonth].join()
    }
  },
  mounted: function () {
    if (this.recurrenceData) {
      this.setRRule()
    }
  },
  watch: {
    recurrenceFields () {
      this.getRRule()
    }
  },
  methods: {
    clearRRule () {
      this.frequency = 0
      this.byweekday = []
      this.bymonth = []
      this.count = null
      this.interval = 1
      this.rruleRaw = null
      this.rruleString = null
    },
    getWeekdays (items) {
      const result = []

      if (!items.length) {
        return result
      }

      items.forEach(function (item) {
        result.push(RRule[item])
      })
<commit_msg>fixing linting of recurrence input (task #15912)<commit_after><template>
  <div>
    <div class="input-group">
      <input
        v-model="rruleString"
        type="text"
        class="form-control"
        placeholder="Recurrence Rule"
        disabled="true"
      >
      <input
        v-model="rruleRaw"
        :name="name"
        type="hidden"
      >
      <span class="input-group-btn">
        <a
          href="#"
          class="btn btn-default"
          data-toggle="modal"
          data-target="#recurrModal"
        >
          <i class="fa fa-calendar" />
        </a>
      </span>
    </div>
    <div
      id="recurrModal"
      class="recurrence-container modal"
      tabindex="-1"
      role="dialog"
    >
      <div
        class="modal-dialog"
        role="document"
      >
        <div class="modal-content">
          <div class="modal-header">
            <button
              type="button"
              class="close"
              data-dismiss="modal"
              aria-label="Close"
            >
              <span aria-hidden="true">&times;</span>
            </button>
            <h4
              id="myModalLabel"
              class="modal-title"
            >
              Configure recurrence
            </h4>
          </div>

          <div class="modal-body">
            <div class="row">
              <div class="frequencies-container col-xs-12">
                <ul class="list-inline">
                  <li
                    v-for="freq in frequencies"
                    :key="freq.value"
                  >
                    <label>
                      <input
                        v-model="frequency"
                        :value="freq.value"
                        type="radio"
                      >
                      {{ freq.name }}
                    </label>
                  </li>
                </ul>
                <hr>
              </div>
            </div>
            <div class="row">
              <div class="weekdays col-xs-12">
                <ul class="list-inline">
                  <li
                    v-for="weekday in weekdays"
                    :key="weekday.value"
                  >
                    <label>
                      <input
                        v-model="byweekday"
                        :value="weekday.value"
                        type="checkbox"
                      >
                      {{ weekday.name }}
                    </label>
                  </li>
                </ul>
              </div>
            </div> <!-- .row -->
            <hr>

            <div class="row">
              <div class="count col-xs-6 col-md-6">
                <div class="form-group">
                  <label>Number of Times:</label>
                  <input
                    v-model="count"
                    type="text"
                    class="form-control"
                    placeholder="e.g. 3 times"
                  >
                </div>
              </div>

              <div class="interval col-xs-6 col-md-6">
                <div class="form-group">
                  <label>Occurrences:</label>
                  <input
                    v-model="interval"
                    type="text"
                    class="form-control"
                    placeholder="# of Occurrences"
                  >
                </div>
              </div>
            </div>
            <hr>
            <div class="row">
              <div class="col-xs-12">
                <ul class="list-inline">
                  <li
                    v-for="month in months"
                    :key="month.value"
                  >
                    <label>
                      <input
                        v-model="bymonth"
                        :value="month.value"
                        type="checkbox"
                      >
                      {{ month.name }}
                    </label>
                  </li>
                </ul>
              </div>
            </div>
            <hr>
            <div class="row">
              <div class="col-xs-12">
                <strong>Recurrence:</strong> <em>{{ rruleString }}</em><br>
                <strong>Rule:</strong> <em>{{ rruleRaw }}</em>
              </div>
            </div>
          </div>
          <div class="modal-footer">
            <button
              type="button"
              class="btn btn-default"
              @click="clearRRule"
            >
              Clear
            </button>
            <button
              type="button"
              class="btn btn-primary"
              data-dismiss="modal"
            >
              Save
            </button>
          </div>
        </div> <!-- modal-content -->
      </div> <!-- modal-dialog -->
    </div> <!-- recurrence-container -->
  </div> <!-- global container -->
</template>

<script>
import RRule from 'rrule'

export default {
  props: [
    'name',
    'recurrenceData'
  ],
  data () {
    return {
      rruleString: null,
      rruleRaw: null,
      count: null,
      interval: 1,
      frequency: null,
      byweekday: [],
      bymonth: [],
      months: [
        { name: 'Jan', value: 1 },
        { name: 'Feb', value: 2 },
        { name: 'Mar', value: 3 },
        { name: 'Apr', value: 4 },
        { name: 'May', value: 5 },
        { name: 'Jun', value: 6 },
        { name: 'Jul', value: 7 },
        { name: 'Aug', value: 8 },
        { name: 'Sep', value: 9 },
        { name: 'Oct', value: 10 },
        { name: 'Nov', value: 11 },
        { name: 'Dec', value: 12 }
      ],
      weekdays: [
        { name: 'MO', value: 'MO' },
        { name: 'TU', value: 'TU' },
        { name: 'WE', value: 'WE' },
        { name: 'TH', value: 'TH' },
        { name: 'FR', value: 'FR' },
        { name: 'SA', value: 'SA' },
        { name: 'SU', value: 'SU' }
      ],
      frequencies: [
        { name: 'Yearly', value: 0 },
        { name: 'Monthly', value: 1 },
        { name: 'Weekly', value: 2 },
        { name: 'Daily', value: 3 },
        { name: 'Hourly', value: 4 },
        { name: 'Minutely', value: 5 }
      ]
    }
  },
  computed: {
    recurrenceFields () {
      return [this.frequency, this.interval, this.count, this.byweekday, this.bymonth].join()
    }
  },
  watch: {
    recurrenceFields () {
      this.getRRule()
    }
  },
  mounted () {
    if (this.recurrenceData) {
      this.setRRule()
    }
  },
  methods: {
    clearRRule () {
      this.frequency = 0
      this.byweekday = []
      this.bymonth = []
      this.count = null
      this.interval = 1
      this.rruleRaw = null
      this.rruleString = null
    },
    getWeekdays (items) {
      const result = []

      if (!items.length) {
        return result
      }

      items.forEach(function (item) {
        result.push(RRule[item])
      })

{'fraction_non_alphanumeric': 0.15951764325024279, 'fraction_numerical': 0.006879248947879573, 'mean_word_length': 1.2369659666908037, 'pattern_counts': {'":': 0, '<': 218, '<?xml version=': 0, '>': 218, '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': '5821416', 'n_tokens_mistral': 3728, 'n_tokens_neox': 3544, 'n_words': 746}