From 6830f121eda27c0f2dc2feca2f6175785c022ed0 Mon Sep 17 00:00:00 2001 From: Wedge Date: Wed, 22 Jan 2020 14:33:03 +0300 Subject: [PATCH] Build list optimization --- .../projects/build_lists/_packages.html.slim | 31 ++++++++++--------- .../projects/build_lists/show.json.jbuilder | 19 +++++++----- app/views/shared/_build_results.html.slim | 6 ++-- 3 files changed, 30 insertions(+), 26 deletions(-) diff --git a/app/views/projects/build_lists/_packages.html.slim b/app/views/projects/build_lists/_packages.html.slim index 39b386ea2..f6f198ed0 100644 --- a/app/views/projects/build_lists/_packages.html.slim +++ b/app/views/projects/build_lists/_packages.html.slim @@ -13,7 +13,7 @@ rd-widget ng-show='build_list.packages' tbody tr ng-repeat-start='package in build_list.packages' td - a.expand ng-show='package.dependent_projects' + a.expand ng-show='::package.dependent_projects.length' span.fa.fa-chevron-up[ ng-show = 'package.show_dependent_projects' ng-click = 'package.show_dependent_projects = false' ] @@ -21,30 +21,31 @@ rd-widget ng-show='build_list.packages' ng-hide = 'package.show_dependent_projects' ng-click = 'package.show_dependent_projects = true' ] td - div ng-if='!package.url' - | {{package.fullname}} - a ng-if='package.url' ng-href="{{package.url}}" - | {{package.fullname}} + div ng-if='::!package.url' + | {{::package.fullname}} + a ng-if='::package.url' ng-href="{{::package.url}}" + | {{::package.fullname}} td - | {{package.name}} + | {{::package.name}} td - | {{package.epoch}} + | {{::package.epoch}} td - | {{package.version}} + | {{::package.version}} td - | {{package.release}} + | {{::package.release}} tr[ ng-repeat-end = '' + ng-if = '::package.dependent_projects.length' ng-show = 'package.show_dependent_projects' - ng-repeat = 'project in package.dependent_projects' ] + ng-repeat = 'project in ::package.dependent_projects' ] td td - a ng-href="{{project.url}}" - | {{project.name}} + a ng-href="{{::project.url}}" + | {{::project.name}} td - p ng-repeat='package in project.dependent_packages' - | {{package}} + p ng-repeat='package in ::project.dependent_packages' + | {{::package}} td colspan=3 - a ng-href='{{project.new_url}}' + a ng-href='{{::project.new_url}}' = t('layout.build_lists.create_build_list') \ No newline at end of file diff --git a/app/views/projects/build_lists/show.json.jbuilder b/app/views/projects/build_lists/show.json.jbuilder index 0eac1b659..3c64c1eb2 100644 --- a/app/views/projects/build_lists/show.json.jbuilder +++ b/app/views/projects/build_lists/show.json.jbuilder @@ -50,15 +50,18 @@ json.build_list do 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.dependent_projects dependent_projects(package) do |project, packages| - json.url project_path(project.name_with_owner) - json.name project.name_with_owner - json.dependent_packages packages - json.new_url new_project_build_list_path(project) - - dependent_projects_exists = true - end if @build_list.save_to_platform.main? + if @build_list.save_to_platform.main? + json.dependent_projects dependent_projects(package) do |project, packages| + json.url project_path(project.name_with_owner) + json.name project.name_with_owner + json.dependent_packages packages + json.new_url new_project_build_list_path(project) + dependent_projects_exists = true + end + else + json.dependent_projects [] + end end if @build_list.packages.present? json.dependent_projects_exists dependent_projects_exists diff --git a/app/views/shared/_build_results.html.slim b/app/views/shared/_build_results.html.slim index 17176f9cf..ea6976d22 100644 --- a/app/views/shared/_build_results.html.slim +++ b/app/views/shared/_build_results.html.slim @@ -9,7 +9,7 @@ rd-widget ng-show='subject.results' tbody tr ng-repeat='item in subject.results' td - a ng-href='{{item.url}}' - | {{item.file_name}} + a ng-href='{{::item.url}}' + | {{::item.file_name}} td - | {{item.size}} + | {{::item.size}}