Latest UI changes for AC-503

This commit is contained in:
chouseknecht
2013-09-30 20:06:36 +00:00
parent 246503440a
commit 8fa1c66caf
6 changed files with 134 additions and 33 deletions

View File

@@ -23,6 +23,7 @@ function InventoryGroups ($scope, $rootScope, $compile, $location, $log, $routeP
var base = $location.path().replace(/^\//,'').split('/')[0];
var id = $routeParams.inventory_id;
scope.grpBtnDisable = false;
scope['inventory_id'] = id;
// Retrieve each related sets and any lookups
@@ -128,6 +129,7 @@ function InventoryGroups ($scope, $rootScope, $compile, $location, $log, $routeP
scope['selectedNode'] = node;
scope['selectedNodeName'] = node.attr('name');
scope['grpBtnDisable'] = false;
$('#tree-view').jstree('open_node',node);
@@ -140,6 +142,9 @@ function InventoryGroups ($scope, $rootScope, $compile, $location, $log, $routeP
scope.groupDeleteHide = false;
scope.createButtonShow = true;
scope.group_id = node.attr('group_id');
// Load the form
GroupsEdit({ "inventory_id": id, group_id: scope.group_id });
//scope.groupName = n.data;
//scope.groupTitle = '<h4>' + n.data + '</h4>';
//scope.groupTitle += (node.attr('description')) ? '<p>' + node.attr('description') + '</p>' : '';
@@ -171,7 +176,24 @@ function InventoryGroups ($scope, $rootScope, $compile, $location, $log, $routeP
}
scope.editGroup = function() {
GroupsEdit({ "inventory_id": id, group_id: scope.group_id });
// Slide in the group properties form
$('#tree-form').show('slide', {direction: 'up'}, 500);
// Set the focust to the first form field
$('input:first').focus();
// Disable all the group related buttons
scope.grpBtnDisable = true;
setTimeout(function() {
// Remove any tooltips that might be lingering
$('.tooltip').each( function(index) {
$(this).remove();
});
$('.popover').each(function(index) {
// remove lingering popover <div>. Seems to be a bug in TB3 RC1
$(this).remove();
});
}, 1000);
}
scope.editInventory = function() {

View File

@@ -14,8 +14,8 @@ angular.module('GroupFormDefinition', [])
editTitle: '{{ name }}', //Legend in edit mode
name: 'group', //Form name attribute
well: false, //Wrap the form with TB well
formLabelSize: 'col-lg-3',
formFieldSize: 'col-lg-9',
//formLabelSize: 'col-lg-3',
//formFieldSize: 'col-lg-9',
fields: {
/*has_active_failures: {
@@ -47,7 +47,7 @@ angular.module('GroupFormDefinition', [])
"class": 'modal-input-xlarge',
"default": "---",
dataTitle: 'Group Variables',
dataPlacement: 'right',
dataPlacement: 'left',
awPopOver: "<p>Enter variables using either JSON or YAML syntax. Use the radio button to toggle between the two.</p>" +
"JSON:<br />\n" +
"<blockquote>{<br />\"somevar\": \"somevalue\",<br />\"password\": \"magic\"<br /> }</blockquote>\n" +
@@ -55,7 +55,7 @@ angular.module('GroupFormDefinition', [])
"<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://www.ansibleworks.com/docs/YAMLSyntax.html" target="_blank">ansibleworks.com</a></p>',
dataContainer: '#form-modal .modal-content'
dataContainer: 'body'
}
},

View File

@@ -228,19 +228,27 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', '
var generator = GenerateForm;
var form = GroupForm;
var defaultUrl = GetBasePath('groups') + group_id + '/';
$('#tree-form').hide('slide',{ direction: 'right' }, 500);
$('#tree-form').empty();
var scope = generator.inject(form, { mode: 'edit', modal: false, related: false, id: 'tree-form', breadCrumbs: false });
//$('#tree-form').show('slide',{ direction: 'up' }, 500);
/*
var scope = generator.inject(form, { mode: 'edit', modal: true, related: false});
*/
generator.reset();
var master = {};
var relatedSets = {};
scope.formModalActionLabel = 'Save';
scope.formModalHeader = 'Edit Group';
scope.formModalCancelShow = true;
//scope.formModalActionLabel = 'Save';
//scope.formModalHeader = 'Edit Group';
//scope.formModalCancelShow = true;
scope.parseType = 'yaml';
ParseTypeChange(scope);
$('#form-modal .btn-none').removeClass('btn-none').addClass('btn-success');
//$('#form-modal .btn-none').removeClass('btn-none').addClass('btn-success');
// After the group record is loaded, retrieve any group variables
if (scope.groupLoadedRemove) {
scope.groupLoadedRemove();