github.com/manicqin/nomad@v0.9.5/ui/app/components/freestyle/sg-table.js (about) 1 import Component from '@ember/component'; 2 import { computed } from '@ember/object'; 3 import productMetadata from 'nomad-ui/utils/styleguide/product-metadata'; 4 5 export default Component.extend({ 6 searchTerm: '', 7 8 currentPage: 1, 9 sortProperty: 'name', 10 sortDescending: false, 11 12 shortList: productMetadata, 13 14 longList: [ 15 { city: 'New York', growth: 0.048, population: '8405837', rank: '1', state: 'New York' }, 16 { city: 'Los Angeles', growth: 0.048, population: '3884307', rank: '2', state: 'California' }, 17 { city: 'Chicago', growth: -0.061, population: '2718782', rank: '3', state: 'Illinois' }, 18 { city: 'Houston', growth: 0.11, population: '2195914', rank: '4', state: 'Texas' }, 19 { 20 city: 'Philadelphia', 21 growth: 0.026, 22 population: '1553165', 23 rank: '5', 24 state: 'Pennsylvania', 25 }, 26 { city: 'Phoenix', growth: 0.14, population: '1513367', rank: '6', state: 'Arizona' }, 27 { city: 'San Antonio', growth: 0.21, population: '1409019', rank: '7', state: 'Texas' }, 28 { city: 'San Diego', growth: 0.105, population: '1355896', rank: '8', state: 'California' }, 29 { city: 'Dallas', growth: 0.056, population: '1257676', rank: '9', state: 'Texas' }, 30 { city: 'San Jose', growth: 0.105, population: '998537', rank: '10', state: 'California' }, 31 { city: 'Austin', growth: 0.317, population: '885400', rank: '11', state: 'Texas' }, 32 { city: 'Indianapolis', growth: 0.078, population: '843393', rank: '12', state: 'Indiana' }, 33 { city: 'Jacksonville', growth: 0.143, population: '842583', rank: '13', state: 'Florida' }, 34 { 35 city: 'San Francisco', 36 growth: 0.077, 37 population: '837442', 38 rank: '14', 39 state: 'California', 40 }, 41 { city: 'Columbus', growth: 0.148, population: '822553', rank: '15', state: 'Ohio' }, 42 { 43 city: 'Charlotte', 44 growth: 0.391, 45 population: '792862', 46 rank: '16', 47 state: 'North Carolina', 48 }, 49 { city: 'Fort Worth', growth: 0.451, population: '792727', rank: '17', state: 'Texas' }, 50 { city: 'Detroit', growth: -0.271, population: '688701', rank: '18', state: 'Michigan' }, 51 { city: 'El Paso', growth: 0.194, population: '674433', rank: '19', state: 'Texas' }, 52 { city: 'Memphis', growth: -0.053, population: '653450', rank: '20', state: 'Tennessee' }, 53 { city: 'Seattle', growth: 0.156, population: '652405', rank: '21', state: 'Washington' }, 54 { city: 'Denver', growth: 0.167, population: '649495', rank: '22', state: 'Colorado' }, 55 { 56 city: 'Washington', 57 growth: 0.13, 58 population: '646449', 59 rank: '23', 60 state: 'District of Columbia', 61 }, 62 { city: 'Boston', growth: 0.094, population: '645966', rank: '24', state: 'Massachusetts' }, 63 { 64 city: 'Nashville-Davidson', 65 growth: 0.162, 66 population: '634464', 67 rank: '25', 68 state: 'Tennessee', 69 }, 70 { city: 'Baltimore', growth: -0.04, population: '622104', rank: '26', state: 'Maryland' }, 71 { city: 'Oklahoma City', growth: 0.202, population: '610613', rank: '27', state: 'Oklahoma' }, 72 { 73 city: 'Louisville/Jefferson County', 74 growth: 0.1, 75 population: '609893', 76 rank: '28', 77 state: 'Kentucky', 78 }, 79 { city: 'Portland', growth: 0.15, population: '609456', rank: '29', state: 'Oregon' }, 80 { city: 'Las Vegas', growth: 0.245, population: '603488', rank: '30', state: 'Nevada' }, 81 { city: 'Milwaukee', growth: 0.003, population: '599164', rank: '31', state: 'Wisconsin' }, 82 { city: 'Albuquerque', growth: 0.235, population: '556495', rank: '32', state: 'New Mexico' }, 83 { city: 'Tucson', growth: 0.075, population: '526116', rank: '33', state: 'Arizona' }, 84 { city: 'Fresno', growth: 0.183, population: '509924', rank: '34', state: 'California' }, 85 { city: 'Sacramento', growth: 0.172, population: '479686', rank: '35', state: 'California' }, 86 { city: 'Long Beach', growth: 0.015, population: '469428', rank: '36', state: 'California' }, 87 { city: 'Kansas City', growth: 0.055, population: '467007', rank: '37', state: 'Missouri' }, 88 { city: 'Mesa', growth: 0.135, population: '457587', rank: '38', state: 'Arizona' }, 89 { city: 'Virginia Beach', growth: 0.051, population: '448479', rank: '39', state: 'Virginia' }, 90 { city: 'Atlanta', growth: 0.062, population: '447841', rank: '40', state: 'Georgia' }, 91 { 92 city: 'Colorado Springs', 93 growth: 0.214, 94 population: '439886', 95 rank: '41', 96 state: 'Colorado', 97 }, 98 { city: 'Omaha', growth: 0.059, population: '434353', rank: '42', state: 'Nebraska' }, 99 { city: 'Raleigh', growth: 0.487, population: '431746', rank: '43', state: 'North Carolina' }, 100 { city: 'Miami', growth: 0.149, population: '417650', rank: '44', state: 'Florida' }, 101 { city: 'Oakland', growth: 0.013, population: '406253', rank: '45', state: 'California' }, 102 { city: 'Minneapolis', growth: 0.045, population: '400070', rank: '46', state: 'Minnesota' }, 103 { city: 'Tulsa', growth: 0.013, population: '398121', rank: '47', state: 'Oklahoma' }, 104 { city: 'Cleveland', growth: -0.181, population: '390113', rank: '48', state: 'Ohio' }, 105 { city: 'Wichita', growth: 0.097, population: '386552', rank: '49', state: 'Kansas' }, 106 { city: 'Arlington', growth: 0.133, population: '379577', rank: '50', state: 'Texas' }, 107 ], 108 109 filteredShortList: computed('searchTerm', 'shortList.[]', function() { 110 const term = this.searchTerm.toLowerCase(); 111 return this.shortList.filter(product => product.name.toLowerCase().includes(term)); 112 }), 113 114 sortedShortList: computed('shortList.[]', 'sortProperty', 'sortDescending', function() { 115 const sorted = this.shortList.sortBy(this.sortProperty); 116 return this.sortDescending ? sorted.reverse() : sorted; 117 }), 118 });