RFE 549 commits now check for spectre connectivity before commiting and a new macro for showing spectre status.

This commit is contained in:
Kaleb Murphy 2008-10-21 16:54:00 +00:00
parent 655e5e7654
commit 77913e956b
7 changed files with 42 additions and 9 deletions

View file

@ -14,6 +14,7 @@
- added: ldaps and ldapi are now supported when working with LDAP authentication
- rfe #740: Thingy Pre-Text (SDH Consulting Group)
- rfe #746: use the menu title in asset manager
- rfe #549: New macro for checking spectre status. VersionTag::RequestCommit and Operation::VestionTag::www_commitVertionTag now both check for spectre status before trying to commit.
7.6.1
- changed: the list of extensions for the export system to pass through
unmodified has been moved to the configuration file under the

View file

@ -688,6 +688,7 @@
"RootTitle" : "RootTitle",
"r" : "r_printable",
"Spacer" : "Spacer",
"SpectreCheck" : "SpectreCheck",
"Thumbnail" : "Thumbnail",
"User" : "User",
"u" : "u_companyUrl",

View file

@ -16,15 +16,14 @@ use WebGUI::International;
=head1 NAME
Package WebGUI::Macro::SessionId
Package WebGUI::Macro:SpectreCheck:
=head1 DESCRIPTION
A macro to return the ID of the user's current session.
A macro to return the status of Spectre.
=head2 process( )
Really just a wrapper around $session->getId;
=cut
@ -32,13 +31,15 @@ Really just a wrapper around $session->getId;
#-------------------------------------------------------------------
sub process {
my $session = shift;
my $remote = WebGUI::Operation::Spectre::getASpectre($session);
my $status = WebGUI::Operation::Spectre::spectreTest($session);
my $i18n = WebGUI::International->new($session, "Macro_SpectreCheck");
if (defined $remote) {
return $i18n->get('spectre ok');
if (defined $status) {
return $i18n->get('success') if($status eq 'success');
return $i18n->get('subnet') if($status eq 'subnet');
return $i18n->get('spectre') if($status eq 'spectre');
}
else {
return $i18n->get('spectre is down');
return $i18n->get('spectre');
}
}

View file

@ -172,7 +172,21 @@ sub www_spectreTest {
my $session = shift;
$session->http->setMimeType("text/plain");
$session->http->setCacheControl("none");
return WebGUI::Operation::Spectre::spectreTest($session);
}
#-------------------------------------------------------------------
=head2 spectreTest ( )
Spectre executes this function to see if WebGUI connectivity is working.
=cut
sub spectreTest{
my $session = shift;
my $subnets = $session->config->get("spectreSubnets");
if (!defined $subnets) {
$subnets = [];
}

View file

@ -307,6 +307,13 @@ sub www_commitVersionTag {
my $session = shift;
my $tagId = $session->form->param("tagId");
my $spectreTest = WebGUI::Operation::Spectre::spectreTest($session);
if($spectreTest ne "success"){
my $i18n = WebGUI::International->new($session, "Macro_SpectreCheck")->get($spectreTest);
my $ac = WebGUI::AdminConsole->new($session,"versions");
return $ac->render( $i18n );
}
if ( !$tagId ) {
return www_manageVersions( $session );
}

View file

@ -407,6 +407,9 @@ fails.
sub requestCommit {
my $self = shift;
return "Failure" if(WebGUI::Operation::Spectre::spectreTest($self->session) ne "success");
$self->lock;
my $instance = WebGUI::Workflow::Instance->create($self->session, {
workflowId=>$self->get("workflowId"),

View file

@ -3,13 +3,19 @@ package WebGUI::i18n::English::Macro_SpectreCheck;
use strict;
our $I18N = {
'spectre ok' => {
'spectre' => {
message => q|Spectre is OK|,
lastUpdated => 1202771219,
context => q|Message saying that Spectre is doing okay.|
},
'spectre is down' => {
'subnet' => {
message => q|There is a problem with Spectre's subnet setting.|,
lastUpdated => 1202771219,
context => q|Message saying that Spectre has a problem with its subnet setting.|
},
'spectre' => {
message => q|Spectre is down|,
lastUpdated => 1202771224,
context => q|Message saying that Spectre is unable to be contacted.|