1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-02 01:21:21 +03:00

AC-1244, AC-1258, AC-1248 fixes. Migrating from 1.4.11.

This commit is contained in:
chouseknecht 2014-05-06 16:58:52 -04:00
parent ffdf03943e
commit 88236e2abe
4 changed files with 40 additions and 18 deletions

View File

@ -56,9 +56,19 @@ angular.module('LogViewerHelper', ['ModalDialog', 'Utilities', 'FormGenerator',
for (key in data) {
scope[key] = data[key];
}
scope.created_by = '';
scope.job_template = '';
if (data.related.created_by) {
pieces = data.related.created_by.replace(/^\//,'').replace(/\/$/,'').split('/');
scope.created_by = parseInt(pieces[pieces.length - 1],10);
LookUpName({
scope: scope,
scope_var: 'created_by',
url: GetBasePath('users') + scope.created_by + '/'
});
}
// For jobs link the name to the job parent
if (base === 'jobs') {
if (data.type === 'job') {
@ -281,7 +291,8 @@ angular.module('LogViewerHelper', ['ModalDialog', 'Utilities', 'FormGenerator',
{ "variable": "inventory", "url": "/#/inventories/" },
{ "variable": "cloud_credential", "url": "/#/credentials/" },
{ "variable": "inventory_source", "url": "/#/home/groups/?id={{ group }}" },
{ "variable": "job_template", "url": "/#/job_templates/" }
{ "variable": "job_template", "url": "/#/job_templates/" },
{ "variable": "created_by", "url": "/#/users/" }
];
html = "<table class=\"table logviewer-status\">\n";

View File

@ -101,6 +101,7 @@ angular.module('LookUpHelper', ['RestServices', 'Utilities', 'SearchHelper', 'Pa
scope.removeModalReady();
}
scope.removeModalReady = scope.$on('ModalReady', function() {
$('#lookup-save-button').attr('disabled','disabled');
$('#lookup-modal-dialog').dialog('open');
});
@ -193,10 +194,7 @@ angular.module('LookUpHelper', ['RestServices', 'Utilities', 'SearchHelper', 'Pa
}
}
}
if (found === false) {
Alert('Missing Selection', 'Oops, you failed to make a selection. Click on a row to make your selection, ' +
'and then click the Select button. Or, click Cancel to quit.');
} else {
if (found) {
// Selection made
$('#lookup-modal-dialog').dialog('close');
if (postAction) {
@ -210,15 +208,33 @@ angular.module('LookUpHelper', ['RestServices', 'Utilities', 'SearchHelper', 'Pa
scope['toggle_' + list.iterator] = function (id) {
var i;
for (i = 0; i < scope[list.name].length; i++) {
if (scope[list.name][i].id === id) {
scope[list.name][i].checked = '1';
scope[list.name][i].success_class = 'success';
var count = 0;
scope[list.name].forEach( function(row, i) {
if (row.id === id) {
if (row.checked === '0') {
scope[list.name][i].checked = '1';
scope[list.name][i].success_class = 'success';
}
else {
scope[list.name][i].checked = '0';
scope[list.name][i].success_class = '';
}
} else {
scope[list.name][i].checked = '0';
scope[list.name][i].success_class = '';
}
});
// Check if any rows are checked
scope[list.name].forEach(function(row) {
if (row.checked === '1') {
count++;
}
});
if (count === 0) {
$('#lookup-save-button').attr('disabled','disabled');
}
else {
$('#lookup-save-button').removeAttr('disabled');
}
};
};

View File

@ -38,7 +38,7 @@ angular.module('SelectionHelper', ['Utilities', 'RestServices'])
var i, j, found;
for (i = 0; i < scope[list.name].length; i++) {
if (scope[list.name][i].id === id) {
if ((scope[list.name][i].checked === "0" && !ischeckbox) || (scope[list.name][i].checked === "1" && ischeckbox)) {
if ((scope[list.name][i].checked === "0" && !ischeckbox) || (scope[list.name][i].checked === "0" && ischeckbox)) {
// select the row
scope[list.name][i].checked = '1';
scope[list.name][i].success_class = 'success';

View File

@ -74,12 +74,7 @@ angular.module('License', ['RestServices', 'Utilities', 'FormGenerator', 'Prompt
}
if (scope.license_date) {
dt = new Date(parseInt(scope.license_date));
if (dt.getFullYear() === '1970') {
// date was passed in seconds rather than milliseconds
dt = new Date(parseInt(scope.license_date,10) * 1000);
scope.time_remaining = scope.time_remaining + '000';
}
dt = new Date(parseInt(scope.license_date, 10) * 1000);
scope.license_date = FormatDate(dt);
days = parseInt(scope.time_remaining / 86400000, 10);