import Ember from 'ember';
const methods = ['get', 'put', 'patch', 'post', 'delete', 'options'];
const { floor, random } = Math;
export default Ember.Controller.extend({

  data: Ember.computed(function(){
    var content=Ember.A([]);
  	for(var i=0; i<1000000; i++) {
  		content.push({
          no: i,
          method: methods[floor(random() * 6)],
          url: 'http://example.com/path/' + i,
          x: floor((random() + 0.1) * 10000000),
          y: floor((random() + 0.1) * 10000000),
          z: floor((random() + 0.1) * 10000000)
  		});
  	}
    return content;
  }),


  queryParams: ['page', 'perPage'],
  page: 1,
  perPage: 10,
  perPageOptions: [10,20,50,100,500],
  
  actions: {
    setPaginationParams(apiPage, page, perPage) {
      this.set('page', page);
      this.set('perPage', perPage);
    }
  }
});
