diff options
author | Oliver Poignant <oliver@poignant.se> | 2017-01-04 15:18:14 +0100 |
---|---|---|
committer | Oliver Poignant <oliver@poignant.se> | 2017-01-04 15:18:14 +0100 |
commit | 3b45ec948debb098ed7b7d3a1775b5e42a41be43 (patch) | |
tree | 4983a0f05598990212ca94a6c37f0e52cfd1315e /webui/src/Components/Timeline/EventNode.js | |
parent | c81d62005871d006c4d1feb0c27c15a469f60a35 (diff) | |
download | Git-Auto-Deploy-3b45ec948debb098ed7b7d3a1775b5e42a41be43.zip Git-Auto-Deploy-3b45ec948debb098ed7b7d3a1775b5e42a41be43.tar.gz Git-Auto-Deploy-3b45ec948debb098ed7b7d3a1775b5e42a41be43.tar.bz2 |
Support for browser notifications
Diffstat (limited to 'webui/src/Components/Timeline/EventNode.js')
-rw-r--r-- | webui/src/Components/Timeline/EventNode.js | 82 |
1 files changed, 5 insertions, 77 deletions
diff --git a/webui/src/Components/Timeline/EventNode.js b/webui/src/Components/Timeline/EventNode.js index 9e7bebc..74022a7 100644 --- a/webui/src/Components/Timeline/EventNode.js +++ b/webui/src/Components/Timeline/EventNode.js @@ -1,103 +1,31 @@ import React, { Component } from 'react'; import './EventNode.scss'; -import moment from 'moment'; class EventNode extends Component { - getColorClass() { - - if(this.props.event.type === "StartupEvent") - return "green"; - - if(this.props.event.type === "WebhookAction") - return "blue"; - - return "purple"; - } - - getTitle() { - - if(this.props.event.type === "StartupEvent") - return "Startup"; - - if(this.props.event.type === "WebhookAction") - return "Webhook"; - - return this.props.event.type; - } - - getSubtitle() { - - if(this.props.event.type === "StartupEvent") { - - if(this.isWaiting()) - return "Starting up.." - - return "Listening for incoming connections"; - } - - if(this.props.event.type === "WebhookAction") { - if(this.props.event.messages.length) - return this.props.event.messages[this.props.event.messages.length - 1] - return "Incoming request from " + this.props.event['client-address']; - } - - return this.props.event.type; - } - - getDate() { - return moment.unix(this.props.event.timestamp).format("YYYY-MM-DD"); - } - - getTime() { - return moment.unix(this.props.event.timestamp).format("HH:mm"); - } - - getIconName() { - - if(this.props.event.success === false) - return "alert" - - if(this.props.event.type === "StartupEvent") - return "alert-circle"; - - return "check"; - } - - isWaiting() { - if(this.props.event.type === "StartupEvent") { - if(this.props.event['ws-started'] !== true || this.props.event['http-started'] !== true) { - return true; - } - } else if(this.props.event.waiting === true) { - return true; - } - return false; - } - getIconElement() { - if(this.isWaiting()) { + if(this.props.event.isWaiting()) { return ( <div className="icon spinner"></div> ); } return ( - <i className={"icon mdi mdi-" + this.getIconName()} /> + <i className={"icon mdi mdi-" + this.props.event.getIconName()} /> ); } render() { return ( - <div className={"EventNode " + this.props.alignment + " " + this.getColorClass()}> + <div className={"EventNode " + this.props.alignment + " " + this.props.event.getColorClass()}> <span className="horizontal-line"></span> <span className="timeline-icon"></span> <div className="inner"> <div className="header"> {this.getIconElement()} - <p className="title">{this.getTitle()}</p> - <p className="subtitle">{this.getSubtitle()}</p> + <p className="title">{this.props.event.getTitle()}</p> + <p className="subtitle">{this.props.event.getSubtitle()}</p> </div> <div className="body"> {this.props.children} |