mirror of
https://github.com/ansible/awx.git
synced 2026-01-15 03:40:42 -03:30
Merge pull request #2572 from mabashian/2303-inv-src
Disable copy button for inv's with sources
This commit is contained in:
commit
bb65965e2b
@ -147,6 +147,14 @@ table, tbody {
|
||||
color: @list-actn-icn-hov;
|
||||
}
|
||||
|
||||
.List-actionButton + .btn-disabled {
|
||||
&:hover {
|
||||
color: @default-icon-hov;
|
||||
background-color: @list-actn-bg !important;
|
||||
}
|
||||
color: @default-icon-hov;
|
||||
}
|
||||
|
||||
.List-actionButton--delete:hover {
|
||||
background-color: @list-actn-del-bg-hov !important;
|
||||
}
|
||||
@ -217,7 +225,7 @@ table, tbody {
|
||||
margin-left: 52%;
|
||||
justify-content: flex-start;
|
||||
button {
|
||||
height: 34px;
|
||||
height: 34px;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -104,10 +104,11 @@ export default ['i18n', 'awxNetStrings' , function(i18n, awxNetStrings) {
|
||||
copy: {
|
||||
label: i18n._('Copy'),
|
||||
ngClick: 'copyInventory(inventory)',
|
||||
"class": 'btn-danger btn-xs',
|
||||
awToolTip: i18n._('Copy inventory'),
|
||||
awToolTip: "{{ inventory.copyTip }}",
|
||||
dataTipWatch: "inventory.copyTip",
|
||||
dataPlacement: 'top',
|
||||
ngShow: '!inventory.pending_deletion && inventory.summary_fields.user_capabilities.copy'
|
||||
ngShow: '!inventory.pending_deletion && inventory.summary_fields.user_capabilities.copy',
|
||||
ngClass: 'inventory.copyClass'
|
||||
},
|
||||
view: {
|
||||
label: i18n._('View'),
|
||||
|
||||
@ -40,6 +40,8 @@ function InventoriesList($scope,
|
||||
inventory.host_status_class = "Inventories-hostStatus";
|
||||
|
||||
if (inventory.has_inventory_sources) {
|
||||
inventory.copyTip = i18n._('Inventories with sources cannot be copied');
|
||||
inventory.copyClass = "btn-disabled";
|
||||
if (inventory.inventory_sources_with_failures > 0) {
|
||||
inventory.syncStatus = 'error';
|
||||
inventory.syncTip = inventory.inventory_sources_with_failures + i18n._(' sources with sync failures. Click for details');
|
||||
@ -50,6 +52,8 @@ function InventoriesList($scope,
|
||||
}
|
||||
}
|
||||
else {
|
||||
inventory.copyTip = i18n._('Copy Inventory');
|
||||
inventory.copyClass = "";
|
||||
inventory.syncStatus = 'na';
|
||||
inventory.syncTip = i18n._('Not configured for inventory sync.');
|
||||
inventory.launch_class = "btn-disabled";
|
||||
@ -74,15 +78,17 @@ function InventoriesList($scope,
|
||||
}
|
||||
|
||||
$scope.copyInventory = inventory => {
|
||||
Wait('start');
|
||||
new Inventory('get', inventory.id)
|
||||
.then(model => model.copy())
|
||||
.then(copy => $scope.editInventory(copy, true))
|
||||
.catch(({ data, status }) => {
|
||||
const params = { hdr: 'Error!', msg: `Call to copy failed. Return status: ${status}` };
|
||||
ProcessErrors($scope, data, status, null, params);
|
||||
})
|
||||
.finally(() => Wait('stop'));
|
||||
if (!inventory.has_inventory_sources) {
|
||||
Wait('start');
|
||||
new Inventory('get', inventory.id)
|
||||
.then(model => model.copy())
|
||||
.then(copy => $scope.editInventory(copy, true))
|
||||
.catch(({ data, status }) => {
|
||||
const params = { hdr: 'Error!', msg: `Call to copy failed. Return status: ${status}` };
|
||||
ProcessErrors($scope, data, status, null, params);
|
||||
})
|
||||
.finally(() => Wait('stop'));
|
||||
}
|
||||
};
|
||||
|
||||
$scope.goToGraph = function(inventory){
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user