Răsfoiți Sursa

Adds last execution for replicas

George Vrancianu 8 ani în urmă
părinte
comite
e58d813392

+ 6 - 3
src/components/ReplicaExecutions/ReplicaExecutions.js

@@ -18,7 +18,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 import React, { Component, PropTypes } from 'react';
 import withStyles from 'isomorphic-style-loader/lib/withStyles';
 import s from './ReplicaExecutions.scss';
-import Dropdown from '../NewDropdown';
+import Helper from '../Helper';
 import LoadingIcon from '../LoadingIcon';
 import moment from 'moment';
 import MigrationActions from '../../actions/MigrationActions';
@@ -171,7 +171,9 @@ class ReplicaExecutions extends Component {
         }
 
         let executionsSorted = this.props.replica.executions
+
         executionsSorted.sort((a, b) => a.number - b.number)
+        let executionTime = Helper.getTimeObject(this.state.executionRef.created_at)
 
         return (
           <div className={s.root}>
@@ -185,10 +187,11 @@ class ReplicaExecutions extends Component {
                 <div className={s.leftSide}>
                   <h4>Execution #{this.state.executionRef && this.state.executionRef.number}</h4>
                   <span className={s.date}>
-                    {this.state.executionRef && moment(this.state.executionRef.created_at).format("MMM Do YYYY HH:mm")}
+                    {this.state.executionRef && moment(executionTime).format("MMM Do YYYY HH:mm")}
                   </span>
                   <span
-                    className={"status-pill " + this.state.executionRef.status}>{this.state.executionRef.status}</span>
+                    className={"status-pill " + this.state.executionRef.status}
+                  >{this.state.executionRef.status}</span>
                 </div>
                 <div className={s.rightSide}>
                   {executionBtn}

+ 6 - 3
src/components/ReplicaList/ReplicaList.js

@@ -112,7 +112,10 @@ class ReplicaList extends Reflux.Component {
       tasksRemaining = "-"
     }
 
-    let createdAt = Helper.getTimeObject(item.created_at)
+    let lastExecution = null
+    if (item.executions.length) {
+      lastExecution = Helper.getTimeObject(item.executions[item.executions.length - 1].created_at)
+    }
 
     return (
       <div className={"item " + (item.selected ? "selected" : "")} key={"replica_" + item.id}>
@@ -129,9 +132,9 @@ class ReplicaList extends Reflux.Component {
           <div className={s.cloudImage + " icon small-cloud " + item.destination_endpoint_type}></div>
         </span>
         <span className={"cell " + s.composite} onClick={(e) => this.replicaDetail(e, item)}>
-          <span className={s.label}>Created</span>
+          <span className={s.label}>Last execution</span>
           <span className={s.value}>
-            <Moment format="MMM Do YYYY HH:mm" date={createdAt} />
+            {lastExecution ? <Moment format="MMM Do YYYY HH:mm" date={lastExecution} /> : "-"}
           </span>
         </span>
         <span className={"cell " + s.composite} onClick={(e) => this.replicaDetail(e, item)}>