diff --git a/app/assets/javascripts/foreman_datacenter/ajax.js b/app/assets/javascripts/foreman_datacenter/ajax.js index 4ebf30d..f5e61be 100644 --- a/app/assets/javascripts/foreman_datacenter/ajax.js +++ b/app/assets/javascripts/foreman_datacenter/ajax.js @@ -1,6 +1,6 @@ $(function () { function onSend() { - foreman.tools.showSpinner(); + tfm.tools.showSpinner(); } function onSuccess() { @@ -8,7 +8,7 @@ $(function () { } function onComplete() { - foreman.tools.hideSpinner(); + tfm.tools.hideSpinner(); } var selectors = 'a[data-action="connected"], a[data-action="planned"], a[data-action="destroy"]'; diff --git a/app/assets/javascripts/foreman_datacenter/device_interface_connections.js b/app/assets/javascripts/foreman_datacenter/device_interface_connections.js index 2cf039f..9428329 100644 --- a/app/assets/javascripts/foreman_datacenter/device_interface_connections.js +++ b/app/assets/javascripts/foreman_datacenter/device_interface_connections.js @@ -4,13 +4,13 @@ function connectionsNewRackSelected(item) { if (rack === '') { return false; } else { - foreman.tools.showSpinner(); + tfm.tools.showSpinner(); var url = $item.data('url'); var params = $.param({ rack_id: rack }); var $container = $('#devices-container'); $container.load(url, params, function () { $container.find('select').select2({allowClear: true}); - foreman.tools.hideSpinner(); + tfm.tools.hideSpinner(); }); } } diff --git a/app/assets/javascripts/foreman_datacenter/devices.js b/app/assets/javascripts/foreman_datacenter/devices.js index bc115fc..23ee102 100644 --- a/app/assets/javascripts/foreman_datacenter/devices.js +++ b/app/assets/javascripts/foreman_datacenter/devices.js @@ -4,13 +4,13 @@ function devicesNewManufacturerSelected(item) { if (manufacturer === '') { return false; } else { - foreman.tools.showSpinner(); + tfm.tools.showSpinner(); var url = $item.data('url'); var params = $.param({ manufacturer_id: manufacturer }); var $container = $('#device-types-container'); $container.load(url + ' #device-types', params, function () { $container.find('select').select2({allowClear: true}); - foreman.tools.hideSpinner(); + tfm.tools.hideSpinner(); }); } } @@ -21,13 +21,13 @@ function devicesNewSiteSelected(item) { if (site === '') { return false; } else { - foreman.tools.showSpinner(); + tfm.tools.showSpinner(); var url = $item.data('url'); var params = $.param({ site_id: site }); var $container = $('#sites-container'); $container.load(url + ' #sites', params, function () { $container.find('select').select2({allowClear: true}); - foreman.tools.hideSpinner(); + tfm.tools.hideSpinner(); }); } } diff --git a/app/assets/javascripts/foreman_datacenter/racks.js b/app/assets/javascripts/foreman_datacenter/racks.js index 44f87cc..26a9105 100644 --- a/app/assets/javascripts/foreman_datacenter/racks.js +++ b/app/assets/javascripts/foreman_datacenter/racks.js @@ -4,13 +4,13 @@ function racksNewSiteSelected(item) { if (site === '') { return false; } else { - foreman.tools.showSpinner(); + tfm.tools.showSpinner(); var url = $item.data('url'); var params = $.param({ site_id: site }); var $container = $('#rack-groups-container'); $container.load(url + ' #rack-groups', params, function () { $container.find('select').select2({allowClear: true}); - foreman.tools.hideSpinner(); + tfm.tools.hideSpinner(); }); } } diff --git a/app/assets/javascripts/foreman_datacenter/shared.js b/app/assets/javascripts/foreman_datacenter/shared.js index cb2225c..5e613c2 100644 --- a/app/assets/javascripts/foreman_datacenter/shared.js +++ b/app/assets/javascripts/foreman_datacenter/shared.js @@ -10,10 +10,10 @@ function newDeviceSelected(item) { if (fragment) url += ' ' + fragment; var params = $.param({device_id: id}); var $targetContainer = $($mainContainer.data('target')); - foreman.tools.showSpinner(); + tfm.tools.showSpinner(); $targetContainer.load(url, params, function () { $targetContainer.find('select').select2({allowClear: true}); - foreman.tools.hideSpinner(); + tfm.tools.hideSpinner(); }); } } diff --git a/app/models/concerns/foreman_datacenter/host_extensions.rb b/app/models/concerns/foreman_datacenter/host_extensions.rb index 766b73a..d80e53d 100644 --- a/app/models/concerns/foreman_datacenter/host_extensions.rb +++ b/app/models/concerns/foreman_datacenter/host_extensions.rb @@ -9,9 +9,11 @@ module HostExtensions end def update_device_on_destroy - new_device_name = "Unassigned device (former: #{name})" - device.update(name: new_device_name) - device.interfaces.clear + if device.exist? + new_device_name = "Unassigned device (former: #{name})" + device.update(name: new_device_name) + # device.interfaces.clear + end end def fact_value_by_name(name) diff --git a/lib/foreman_datacenter/version.rb b/lib/foreman_datacenter/version.rb index 5601650..4558f51 100644 --- a/lib/foreman_datacenter/version.rb +++ b/lib/foreman_datacenter/version.rb @@ -1,3 +1,3 @@ module ForemanDatacenter - VERSION = '0.1.9'.freeze + VERSION = '0.1.10'.freeze end