mirror of
https://github.com/ansible/awx.git
synced 2026-01-21 22:48:02 -03:30
Merge pull request #5454 from ryanpetrello/fix-5420
disable the on/off toggle button for hosts from dynamic inventory.
This commit is contained in:
commit
e9a9a79d94
@ -12,6 +12,9 @@
|
||||
$state.go('^', null, {reload: true});
|
||||
};
|
||||
$scope.toggleHostEnabled = function(){
|
||||
if ($scope.host.has_inventory_sources){
|
||||
return;
|
||||
}
|
||||
$scope.host.enabled = !$scope.host.enabled;
|
||||
};
|
||||
$scope.toggleEnabled = function(){
|
||||
|
||||
@ -43,6 +43,9 @@ export default ['$scope', '$state', '$stateParams', 'GetBasePath', 'DashboardHos
|
||||
};
|
||||
|
||||
$scope.toggleHostEnabled = function(host) {
|
||||
if (host.has_inventory_sources){
|
||||
return;
|
||||
}
|
||||
DashboardHostService.setHostStatus(host, !host.enabled)
|
||||
.then(function(res) {
|
||||
var index = _.findIndex($scope.hosts, function(o) {
|
||||
|
||||
@ -19,7 +19,6 @@ export default ['i18n', function(i18n){
|
||||
class: 'Form-header-field',
|
||||
ngClick: 'toggleHostEnabled()',
|
||||
type: 'toggle',
|
||||
|
||||
awToolTip: "<p>" +
|
||||
i18n._("Indicates if a host is available and should be included in running jobs.") +
|
||||
"</p><p>" +
|
||||
@ -28,6 +27,7 @@ export default ['i18n', function(i18n){
|
||||
" sync process.") +
|
||||
"</p>",
|
||||
dataTitle: i18n._('Host Enabled'),
|
||||
ngDisabled: 'host.has_inventory_sources'
|
||||
}
|
||||
},
|
||||
fields: {
|
||||
|
||||
@ -52,6 +52,7 @@ export default [ 'i18n', function(i18n){
|
||||
nosort: true,
|
||||
awToolTip: "<p>" + i18n._("Indicates if a host is available and should be included in running jobs.") + "</p><p>" + i18n._("For hosts that are part of an external inventory, this flag cannot be changed. It will be set by the inventory sync process.") + "</p>",
|
||||
dataTitle: i18n._('Host Enabled'),
|
||||
ngDisabled: 'host.has_inventory_sources'
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@ -36,6 +36,7 @@ export default
|
||||
" set by the inventory sync process.") +
|
||||
"</p>",
|
||||
dataTitle: i18n._('Host Enabled'),
|
||||
ngDisabled: 'host.has_inventory_sources'
|
||||
}
|
||||
},
|
||||
fields: {
|
||||
|
||||
@ -34,6 +34,9 @@ export default ['$state', '$stateParams', '$scope', 'HostForm', 'ParseTypeChange
|
||||
$state.go('^');
|
||||
};
|
||||
$scope.toggleHostEnabled = function() {
|
||||
if ($scope.host.has_inventory_sources){
|
||||
return;
|
||||
}
|
||||
$scope.host.enabled = !$scope.host.enabled;
|
||||
};
|
||||
$scope.formSave = function(){
|
||||
|
||||
@ -63,6 +63,9 @@
|
||||
$state.go('^');
|
||||
};
|
||||
$scope.toggleHostEnabled = function(){
|
||||
if ($scope.host.has_inventory_sources){
|
||||
return;
|
||||
}
|
||||
$scope.host.enabled = !$scope.host.enabled;
|
||||
};
|
||||
$scope.formSave = function(){
|
||||
|
||||
@ -11,12 +11,21 @@
|
||||
cursor: pointer;
|
||||
display: flex;
|
||||
height: 18px;
|
||||
|
||||
&.ScheduleToggle--disabled {
|
||||
cursor: not-allowed;
|
||||
border-color: @b7grey !important;
|
||||
.ScheduleToggle-switch {
|
||||
background-color: @b7grey !important;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.ScheduleToggle-switch {
|
||||
color: @default-interface-txt;
|
||||
background-color: @default-bg;
|
||||
margin-left: 4px;
|
||||
margin-left: 7px;
|
||||
border-left: 1px solid @default-icon;
|
||||
margin-right: 0px;
|
||||
text-align: center;
|
||||
@ -28,6 +37,7 @@
|
||||
margin-top: 0px;
|
||||
border-top: 0px;
|
||||
border-bottom: 0px;
|
||||
border-right: 0px;
|
||||
}
|
||||
|
||||
.ScheduleToggle.is-on {
|
||||
|
||||
@ -545,6 +545,7 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
|
||||
html += " " + field.columnClass;
|
||||
html += "\"><div class='ScheduleToggle' ng-class='{\"is-on\": " + form.iterator + ".";
|
||||
html += (field.flag) ? field.flag : "enabled";
|
||||
html += (field.ngDisabled) ? ', "ScheduleToggle--disabled": ' + field.ngDisabled : '';
|
||||
html += "\}' aw-tool-tip='" + field.awToolTip + "' data-placement='" + field.dataPlacement + "' data-tip-watch='" + field.dataTipWatch + "'><button ng-show='" + form.iterator + "." ;
|
||||
html += (field.flag) ? field.flag : 'enabled';
|
||||
html += "' class='ScheduleToggle-switch is-on' ng-click='" + field.ngClick + "'>" + i18n._("ON") + "</button><button ng-show='!" + form.iterator + "." ;
|
||||
@ -693,6 +694,7 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
|
||||
html += " " + field.columnClass;
|
||||
html += "\"><div class='ScheduleToggle' ng-class='{\"is-on\": " + form.iterator + ".";
|
||||
html += (field.flag) ? field.flag : "enabled";
|
||||
html += (field.ngDisabled) ? ', "ScheduleToggle--disabled": ' + field.ngDisabled : '';
|
||||
html += "\}' aw-tool-tip='" + field.awToolTip + "' data-placement='" + field.dataPlacement + "' data-tip-watch='" + field.dataTipWatch + "'><div ng-show='" + form.iterator + "." ;
|
||||
html += (field.flag) ? field.flag : 'enabled';
|
||||
html += "' class='ScheduleToggle-switch is-on' ng-click='" + field.ngClick + "'>ON</div><div ng-show='!" + form.iterator + "." ;
|
||||
|
||||
@ -510,6 +510,7 @@ angular.module('GeneratorHelpers', [systemStatus.name])
|
||||
html += field.columnClass ? " " + field.columnClass : "";
|
||||
html += "\"><div class='ScheduleToggle' ng-class='{\"is-on\": " + list.iterator + ".";
|
||||
html += (field.flag) ? field.flag : "enabled";
|
||||
html += (field.ngDisabled) ? ', "ScheduleToggle--disabled": ' + field.ngDisabled : '';
|
||||
html += "\}' aw-tool-tip='" + field.awToolTip + "' data-placement='" + field.dataPlacement + "' data-tip-watch='" + field.dataTipWatch + "'><button ";
|
||||
html += (field.ngDisabled) ? `ng-disabled="${field.ngDisabled}" ` : "";
|
||||
html += "ng-show='" + list.iterator + "." ;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user