Skip to content

Commit

Permalink
Merge pull request #4035 from mdeniz/kiwi_editor_improvements
Browse files Browse the repository at this point in the history
Minor Kiwi Editor workflow improvements
  • Loading branch information
Moisés Déniz Alemán committed Oct 19, 2017
2 parents a7f8cdb + 07db0f4 commit dcef270
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 15 deletions.
10 changes: 8 additions & 2 deletions src/api/app/controllers/webui/package_controller.rb
Expand Up @@ -557,8 +557,14 @@ def branch
targetproject: created_project_name, targetpackage: created_package_name,
user: User.current.login)

flash[:notice] = 'Successfully branched package'
redirect_to(package_show_path(project: created_project_name, package: created_package_name))
branched_package_object = Package.find_by_project_and_name(created_project_name, created_package_name)

if request.env["HTTP_REFERER"] == image_templates_url && branched_package_object.kiwi_image?
redirect_to(import_kiwi_image_path(branched_package_object.id))
else
flash[:notice] = 'Successfully branched package'
redirect_to(package_show_path(project: created_project_name, package: created_package_name))
end

rescue BranchPackage::DoubleBranchPackageError => exception
flash[:notice] = 'You have already branched this package'
Expand Down
4 changes: 2 additions & 2 deletions src/api/app/helpers/webui/kiwi/image_helper.rb
Expand Up @@ -3,10 +3,10 @@ module Webui::Kiwi::ImageHelper

def kiwi_image_breadcrumb(kiwi_image, *args)
@project = kiwi_image.package.try(:project)
@package = kiwi_image.package
return unless @project

args.insert(0, link_to_if(params['action'] != 'show', 'Image',
kiwi_image_path(id: kiwi_image)))
args.insert(0, link_to(@package, package_show_path(project: @project, package: @package)))
project_bread_crumb( *args )
end
end
22 changes: 11 additions & 11 deletions src/api/app/views/webui/kiwi/_tabs.html.erb
Expand Up @@ -10,17 +10,7 @@

<div class="box-header header-tabs" id="package_tabs">
<ul>
<%= tab 'kiwi', 'Kiwi', controller: 'kiwi/images', action: 'show', selected: true %>
<% if @image.package.name == "patchinfo" %>
<%= tab 'details', 'Details', controller: '/webui/patchinfo', action: 'show' %>
<% end %>
<%= tab 'overview', 'Overview', controller: '/webui/package', action: 'show', package: @image.package %>
<% unless @spider_bot %>
<%= tab 'repositories', 'Repositories', controller: '/webui/repositories', action: 'index' %>
<%= tab 'revisions', 'Revisions', :controller => '/webui/package', :action => 'revisions', package: @image.package %>
<%= tab 'requests', "Requests", :controller => '/webui/package', :action => 'requests', package: @image.package %>
<%= tab 'users', 'Users', :controller => '/webui/package', :action => 'users', package: @image.package %>
<% end %>
<%= tab 'kiwi', 'Image Editor', controller: 'kiwi/images', action: 'show', selected: true %>
<% if is_advanced_tab? %>
<%= content_for :ready_function do %>
$("#advanced_tabs").show();
Expand All @@ -32,6 +22,16 @@
<% unless @spider_bot %>
<div id="advanced_tabs" class="hidden">
<ul>
<%= tab 'overview', 'Overview', controller: '/webui/package', action: 'show', package: @image.package %>
<% if @image.package.name == "patchinfo" %>
<%= tab 'details', 'Details', controller: '/webui/patchinfo', action: 'show' %>
<% end %>
<% unless @spider_bot %>
<%= tab 'repositories', 'Repositories', controller: '/webui/repositories', action: 'index' %>
<%= tab 'revisions', 'Revisions', :controller => '/webui/package', :action => 'revisions', package: @image.package %>
<%= tab 'requests', "Requests", :controller => '/webui/package', :action => 'requests', package: @image.package %>
<%= tab 'users', 'Users', :controller => '/webui/package', :action => 'users', package: @image.package %>
<% end %>
<%= tab 'attributes', 'Attributes', controller: '/webui/attribute', :package => @image.package, :project => @image.package.project , :action => 'index' %>
<%= tab 'meta', 'Meta', :controller => '/webui/package', :action => 'meta', package: @image.package %>
</ul>
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/api/spec/features/webui/image_templates_spec.rb
Expand Up @@ -32,6 +32,7 @@
fill_in 'target_package', with: "custom_name"

click_button("Create appliance")
find('#package_tabs')
expect(page).to have_text("Successfully branched package")
expect(page).to have_text("home:tom:branches:my_project > custom_name")
end
Expand Down

0 comments on commit dcef270

Please sign in to comment.