Project

General

Profile

Revision 329cfcba

Added by Sebastian Gräßl about 5 years ago

Fixes #18902 - Enable autocomplete for container image search

This enables the autocomplete for the image name search and
improves the usability of searching for container images on
Docker Hub or an external Registry.

View differences:

app/views/containers/steps/_image_hub_tab.html.erb
17 17
  <% end %>
18 18

  
19 19
  <% if registry == "registry" -%>
20
    <div class="input-group col-md-6">
21 20
      <%= select_registry f %>
22
    </div>
23 21
  <% end -%>
24 22

  
25 23
  <% help_type = f.object.errors[:repository_name].present? ? :help_block : :help_inline %>
26 24
  <%= text_f(f, :repository_name,
27 25
    :label => _('Search'),
28
    :size => 'col-md-6',
29 26
    :wrapper_class => (image_search_wrapper_class(model) if tab_active?(registry)),
30
    :'data-url'  => auto_complete_repository_name_image_search_path(model.compute_resource_id),
27
    :'data-url'  => search_repository_image_search_path(model.compute_resource_id),
31 28
    :value       => f.object.repository_name.present? ? f.object.repository_name : '',
32 29
    :'data-registry' => registry,
33 30
    :'data-image' => true,
34
    :'data-search' => true,
35 31
    :'data-min-length' => 1,
36 32
    :focus_on_load => true,
37 33
    :placeholder => _('Find your favorite container, e.g. centos'),
38 34
    :control_group_id => "#{registry}_image_search",
39
    help_type => link_to_function(
40
        icon_text('search', ''),
41
        'searchRepo(this)',
42
        :class => 'btn btn-default',
43
        :id => "search_repository_#{registry}",
44
        :'data-registry' => registry,
45
        :'data-url' => search_repository_image_search_path(model.compute_resource_id)
46
      ) + content_tag(:span, '', :id => 'image-confirmation').html_safe) %>
35
    :help_inline => spinner('', class: 'hide autocomplete-status')) %>
47 36

  
48 37
  <%= text_f f, :tag,
49 38
    :control_group_id => "#{registry}_tag_search",
50 39
    :'data-registry' => registry,
51 40
    :'data-tag' => true,
52
    :'data-url' => auto_complete_image_tag_image_search_path(model.compute_resource_id) %>
41
    :'data-min-length' => 0,
42
    :'data-url' => search_repository_image_search_path(model.compute_resource_id),
43
    :help_inline => spinner('', class: 'hide autocomplete-status') %>
44

  
45
  <div class="col-md-6 col-md-offset-2 small-gutter">
46
    <%= link_to(icon_text('search', _('Search for images')), "#",
47
          :id => "search_repository_button_#{registry}",
48
          :class => 'image-search-button btn btn-default',
49
          :'data-registry' => registry,
50
          :'data-url' => search_repository_image_search_path(model.compute_resource_id)) %>
51
  </div>
53 52

  
54
  <div class="col-md-12">
53
  <div class="registry-search-results col-md-12">
55 54
    <div data-search-spinner=true class='col-md-offset-3 hide'>
56 55
      <span data-wait-text=true>
57 56
      </span>
58
      <%= spinner('', :id => "loading_repositories_indicator_#{registry}") %>
57
      <%= spinner('') %>
59 58
    </div>
60
    <div data-repository-search-results=true >
59
    <div class="registry-search-results-list">
61 60
    </div>
62 61
  </div>
63 62
  <%= render :partial => 'form_buttons', locals: { :registry => registry} %>

Also available in: Unified diff