Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding an alert to notify users when ingestion has not been run. #1389

Merged
merged 6 commits into from
Jul 21, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 25 additions & 8 deletions html/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -235,16 +235,29 @@ function isReferrer($referrer)
<link rel="stylesheet" type="text/css" href="gui/css/LoginPrompt.css"/>
<?php endif; ?>

<?php
$realms = array_reduce(Realms::getRealms(), function ($carry, Realm $item) {
$carry [] = $item->getName();
return $carry;
}, array());
?>

<script type='text/javascript'>

<?php
$realms = array_reduce(Realms::getRealms(), function ($carry, Realm $item) {
$carry [] = $item->getName();
return $carry;
}, array());

if (count($realms) === 0) {
$code = <<<JS
Ext.onReady(function() {
Ext.MessageBox.alert(
'Invalid State Detected',
'This XDMoD installation has had an invalid state detected. <br/><br/>' +
ryanrath marked this conversation as resolved.
Show resolved Hide resolved
'Before XDMoD can be utilized you must run ingestion at least once.<br/><br/>' +
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so does the no aggregated data message show up somewhere else? Cause I think we have to have both ingestion and aggregation done before it actually works?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure to be honest, but I can update the phrasing to reference both ingestion / aggregation. The direct cause of this problem is that there are no records in moddb.realms when they try to load the front page.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried it and the one, new message, is displayed. Nothing after that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jtpalmer did you add all of the changes from the PR? I know that before I added the try-catch around the disabledMenus section the page came up empty because the exception from Acls::getDisabledMenus function ultimately ended up outputting a blob 'o json describing the exception right in the middle of those js variables.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we only have it for jobs, and only when we are not using the dashboard
https://github.com/ubccr/xdmod/blob/xdmod9.0/html/controllers/ui_data/summary3.php#L71

Wonder if we should find a way to test for it...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test for what? Not having run ingestion / aggregation and / or acl-config?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ryanrath I testing using your branch (at the time that I posted the comment). I did not shred or ingest any jobs so it's possible that if I had done that, but not aggregated that something different would happen.

ryanrath marked this conversation as resolved.
Show resolved Hide resolved
'If ingestion has already been run then make sure that you have run the acl-config cli application and that it has completed successfully.<br/><br/>' +
ryanrath marked this conversation as resolved.
Show resolved Hide resolved
'<b>NOTE: XDMoD will not function correctly until this problem has been resolved.</b>'
ryanrath marked this conversation as resolved.
Show resolved Hide resolved
);
});
JS;
print $code;
}

print "CCR.xdmod.publicUser = " . json_encode(!$userLoggedIn) . ";\n";

$tech_support_recipient = xd_utilities\getConfiguration('general', 'tech_support_recipient');
Expand Down Expand Up @@ -281,7 +294,11 @@ function ($item) {

print "CCR.xdmod.ui.rawDataAllowedRealms = " . json_encode($rawDataRealms) . ";\n";

print "CCR.xdmod.ui.disabledMenus = " . json_encode(Acls::getDisabledMenus($user, $realms)) . ";\n";
try {
print "CCR.xdmod.ui.disabledMenus = " . json_encode(Acls::getDisabledMenus($user, $realms)) . ";\n";
} catch (Exception $e) {
print "CCR.xdmod.ui.disabledMenus = [];\n";
}

if ($userLoggedIn) {
print "CCR.xdmod.ui.allRoles = " . json_encode($user->enumAllAvailableRoles()) . "\n";
Expand Down