mirror of
https://github.com/ansible/awx.git
synced 2026-02-22 05:30:18 -03:30
Merge pull request #3672 from jaredevantabor/groups-hosts-yaml-parser
YAML parsing groups and hosts extra variables
This commit is contained in:
@@ -5,10 +5,8 @@
|
|||||||
*************************************************/
|
*************************************************/
|
||||||
|
|
||||||
export default
|
export default
|
||||||
['$state', '$stateParams', '$scope', 'GroupForm', 'CredentialList', 'inventoryScriptsListObject', 'ParseTypeChange', 'GenerateForm', 'inventoryData', 'LookUpInit',
|
['$state', '$stateParams', '$scope', 'GroupForm', 'CredentialList', 'inventoryScriptsListObject', 'ParseTypeChange', 'GenerateForm', 'inventoryData', 'LookUpInit', 'GroupManageService', 'GetChoices', 'GetBasePath', 'CreateSelect2', 'GetSourceTypeOptions','ToJSON',
|
||||||
'GroupManageService', 'GetChoices', 'GetBasePath', 'CreateSelect2', 'GetSourceTypeOptions',
|
function($state, $stateParams, $scope, GroupForm, CredentialList, InventoryScriptsList, ParseTypeChange, GenerateForm, inventoryData, LookUpInit, GroupManageService, GetChoices, GetBasePath, CreateSelect2, GetSourceTypeOptions, ToJSON){
|
||||||
function($state, $stateParams, $scope, GroupForm, CredentialList, InventoryScriptsList, ParseTypeChange, GenerateForm, inventoryData, LookUpInit,
|
|
||||||
GroupManageService, GetChoices, GetBasePath, CreateSelect2, GetSourceTypeOptions){
|
|
||||||
var generator = GenerateForm,
|
var generator = GenerateForm,
|
||||||
form = GroupForm();
|
form = GroupForm();
|
||||||
|
|
||||||
@@ -20,10 +18,11 @@
|
|||||||
$state.go('^');
|
$state.go('^');
|
||||||
};
|
};
|
||||||
$scope.formSave = function(){
|
$scope.formSave = function(){
|
||||||
var params, source;
|
var params, source,
|
||||||
|
json_data = ToJSON($scope.parseType, $scope.variables, true);
|
||||||
// group fields
|
// group fields
|
||||||
var group = {
|
var group = {
|
||||||
variables: $scope.variables === '---' || $scope.variables === '{}' ? null : $scope.variables,
|
variables: json_data,
|
||||||
name: $scope.name,
|
name: $scope.name,
|
||||||
description: $scope.description,
|
description: $scope.description,
|
||||||
inventory: inventoryData.id
|
inventory: inventoryData.id
|
||||||
|
|||||||
@@ -7,10 +7,10 @@
|
|||||||
export default
|
export default
|
||||||
['$state', '$stateParams', '$scope', 'GroupForm', 'CredentialList', 'inventoryScriptsListObject', 'ToggleNotification', 'ParseVariableString',
|
['$state', '$stateParams', '$scope', 'GroupForm', 'CredentialList', 'inventoryScriptsListObject', 'ToggleNotification', 'ParseVariableString',
|
||||||
'ParseTypeChange', 'GenerateForm', 'LookUpInit', 'RelatedSearchInit', 'RelatedPaginateInit', 'NotificationsListInit',
|
'ParseTypeChange', 'GenerateForm', 'LookUpInit', 'RelatedSearchInit', 'RelatedPaginateInit', 'NotificationsListInit',
|
||||||
'GroupManageService','GetChoices', 'GetBasePath', 'CreateSelect2', 'GetSourceTypeOptions', 'groupData', 'inventorySourceData',
|
'GroupManageService','GetChoices', 'GetBasePath', 'CreateSelect2', 'GetSourceTypeOptions', 'groupData', 'inventorySourceData', 'ToJSON',
|
||||||
function($state, $stateParams, $scope, GroupForm, CredentialList, InventoryScriptsList, ToggleNotification, ParseVariableString,
|
function($state, $stateParams, $scope, GroupForm, CredentialList, InventoryScriptsList, ToggleNotification, ParseVariableString,
|
||||||
ParseTypeChange, GenerateForm, LookUpInit, RelatedSearchInit, RelatedPaginateInit, NotificationsListInit,
|
ParseTypeChange, GenerateForm, LookUpInit, RelatedSearchInit, RelatedPaginateInit, NotificationsListInit,
|
||||||
GroupManageService, GetChoices, GetBasePath, CreateSelect2, GetSourceTypeOptions, groupData, inventorySourceData){
|
GroupManageService, GetChoices, GetBasePath, CreateSelect2, GetSourceTypeOptions, groupData, inventorySourceData, ToJSON){
|
||||||
var generator = GenerateForm,
|
var generator = GenerateForm,
|
||||||
form = GroupForm();
|
form = GroupForm();
|
||||||
|
|
||||||
@@ -22,15 +22,18 @@
|
|||||||
$state.go('^');
|
$state.go('^');
|
||||||
};
|
};
|
||||||
$scope.formSave = function(){
|
$scope.formSave = function(){
|
||||||
var params, source;
|
var params, source,
|
||||||
|
json_data = ToJSON($scope.parseType, $scope.variables, true);
|
||||||
|
|
||||||
// group fields
|
// group fields
|
||||||
var group = {
|
var group = {
|
||||||
variables: $scope.variables === '---' || $scope.variables === '{}' ? null : $scope.variables,
|
variables: json_data,
|
||||||
name: $scope.name,
|
name: $scope.name,
|
||||||
description: $scope.description,
|
description: $scope.description,
|
||||||
inventory: $scope.inventory,
|
inventory: $scope.inventory,
|
||||||
id: groupData.id
|
id: groupData.id
|
||||||
};
|
};
|
||||||
|
|
||||||
if ($scope.source){
|
if ($scope.source){
|
||||||
// inventory_source fields
|
// inventory_source fields
|
||||||
params = {
|
params = {
|
||||||
|
|||||||
@@ -5,8 +5,8 @@
|
|||||||
*************************************************/
|
*************************************************/
|
||||||
|
|
||||||
export default
|
export default
|
||||||
['$state', '$stateParams', '$scope', 'HostForm', 'ParseTypeChange', 'GenerateForm', 'HostManageService',
|
['$state', '$stateParams', '$scope', 'HostForm', 'ParseTypeChange', 'GenerateForm', 'HostManageService', 'ToJSON',
|
||||||
function($state, $stateParams, $scope, HostForm, ParseTypeChange, GenerateForm, HostManageService){
|
function($state, $stateParams, $scope, HostForm, ParseTypeChange, GenerateForm, HostManageService, ToJSON){
|
||||||
var generator = GenerateForm,
|
var generator = GenerateForm,
|
||||||
form = HostForm;
|
form = HostForm;
|
||||||
$scope.parseType = 'yaml';
|
$scope.parseType = 'yaml';
|
||||||
@@ -17,8 +17,9 @@
|
|||||||
$scope.host.enabled = !$scope.host.enabled;
|
$scope.host.enabled = !$scope.host.enabled;
|
||||||
};
|
};
|
||||||
$scope.formSave = function(){
|
$scope.formSave = function(){
|
||||||
var params = {
|
var json_data = ToJSON($scope.parseType, $scope.variables, true),
|
||||||
variables: $scope.variables === '---' || $scope.variables === '{}' ? null : $scope.variables,
|
params = {
|
||||||
|
variables: json_data,// $scope.variables === '---' || $scope.variables === '{}' ? null : $scope.variables,
|
||||||
name: $scope.name,
|
name: $scope.name,
|
||||||
description: $scope.description,
|
description: $scope.description,
|
||||||
enabled: $scope.host.enabled,
|
enabled: $scope.host.enabled,
|
||||||
|
|||||||
@@ -5,8 +5,8 @@
|
|||||||
*************************************************/
|
*************************************************/
|
||||||
|
|
||||||
export default
|
export default
|
||||||
['$state', '$stateParams', '$scope', 'HostForm', 'ParseTypeChange', 'GenerateForm', 'HostManageService', 'host', 'ParseVariableString',
|
['$state', '$stateParams', '$scope', 'HostForm', 'ParseTypeChange', 'GenerateForm', 'HostManageService', 'host', 'ParseVariableString', 'ToJSON',
|
||||||
function($state, $stateParams, $scope, HostForm, ParseTypeChange, GenerateForm, HostManageService, host, ParseVariableString){
|
function($state, $stateParams, $scope, HostForm, ParseTypeChange, GenerateForm, HostManageService, host, ParseVariableString, ToJSON){
|
||||||
var generator = GenerateForm,
|
var generator = GenerateForm,
|
||||||
form = HostForm;
|
form = HostForm;
|
||||||
$scope.parseType = 'yaml';
|
$scope.parseType = 'yaml';
|
||||||
@@ -17,9 +17,10 @@
|
|||||||
$scope.host.enabled = !$scope.host.enabled;
|
$scope.host.enabled = !$scope.host.enabled;
|
||||||
};
|
};
|
||||||
$scope.formSave = function(){
|
$scope.formSave = function(){
|
||||||
var host = {
|
var json_data = ToJSON($scope.parseType, $scope.variables, true),
|
||||||
|
host = {
|
||||||
id: $scope.host.id,
|
id: $scope.host.id,
|
||||||
variables: $scope.variables === '---' || $scope.variables === '{}' ? null : $scope.variables,
|
variables: json_data,
|
||||||
name: $scope.name,
|
name: $scope.name,
|
||||||
description: $scope.description,
|
description: $scope.description,
|
||||||
enabled: $scope.host.enabled
|
enabled: $scope.host.enabled
|
||||||
|
|||||||
Reference in New Issue
Block a user