#267: updated attaching of advisory

This commit is contained in:
Vokhmin Alexey V 2013-08-20 18:17:31 +04:00
parent d733523953
commit b9778300d5
3 changed files with 40 additions and 31 deletions

View File

@ -4,7 +4,7 @@ RosaABF.controller('BuildListController', ['$scope', '$http', '$timeout', functi
$scope.id = $('#build_list_id').val();
$scope.build_list = null;
$scope.subject = {};
$scope.subject = {}; // See: shared/build_results
$scope.attach_advisory = 'no';
// Statuses: advisory_not_found, server_error, continue_input
$scope.search_status = 'continue_input';
@ -13,15 +13,26 @@ RosaABF.controller('BuildListController', ['$scope', '$http', '$timeout', functi
$scope.getBuildList = function() {
$http.get(Routes.build_list_path($scope.id, {format: 'json'})).success(function(results) {
// Render Server status
$scope.build_list = new BuildList(results.build_list);
$scope.subject = $scope.build_list;
$scope.build_list = $scope.subject = new BuildList(results.build_list);
});
}
$scope.cancelRefresh = null;
$scope.refresh = function() {
$scope.getBuildList();
if ( $scope.attach_advisory == 'no' &&
(
!$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.refresh();

View File

@ -44,12 +44,10 @@
.both
.leftlist= t("activerecord.attributes.build_list.update_type")
.rightlist
- if can?(:publish, @build_list)
= f.select :update_type, options_for_select(build_list_classified_update_types,
@build_list.update_type), {}, 'ng-model' => 'build_list.update_type',
'ng-change' => 'updateTypeChanged()'
- else
= @build_list.update_type
= f.select :update_type, options_for_select(build_list_classified_update_types,
@build_list.update_type), {}, 'ng-model' => 'build_list.update_type',
'ng-change' => 'updateTypeChanged()', 'ng-show' => 'build_list.can_publish'
%div{'ng-hide' => 'build_list.can_publish'}= @build_list.update_type
.both
.leftlist= t("activerecord.attributes.build_list.auto_publish")
.rightlist= t("layout.#{@build_list.auto_publish}_")
@ -102,12 +100,8 @@
.rightlist {{build_list.human_duration }}
.both
- if can?(:cancel, @build_list)
= link_to t("layout.build_lists.cancel"), cancel_build_list_path(@build_list),
:method => :put, :confirm => t("layout.confirm"), :class => 'button', 'ng-show' => 'build_list.can_cancel'
- if @build_list.save_to_platform.released && @build_list.advisory.nil? && can?(:publish, @build_list)
#advisory_block
- if @build_list.save_to_platform.released
#advisory_block{'ng-show' => 'build_list.can_publish && !build_list.advisory'}
.leftlist= label_tag :attach_advisory, t("layout.build_lists.attached_advisory")
.rightlist
= select_tag :attach_advisory, advisories_select_options(@advisories), 'ng-model' => 'attach_advisory', 'ng-change' => 'attachAdvisoryChanged()'
@ -140,25 +134,25 @@
.rightlist.refs {{advisory.references}}
.both
%div{'ng-show' => "build_list.status == #{BuildList::BUILD_STARTED}"}
= render 'shared/log', { :build_started => true, :get_log_path => log_build_list_path(@build_list) }
%div{'ng-hide' => 'build_list.extra_build_lists_published'}
.flash_notify
.alert.alert-error= t('layout.build_lists.publish_with_extra_fail')
.both
- if can?(:publish, @build_list)
= submit_tag t('layout.publish_again'),
:confirm => t("layout.publish_again_warning"),
:name => 'publish',
'ng-show' => "build_list.status == #{BuildList::BUILD_PUBLISHED}"
= submit_tag t("layout.publish"),
:confirm => t('layout.build_lists.tests_failed'), :name => 'publish',
'ng-show' => "build_list.can_publish_in_future && build_list.extra_build_lists_published && build_list.status == #{BuildList::TESTS_FAILED}"
= submit_tag t("layout.publish"),
:confirm => t('layout.confirm'), :name => 'publish',
'ng-show' => "build_list.can_publish_in_future && build_list.extra_build_lists_published && build_list.status != #{BuildList::TESTS_FAILED}"
- if can?(:cancel, @build_list)
= link_to t("layout.build_lists.cancel"), cancel_build_list_path(@build_list),
:method => :put, :confirm => t("layout.confirm"), :class => 'button',
'ng-show' => 'build_list.can_cancel'
= submit_tag t('layout.publish_again'),
:confirm => t("layout.publish_again_warning"),
:name => 'publish',
'ng-show' => "build_list.can_publish && build_list.status == #{BuildList::BUILD_PUBLISHED}"
= submit_tag t("layout.publish"),
:confirm => t('layout.build_lists.tests_failed'), :name => 'publish',
'ng-show' => "build_list.can_publish && build_list.can_publish_in_future && build_list.extra_build_lists_published && build_list.status == #{BuildList::TESTS_FAILED}"
= submit_tag t("layout.publish"),
:confirm => t('layout.confirm'), :name => 'publish',
'ng-show' => "build_list.can_publish && build_list.can_publish_in_future && build_list.extra_build_lists_published && build_list.status != #{BuildList::TESTS_FAILED} && build_list.status != #{BuildList::BUILD_PUBLISHED}"
- if can?(:reject_publish, @build_list)
= link_to t('layout.reject_publish'), reject_publish_build_list_path(@build_list),
:method => :put, :confirm => t("layout.confirm"),
@ -173,6 +167,9 @@
- if can? :create, @build_list
= link_to t('layout.build_lists.recreate_build_list'), new_project_build_list_path(@build_list.project, :build_list_id => @build_list.id), :class => 'button'
%div{'ng-show' => "build_list.status == #{BuildList::BUILD_STARTED}"}
= render 'shared/log', { :build_started => true, :get_log_path => log_build_list_path(@build_list) }
.hr
%h3= t("layout.build_lists.items_header")
%h4.nomargin{'ng-hide' => 'build_list.item_groups'}

View File

@ -11,6 +11,7 @@ json.build_list do
json.build_log_url log_build_list_path(@build_list)
json.can_publish can?(:publish, @build_list)
json.can_cancel @build_list.can_cancel?
json.can_create_container @build_list.can_create_container?
json.can_reject_publish @build_list.can_reject_publish?