<commit_before>React = require 'react'

GatebluAddDeviceStatus                 = require '../models/gateblu/gateblu-add-device-status'
GatebluAddDeviceSuccessOverTime        = require '../models/gateblu/gateblu-add-device-success-over-time'
GatebluAddDeviceAvgElapsedTime         = require '../models/gateblu/gateblu-add-device-avg-elapsed-time'
GatebluAddDeviceAvgElapsedTimeOverTime = require '../models/gateblu/gateblu-add-device-avg-elapsed-time-over-time'

OverTimeGauge       = require './over-time-gauge'
StatusGauge         = require './flow-status/status-gauge'
AvgElapsedTimeGauge = require './flow-status/avg-elapsed-time-gauge'

GatebluDashboard = React.createClass
  displayName: 'GatebluDashboard'

  getInitialState: ->
    total: 0
    successes: 0
    failures: 0
    successPercentage: 0
    avgElapsedTime: 0
    gatebluAddDeviceSuccessOverTime:
      index: 'gateblu_device_add'
      datasets: []
      labels: []

  componentWillMount: ->
    @gatebluAddDeviceStatus = new GatebluAddDeviceStatus index: "gateblu_device_add"
    @gatebluAddDeviceStatus.on 'change', =>
      @setState @gatebluAddDeviceStatus.toJSON()

    @gatebluAddDeviceSuccessOverTime = new GatebluAddDeviceSuccessOverTime index: "gateblu_device_add"
    @gatebluAddDeviceSuccessOverTime.on 'change', =>
      @setState gatebluAddDeviceSuccessOverTime: @gatebluAddDeviceSuccessOverTime.toJSON()

    @gatebluAddDeviceAvgElapsedTime = new GatebluAddDeviceAvgElapsedTime index: "gateblu_device_add"
    @gatebluAddDeviceAvgElapsedTime.on 'change', =>
      @setState @gatebluAddDeviceAvgElapsedTime.toJSON()

    @gatebluAddDeviceAvgElapsedTimeOverTime = new GatebluAddDeviceAvgElapsedTimeOverTime index: "gateblu_device_add"
    @gatebluAddDeviceAvgElapsedTimeOverTime.on 'change', =>
      @setState elapsedTimeChartData: @gatebluAddDeviceAvgElapsedTimeOverTime.toJSON()

  componentDidMount: ->
    @periodicallyFetchForModel @gatebluAddDeviceStatus
    @periodicallyFetchForModel @gatebluAddDeviceSuccessOverTime
    @periodicallyFetchForModel @gatebluAddDeviceAvgElapsedTime
    @periodicallyFetchForModel @gatebluAddDeviceAvgElapsedTimeOverTime

  periodicallyFetchForModel: (model) ->
    setInterval model.fetch, 60 * 1000
    model.fetch()

  render: ->
    <div className="dashboard">
      <StatusGauge
        title="Gateblu Add Device Success Rate"
        failures={@state.failures}
        successes={@state.successes}
        successPercentage={@state.successPercentage}
        total={@state.total} />

      <OverTimeGauge
        title="Gateblu Add Device Success Over Time"
        suffix="%"
        elapsedTimeChartData={@state.gatebluAddDeviceSuccessOverTime} />

      <AvgElapsedTimeGauge
        title="Gateblu Add Device Average Time"
        avgElapsedTime={@state.avgElapsedTime} />

      <OverTimeGauge
        title="Gateblu Add Device Average Time Over Time"<commit_msg>moved graphs to bottom row<commit_after>React = require 'react'

GatebluAddDeviceStatus                 = require '../models/gateblu/gateblu-add-device-status'
GatebluAddDeviceSuccessOverTime        = require '../models/gateblu/gateblu-add-device-success-over-time'
GatebluAddDeviceAvgElapsedTime         = require '../models/gateblu/gateblu-add-device-avg-elapsed-time'
GatebluAddDeviceAvgElapsedTimeOverTime = require '../models/gateblu/gateblu-add-device-avg-elapsed-time-over-time'

OverTimeGauge       = require './over-time-gauge'
StatusGauge         = require './flow-status/status-gauge'
AvgElapsedTimeGauge = require './flow-status/avg-elapsed-time-gauge'

GatebluDashboard = React.createClass
  displayName: 'GatebluDashboard'

  getInitialState: ->
    total: 0
    successes: 0
    failures: 0
    successPercentage: 0
    avgElapsedTime: 0
    gatebluAddDeviceSuccessOverTime:
      index: 'gateblu_device_add'
      datasets: []
      labels: []

  componentWillMount: ->
    @gatebluAddDeviceStatus = new GatebluAddDeviceStatus index: "gateblu_device_add"
    @gatebluAddDeviceStatus.on 'change', =>
      @setState @gatebluAddDeviceStatus.toJSON()

    @gatebluAddDeviceSuccessOverTime = new GatebluAddDeviceSuccessOverTime index: "gateblu_device_add"
    @gatebluAddDeviceSuccessOverTime.on 'change', =>
      @setState gatebluAddDeviceSuccessOverTime: @gatebluAddDeviceSuccessOverTime.toJSON()

    @gatebluAddDeviceAvgElapsedTime = new GatebluAddDeviceAvgElapsedTime index: "gateblu_device_add"
    @gatebluAddDeviceAvgElapsedTime.on 'change', =>
      @setState @gatebluAddDeviceAvgElapsedTime.toJSON()

    @gatebluAddDeviceAvgElapsedTimeOverTime = new GatebluAddDeviceAvgElapsedTimeOverTime index: "gateblu_device_add"
    @gatebluAddDeviceAvgElapsedTimeOverTime.on 'change', =>
      @setState elapsedTimeChartData: @gatebluAddDeviceAvgElapsedTimeOverTime.toJSON()

  componentDidMount: ->
    @periodicallyFetchForModel @gatebluAddDeviceStatus
    @periodicallyFetchForModel @gatebluAddDeviceSuccessOverTime
    @periodicallyFetchForModel @gatebluAddDeviceAvgElapsedTime
    @periodicallyFetchForModel @gatebluAddDeviceAvgElapsedTimeOverTime

  periodicallyFetchForModel: (model) ->
    setInterval model.fetch, 60 * 1000
    model.fetch()

  render: ->
    <div className="dashboard">
      <StatusGauge
        title="Gateblu Add Device Success Rate"
        failures={@state.failures}
        successes={@state.successes}
        successPercentage={@state.successPercentage}
        total={@state.total} />

      <AvgElapsedTimeGauge
        title="Gateblu Add Device Average Time"
        avgElapsedTime={@state.avgElapsedTime} />

      <OverTimeGauge
        title="Gateblu Add Device Success Over Time"
        suffix="%"
        elapsedTimeChartData={@state.gatebluAddDeviceSuccessOverTime} />

      <OverTimeGauge
        title="Gateblu Add Device Average Time Over Time"
{'fraction_non_alphanumeric': 0.09139506811519227, 'fraction_numerical': 0.0037937575444042075, 'mean_word_length': 4.2205220522052205, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 29, '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': '3617084', 'n_tokens_mistral': 1850, 'n_tokens_neox': 1813, 'n_words': 275}