foreman_datacenter 1.16.9 → 1.16.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 94ce329914cc6e464c970b29a73a8f7594373aa85b74b2900dbe1cd526eb8fd8
4
- data.tar.gz: 3acd7ceeac77e9f2401a7a997b0169bddc0e0e62a91feedff42c411ba2899284
3
+ metadata.gz: 354eb0d1b2fc1d23cc0079af61f342fe0ed71e4847511b620d248a6077f148f2
4
+ data.tar.gz: cec0dd33b9e2b47c87f6ae16e1881aaaafd099d7976b32fbb1eeb5a2500e2ef5
5
5
  SHA512:
6
- metadata.gz: 3d6109c79b9d5ba3804728a600259d698f90cc6339b3cfd6c7e0d9a49737d20fde77c5019cb9142997a9151d205f58c1e9a5ec15c465ac4e7022197046bfa3b9
7
- data.tar.gz: a0f321fb5c392f250fe2435b790e0e07347bb27b00ee96f98701aa05732ce8c57c6e8a70a37cf36e2c03a4c036c12eb91c93cfce1cf6902a603f9aa93802da25
6
+ metadata.gz: a144a6ae2fc8b67c74fa8f955de09f2ad47f82d8f5714a449713fa19da95817fbff47cf8e12ccebfe1722c45687e2a361bc8058c45ab8934cbf61593c8125155
7
+ data.tar.gz: c3561ccbceb2dc8afb29b35f28352a664d6d7278435e67916616b4c98eae9747e6db416ae5b84087fbae6a3595f7f7cc4a32d7e1d6bfbc1d0d59db2895322a12
@@ -10,7 +10,8 @@ $(window).click(function(event) {
10
10
  var patt = new RegExp(str);
11
11
  var token = $('meta[name="csrf-token"]').attr('content');
12
12
  if (object_type == 'device') {
13
- var checkbox_label = 'Delete associated host ONLY and keep current device as UNASSIGNED!'
13
+ // var checkbox_label = 'Delete associated host ONLY and keep current device as UNASSIGNED!'
14
+ var checkbox_label = ''
14
15
  } else {
15
16
  var checkbox_label = 'Delete ' + object_type + ' ONLY'
16
17
  }
@@ -18,11 +19,18 @@ $(window).click(function(event) {
18
19
  if (!(patt.test(pathname))) {
19
20
  pathname = pathname + str
20
21
  }
21
-
22
22
  var move = "<p></p>"
23
- if (object_type == "device" || object_type == "site" || object_type == "rack" || object_type == "rack_group") {
23
+ var checkbox = ""
24
+ var text = "You will permanently delete the"
25
+ text_ao = ""
26
+ if (object_type == "site" || object_type == "rack" || object_type == "rack_group") {
24
27
  move = '<p>You also can move associated object to another <strong>' + object_type + '</strong> before you destroy it.</p> \
25
28
  <a class="btn btn-block btn-primary modal-btn modal-btn-primary marginbottomsixteen" href="/datacenter/' + object_type + 's/' + object_id + '/move">Move associated objects</a>'
29
+ checkbox = '<input type="checkbox" name="object_only" id="object_only" value="true" checked="checked">'
30
+ text = "By unselecting checkbox you will permanently delete the"
31
+ text_ao = 'with \
32
+ <strong>ALL</strong> \
33
+ associated objects' + ao
26
34
  }
27
35
 
28
36
  var form = '<div id="myModal" class="modal"> \
@@ -37,16 +45,15 @@ $(window).click(function(event) {
37
45
  <div class="modal-body"> \
38
46
  <p>This action \
39
47
  <strong>cannot</strong> \
40
- be undone. By unselecting checkbox you will permanently delete the \
48
+ be undone. \
49
+ ' + text + ' \
41
50
  <strong>' + object_name + '</strong> \
42
- with \
43
- <strong>ALL</strong> \
44
- associated objects' + ao + ' \
51
+ ' + text_ao + ' \
45
52
  </p> \
46
53
  <form class="modal-form nonpaddingbottom" action=' + pathname + ' accept-charset="UTF-8" method="post"> \
47
54
  <input type="hidden" name="_method" value="delete"> \
48
55
  <input type="hidden" name="authenticity_token" value=' + token + '> \
49
- <input type="checkbox" name="object_only" id="object_only" value="true" checked="checked"> \
56
+ ' + checkbox + ' \
50
57
  <label>' + checkbox_label + '</label> \
51
58
  <input type="submit" name="commit" value="I understand the consequences, delete this ' + object_type + '" class="btn btn-block btn-danger modal-btn modal-btn-danger"> \
52
59
  </form> \
@@ -3,10 +3,10 @@ module ForemanDatacenter
3
3
  include Foreman::Controller::AutoCompleteSearch
4
4
  include ForemanDatacenter::Controller::Parameters::DeviceInterfaceConnection
5
5
 
6
- before_action :find_resource, only: [:destroy, :planned, :connected]
6
+ before_action :find_resource, only: [:destroy, :planned, :connected, :edit]
7
7
 
8
8
  def index
9
- @device_interface_connections = resource_base_search_and_page.includes(:second_interface, first_interface: [:device])
9
+ @device_interface_connections = resource_base_search_and_page.includes(second_interface: [:device], first_interface: [:device])
10
10
  end
11
11
 
12
12
  def new
@@ -15,6 +15,10 @@ module ForemanDatacenter
15
15
  )
16
16
  end
17
17
 
18
+ def edit
19
+ @device = @device_interface_connection.first_device
20
+ end
21
+
18
22
  def create
19
23
  @device_interface_connection = ForemanDatacenter::DeviceInterfaceConnection.new(device_interface_connection_params.merge(interface_a: params[:device_interface_id]))
20
24
  @device_interface_connection.first_interface = get_device_interface
@@ -52,5 +56,9 @@ module ForemanDatacenter
52
56
  def get_device_interface
53
57
  ForemanDatacenter::DeviceInterface.find(params[:device_interface_id])
54
58
  end
59
+
60
+ def device_interface_connection_params
61
+ params[:foreman_datacenter_device_interface_connetction].permit(:speed)
62
+ end
55
63
  end
56
64
  end
@@ -60,21 +60,10 @@ module ForemanDatacenter
60
60
  end
61
61
 
62
62
  def destroy
63
- unless params['object_only']
64
- if @device.destroy
65
- process_success success_redirect: "/datacenter/devices"
66
- else
67
- process_error object: @device
68
- end
63
+ if @device.destroy
64
+ process_success success_redirect: "/datacenter/devices"
69
65
  else
70
- if @device.host
71
- @device.host.destroy
72
- new_device_name = "Unassigned device (former: #{@device.name})"
73
- @device.update(name: new_device_name)
74
- process_success success_redirect: '/datacenter/devices', success_msg: 'Associated host deleted'
75
- else
76
- process_error success_redirect: '/datacenter/devices', error_msg: 'Associated host not found'
77
- end
66
+ process_error object: @device
78
67
  end
79
68
  end
80
69
 
@@ -23,7 +23,7 @@ module ForemanDatacenter
23
23
  scoped_search in: :second_interface, on: :name, complete_value: true, rename: :interface_b
24
24
 
25
25
  def first_device
26
- first_interface.device
26
+ self.try(:first_interface).try(:device)
27
27
  end
28
28
 
29
29
  def first_rack
@@ -35,7 +35,7 @@ module ForemanDatacenter
35
35
  end
36
36
 
37
37
  def second_device
38
- second_interface.device
38
+ self.try(:second_interface).try(:device)
39
39
  end
40
40
 
41
41
  def second_rack
@@ -14,12 +14,34 @@
14
14
  <% for port in @console_ports %>
15
15
  <tr>
16
16
  <td>
17
- <%= link_to port.console_server_port.device.name,
18
- device_path(port.console_server_port.device) %>
17
+ <% if port.console_server_port %>
18
+ <%= link_to port.console_server_port.device.name,
19
+ device_path(port.console_server_port.device) %>
20
+ <% else %>
21
+ <%= muted_text("Device not found", "span") %>
22
+ <% end %>
23
+ </td>
24
+ <td>
25
+ <% if port.console_server_port %>
26
+ <%= h port.console_server_port.name %>
27
+ <% else %>
28
+ <%= muted_text("Port not found", "span") %>
29
+ <% end %>
30
+ </td>
31
+ <td>
32
+ <% if port.device %>
33
+ <%= link_to port.device.name, device_path(port.device) %>
34
+ <% else %>
35
+ <%= muted_text("Device not found", "span") %>
36
+ <% end %>
37
+ </td>
38
+ <td>
39
+ <% if port %>
40
+ <%= h port.name %>
41
+ <% else %>
42
+ <%= muted_text("Port not found", "span") %>
43
+ <% end %>
19
44
  </td>
20
- <td><%= h port.console_server_port.name %></td>
21
- <td><%= link_to port.device.name, device_path(port.device) %></td>
22
- <td><%= h port.name %></td>
23
45
  </tr>
24
46
  <% end %>
25
47
  </tbody>
@@ -15,15 +15,35 @@
15
15
  <% for connection in @device_interface_connections %>
16
16
  <tr>
17
17
  <td>
18
- <%= link_to connection.first_device.name,
18
+ <% if connection.first_device %>
19
+ <%= link_to connection.first_device.name,
19
20
  device_path(connection.first_device) %>
21
+ <% else %>
22
+ <%= muted_text("Device not found", "span") %>
23
+ <% end %>
20
24
  </td>
21
- <td><%= h connection.first_interface.name %></td>
22
25
  <td>
26
+ <% if connection.first_device %>
27
+ <%= h connection.first_interface.name %>
28
+ <% else %>
29
+ <%= muted_text("Interface not found", "span") %>
30
+ <% end %>
31
+ </td>
32
+ <td>
33
+ <% if connection.second_device %>
23
34
  <%= link_to connection.second_device.name,
24
35
  device_path(connection.second_device) %>
36
+ <% else %>
37
+ <%= muted_text("Device not found", "span") %>
38
+ <% end %>
39
+ </td>
40
+ <td>
41
+ <% if connection.second_device %>
42
+ <%= h connection.second_interface.name %>
43
+ <% else %>
44
+ <%= muted_text("Interface not found", "span") %>
45
+ <% end %>
25
46
  </td>
26
- <td><%= h connection.second_interface.name %></td>
27
47
  </tr>
28
48
  <% end %>
29
49
  </tbody>
@@ -8,11 +8,19 @@
8
8
  <td><%= h interface.mac_address %></td>
9
9
  <td><%= h interface.ip_address %></td>
10
10
  <td>
11
- <%= link_to interface.connected_interface.device.name,
12
- device_path(interface.connected_interface.device) %>
11
+ <% if interface.connected_interface %>
12
+ <%= link_to interface.connected_interface.device.name,
13
+ device_path(interface.connected_interface.device) %>
14
+ <% else %>
15
+ <%= muted_text("Device not found", "span") %>
16
+ <% end %>
13
17
  </td>
14
18
  <td>
15
- <%= h interface.connected_interface.name %>
19
+ <% if interface.connected_interface %>
20
+ <%= h interface.connected_interface.name %>
21
+ <% else %>
22
+ <%= muted_text("Interface not found", "span") %>
23
+ <% end %>
16
24
  </td>
17
25
  <td>
18
26
  <%= h interface.connection.id %>
@@ -10,14 +10,14 @@
10
10
  :class => 'btn btn-warning'
11
11
  ),
12
12
  display_fake_delete_if_authorized(
13
- hash_for_platform_path(id: @platform),
14
- class: 'btn btn-danger',
15
- id: 'init-modal',
16
- href: '#',
17
- data: { objecttype: 'platform',
18
- objectid: @platform.id,
19
- objectname: @platform.to_label,
20
- associatedobjects: associated_objects('platform') }
13
+ hash_for_platform_path(:id => @platform).merge(:auth_object => @platform, :authorizer => authorizer),
14
+ class: 'btn btn-danger',
15
+ id: 'init-modal',
16
+ href: '#',
17
+ data: { objecttype: 'platform',
18
+ objectid: @platform.id,
19
+ objectname: @platform.to_label,
20
+ associatedobjects: associated_objects('platform') }
21
21
  )
22
22
  help_path %>
23
23
 
@@ -25,7 +25,7 @@
25
25
  <% end %>
26
26
  <% unless rack.unpositioned_devices.empty? %>
27
27
  <tr>
28
- <td class="col-md-1">Unpositioned Devices</td>
28
+ <td class="col-md-1">Unpositioned</br>Devices</td>
29
29
  <td class="col-md-4" style="text-align:center">
30
30
  <% rack.unpositioned_devices.each do |d| %>
31
31
  <div class="<%= "label " + d.device_role.color.downcase.gsub(" ","") %>" style="border-radius:40px;border:0px;">&nbsp;&nbsp;</div>
@@ -1,3 +1,3 @@
1
1
  module ForemanDatacenter
2
- VERSION = '1.16.9'.freeze
2
+ VERSION = '1.16.10'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_datacenter
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.16.9
4
+ version: 1.16.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pavel Ivanov
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-07-09 00:00:00.000000000 Z
12
+ date: 2019-07-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: prawn