Merge pull request #401 from abf/rosa-build:397-dependent-packages
#397: display dependent projects
This commit is contained in:
commit
4953c228ff
|
@ -82,7 +82,7 @@ GEM
|
||||||
ancestry (2.0.0)
|
ancestry (2.0.0)
|
||||||
activerecord (>= 3.0.0)
|
activerecord (>= 3.0.0)
|
||||||
angular-i18n (0.1.2)
|
angular-i18n (0.1.2)
|
||||||
angularjs-rails (1.2.14)
|
angularjs-rails (1.2.16)
|
||||||
arbre (1.0.1)
|
arbre (1.0.1)
|
||||||
activesupport (>= 3.0.0)
|
activesupport (>= 3.0.0)
|
||||||
arel (4.0.2)
|
arel (4.0.2)
|
||||||
|
|
|
@ -21,22 +21,27 @@ RosaABF.controller('BuildListController', ['$scope', '$http', '$timeout', 'Sound
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$scope.canRefresh = function() {
|
||||||
|
if ($scope.attach_advisory != 'no') { return false; }
|
||||||
|
if (!$scope.build_list) { return true; }
|
||||||
|
|
||||||
|
var show_dependent_projects = _.find($scope.build_list.packages, function(p){
|
||||||
|
return p.show_dependent_projects;
|
||||||
|
});
|
||||||
|
if (show_dependent_projects) { return false; }
|
||||||
|
if (!(
|
||||||
|
$scope.build_list.status == <%=BuildList::BUILD_PUBLISHED%> ||
|
||||||
|
$scope.build_list.status == <%=BuildList::REJECTED_PUBLISH%> ||
|
||||||
|
$scope.build_list.status == <%=BuildList::FAILED_PUBLISH%> ||
|
||||||
|
$scope.build_list.status == <%=BuildList::BUILD_CANCELED%> ||
|
||||||
|
$scope.build_list.status == <%=BuildList::BUILD_ERROR%>
|
||||||
|
)) { return true; }
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
$scope.cancelRefresh = null;
|
$scope.cancelRefresh = null;
|
||||||
$scope.refresh = function() {
|
$scope.refresh = function() {
|
||||||
if ( $scope.attach_advisory == 'no' &&
|
if ($scope.canRefresh()) { $scope.getBuildList(); }
|
||||||
(
|
|
||||||
!$scope.build_list ||
|
|
||||||
!(
|
|
||||||
$scope.build_list.status == <%=BuildList::BUILD_PUBLISHED%> ||
|
|
||||||
$scope.build_list.status == <%=BuildList::REJECTED_PUBLISH%> ||
|
|
||||||
$scope.build_list.status == <%=BuildList::FAILED_PUBLISH%> ||
|
|
||||||
$scope.build_list.status == <%=BuildList::BUILD_CANCELED%> ||
|
|
||||||
$scope.build_list.status == <%=BuildList::BUILD_ERROR%>
|
|
||||||
)
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
$scope.getBuildList();
|
|
||||||
}
|
|
||||||
$scope.cancelRefresh = $timeout($scope.refresh, 10000);
|
$scope.cancelRefresh = $timeout($scope.refresh, 10000);
|
||||||
}
|
}
|
||||||
$scope.refresh();
|
$scope.refresh();
|
||||||
|
|
|
@ -2048,7 +2048,7 @@ article .activity .top {
|
||||||
}
|
}
|
||||||
|
|
||||||
table tbody {
|
table tbody {
|
||||||
td.build-list-statuses {
|
td.build-list-statuses, td.package {
|
||||||
background: #FFF;
|
background: #FFF;
|
||||||
|
|
||||||
.status {
|
.status {
|
||||||
|
|
|
@ -18,6 +18,29 @@ module BuildListsHelper
|
||||||
Platform.availables_main_platforms current_user, current_ability
|
Platform.availables_main_platforms current_user, current_ability
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def dependent_projects(package)
|
||||||
|
return [] if package.dependent_packages.blank?
|
||||||
|
|
||||||
|
packages = BuildList::Package.
|
||||||
|
select('build_list_packages.project_id, build_list_packages.name').
|
||||||
|
joins(:build_list).
|
||||||
|
where(
|
||||||
|
platform_id: package.platform,
|
||||||
|
name: package.dependent_packages,
|
||||||
|
package_type: package.package_type,
|
||||||
|
build_lists: { status: BuildList::BUILD_PUBLISHED }
|
||||||
|
).
|
||||||
|
group('build_list_packages.project_id, build_list_packages.name').
|
||||||
|
reorder(:project_id).group_by(&:project_id)
|
||||||
|
|
||||||
|
Project.where(id: packages.keys).recent.map do |project|
|
||||||
|
[
|
||||||
|
project,
|
||||||
|
packages[project.id].map(&:name).sort
|
||||||
|
]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def save_to_repositories(project)
|
def save_to_repositories(project)
|
||||||
project.repositories.collect do |r|
|
project.repositories.collect do |r|
|
||||||
[
|
[
|
||||||
|
|
|
@ -6,7 +6,6 @@ class BuildList::Package < ActiveRecord::Base
|
||||||
belongs_to :platform
|
belongs_to :platform
|
||||||
|
|
||||||
serialize :dependent_packages, Array
|
serialize :dependent_packages, Array
|
||||||
serialize :dependent_projects, Array
|
|
||||||
|
|
||||||
attr_accessible :fullname, :name, :release, :version, :sha1, :epoch, :dependent_packages
|
attr_accessible :fullname, :name, :release, :version, :sha1, :epoch, :dependent_packages
|
||||||
|
|
||||||
|
@ -27,7 +26,6 @@ class BuildList::Package < ActiveRecord::Base
|
||||||
|
|
||||||
before_create :set_epoch
|
before_create :set_epoch
|
||||||
before_create :normalize_dependent_packages
|
before_create :normalize_dependent_packages
|
||||||
after_commit(on: :create) { |p| p.find_dependent_projects if p.dependent_packages.present? } # later with resque
|
|
||||||
|
|
||||||
def assignee
|
def assignee
|
||||||
project.maintainer
|
project.maintainer
|
||||||
|
@ -50,11 +48,6 @@ class BuildList::Package < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def find_dependent_projects
|
|
||||||
# TODO
|
|
||||||
end
|
|
||||||
later :find_dependent_projects, queue: :middle
|
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
def normalize_dependent_packages
|
def normalize_dependent_packages
|
||||||
|
|
|
@ -241,7 +241,7 @@
|
||||||
|
|
||||||
%div{'ng-show' => 'build_list.packages'}
|
%div{'ng-show' => 'build_list.packages'}
|
||||||
.hr
|
.hr
|
||||||
%h3= t("layout.build_lists.packages_header")
|
%h3= t('layout.build_lists.packages_header')
|
||||||
%table.tablesorter.width565{cellpadding: "0", cellspacing: "0"}
|
%table.tablesorter.width565{cellpadding: "0", cellspacing: "0"}
|
||||||
%thead
|
%thead
|
||||||
%tr
|
%tr
|
||||||
|
@ -251,14 +251,38 @@
|
||||||
%th= t("activerecord.attributes.build_list/package.version")
|
%th= t("activerecord.attributes.build_list/package.version")
|
||||||
%th= t("activerecord.attributes.build_list/package.release")
|
%th= t("activerecord.attributes.build_list/package.release")
|
||||||
%tbody
|
%tbody
|
||||||
%tr{'ng-repeat' => 'package in build_list.packages'}
|
%tr{'ng-repeat-start' => 'package in build_list.packages'}
|
||||||
%td{'ng-show' => 'package.url'}
|
%td.package
|
||||||
%a{'ng-href' => "{{package.url}}" } {{package.fullname}}
|
%a.expand{'ng-show' => 'package.dependent_projects' }
|
||||||
%td{'ng-hide' => 'package.url'} {{package.fullname}}
|
%span.icon-chevron-down{'ng-show' => 'package.show_dependent_projects',
|
||||||
|
'ng-click' => 'package.show_dependent_projects = false' }
|
||||||
|
%span.icon-chevron-up{'ng-hide' => 'package.show_dependent_projects',
|
||||||
|
'ng-click' => 'package.show_dependent_projects = true' }
|
||||||
|
%div{'ng-if' => '!package.url'} {{package.fullname}}
|
||||||
|
%a{ 'ng-if' => 'package.url',
|
||||||
|
'ng-href' => "{{package.url}}" }
|
||||||
|
{{package.fullname}}
|
||||||
|
|
||||||
%td {{package.name}}
|
%td {{package.name}}
|
||||||
%td {{package.epoch}}
|
%td {{package.epoch}}
|
||||||
%td {{package.version}}
|
%td {{package.version}}
|
||||||
%td {{package.release}}
|
%td {{package.release}}
|
||||||
|
|
||||||
|
%tr{'ng-repeat-end' => '',
|
||||||
|
'ng-show' => 'package.show_dependent_projects',
|
||||||
|
'ng-repeat' => 'project in package.dependent_projects' }
|
||||||
|
%td
|
||||||
|
%a{'ng-href' => "{{project.url}}" } {{project.name}}
|
||||||
|
%td
|
||||||
|
%p{'ng-repeat' => 'package in project.dependent_packages'}
|
||||||
|
{{package}}
|
||||||
|
%td{ colspan: 3 }
|
||||||
|
%a{'ng-href' => '{{project.new_url}}' }
|
||||||
|
= t('layout.build_lists.create_build_list')
|
||||||
|
/ .both
|
||||||
|
/ %a{'ng-href' => '{{project.new_url}}' }
|
||||||
|
/ = t('layout.build_lists.run_build_list')
|
||||||
|
|
||||||
.both
|
.both
|
||||||
|
|
||||||
- if @build_list.new_core?
|
- if @build_list.new_core?
|
||||||
|
|
|
@ -55,12 +55,16 @@ json.build_list do
|
||||||
json.(package, :id, :name, :fullname, :release, :version, :sha1, :epoch)
|
json.(package, :id, :name, :fullname, :release, :version, :sha1, :epoch)
|
||||||
json.url "#{APP_CONFIG['file_store_url']}/api/v1/file_stores/#{package.sha1}" if package.sha1
|
json.url "#{APP_CONFIG['file_store_url']}/api/v1/file_stores/#{package.sha1}" if package.sha1
|
||||||
|
|
||||||
json.dependent_projects Project.where(id: package.dependent_projects).to_a do |project|
|
json.dependent_projects dependent_projects(package) do |project, packages|
|
||||||
json.project_path project_path(project)
|
json.url project_path(project.name_with_owner)
|
||||||
json.new_project_build_list_path new_project_build_list_path(@project)
|
json.name project.name_with_owner
|
||||||
|
json.dependent_packages packages
|
||||||
|
json.new_url new_project_build_list_path(project)
|
||||||
end
|
end
|
||||||
|
|
||||||
end if @build_list.packages.present?
|
end if @build_list.packages.present?
|
||||||
|
|
||||||
|
|
||||||
json.item_groups do |group|
|
json.item_groups do |group|
|
||||||
@item_groups.each_with_index do |group, level|
|
@item_groups.each_with_index do |group, level|
|
||||||
json.group group do |item|
|
json.group group do |item|
|
||||||
|
|
|
@ -66,6 +66,8 @@ en:
|
||||||
layout:
|
layout:
|
||||||
build_lists:
|
build_lists:
|
||||||
create_container: Create container
|
create_container: Create container
|
||||||
|
create_build_list: Create Build List
|
||||||
|
run_build_list: Run Build List
|
||||||
platform_deleted: platform has been deleted
|
platform_deleted: platform has been deleted
|
||||||
filter_header: Filter
|
filter_header: Filter
|
||||||
current: Curent
|
current: Curent
|
||||||
|
|
|
@ -65,6 +65,8 @@ ru:
|
||||||
layout:
|
layout:
|
||||||
build_lists:
|
build_lists:
|
||||||
create_container: Создать контейнер
|
create_container: Создать контейнер
|
||||||
|
create_build_list: Создать сборку
|
||||||
|
run_build_list: Запустить сборку
|
||||||
platform_deleted: платформа была удалена
|
platform_deleted: платформа была удалена
|
||||||
filter_header: Фильтр
|
filter_header: Фильтр
|
||||||
current: Текущие
|
current: Текущие
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
class RemoveDependentProjectsFromBuildListPackages < ActiveRecord::Migration
|
||||||
|
def up
|
||||||
|
remove_column :build_list_packages, :dependent_projects
|
||||||
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
add_column :build_list_packages, :dependent_projects, :text
|
||||||
|
end
|
||||||
|
end
|
|
@ -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: 20140606193047) do
|
ActiveRecord::Schema.define(version: 20140612213342) 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"
|
||||||
|
@ -96,7 +96,6 @@ ActiveRecord::Schema.define(version: 20140606193047) do
|
||||||
t.string "sha1"
|
t.string "sha1"
|
||||||
t.integer "epoch"
|
t.integer "epoch"
|
||||||
t.text "dependent_packages"
|
t.text "dependent_packages"
|
||||||
t.text "dependent_projects"
|
|
||||||
t.index ["actual", "platform_id"], :name => "index_build_list_packages_on_actual_and_platform_id"
|
t.index ["actual", "platform_id"], :name => "index_build_list_packages_on_actual_and_platform_id"
|
||||||
t.index ["build_list_id"], :name => "index_build_list_packages_on_build_list_id"
|
t.index ["build_list_id"], :name => "index_build_list_packages_on_build_list_id"
|
||||||
t.index ["name", "project_id"], :name => "index_build_list_packages_on_name_and_project_id"
|
t.index ["name", "project_id"], :name => "index_build_list_packages_on_name_and_project_id"
|
||||||
|
|
Loading…
Reference in New Issue