[#247] monitoring page: fix double request + add index

This commit is contained in:
Alexander Machehin 2015-05-19 16:31:36 +05:00
parent 3133bea575
commit 8ec6707548
3 changed files with 13 additions and 2 deletions

View File

@ -57,6 +57,9 @@ RosaABF.controller('BuildListsController',
}, true);
$scope.getBuildLists = function() {
if ( $scope.isRequest) {
return;
}
// Disable 'Search' button
$scope.isRequest = true;
@ -115,6 +118,7 @@ RosaABF.controller('BuildListsController',
// Enable 'Search' button
$scope.isRequest = false;
});;
$scope.first_run = false;
}
$scope.showRelated = function(build_list, disable_effect) {
@ -144,11 +148,11 @@ RosaABF.controller('BuildListsController',
$scope.refresh = function(force) {
if ($('#autoreload').is(':checked') || force) {
var params = {};
_.each($("#monitoring_filter").serializeArray(), function(a){
if (a.value) { params[a.name] = a.value; }
});
$location.search(params);
$scope.first_run = false;
$scope.getBuildLists();
}
if (!force)
@ -163,6 +167,7 @@ RosaABF.controller('BuildListsController',
$scope.updateParams = function() {
var params = $location.search();
$scope.params = {
page: params.page || 1,
per_page: params.per_page || 25,

View File

@ -0,0 +1,5 @@
class AddUpdatedAtIndexToBuildList < ActiveRecord::Migration
def change
add_index :build_lists, :updated_at, order: { updated_at: :desc }
end
end

View File

@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20150502145718) do
ActiveRecord::Schema.define(version: 20150519032855) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@ -155,6 +155,7 @@ ActiveRecord::Schema.define(version: 20150502145718) do
t.index ["mass_build_id", "status"], :name => "index_build_lists_on_mass_build_id_and_status"
t.index ["project_id", "save_to_repository_id", "build_for_platform_id", "arch_id"], :name => "maintainer_search_index"
t.index ["project_id"], :name => "index_build_lists_on_project_id"
t.index ["updated_at"], :name => "index_build_lists_on_updated_at", :order => {"updated_at" => :desc}
end
create_table "projects", force: true do |t|