Skip to content

Commit

Permalink
Item12952: package installer fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
crawford committed Oct 3, 2014
1 parent 8d503d1 commit 64d0d7f
Show file tree
Hide file tree
Showing 12 changed files with 836 additions and 931 deletions.
46 changes: 10 additions & 36 deletions ConfigurePlugin/lib/Foswiki/Plugins/ConfigurePlugin.pm
Original file line number Diff line number Diff line change
Expand Up @@ -490,21 +490,15 @@ sub _getSetParams {
sub check_current_value {
my $params = shift;

my @report;

# Load the spec files
my $reporter = Foswiki::Configure::Reporter->new();
my $root = _loadSpec($reporter);
foreach my $level ( 'errors', 'warnings', 'confirmations', 'notes' ) {
push(
@report,
{
keys => '',
level => $level,
message => $reporter->text($level)
}
) if $reporter->has($level);
my @report;

if ( scalar @{ $reporter->messages() } ) {
push( @report, { reports => $reporter->messages(), } );
}

$reporter->clear();

# Because we're running in a plugin, we already have LocalSite.cfg
Expand Down Expand Up @@ -581,25 +575,14 @@ sub check_current_value {
$reporter->clear();
print STDERR "Checking $k\n" if TRACE;
$checker->check_current_value($reporter);
my @reps;
foreach my $level ( 'errors', 'warnings', 'confirmations', 'notes' )
{
push(
@reps,
{
level => $level,
message => $reporter->text($level)
}
) if $reporter->has($level);
}
my @path = $spec->getPath();
pop(@path); # remove keys
push(
@report,
{
keys => $k,
path => [@path],
reports => \@reps
reports => $reporter->messages()
}
);
}
Expand Down Expand Up @@ -975,19 +958,10 @@ sub wizard {
my $response = $target->$method($reporter);

unless ($response) {
my @report;
foreach my $level ( 'errors', 'warnings', 'confirmations', 'notes',
'changes' )
{
push(
@report,
{
level => $level,
message => $reporter->text($level)
}
) if $reporter->has($level);
}
$response = { changes => $reporter->{changes}, report => \@report };
$response = {
changes => $reporter->changes(),
messages => $reporter->messages()
};
}

return $response;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,14 @@ td {
div.information {
}

p.one_line_report {
margin: 0;
}

.reports > .warnings,
.reports > .errors {
.reports > .errors,
.message_block > .warnings,
.message_block > .errors {
margin:1em 0;
padding:0.5em 1em 0.5em 3em;
background-repeat:no-repeat;
Expand All @@ -114,20 +120,27 @@ div.information {
border-radius: 4px;
}

.reports > .warnings {
.reports > .warnings,
.message_block > .warnings {
background-image: url(warningsIcon.png);
background-color:#FFF6BF;
border-color:#FDD845;
color:#c09853;
}

.reports > .errors {
.reports > .errors,
.message_block > .errors {
background-image: url(errorsIcon.png);
background-color:#FBE3E4;
border-color:#FBC7C9;
color:#b22222;
}

.message_block > .changes {
background-color:#DEEBFA;
color:#005884;
}

.tab.warnings {
background-image: url(warningsIcon.png);
padding-right: 22px;
Expand Down Expand Up @@ -212,14 +225,13 @@ textarea.report {
height: 40%;
}

/* --- EXTENSIONS --- */
.extensions_report table {
table.tml {
border: none;
width: auto;
margin: 0;
}

.extensions_report th td {
.tml th td {
background: #fff;
padding-top: 1em;
padding-bottom: 1em;
Expand Down
101 changes: 62 additions & 39 deletions ConfigurePlugin/pub/System/ConfigurePlugin/configure.uncompressed.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,11 +189,7 @@ function _id_ify(id) {
$.each(r.path, function(index, pel) {
sid = _id_ify(pel);
$.each(has, function (level, count) {
if (count === 0) {
return;
}

if (level != 'errors' && level != 'warnings') {
if (count === 0 || level === 'notes' ) {
return;
}

Expand Down Expand Up @@ -229,6 +225,24 @@ function _id_ify(id) {

$.each(results, function (index, r) {

if (!r.keys) {
// Report generic problems
var $div = $('<div id="report_dialog"></div>');
$div.html(TML.render_reports(r.reports));
$div.dialog({
width: '60%',
modal: true,
buttons: {
Ok: function() {
$div.dialog("close");
$div.remove();
}
},
close: function() {
$('body').css('cursor','auto');
}
});
}
var id = _id_ify(r.keys),
has, $reports, $whine;

Expand All @@ -244,26 +258,21 @@ function _id_ify(id) {
// Update the key block report (if it's there)
has = { errors: 0, warnings: 0 };
if (r.reports) {
$reports = $('#REP' + id); // if it's there
$reports = $('#REP' + id); // key block report is there
$.each(r.reports, function(index, rep) {
// An empty information message can be ignored
if (!(rep.level == 'notes' && rep.message == '')) {
if (rep.level == 'errors' || rep.level == 'warnings') {
has[rep.level]++;
}
if ($reports.length > 0) {
// If the key block isn't loaded,
// bubble_checker_reports will annotate
// the path leading to it
$whine = $('<div>'
+ TML.render(rep.message)
+ '</div>');
$whine.addClass(rep.level);
$whine.addClass(id + '_report');
$reports.append($whine);
}
}
has[rep.level]++;
});
if ($reports.length > 0) {
// Annotate the key block report
$whine = $("<div></div>");
$whine.html(TML.render_reports(r.reports));
$whine.addClass(id + '_report');
$whine.addClass('message_block');
$reports.append($whine);
};
// If the key block isn't loaded yet,
// bubble_checker_reports will annotate
// the path leading to it
}

// Bubble the existance of reports up through
Expand Down Expand Up @@ -304,19 +313,31 @@ function _id_ify(id) {
function wizard_reports($node, results) {
$('body').css('cursor','wait');
// Generate reports
var $div = $('<div id="report_dialog"></div>');
$.each(results.report, function(index, rep) {
var $whine = $('<div>'
+ TML.render(rep.message)
+ '</div>');
$whine.addClass(rep.level);
$div.append($whine);
// Enable any carry-on buttons we find
$whine.find('.wizard_button').each(function() {
var data = $(this).data('wizard');
$(this).button().click(function() {
call_wizard($node, data);
});
var $div = $('<div class="message_block"></div>');
$div.html(TML.render_reports(results.messages));
$.each(results.changes, function(key, value) {
$div.append('<div class="changes">'
+ key + ' = ' + value
+ '</div>');

});
// Enable any carry-on buttons we find
$div.find('.wizard_button').each(function() {
var data = $(this).data('wizard');
$(this).button().click(function() {
var params = {
wizard: data.wizard,
method: data.method,
args: data.args,
set: find_modified_values(),
cfgusername: $('#username').val(),
cfgpassword: $('#password').val()
};

RPC('wizard',
'Call ' + data.method,
params,
function(result) { wizard_reports($node, result) });
});
});
// Reflect changed values back to the input elements and
Expand Down Expand Up @@ -359,13 +380,15 @@ function _id_ify(id) {
update_save_button();
}
});
$div.dialog({
var $dlg = $('<div id="report_dialog"></div>');
$dlg.append($div);
$dlg.dialog({
width: '60%',
modal: true,
buttons: {
Ok: function() {
$div.dialog("close");
$div.remove();
$dlg.dialog("close");
$dlg.remove();
}
},
close: function() {
Expand Down
Loading

0 comments on commit 64d0d7f

Please sign in to comment.