mirror of
https://github.com/ansible/awx.git
synced 2026-05-13 20:37:39 -02: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:
@@ -12,6 +12,9 @@
|
|||||||
$state.go('^', null, {reload: true});
|
$state.go('^', null, {reload: true});
|
||||||
};
|
};
|
||||||
$scope.toggleHostEnabled = function(){
|
$scope.toggleHostEnabled = function(){
|
||||||
|
if ($scope.host.has_inventory_sources){
|
||||||
|
return;
|
||||||
|
}
|
||||||
$scope.host.enabled = !$scope.host.enabled;
|
$scope.host.enabled = !$scope.host.enabled;
|
||||||
};
|
};
|
||||||
$scope.toggleEnabled = function(){
|
$scope.toggleEnabled = function(){
|
||||||
|
|||||||
@@ -43,6 +43,9 @@ export default ['$scope', '$state', '$stateParams', 'GetBasePath', 'DashboardHos
|
|||||||
};
|
};
|
||||||
|
|
||||||
$scope.toggleHostEnabled = function(host) {
|
$scope.toggleHostEnabled = function(host) {
|
||||||
|
if (host.has_inventory_sources){
|
||||||
|
return;
|
||||||
|
}
|
||||||
DashboardHostService.setHostStatus(host, !host.enabled)
|
DashboardHostService.setHostStatus(host, !host.enabled)
|
||||||
.then(function(res) {
|
.then(function(res) {
|
||||||
var index = _.findIndex($scope.hosts, function(o) {
|
var index = _.findIndex($scope.hosts, function(o) {
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ export default ['i18n', function(i18n){
|
|||||||
class: 'Form-header-field',
|
class: 'Form-header-field',
|
||||||
ngClick: 'toggleHostEnabled()',
|
ngClick: 'toggleHostEnabled()',
|
||||||
type: 'toggle',
|
type: 'toggle',
|
||||||
|
|
||||||
awToolTip: "<p>" +
|
awToolTip: "<p>" +
|
||||||
i18n._("Indicates if a host is available and should be included in running jobs.") +
|
i18n._("Indicates if a host is available and should be included in running jobs.") +
|
||||||
"</p><p>" +
|
"</p><p>" +
|
||||||
@@ -28,6 +27,7 @@ export default ['i18n', function(i18n){
|
|||||||
" sync process.") +
|
" sync process.") +
|
||||||
"</p>",
|
"</p>",
|
||||||
dataTitle: i18n._('Host Enabled'),
|
dataTitle: i18n._('Host Enabled'),
|
||||||
|
ngDisabled: 'host.has_inventory_sources'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
fields: {
|
fields: {
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ export default [ 'i18n', function(i18n){
|
|||||||
nosort: true,
|
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>",
|
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'),
|
dataTitle: i18n._('Host Enabled'),
|
||||||
|
ngDisabled: 'host.has_inventory_sources'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ export default
|
|||||||
" set by the inventory sync process.") +
|
" set by the inventory sync process.") +
|
||||||
"</p>",
|
"</p>",
|
||||||
dataTitle: i18n._('Host Enabled'),
|
dataTitle: i18n._('Host Enabled'),
|
||||||
|
ngDisabled: 'host.has_inventory_sources'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
fields: {
|
fields: {
|
||||||
|
|||||||
@@ -34,6 +34,9 @@ export default ['$state', '$stateParams', '$scope', 'HostForm', 'ParseTypeChange
|
|||||||
$state.go('^');
|
$state.go('^');
|
||||||
};
|
};
|
||||||
$scope.toggleHostEnabled = function() {
|
$scope.toggleHostEnabled = function() {
|
||||||
|
if ($scope.host.has_inventory_sources){
|
||||||
|
return;
|
||||||
|
}
|
||||||
$scope.host.enabled = !$scope.host.enabled;
|
$scope.host.enabled = !$scope.host.enabled;
|
||||||
};
|
};
|
||||||
$scope.formSave = function(){
|
$scope.formSave = function(){
|
||||||
|
|||||||
@@ -63,6 +63,9 @@
|
|||||||
$state.go('^');
|
$state.go('^');
|
||||||
};
|
};
|
||||||
$scope.toggleHostEnabled = function(){
|
$scope.toggleHostEnabled = function(){
|
||||||
|
if ($scope.host.has_inventory_sources){
|
||||||
|
return;
|
||||||
|
}
|
||||||
$scope.host.enabled = !$scope.host.enabled;
|
$scope.host.enabled = !$scope.host.enabled;
|
||||||
};
|
};
|
||||||
$scope.formSave = function(){
|
$scope.formSave = function(){
|
||||||
|
|||||||
@@ -11,12 +11,21 @@
|
|||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
display: flex;
|
display: flex;
|
||||||
height: 18px;
|
height: 18px;
|
||||||
|
|
||||||
|
&.ScheduleToggle--disabled {
|
||||||
|
cursor: not-allowed;
|
||||||
|
border-color: @b7grey !important;
|
||||||
|
.ScheduleToggle-switch {
|
||||||
|
background-color: @b7grey !important;
|
||||||
|
cursor: not-allowed;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.ScheduleToggle-switch {
|
.ScheduleToggle-switch {
|
||||||
color: @default-interface-txt;
|
color: @default-interface-txt;
|
||||||
background-color: @default-bg;
|
background-color: @default-bg;
|
||||||
margin-left: 4px;
|
margin-left: 7px;
|
||||||
border-left: 1px solid @default-icon;
|
border-left: 1px solid @default-icon;
|
||||||
margin-right: 0px;
|
margin-right: 0px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
@@ -28,6 +37,7 @@
|
|||||||
margin-top: 0px;
|
margin-top: 0px;
|
||||||
border-top: 0px;
|
border-top: 0px;
|
||||||
border-bottom: 0px;
|
border-bottom: 0px;
|
||||||
|
border-right: 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ScheduleToggle.is-on {
|
.ScheduleToggle.is-on {
|
||||||
|
|||||||
@@ -545,6 +545,7 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
|
|||||||
html += " " + field.columnClass;
|
html += " " + field.columnClass;
|
||||||
html += "\"><div class='ScheduleToggle' ng-class='{\"is-on\": " + form.iterator + ".";
|
html += "\"><div class='ScheduleToggle' ng-class='{\"is-on\": " + form.iterator + ".";
|
||||||
html += (field.flag) ? field.flag : "enabled";
|
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 += "\}' 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 += (field.flag) ? field.flag : 'enabled';
|
||||||
html += "' class='ScheduleToggle-switch is-on' ng-click='" + field.ngClick + "'>" + i18n._("ON") + "</button><button ng-show='!" + form.iterator + "." ;
|
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 += " " + field.columnClass;
|
||||||
html += "\"><div class='ScheduleToggle' ng-class='{\"is-on\": " + form.iterator + ".";
|
html += "\"><div class='ScheduleToggle' ng-class='{\"is-on\": " + form.iterator + ".";
|
||||||
html += (field.flag) ? field.flag : "enabled";
|
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 += "\}' 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 += (field.flag) ? field.flag : 'enabled';
|
||||||
html += "' class='ScheduleToggle-switch is-on' ng-click='" + field.ngClick + "'>ON</div><div ng-show='!" + form.iterator + "." ;
|
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 += field.columnClass ? " " + field.columnClass : "";
|
||||||
html += "\"><div class='ScheduleToggle' ng-class='{\"is-on\": " + list.iterator + ".";
|
html += "\"><div class='ScheduleToggle' ng-class='{\"is-on\": " + list.iterator + ".";
|
||||||
html += (field.flag) ? field.flag : "enabled";
|
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 += "\}' aw-tool-tip='" + field.awToolTip + "' data-placement='" + field.dataPlacement + "' data-tip-watch='" + field.dataTipWatch + "'><button ";
|
||||||
html += (field.ngDisabled) ? `ng-disabled="${field.ngDisabled}" ` : "";
|
html += (field.ngDisabled) ? `ng-disabled="${field.ngDisabled}" ` : "";
|
||||||
html += "ng-show='" + list.iterator + "." ;
|
html += "ng-show='" + list.iterator + "." ;
|
||||||
|
|||||||
Reference in New Issue
Block a user