Clean up meas search a bit
This commit is contained in:
		
							parent
							
								
									62426cff9d
								
							
						
					
					
						commit
						a354ecd639
					
				
					 4 changed files with 7 additions and 15 deletions
				
			
		| 
						 | 
					@ -1,18 +1,15 @@
 | 
				
			||||||
import Ember from 'ember';
 | 
					import Ember from 'ember';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export default Ember.Component.extend({
 | 
					export default Ember.Component.extend({
 | 
				
			||||||
  isLoading: false,
 | 
					 | 
				
			||||||
  actions: {
 | 
					  actions: {
 | 
				
			||||||
    search: function() {
 | 
					    search: function() {
 | 
				
			||||||
      this.set('isLoading', true);
 | 
					 | 
				
			||||||
      let strain = this.get('selectedStrain');
 | 
					      let strain = this.get('selectedStrain');
 | 
				
			||||||
      let characteristic = this.get('selectedCharacteristic');
 | 
					      let characteristic = this.get('selectedCharacteristic');
 | 
				
			||||||
      if ((strain === 'all') && (characteristic === 'all')) {
 | 
					      if ((strain === 'all') && (characteristic === 'all')) {
 | 
				
			||||||
        this.store.findAll('measurement').then((measurements)=>{
 | 
					        this.store.findAll('measurement').then((measurements)=>{
 | 
				
			||||||
          this.set('measurements', measurements);
 | 
					          this.set('measurements', measurements);
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
        this.set('isLoading', false);
 | 
					        return;
 | 
				
			||||||
        return false;
 | 
					 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
      let search = {};
 | 
					      let search = {};
 | 
				
			||||||
      if (strain !== 'all') {
 | 
					      if (strain !== 'all') {
 | 
				
			||||||
| 
						 | 
					@ -24,8 +21,6 @@ export default Ember.Component.extend({
 | 
				
			||||||
      this.store.find('measurement', search).then((measurements)=>{
 | 
					      this.store.find('measurement', search).then((measurements)=>{
 | 
				
			||||||
        this.set('measurements', measurements);
 | 
					        this.set('measurements', measurements);
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
      this.set('isLoading', false);
 | 
					 | 
				
			||||||
      return false;
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -10,7 +10,7 @@
 | 
				
			||||||
</div>
 | 
					</div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
{{#if isLoading}}
 | 
					{{#if isLoading}}
 | 
				
			||||||
  {{!-- This doesn't work yet --}}
 | 
					  {{!-- This doesn't work yet, something is blocking --}}
 | 
				
			||||||
  {{loading-panel}}
 | 
					  {{loading-panel}}
 | 
				
			||||||
{{else}}
 | 
					{{else}}
 | 
				
			||||||
  <table class="flakes-table">
 | 
					  <table class="flakes-table">
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -10,13 +10,6 @@ export default Ember.Route.extend(AuthenticatedRouteMixin, {
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  setupController: function(controller, models) {
 | 
					  setupController: function(controller, models) {
 | 
				
			||||||
    var tableAttrs = [
 | 
					 | 
				
			||||||
      { name: 'Strain', attr: 'strain.strainName' },
 | 
					 | 
				
			||||||
      { name: 'Characteristic', attr: 'characteristic.characteristicName' },
 | 
					 | 
				
			||||||
      { name: 'Value', attr: 'computedValue'}
 | 
					 | 
				
			||||||
    ];
 | 
					 | 
				
			||||||
    controller.set('tableAttrs', tableAttrs);
 | 
					 | 
				
			||||||
    controller.set('row', 'measurement-index-row');
 | 
					 | 
				
			||||||
    controller.set('measurements', []);
 | 
					    controller.set('measurements', []);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Set up search parameters
 | 
					    // Set up search parameters
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -28,4 +28,8 @@
 | 
				
			||||||
  </div>
 | 
					  </div>
 | 
				
			||||||
</div>
 | 
					</div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
{{measurement-search-table}}
 | 
					{{
 | 
				
			||||||
 | 
					  measurement-search-table
 | 
				
			||||||
 | 
					  selectedStrain=selectedStrain
 | 
				
			||||||
 | 
					  selectedCharacteristic=selectedCharacteristic
 | 
				
			||||||
 | 
					}}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Reference in a new issue