Skip to content

Commit

Permalink
[webui] Redirect to Kiwi Editor from image templates
Browse files Browse the repository at this point in the history
It will redirect the user to the Kiwi Editor if the branched
package is an image template
  • Loading branch information
Moises Deniz Aleman committed Oct 18, 2017
1 parent d5df057 commit 25a4880
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/api/app/controllers/webui/package_controller.rb
Original file line number Diff line number Diff line change
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
1 change: 1 addition & 0 deletions src/api/spec/features/webui/image_templates_spec.rb
Original file line number Diff line number Diff line change
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 25a4880

Please sign in to comment.