Răsfoiți Sursa

Merge pull request #1 from cloudbase/master

Update fork
smiclea 8 ani în urmă
părinte
comite
dcf69e3e80

+ 1 - 1
package.json

@@ -1,7 +1,7 @@
 {
   "private": true,
   "engines": {
-    "node": ">=5.0 <6",
+    "node": ">=5.0 <7",
     "npm": ">=3.3 <4"
   },
   "dependencies": {

+ 2 - 7
src/components/ReplicaList/ReplicaList.js

@@ -111,12 +111,7 @@ class ReplicaList extends Reflux.Component {
     if (count == 0) {
       tasksRemaining = "-"
     }
-
-    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}>
         <span className="cell cell-icon" onClick={(e) => this.replicaDetail(e, item)}>
@@ -134,7 +129,7 @@ class ReplicaList extends Reflux.Component {
         <span className={"cell " + s.composite} onClick={(e) => this.replicaDetail(e, item)}>
           <span className={s.label}>Last execution</span>
           <span className={s.value}>
-            {lastExecution ? <Moment format="MMM Do YYYY HH:mm" date={lastExecution} /> : "-"}
+            {item.lastExecution ? <Moment format="MMM Do YYYY HH:mm" date={Helper.getTimeObject(item.lastExecution)} /> : "-"}
           </span>
         </span>
         <span className={"cell " + s.composite} onClick={(e) => this.replicaDetail(e, item)}>

+ 18 - 2
src/components/Table/Table.js

@@ -51,7 +51,7 @@ class Table extends Component {
   }
 
 
-  toggleDrawer(e, index) {
+  toggleDrawer(index) {
     let newOpenState = this.state.openState
     let toggled = !newOpenState[index]
     for (let i in newOpenState) {
@@ -62,6 +62,21 @@ class Table extends Component {
     this.setState({ openState: newOpenState })
   }
 
+  rowMouseDown(e) {
+    this.dragStartPosition = {x: e.screenX, y: e.screenY};
+  }
+
+  rowMouseUp(e, index) {
+    this.dragStartPosition = this.dragStartPosition || {x: e.screenX, y: e.screenY};
+   
+    // If a drag operation has been initiated (i.e. text selection), don't call toggleDrawer
+    if (Math.abs(this.dragStartPosition.x - e.screenX) < 3 && Math.abs(this.dragStartPosition.y - e.screenY) < 3) {
+      this.toggleDrawer(index);
+    }
+
+    this.dragStartPosition = null;
+  }
+
   render() {
     let headerItems = this.props.headerItems.map((item, index) =>
       <div className={s.cell + " cell"} key={'headerItem_' + index}>{item.label}</div>
@@ -96,7 +111,8 @@ class Table extends Component {
           <div
             className={s.row + " row " + (this.state.openState[index] ? "isOpen" : "")}
             key={"row_" + index}
-            onClick={(e) => this.toggleDrawer(e, index)}
+            onMouseDown={e => this.rowMouseDown(e)}
+            onMouseUp={e => this.rowMouseUp(e, index)}
           >
             {row} {detailView}
           </div>)

+ 2 - 0
src/constants/CloudLabels.js

@@ -38,6 +38,8 @@ export const defaultLabels = {
   migr_image_name: "Migration Image Name",
   migr_image_name_map: "Migration Image Name Map",
   migr_image_id: "Migration Image ID",
+  migr_worker_use_config_drive: "Migration Worker use ConfigDrive",
+  migr_worker_use_fip: "Migration Worker use FIP",
   delete_disks_on_vm_termination: "Delete Disks on VM termination",
   set_dhcp: "Set DHCP",
   vm_size: "VM Size",

+ 1 - 1
src/stores/ConnectionsStore/ConnectionsStore.js

@@ -328,7 +328,7 @@ class ConnectionsStore extends Reflux.Store
               {label: "Yes", value: "true"},
               {label: "No", value: "false"}
             ]
-
+            field.default = field.default && "true"
             break
 
           case "string":

+ 3 - 1
src/stores/MigrationStore/MigrationStore.js

@@ -90,11 +90,13 @@ class MigrationStore extends Reflux.Store
 
       if (replica.executions.length) {
         MigrationActions.getReplicaExecutions(replica)
+        
+        replica.lastExecution = replica.executions[replica.executions.length - 1].created_at
       }
     })
 
     replicas.sort((a, b) => {
-      return moment(b.created_at).isAfter(moment(a.created_at))
+      return moment(b.lastExecution || b.created_at).isAfter(moment(a.lastExecution || a.created_at))
     })
 
     this.setState({

+ 1 - 1
src/stores/WizardStore/WizardStore.js

@@ -112,7 +112,7 @@ class WizardStore extends Reflux.Store
 
   onLoadInstanceDetail(endpoint, instance) {
     let projectId = Reflux.GlobalState.userStore.currentUser.project.id
-    let instanceNameBase64 = btoa(instance.name)
+    let instanceNameBase64 = btoa(instance.instance_name)
     let url = `${servicesUrl.coriolis}/${projectId}/endpoints/${endpoint.id}/instances/${instanceNameBase64}`
 
     Api.sendAjaxRequest({