#251: added groups to build_lists
This commit is contained in:
parent
a0bcc6a8a0
commit
39ccf5c91d
|
@ -16,8 +16,18 @@ RosaABF.controller('BuildListsController', ['$scope', '$http', '$location', '$ti
|
|||
$http.get('/build_lists.json', {params: $location.search()}).success(function(results) {
|
||||
$scope.server_status = results.server_status;
|
||||
$scope.build_lists = [];
|
||||
_.each(results.build_lists, function(bl){
|
||||
$scope.build_lists.push(new BuildList(bl));
|
||||
var groups = {};
|
||||
_.each(results.build_lists, function(r){
|
||||
var bl = new BuildList(r);
|
||||
var key = bl.project_id + '-' + bl.commit_hash;
|
||||
if (groups[key]) {
|
||||
groups[key].addRelated(bl);
|
||||
} else {
|
||||
groups[key] = bl;
|
||||
$scope.build_lists.push({group: bl});
|
||||
}
|
||||
$scope.build_lists.push(bl);
|
||||
// $scope.build_lists.push(new BuildList(r));
|
||||
});
|
||||
$scope.isRequest = false;
|
||||
}).error(function(data, status, headers, config) {
|
||||
|
@ -27,6 +37,17 @@ RosaABF.controller('BuildListsController', ['$scope', '$http', '$location', '$ti
|
|||
}
|
||||
|
||||
|
||||
$scope.showGroup = function(bl) {
|
||||
_.each(bl.group.related, function(b){
|
||||
b.show = true;
|
||||
});
|
||||
}
|
||||
|
||||
$scope.hideGroup = function(bl) {
|
||||
_.each(bl.group.related, function(b){
|
||||
b.show = false;
|
||||
});
|
||||
}
|
||||
|
||||
$scope.defaultValues = {
|
||||
'filter[ownership]': 'owned',
|
||||
|
|
|
@ -10,7 +10,16 @@ var BuildList = function(atts) {
|
|||
|
||||
|
||||
//with some logic...
|
||||
self.related = [self];
|
||||
self.show = true;
|
||||
|
||||
self.hasRelated = false;
|
||||
self.addRelated = function(bl) {
|
||||
self.related.push(bl);
|
||||
self.hasRelated = true;
|
||||
bl.show = false;
|
||||
self.show = false;
|
||||
}
|
||||
|
||||
//return the scope-safe instance
|
||||
return self;
|
||||
|
|
|
@ -2062,3 +2062,16 @@ a.button.reject_publish, a.button.create_container {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
table tbody {
|
||||
.build-list-statuses {
|
||||
div {
|
||||
float: left;
|
||||
//border: 1px solid #DDD;
|
||||
margin: 0 2px;
|
||||
}
|
||||
.error { background: #fedede; }
|
||||
.success { background: #e3edb7; }
|
||||
.warning { background: #FCF8E3; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,11 +26,14 @@ class Projects::BuildListsController < Projects::BaseController
|
|||
if request.xhr?
|
||||
@filter = BuildList::Filter.new(@project, current_user, current_ability, params[:filter] || {})
|
||||
@per_page = BuildList::Filter::PER_PAGE.include?(params[:per_page].to_i) ? params[:per_page].to_i : 25
|
||||
@bls = @filter.find.recent.paginate(
|
||||
@bls = @filter.find.recent
|
||||
.paginate(
|
||||
:page => (params[:page].to_i == 0 ? nil : params[:page]),
|
||||
:per_page => @per_page
|
||||
)
|
||||
@build_lists = BuildList.where(:id => @bls.pluck(:id)).recent
|
||||
@build_lists = BuildList.where(:id => @bls.pluck(:id))
|
||||
.order('build_lists.project_id, build_lists.project_version')
|
||||
.recent
|
||||
.includes(
|
||||
:save_to_platform,
|
||||
:save_to_repository,
|
||||
|
|
|
@ -17,10 +17,38 @@
|
|||
%th.lpadding16= t("activerecord.attributes.build_list.user")
|
||||
%th.lpadding6= t("activerecord.attributes.build_list.updated_at")
|
||||
%tbody
|
||||
%tr{'ng-repeat' => 'bl in build_lists', 'class' => '{{bl.status_color}}'}
|
||||
%td
|
||||
%tr{'ng-repeat' => 'bl in build_lists', :class => '{{bl.status_color}}'}
|
||||
|
||||
/ == Show related group
|
||||
|
||||
/ id && status
|
||||
%td{'ng-show' => 'bl.group.hasRelated && !bl.group.show', :colspan => 2}
|
||||
%a.button{'ng-click' => 'showGroup(bl)' }= t('layout.show')
|
||||
%td{'ng-show' => 'bl.group.hasRelated && bl.group.show', :colspan => 2}
|
||||
%a.button{'ng-click' => 'hideGroup(bl)' }= t('layout.hide')
|
||||
|
||||
/ project
|
||||
%td.centered{'ng-show' => '!bl.group.project && bl.group.hasRelated', :colspan => 2}
|
||||
= t('layout.projects.unexisted_project')
|
||||
%td{'ng-show' => 'bl.group.project && bl.group.hasRelated'}
|
||||
%a{'ng-href' => '{{bl.group.project.url}}' } {{bl.group.project.name_with_owner}}
|
||||
|
||||
/ diff && project_version && save_to_repository && arch_short && user
|
||||
%td.build-list-statuses{'ng-show' => 'bl.group.hasRelated', :colspan => 5}
|
||||
%div{'ng-repeat' => 'related in bl.group.related', :class => '{{related.status_color}}'}
|
||||
%a{'ng-href' => '{{related.url}}' } {{related.id}}
|
||||
|
||||
/ updated_at
|
||||
%td{'ng-show' => 'bl.group.hasRelated'} {{bl.group.updated_at}}
|
||||
|
||||
/ == BuildList has no related ==
|
||||
|
||||
/ id
|
||||
%td{'ng-show' => 'bl.show'}
|
||||
%a{'ng-href' => '{{bl.url}}' } {{bl.id}}
|
||||
%td
|
||||
|
||||
/ status
|
||||
%td{'ng-show' => 'bl.show'}
|
||||
{{bl.human_status}}
|
||||
%br
|
||||
%time{'ng-show' => 'bl.duration'}
|
||||
|
@ -28,23 +56,33 @@
|
|||
%time{'ng-show' => 'bl.average_build_time'}
|
||||
\/{{bl.average_build_time}}
|
||||
|
||||
%td.centered{'ng-hide' => 'bl.project', :colspan => 2}
|
||||
/ project
|
||||
%td.centered{'ng-show' => '!bl.project && bl.show', :colspan => 2}
|
||||
= t('layout.projects.unexisted_project')
|
||||
%td{'ng-show' => 'bl.project'}
|
||||
%td{'ng-show' => 'bl.project && bl.show'}
|
||||
%a{'ng-href' => '{{bl.project.url}}' } {{bl.project.name_with_owner}}
|
||||
%td{'ng-show' => 'bl.project', 'ng-bind-html-unsafe' => 'bl.project.version_link'}
|
||||
|
||||
%td {{bl.project_version}}
|
||||
%td
|
||||
/ diff
|
||||
%td{'ng-show' => 'bl.project && bl.show', 'ng-bind-html-unsafe' => 'bl.project.version_link'}
|
||||
|
||||
/ project_version
|
||||
%td{'ng-show' => 'bl.show'} {{bl.version_release}}
|
||||
|
||||
/ save_to_repository
|
||||
%td{'ng-show' => 'bl.show'}
|
||||
%a{'ng-href' => '{{bl.save_to_repository.url}}' } {{bl.save_to_repository.name}}
|
||||
|
||||
%td{'ng-show' => 'bl.arch'} {{bl.arch}}
|
||||
%td{'ng-hide' => 'bl.arch'}= t("layout.arches.unexisted_arch")
|
||||
/ arch_short
|
||||
%td{'ng-show' => 'bl.arch && bl.show'} {{bl.arch}}
|
||||
%td{'ng-show' => '!bl.arch && bl.show'}
|
||||
= t("layout.arches.unexisted_arch")
|
||||
|
||||
%td
|
||||
/ user
|
||||
%td{'ng-show' => 'bl.show'}
|
||||
%a{'ng-href' => '{{bl.user.url}}' } {{bl.user.fullname}}
|
||||
|
||||
%td {{bl.updated_at}}
|
||||
/ updated_at
|
||||
%td{'ng-show' => 'bl.show'} {{bl.updated_at}}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
now = Time.now.utc
|
||||
json.build_lists @build_lists do |build_list|
|
||||
json.(build_list, :id, :status, :human_status)
|
||||
json.(build_list, :id, :status, :human_status, :project_id)
|
||||
json.commit_hash build_list.commit_hash.last(5)
|
||||
json.url build_list_path(build_list)
|
||||
|
||||
if BuildList::HUMAN_STATUSES[build_list.status].in? [:build_pending, :build_started, :build_publish]
|
||||
|
@ -15,7 +16,7 @@ json.build_lists @build_lists do |build_list|
|
|||
json.version_link build_list_version_link(build_list).html_safe
|
||||
end if build_list.project.present?
|
||||
|
||||
json.project_version get_version_release(build_list)
|
||||
json.version_release get_version_release(build_list)
|
||||
|
||||
json.save_to_repository do
|
||||
build_for = " (#{build_list.build_for_platform.name})" if build_list.build_for_platform && build_list.save_to_platform.personal?
|
||||
|
|
Loading…
Reference in New Issue