Skip to content

Commit

Permalink
[webui] - Fixed adding of unknown trackers in the PatchinfoController
Browse files Browse the repository at this point in the history
- Added a link to a list of valid trackers
  • Loading branch information
bbrunner authored and adrianschroeter committed Feb 19, 2013
1 parent 4e3ca28 commit 1d024ef
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 16 deletions.
42 changes: 27 additions & 15 deletions src/webui/app/controllers/patchinfo_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,12 @@ def read_patchinfo
issue = Array.new
issueid = a.value(:id)
issueurl = IssueTracker.find(:name => a.tracker)
issueurl = issueurl.each("/issue-tracker/show-url").first.text
issueurl = issueurl.sub(/@@@/, issueid)
if !issueurl.nil?
issueurl = issueurl.each("/issue-tracker/show-url").first.text
issueurl = issueurl.sub(/@@@/, issueid)
else
issueurl = ""
end
issue << a.tracker
issue << issueid
issue << issueurl
Expand Down Expand Up @@ -274,7 +278,9 @@ def new_tracker
new_issues = params[:issues]
#collection with all informations of the new issues
issue_collection = Array.new
error = ""
error = String.new
invalid_format = String.new
invalid_tracker = String.new
new_issues.each do |new_issue|
#issue = collecting all informations of an new issue
issue = Array.new
Expand All @@ -286,25 +292,31 @@ def new_tracker
end
if issue.length > 1
begin

issueurl = IssueTracker.find(:name => issue[0])
issueurl = issueurl.each("/issue-tracker/show-url").first.text
issueurl = issueurl.sub(/@@@/, issue[1])
issue << issueurl
get_issue_sum(issue[0], issue[1])
if !@error.nil?
error += "#{issue[0]} "
next
if !issueurl.nil?
issueurl = issueurl.each("/issue-tracker/show-url").first.text
issueurl = issueurl.sub(/@@@/, issue[1])
issue << issueurl
get_issue_sum(issue[0], issue[1])
if !@error.nil?
invalid_format += "#{issue[0]} "
next
end
issue << @issuesum
issue_collection << issue
else
invalid_tracker += "#{issue[0]} is not a valid tracker.\n"
end
issue << @issuesum
issue_collection << issue
rescue ActiveXML::Transport::NotFoundError
error += "#{issue[0]} "
invalid_format += "#{issue[0]} "
end
else
error += "#{issue[0]} "
invalid_format += "#{issue[0]} "
end
end
error += "has no valid format. (Correct formats are e.g. bnc#123456, CVE-1234-5678 and the string has to be a comma-separated list)" if error != ""
error += "#{invalid_tracker}"
error += "#{invalid_format}has no valid format. (Correct formats are e.g. bnc#123456, CVE-1234-5678 and the string has to be a comma-separated list)" if !invalid_format.empty?
render :nothing => true, :json => { :error => error, :issues => issue_collection}
end

Expand Down
4 changes: 3 additions & 1 deletion src/webui/app/views/patchinfo/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@
</div>
<div class="box show_right show_left" style="margin-top:5px;">
<p>
<label for='issue'>Add an additional bug (single or a comma-separated list e.g.: "bnc#123456, bgo#654321,CVE-2012-1234)"</label>
<label for='issue'>Add an additional bug (single or a comma-separated list e.g.: "bnc#123456, bgo#654321,CVE-2012-1234)"<br/>
A list of all supported tracker you can find here:
<%= link_to "Tracker List", "https://en.opensuse.org/openSUSE:Packaging_Patches_guidelines#Current_set_of_abbreviations"%></label>
<input type="text" id="issue" name="issuelist" value="<%=@issueid%>"/>

<%= link_to image_tag('bug_add.png', :alt => "Add Bug", :title => "Add additional issues e.g.: \"bnc#123456, bgo#654321\""), '#', :onclick => 'append_bug($("#issue").val()); return false;', :id => 'add_bug' %>
Expand Down

0 comments on commit 1d024ef

Please sign in to comment.