Merge pull request #6157 from mabashian/inventory-ux-bug-fixes

Inventory ux bug fixes
This commit is contained in:
Michael Abashian 2017-05-05 10:33:56 -04:00 committed by GitHub
commit 0522e27a66
12 changed files with 40 additions and 49 deletions

View File

@ -15,6 +15,9 @@ export default {
squash: true
}
},
data: {
formChildState: true
},
name: 'inventories.edit.adhoc',
views: {
'adhocForm@inventories': {

View File

@ -83,6 +83,8 @@ function(i18n, nestedGroupListState, nestedHostsListState, buildHostAddState){
related: {
nested_groups: {
name: 'nested_groups',
awToolTip: i18n._('Please save before defining groups'),
dataPlacement: 'top',
ngClick: "$state.go('inventories.edit.groups.edit.nested_groups')",
include: "NestedGroupListDefinition",
includeForm: "NestedGroupFormDefinition",
@ -92,6 +94,8 @@ function(i18n, nestedGroupListState, nestedHostsListState, buildHostAddState){
},
nested_hosts: {
name: 'nested_hosts',
awToolTip: i18n._('Please save before defining hosts'),
dataPlacement: 'top',
ngClick: "$state.go('inventories.edit.groups.edit.nested_hosts')",
include: "NestedHostsListDefinition",
title: i18n._('Hosts'),

View File

@ -167,7 +167,7 @@
return item.name;
}).value().join(':');
$state.go('^.adhoc', {pattern: pattern});
$state.go('^.^.^.adhoc', {pattern: pattern});
};
}];

View File

@ -153,7 +153,7 @@ export default ['$scope', 'NestedHostsListDefinition', '$rootScope', 'GetBasePat
return item.name;
}).value().join(':');
$state.go('^.adhoc', {pattern: pattern});
$state.go('^.^.^.adhoc', {pattern: pattern});
};
$scope.copyMoveHost = function(id) {

View File

@ -107,11 +107,15 @@ function(i18n, nestedGroupListState) {
related: {
ansible_facts: {
name: 'ansible_facts',
awToolTip: i18n._('Please save before viewing facts'),
dataPlacement: 'top',
title: i18n._('Facts'),
skipGenerator: true
},
nested_groups: {
name: 'nested_groups',
awToolTip: i18n._('Please save before defining groups'),
dataPlacement: 'top',
ngClick: "$state.go('inventories.edit.groups.edit.nested_hosts.edit.nested_groups')",
include: "NestedGroupListDefinition",
includeForm: "NestedGroupFormDefinition",
@ -121,6 +125,8 @@ function(i18n, nestedGroupListState) {
},
insights: {
name: 'insights',
awToolTip: i18n._('Please save before viewing Insights'),
dataPlacement: 'top',
title: i18n._('Insights'),
skipGenerator: true
}

View File

@ -106,12 +106,15 @@ function(i18n, nestedGroupListState) {
related: {
ansible_facts: {
name: 'ansible_facts',
awToolTip: i18n._('Please save before viewing facts'),
dataPlacement: 'top',
title: i18n._('Facts'),
skipGenerator: true
},
nested_groups: {
name: 'nested_groups',
// ngClick: "$state.go('hosts.edit.nested_groups')",
awToolTip: i18n._('Please save before defining groups'),
dataPlacement: 'top',
ngClick: "groupsTab()",
include: "NestedGroupListDefinition",
includeForm: "NestedGroupFormDefinition",
@ -121,6 +124,8 @@ function(i18n, nestedGroupListState) {
},
insights: {
name: 'insights',
awToolTip: i18n._('Please save before viewing Insights'),
dataPlacement: 'top',
title: i18n._('Insights'),
skipGenerator: true
}

View File

@ -159,6 +159,8 @@ function(i18n, buildGroupsListState, buildGroupsAddState, buildGroupsEditState,
},
groups: {
name: 'groups',
awToolTip: i18n._('Please save before creating groups'),
dataPlacement: 'top',
include: "GroupList",
title: i18n._('Groups'),
iterator: 'group',
@ -168,6 +170,8 @@ function(i18n, buildGroupsListState, buildGroupsAddState, buildGroupsEditState,
},
hosts: {
name: 'hosts',
awToolTip: i18n._('Please save before creating hosts'),
dataPlacement: 'top',
include: "RelatedHostsListDefinition",
title: i18n._('Hosts'),
iterator: 'host',
@ -177,6 +181,8 @@ function(i18n, buildGroupsListState, buildGroupsAddState, buildGroupsEditState,
},
inventory_sources: {
name: 'inventory_sources',
awToolTip: i18n._('Please save before defining inventory sources'),
dataPlacement: 'top',
include: "SourcesListDefinition",
includeForm: "SourcesFormDefinition",
title: i18n._('Sources'),

View File

@ -107,11 +107,15 @@ function(i18n,nestedGroupListState) {
related: {
ansible_facts: {
name: 'ansible_facts',
awToolTip: i18n._('Please save before viewing facts'),
dataPlacement: 'top',
title: i18n._('Facts'),
skipGenerator: true
},
nested_groups: {
name: 'nested_groups',
awToolTip: i18n._('Please save before defining groups'),
dataPlacement: 'top',
ngClick: "$state.go('inventories.edit.hosts.edit.nested_groups')",
include: "NestedGroupListDefinition",
includeForm: "NestedGroupFormDefinition",
@ -121,6 +125,8 @@ function(i18n,nestedGroupListState) {
},
insights: {
name: 'insights',
awToolTip: i18n._('Please save before viewing Insights'),
dataPlacement: 'top',
title: i18n._('Insights'),
skipGenerator: true
}

View File

@ -24,13 +24,7 @@ export default ['$state', '$stateParams', '$scope', 'SourcesFormDefinition',
.then(function(canAdd) {
$scope.canAdd = canAdd;
});
$scope.parseType = 'yaml';
$scope.envParseType = 'yaml';
ParseTypeChange({
scope: $scope,
field_id: 'inventory_source_variables',
variable: 'variables',
});
initSources();
}
@ -50,8 +44,7 @@ export default ['$state', '$stateParams', '$scope', 'SourcesFormDefinition',
};
$scope.formSave = function() {
var params, json_data;
json_data = ToJSON($scope.parseType, $scope.variables, true);
var params;
params = {
name: $scope.name,
@ -64,7 +57,6 @@ export default ['$state', '$stateParams', '$scope', 'SourcesFormDefinition',
overwrite_vars: $scope.overwrite_vars,
update_on_launch: $scope.update_on_launch,
update_cache_timeout: $scope.update_cache_timeout || 0,
variables: json_data,
// comma-delimited strings
group_by: _.map($scope.group_by, 'value').join(','),
source_regions: _.map($scope.source_regions, 'value').join(',')

View File

@ -36,17 +36,8 @@ export default ['$state', '$stateParams', '$scope', 'ParseVariableString',
$scope.canAdd = val;
});
// init codemirror(s)
$scope.variables = $scope.variables === null || $scope.variables === '' ? '---' : ParseVariableString($scope.variables);
$scope.parseType = 'yaml';
$scope.envParseType = 'yaml';
ParseTypeChange({
scope: $scope,
field_id: 'inventory_source_variables',
variable: 'variables',
});
initSources();
}
@ -76,10 +67,10 @@ export default ['$state', '$stateParams', '$scope', 'ParseVariableString',
$state.go('^');
};
$scope.formSave = function() {
var params, json_data;
json_data = ToJSON($scope.parseType, $scope.variables, true);
var params;
params = {
id: inventorySourceData.id,
name: $scope.name,
description: $scope.description,
inventory: inventoryData.id,
@ -90,7 +81,6 @@ export default ['$state', '$stateParams', '$scope', 'ParseVariableString',
overwrite_vars: $scope.overwrite_vars,
update_on_launch: $scope.update_on_launch,
update_cache_timeout: $scope.update_cache_timeout || 0,
variables: json_data,
// comma-delimited strings
group_by: _.map($scope.group_by, 'value').join(','),
source_regions: _.map($scope.source_regions, 'value').join(',')

View File

@ -57,27 +57,6 @@ return {
ngDisabled: '!(group_obj.summary_fields.user_capabilities.edit || canAdd)',
tab: 'properties'
},
variables: {
label: 'Variables',
type: 'textarea',
class: 'Form-textAreaLabel Form-formGroup--fullWidth',
rows: 6,
'default': '---',
dataTitle: 'Group Variables',
dataPlacement: 'right',
parseTypeName: 'parseType',
awPopOver: "<p>Variables defined here apply to all child groups and hosts.</p>" +
"<p>Enter variables using either JSON or YAML syntax. Use the " +
"radio button to toggle between the two.</p>" +
"JSON:<br />\n" +
"<blockquote>{<br />&emsp; \"somevar\": \"somevalue\",<br />&emsp;\"password\": \"magic\"<br /> }</blockquote>\n" +
"YAML:<br />\n" +
"<blockquote>---<br />somevar: somevalue<br />password: magic<br /></blockquote>\n" +
'<p>View JSON examples at <a href="http://www.json.org" target="_blank">www.json.org</a></p>' +
'<p>View YAML examples at <a href="http://docs.ansible.com/YAMLSyntax.html" target="_blank">docs.ansible.com</a></p>',
dataContainer: 'body',
tab: 'properties'
},
source: {
label: 'Source',
type: 'select',

View File

@ -1560,9 +1560,9 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
for (itm in this.form.related) {
collection = this.form.related[itm];
html += "<div id=\"" + itm + "_tab\" "+ "aw-tool-tip=\"" +
collection.awToolTip + "\" aw-tip-placement=\"" + collection.dataPlacement + "\" " +
"data-container=\"body\" tooltipinnerclass=\"StartStatus-tooltip\" data-trigger=\"hover\"" +
html += "<div id=\"" + itm + "_tab\" ";
html += collection.awToolTip ? "aw-tool-tip=\"" + collection.awToolTip + "\" aw-tip-placement=\"" + collection.dataPlacement + "\" " : "";
html += "data-container=\"body\" tooltipinnerclass=\"StartStatus-tooltip\" data-trigger=\"hover\"" +
"class=\"Form-tab Form-tab--disabled\">" + (collection.title || collection.editTitle) +
"</div>\n";
}
@ -1676,7 +1676,7 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
html += "<div class=\"buttons Form-buttons\" ";
html += "id=\"" + this.form.name + "_controls\" ";
if (options.mode === 'edit' && !_.isEmpty(this.form.related)) {
html += `ng-show="$state.is('${this.form.activeEditState}') || $state.is('${this.form.stateTree}.edit') || $state.matches('lookup') "`;
html += `ng-show="$state.is('${this.form.activeEditState}') || $state.is('${this.form.stateTree}.edit') || $state.$current.data.formChildState || $state.matches('lookup') "`;
}
html += ">\n";