mirror of
https://github.com/ansible/awx.git
synced 2026-04-07 02:59:21 -02:30
Fixed inventory codemirrors and tweaked delete source warning
This commit is contained in:
committed by
Jared Tabor
parent
832e55f964
commit
5c79561b7d
@@ -20,7 +20,7 @@ function InventoriesEdit($scope, $location,
|
|||||||
form = InventoryForm,
|
form = InventoryForm,
|
||||||
inventory_id = $stateParams.inventory_id,
|
inventory_id = $stateParams.inventory_id,
|
||||||
master = {},
|
master = {},
|
||||||
fld, json_data, data;
|
fld, data;
|
||||||
|
|
||||||
ClearScope();
|
ClearScope();
|
||||||
init();
|
init();
|
||||||
@@ -45,9 +45,9 @@ function InventoriesEdit($scope, $location,
|
|||||||
.success(function(data) {
|
.success(function(data) {
|
||||||
var fld;
|
var fld;
|
||||||
for (fld in form.fields) {
|
for (fld in form.fields) {
|
||||||
if (fld === 'variables') {
|
if (fld === 'inventory_variables') {
|
||||||
$scope.variables = ParseVariableString(data.variables);
|
$scope.inventory_variables = ParseVariableString(data.variables);
|
||||||
master.variables = $scope.variables;
|
master.inventory_variables = $scope.variables;
|
||||||
} else if (fld === 'inventory_name') {
|
} else if (fld === 'inventory_name') {
|
||||||
$scope[fld] = data.name;
|
$scope[fld] = data.name;
|
||||||
master[fld] = $scope[fld];
|
master[fld] = $scope[fld];
|
||||||
@@ -71,9 +71,9 @@ function InventoriesEdit($scope, $location,
|
|||||||
$scope.parseType = 'yaml';
|
$scope.parseType = 'yaml';
|
||||||
ParseTypeChange({
|
ParseTypeChange({
|
||||||
scope: $scope,
|
scope: $scope,
|
||||||
variable: 'variables',
|
variable: 'inventory_variables',
|
||||||
parse_variable: 'parseType',
|
parse_variable: 'parseType',
|
||||||
field_id: 'inventory_variables'
|
field_id: 'inventory_inventory_variables'
|
||||||
});
|
});
|
||||||
|
|
||||||
OrgAdminLookup.checkForAdminAccess({organization: data.organization})
|
OrgAdminLookup.checkForAdminAccess({organization: data.organization})
|
||||||
@@ -83,8 +83,6 @@ function InventoriesEdit($scope, $location,
|
|||||||
|
|
||||||
$scope.inventory_obj = data;
|
$scope.inventory_obj = data;
|
||||||
$scope.name = data.name;
|
$scope.name = data.name;
|
||||||
|
|
||||||
$scope.$emit('inventoryLoaded');
|
|
||||||
})
|
})
|
||||||
.error(function(data, status) {
|
.error(function(data, status) {
|
||||||
ProcessErrors($scope, data, status, null, {
|
ProcessErrors($scope, data, status, null, {
|
||||||
@@ -96,9 +94,6 @@ function InventoriesEdit($scope, $location,
|
|||||||
$scope.formSave = function() {
|
$scope.formSave = function() {
|
||||||
Wait('start');
|
Wait('start');
|
||||||
|
|
||||||
// Make sure we have valid variable data
|
|
||||||
json_data = ToJSON($scope.parseType, $scope.variables);
|
|
||||||
|
|
||||||
data = {};
|
data = {};
|
||||||
for (fld in form.fields) {
|
for (fld in form.fields) {
|
||||||
if (form.fields[fld].realName) {
|
if (form.fields[fld].realName) {
|
||||||
|
|||||||
@@ -20,10 +20,10 @@ export default ['$state', '$stateParams', '$scope', 'GroupForm',
|
|||||||
// apply form definition's default field values
|
// apply form definition's default field values
|
||||||
GenerateForm.applyDefaults(form, $scope);
|
GenerateForm.applyDefaults(form, $scope);
|
||||||
|
|
||||||
rbacUiControlService.canAdd(GetBasePath('inventory') + $stateParams.inventory_id + "/groups")
|
rbacUiControlService.canAdd(GetBasePath('inventory') + $stateParams.inventory_id + "/groups")
|
||||||
.then(function(canAdd) {
|
.then(function(canAdd) {
|
||||||
$scope.canAdd = canAdd;
|
$scope.canAdd = canAdd;
|
||||||
});
|
});
|
||||||
$scope.parseType = 'yaml';
|
$scope.parseType = 'yaml';
|
||||||
$scope.envParseType = 'yaml';
|
$scope.envParseType = 'yaml';
|
||||||
ParseTypeChange({
|
ParseTypeChange({
|
||||||
|
|||||||
@@ -75,7 +75,8 @@ function(i18n, buildGroupsListState, buildGroupsAddState, buildGroupsEditState,
|
|||||||
ngDisabled: '!(inventory_obj.summary_fields.user_capabilities.edit || canAdd) || !canEditOrg',
|
ngDisabled: '!(inventory_obj.summary_fields.user_capabilities.edit || canAdd) || !canEditOrg',
|
||||||
awLookupWhen: '(inventory_obj.summary_fields.user_capabilities.edit || canAdd) && canEditOrg'
|
awLookupWhen: '(inventory_obj.summary_fields.user_capabilities.edit || canAdd) && canEditOrg'
|
||||||
},
|
},
|
||||||
variables: {
|
inventory_variables: {
|
||||||
|
realName: 'variables',
|
||||||
label: i18n._('Variables'),
|
label: i18n._('Variables'),
|
||||||
type: 'textarea',
|
type: 'textarea',
|
||||||
class: 'Form-formGroup--fullWidth',
|
class: 'Form-formGroup--fullWidth',
|
||||||
|
|||||||
@@ -82,7 +82,7 @@
|
|||||||
$state.go('inventories.edit.inventory_sources.edit', {inventory_source_id: id});
|
$state.go('inventories.edit.inventory_sources.edit', {inventory_source_id: id});
|
||||||
};
|
};
|
||||||
$scope.deleteSource = function(inventory_source){
|
$scope.deleteSource = function(inventory_source){
|
||||||
var body = '<div class=\"Prompt-bodyQuery\">Are you sure you want to permanently delete the inventory source below from the inventory?</div><div class=\"Prompt-bodyTarget\">' + $filter('sanitize')(inventory_source.name) + '</div>';
|
var body = '<div class=\"Prompt-bodyQuery\">Are you sure you want to permanently delete the inventory source below from the inventory? Hosts generated by this inventory source will also be deleted.</div><div class=\"Prompt-bodyTarget\">' + $filter('sanitize')(inventory_source.name) + '</div>';
|
||||||
var action = function(){
|
var action = function(){
|
||||||
delete $rootScope.promptActionBtnClass;
|
delete $rootScope.promptActionBtnClass;
|
||||||
Wait('start');
|
Wait('start');
|
||||||
|
|||||||
Reference in New Issue
Block a user