Procházet zdrojové kódy

- Adds status filtering, removes old migration/replica filter

George Vrancianu před 9 roky
rodič
revize
f132a1d983

+ 1 - 1
src/components/FilteredTable/FilteredTable.js

@@ -62,7 +62,7 @@ class FilteredTable extends Component {
     let queryResult = []
     if (this.props.items.length) {
       this.props.items.forEach((item) => {
-        if (this.props.filterFn(item, this.props.queryText, this.props.filterType)) {
+        if (this.props.filterFn(item, this.props.queryText, this.props.filterType, this.props.filterStatus)) {
           queryResult.push(item)
         }
       }, this)

+ 13 - 4
src/components/MigrationList/MigrationList.js

@@ -59,6 +59,7 @@ class MigrationList extends Reflux.Component {
       title: props.type == "migrations" ? "Migrations" : "Replicas",
       queryText: '',
       filterType: props.type == "migrations" ? "migration" : "replica",
+      filterStatus: "all",
       currentProject: "My Project",
       searchMin: true,
       filteredData: [],
@@ -176,10 +177,17 @@ class MigrationList extends Reflux.Component {
     })
   }
 
-  filterFn(item, queryText, filterType) {
+  filterStatus(e, status) {
+    this.setState({ filterStatus: status }, () => {
+      this.searchItem({ target: { value: this.state.queryText } })
+    })
+  }
+
+  filterFn(item, queryText, filterType, filterStatus) {
     return (
       item.name.toLowerCase().indexOf(queryText.toLowerCase()) != -1 &&
-      (filterType == "all" || filterType == item.type)
+      (filterType == "all" || filterType == item.type) &&
+      (filterStatus == "all" || filterStatus == item.status)
     )
   }
 
@@ -338,9 +346,9 @@ class MigrationList extends Reflux.Component {
     let _this = this
     let itemStates = statusTypes.map((state, index) => (
         <a
-          className={_this.state.filterType == state.type || (_this.state.filterType == null && state.type == "all") ?
+          className={_this.state.filterStatus == state.type || (_this.state.filterStatus == null && state.type == "all") ?
             "selected" : ""}
-          onClick={(e) => _this.filterType(e, state.type)} key={"status_" + index}
+          onClick={(e) => _this.filterStatus(e, state.type)} key={"status_" + index}
         >{state.label}</a>
       )
     )
@@ -397,6 +405,7 @@ class MigrationList extends Reflux.Component {
               filterFn={this.filterFn}
               queryText={this.state.queryText}
               filterType={this.state.filterType}
+              filterStatus={this.state.filterStatus}
               renderSearch={(e) => this.renderSearch(e)}
             ></FilteredTable>
           </div>

+ 1 - 1
src/components/WizardSummary/WizardSummary.js

@@ -142,7 +142,7 @@ class WizardSummary extends Component {
                   </span>
                 </div>
                 <div className={s.row}>
-                  <span>Flavour:</span>
+                  <span>Flavor:</span>
                   <span>{this.props.summary.sourceCloud.autoFlavors ?
                     "Automatic Flavor Selection" : "Manual Flavor Selection"}</span>
                 </div>