1
0
mirror of https://github.com/ansible/awx.git synced 2024-10-31 15:21:13 +03:00

Merge pull request #4420 from wenottingham/be-an-enabler

[RFC] Allow enable/disable of hosts in dynamic inventory from the UI.

Reviewed-by: https://github.com/softwarefactory-project-zuul[bot]
This commit is contained in:
softwarefactory-project-zuul[bot] 2019-08-05 17:29:17 +00:00 committed by GitHub
commit dbcc3c5733
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 19 additions and 22 deletions

View File

@ -34,11 +34,10 @@ function(i18n) {
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>" +
i18n._("For hosts that are part of an external" + i18n._("For hosts that are part of an external" +
" inventory, this flag cannot be changed. It will be" + " inventory, this may be" +
" set by the inventory sync process.") + " reset by the inventory sync process.") +
"</p>", "</p>",
dataTitle: i18n._('Host Enabled'), dataTitle: i18n._('Host Enabled'),
ngDisabled: 'host.has_inventory_sources'
} }
}, },
fields: { fields: {

View File

@ -27,7 +27,6 @@ export default ['i18n', function(i18n) {
{ {
field: 'toggleHost', field: 'toggleHost',
content: { content: {
ngDisabled: 'host.has_inventory_sources',
label: '', label: '',
columnClass: 'List-staticColumn--toggle', columnClass: 'List-staticColumn--toggle',
type: "toggle", type: "toggle",
@ -36,8 +35,8 @@ export default ['i18n', function(i18n) {
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>" +
i18n._("For hosts that are part of an external" + i18n._("For hosts that are part of an external" +
" inventory, this flag cannot be changed. It will be" + " inventory, this flag may be" +
" set by the inventory sync process.") + " reset by the inventory sync process.") +
"</p>", "</p>",
dataPlacement: "right", dataPlacement: "right",
nosort: true, nosort: true,

View File

@ -52,9 +52,9 @@
<div class="List-staticColumnLayout--hosts List-tableRow" ng-repeat="host in hosts track by host.id"> <div class="List-staticColumnLayout--hosts List-tableRow" ng-repeat="host in hosts track by host.id">
<div></div> <div></div>
<div class="List-tableCell toggleHost-column List-staticColumn--toggle"> <div class="List-tableCell toggleHost-column List-staticColumn--toggle">
<div class="ScheduleToggle" ng-class="{'is-on': host.enabled, 'ScheduleToggle--disabled': host.has_inventory_sources}" aw-tool-tip="{{strings.get('hostList.DISABLED_TOGGLE_TOOLTIP')}}" data-placement="right" data-tip-watch="undefined"> <div class="ScheduleToggle" ng-class="{'is-on': host.enabled}" aw-tool-tip="{{strings.get('hostList.DISABLED_TOGGLE_TOOLTIP')}}" data-placement="right" data-tip-watch="undefined">
<button type="button" ng-disabled="host.has_inventory_sources" ng-show="host.enabled" class="ScheduleToggle-switch is-on" ng-click="toggleHost($event, host)" translate>ON</button> <button type="button" ng-show="host.enabled" class="ScheduleToggle-switch is-on" ng-click="toggleHost($event, host)" translate>ON</button>
<button type="button" ng-disabled="host.has_inventory_sources" ng-show="!host.enabled" class="ScheduleToggle-switch" ng-click="toggleHost($event, host)" translate>OFF</button> <button type="button" ng-show="!host.enabled" class="ScheduleToggle-switch" ng-click="toggleHost($event, host)" translate>OFF</button>
</div> </div>
</div> </div>
<div class="List-tableCell active_failures-column status-column List-staticColumn--smallStatus"> <div class="List-tableCell active_failures-column status-column List-staticColumn--smallStatus">

View File

@ -33,11 +33,10 @@ function(i18n) {
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>" +
i18n._("For hosts that are part of an external" + i18n._("For hosts that are part of an external" +
" inventory, this flag cannot be changed. It will be" + " inventory, this may be" +
" set by the inventory sync process.") + " reset by the inventory sync process.") +
"</p>", "</p>",
dataTitle: i18n._('Host Enabled'), dataTitle: i18n._('Host Enabled'),
ngDisabled: 'host.has_inventory_sources'
} }
}, },
fields: { fields: {

View File

@ -23,7 +23,7 @@ export default ['i18n', function(i18n) {
{ {
field: 'toggleHost', field: 'toggleHost',
content: { content: {
ngDisabled: '!nested_host.summary_fields.user_capabilities.edit || nested_host.has_inventory_sources', ngDisabled: '!nested_host.summary_fields.user_capabilities.edit',
label: '', label: '',
columnClass: 'List-staticColumn--toggle', columnClass: 'List-staticColumn--toggle',
type: "toggle", type: "toggle",
@ -32,8 +32,8 @@ export default ['i18n', function(i18n) {
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>" +
i18n._("For hosts that are part of an external" + i18n._("For hosts that are part of an external" +
" inventory, this flag cannot be changed. It will be" + " inventory, this flag may be" +
" set by the inventory sync process.") + " reset by the inventory sync process.") +
"</p>", "</p>",
dataPlacement: "right", dataPlacement: "right",
nosort: true, nosort: true,

View File

@ -33,12 +33,12 @@ function(i18n) {
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>" +
i18n._("For hosts that are part of an external" + i18n._("For hosts that are part of an external" +
" inventory, this flag cannot be changed. It will be" + " inventory, this may be" +
" set by the inventory sync process.") + " reset by the inventory sync process.") +
"</p>", "</p>",
dataTitle: i18n._('Host Enabled'), dataTitle: i18n._('Host Enabled'),
dataPlacement: "right", dataPlacement: "right",
ngDisabled: '!host.summary_fields.user_capabilities.edit || host.has_inventory_sources || isSmartInvHost' ngDisabled: '!host.summary_fields.user_capabilities.edit || isSmartInvHost'
} }
}, },
fields: { fields: {

View File

@ -22,7 +22,7 @@ export default ['i18n', function(i18n) {
{ {
field: 'toggleHost', field: 'toggleHost',
content: { content: {
ngDisabled: '!host.summary_fields.user_capabilities.edit || host.has_inventory_sources', ngDisabled: '!host.summary_fields.user_capabilities.edit',
label: '', label: '',
type: "toggle", type: "toggle",
ngClick: "toggleHost($event, host)", ngClick: "toggleHost($event, host)",
@ -30,8 +30,8 @@ export default ['i18n', function(i18n) {
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>" +
i18n._("For hosts that are part of an external" + i18n._("For hosts that are part of an external" +
" inventory, this flag cannot be changed. It will be" + " inventory, this may be" +
" set by the inventory sync process.") + " reset by the inventory sync process.") +
"</p>", "</p>",
dataPlacement: "right", dataPlacement: "right",
nosort: true, nosort: true,

View File

@ -30,7 +30,7 @@ function InventoryHostsStrings (BaseString) {
ns.hostList = { ns.hostList = {
DISABLED_TOGGLE_TOOLTIP: () => t.s('{{ str1 }}</p><p>{{ str2 }}</p>', { DISABLED_TOGGLE_TOOLTIP: () => t.s('{{ str1 }}</p><p>{{ str2 }}</p>', {
str1: t.s('Indicates if a host is available and should be included in running jobs.'), str1: t.s('Indicates if a host is available and should be included in running jobs.'),
str2: t.s('For hosts that are part of an external inventory, this flag cannot be changed. It will be set by the inventory sync process.') str2: t.s('For hosts that are part of an external inventory, this may be reset by the inventory sync process.')
}) })
}; };