Skip to content

Commit

Permalink
0.1.10
Browse files Browse the repository at this point in the history
  • Loading branch information
Zenya committed Nov 4, 2017
1 parent c3bd848 commit e3c2c92
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 16 deletions.
4 changes: 2 additions & 2 deletions app/assets/javascripts/foreman_datacenter/ajax.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
$(function () {
function onSend() {
foreman.tools.showSpinner();
tfm.tools.showSpinner();
}

function onSuccess() {
window.location.reload();
}

function onComplete() {
foreman.tools.hideSpinner();
tfm.tools.hideSpinner();
}

var selectors = 'a[data-action="connected"], a[data-action="planned"], a[data-action="destroy"]';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
}
}
8 changes: 4 additions & 4 deletions app/assets/javascripts/foreman_datacenter/devices.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
}
}
Expand All @@ -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();
});
}
}
4 changes: 2 additions & 2 deletions app/assets/javascripts/foreman_datacenter/racks.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
}
}
4 changes: 2 additions & 2 deletions app/assets/javascripts/foreman_datacenter/shared.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
}
}
8 changes: 5 additions & 3 deletions app/models/concerns/foreman_datacenter/host_extensions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion lib/foreman_datacenter/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module ForemanDatacenter
VERSION = '0.1.9'.freeze
VERSION = '0.1.10'.freeze
end

0 comments on commit e3c2c92

Please sign in to comment.