0 && avg <= this._consideredBadResponseTime,
- 'yellow': avg > this._consideredBadResponseTime
- })}>{monitoring.averageResponseTime}ms
)
-
- var rowClass = cx('list-row', monitoring.status.toLowerCase(), {disabled: !monitoring.enabled})
- let hostString = null
- if (monitoring.type === 'SERVER') {
- hostString = monitoring.hostname
- } else if (monitoring.type === 'SERVICE') {
- hostString = monitoring.url
- }
- return (
- {
- this.navigate(`/monitorings/${monitoring.id}`)
- }}>
-
-
{monitoring.name}
- ({hostString})
-
-
- last seen: {lastSeen}
-
-
-
- {checkResult}
-
-
- {pingResult}
-
-
- );
- }
-
-}
-// TODO: the numbers in here should be configurable!
-var MonitoringListItem = React.createClass({
-
- mixins: [NavigatesMixin],
-
- _consideredBadResponseTime: 5000,
-
- _onRowClicked: function () {
- this._navigate(`/monitorings/details/${this.props.monitoring.id}`);
- },
-
- render: function () {
-
- }
-});
-module.exports = MonitoringListItem;
diff --git a/grails-app/assets/javascripts/app/components/monitorings/monitoring-list.js b/grails-app/assets/javascripts/app/components/monitorings/monitoring-list.js
deleted file mode 100644
index d9f4d3f..0000000
--- a/grails-app/assets/javascripts/app/components/monitorings/monitoring-list.js
+++ /dev/null
@@ -1,235 +0,0 @@
-'use strict';
-
-import * as _ from 'lodash';
-
-var cx = require('classnames');
-
-import React from "react";
-import MonitoringListRow from "./monitoring-list-row";
-import LoadingHero from "../tools/loading-hero";
-import BaseComponent from "../tools/base-component";
-import ReactPaginate from "react-paginate";
-
-export default class MonitoringList extends BaseComponent {
-
- constructor(props) {
- super(props)
-
- this.state = {
- monitorings: null,
- unfilteredTotal: -1,
- showDisabled: false,
- type: null,
- status: null
- }
-
- this._bindThis('loadObjectsFromServer')
- }
-
- componentWillReceiveProps(newProps) {
- if (!this.props.urlParameters || _.get(newProps.urlParameters, 'offset') !== `${this.getOffset()}`) {
- this.loadObjectsFromServer(newProps.urlParameters)
- }
- }
-
- componentWillUnmount() {
- this.stopInterval();
- }
-
- componentDidMount() {
- this.setInterval(this.loadObjectsFromServer, 5000);
- }
-
- _toggleShowDisabled() {
- this.state.showDisabled = !this.state.showDisabled
- this.setState(this.state)
- this.loadObjectsFromServer()
- }
-
- _toggleTypeFilter(e) {
- var target = e.target
- if (target.nodeName === 'I') {
- target = target.parentElement
- }
- var type = target.getAttribute('data-type')
- if (this.state.type === type) {
- this.state.type = null;
- } else {
- this.state.type = type;
- }
- this.setState(this.state)
- this.loadObjectsFromServer();
- }
-
- _toggleStatusFilter() {
- switch (this.state.status) {
- case 'green' :
- this.state.status = null
- break
- case 'yellow' :
- this.state.status = 'green'
- break
- case 'red' :
- this.state.status = 'yellow'
- break
- default :
- this.state.status = 'red'
- }
- this.setState(this.state)
- this.loadObjectsFromServer()
- }
-
- _clearFilters() {
- this.state.type = null;
- this.state.status = null;
- this.state.showDisabled = false;
- this.setState(this.state);
- this.loadObjectsFromServer();
- }
-
- componentWillMount() {
- this._clearFilters()
- this.loadObjectsFromServer(true);
- }
-
- componentDidMount() {
- this.setInterval(this.loadObjectsFromServer, 10000);
- }
-
- loadObjectsFromServer(props) {
- let offset = _.get(props, 'offset') || this.getOffset();
- let max = _.get(props, 'max') || this.getMax();
-
- this.getMonitoringService().list({offset, max})
- .then(json=> {
- if (json.monitorings.length === 0 && offset > 0) {
- this.navigate("/monitorings/")
- } else {
- this.setState(_.assign(this.state, {
- monitorings: json.monitorings,
- unfilteredTotal: json.unfilteredTotal,
- total: json.total,
- loading: false
- }))
- }
- });
- }
-
- changePage(pageObj) {
- if (!this.state.loading) {
- let max = this.getMax();
- let offset = pageObj.selected * max;
- this.navigate(`/monitorings/?${querystring.stringify({max, offset})}`);
- }
- }
-
- render() {
- const {loading, monitorings, unfilteredTotal, total} = this.state
- let offset = this.getOffset();
- let max = this.getMax();
- if (unfilteredTotal === -1) {
- return