Merge pull request #477 from abf/rosa-build:247-optimize_activity_feed_page

refactoring a monitoring page
This commit is contained in:
avokhmin 2015-05-19 19:15:43 +04:00
commit eb7b78d978
3 changed files with 13 additions and 2 deletions

View File

@ -57,6 +57,9 @@ RosaABF.controller('BuildListsController',
}, true); }, true);
$scope.getBuildLists = function() { $scope.getBuildLists = function() {
if ( $scope.isRequest) {
return;
}
// Disable 'Search' button // Disable 'Search' button
$scope.isRequest = true; $scope.isRequest = true;
@ -115,6 +118,7 @@ RosaABF.controller('BuildListsController',
// Enable 'Search' button // Enable 'Search' button
$scope.isRequest = false; $scope.isRequest = false;
});; });;
$scope.first_run = false;
} }
$scope.showRelated = function(build_list, disable_effect) { $scope.showRelated = function(build_list, disable_effect) {
@ -144,11 +148,11 @@ RosaABF.controller('BuildListsController',
$scope.refresh = function(force) { $scope.refresh = function(force) {
if ($('#autoreload').is(':checked') || force) { if ($('#autoreload').is(':checked') || force) {
var params = {}; var params = {};
_.each($("#monitoring_filter").serializeArray(), function(a){ _.each($("#monitoring_filter").serializeArray(), function(a){
if (a.value) { params[a.name] = a.value; } if (a.value) { params[a.name] = a.value; }
}); });
$location.search(params); $location.search(params);
$scope.first_run = false;
$scope.getBuildLists(); $scope.getBuildLists();
} }
if (!force) if (!force)
@ -163,6 +167,7 @@ RosaABF.controller('BuildListsController',
$scope.updateParams = function() { $scope.updateParams = function() {
var params = $location.search(); var params = $location.search();
$scope.params = { $scope.params = {
page: params.page || 1, page: params.page || 1,
per_page: params.per_page || 25, 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. # 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 # These are extensions that must be enabled in order to support this database
enable_extension "plpgsql" 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 ["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", "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 ["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 end
create_table "projects", force: true do |t| create_table "projects", force: true do |t|