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