Module: ContainerStepsHelper

Defined in:
app/helpers/container_steps_helper.rb

Instance Method Summary collapse

Instance Method Details

#active_tabObject



65
66
67
68
69
70
71
72
73
# File 'app/helpers/container_steps_helper.rb', line 65

def active_tab
  if @docker_container_wizard_states_image.katello?
    :katello
  elsif @docker_container_wizard_states_image.registry_id.nil?
    :hub
  else
    :registry
  end
end

#cleanup_image_name(name) ⇒ Object

el7 returns -> “name” => “docker.io: docker.io/centos”, while f20 returns -> “name” => “centos” we need repo name to be => “docker.io/centos” for el7 and “centos” for fedora to ensure proper search with respect to the tags, image creation etc.



41
42
43
# File 'app/helpers/container_steps_helper.rb', line 41

def cleanup_image_name(name)
  name.split.last
end

#container_wizard(step) ⇒ Object



2
3
4
5
6
7
# File 'app/helpers/container_steps_helper.rb', line 2

def container_wizard(step)
  wizard_header(
    step,
    *humanized_steps
  )
end

#humanized_stepsObject



21
22
23
# File 'app/helpers/container_steps_helper.rb', line 21

def humanized_steps
  [_('Preliminary'), _('Image'), _('Configuration'), _('Environment')]
end

#image_search_wrapper_class(model) ⇒ Object



53
54
55
56
57
58
59
# File 'app/helpers/container_steps_helper.rb', line 53

def image_search_wrapper_class(model)
  if model.errors.messages[:image]
    'form-group has-error'
  else
    'form-group'
  end
end

#last_step?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'app/helpers/container_steps_helper.rb', line 25

def last_step?
  step == wizard_steps.last
end

#model_for(registry_type) ⇒ Object



45
46
47
48
49
50
51
# File 'app/helpers/container_steps_helper.rb', line 45

def model_for(registry_type)
  if active_tab.to_s == registry_type.to_s
    @docker_container_wizard_states_image
  else
    DockerContainerWizardStates::Image.new(:wizard_state => @state)
  end
end

#select_registry(f) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
# File 'app/helpers/container_steps_helper.rb', line 9

def select_registry(f)
  registries = DockerRegistry.with_taxonomy_scope_override(@location, @organization)
               .authorized(:view_registries)
  field(f, 'docker_container_wizard_states_image[registry_id]', :label => _("Registry")) do
    collection_select :docker_container_wizard_states_image, :registry_id,
                      registries,
                      :id, :name,
                      { :prompt => _("Select a registry") },
                      :class => "form-control", :disabled => registries.size == 0
  end
end

#tab_active?(registry) ⇒ Boolean

Returns:

  • (Boolean)


61
62
63
# File 'app/helpers/container_steps_helper.rb', line 61

def tab_active?(registry)
  active_tab == registry.to_sym
end

#tab_class(tab_name) ⇒ Object



33
34
35
# File 'app/helpers/container_steps_helper.rb', line 33

def tab_class(tab_name)
  active_tab.to_s == tab_name.to_s ? "active" : ""
end

#taxonomy_icon(taxonomy) ⇒ Object



29
30
31
# File 'app/helpers/container_steps_helper.rb', line 29

def taxonomy_icon(taxonomy)
  taxonomy == 'locations' ? 'globe' : 'briefcase'
end