diff --git a/lib/pact_broker/ui/controllers/index.rb b/lib/pact_broker/ui/controllers/index.rb index ae6645776..24db3b15f 100644 --- a/lib/pact_broker/ui/controllers/index.rb +++ b/lib/pact_broker/ui/controllers/index.rb @@ -43,6 +43,7 @@ class Index < Base current_page_size: view_index_items.size, base_url: base_url, errors: error_messages, + tags: tags, pacticipant_name: pacticipant_name } diff --git a/lib/pact_broker/ui/views/index/show-with-tags.haml b/lib/pact_broker/ui/views/index/show-with-tags.haml index 575ad3014..809076a7c 100644 --- a/lib/pact_broker/ui/views/index/show-with-tags.haml +++ b/lib/pact_broker/ui/views/index/show-with-tags.haml @@ -2,10 +2,25 @@ != render :haml, :'index/_css_and_js', :layout => false .container != render :haml, :'index/_navbar', :layout => false, locals: {tag_toggle: false, base_url: base_url} - - if index_items.empty? + - if index_items.empty? && pacticipant_name.blank? != render :haml, :'index/_getting-started', :layout => false %h1.page-header Pacts + + - unless errors.blank? + - errors.each do | error | + %div.alert.alert-danger + = error + + %form{action: "#{base_url}"} + .field + %label{for: 'pacticipant_name'} + Pacticipant name + %input{name: 'pacticipant_name', id: 'pacticipant_name', class: 'pacticipant_name', value: pacticipant_name} + %div.top-of-group + %input{type: 'button', class: 'submit-search', value: 'Search'} + %input{type: 'button', class: 'reset-search', value: 'Reset' } + %table.table.table-bordered.table-striped{ id: 'relationships' } %thead %tr @@ -118,3 +133,13 @@ $(td).tooltip({container: $(td).first()}); }); }); + + $(".reset-search").on("click", function() { + location = window.location.href + window.location.replace("#{base_url}/?tags=#{tags}"); + }) + + $(".submit-search").on("click", function() { + pacticipant_name = $("#pacticipant_name").val(); + window.location.replace("#{base_url}/?tags=#{tags}" + `&pacticipant_name=${pacticipant_name}`); + })