Commit e2cf5fae authored by Jonathon Duerig's avatar Jonathon Duerig
Browse files

Add tutorial event hooks for some internal page events on instantiate/status pages.

parent d43b6348
......@@ -182,13 +182,38 @@ window.APT_OPTIONS.fetchTemplateList = function (nameList) {
};
window.APT_OPTIONS.startPage = function () {
if (window.parent) {
window.parent.postMessage({ url: window.location.href}, '*')
}
window.APT_OPTIONS.postTutorial({ url: window.location.href });
}
window.APT_OPTIONS.endPage = function () {
if (window.parent) {
window.parent.postMessage({ url: "None"}, '*')
window.APT_OPTIONS.postTutorial({ url: "None" });
}
window.APT_OPTIONS.updatePage = function (data) {
window.APT_OPTIONS.postTutorial({ url: window.location.href, update: data });
}
window.APT_OPTIONS.postTutorial = function (data) {
console.log('PostTutorial: ', data);
//console.log('parent: ', window.parent.location.hostname, window.parent.location.port, window.parent.location.protocol);
window.parent.postMessage(data, 'http://tutorial.cloudlab.us:5000');
try {
if (window.parent) {
if (window.parent.location.hostname === 'tutorial.cloudlab.us' &&
window.parent.location.port === '5000' &&
window.parent.location.protocol === 'http')
{
console.log('sending');
window.parent.postMessage(data, 'http://tutorial.cloudlab.us:5000');
}
else if (window.parent.location.hostname === 'tutorial.cloudlab.us' &&
window.parent.location.port === '' &&
window.parent.location.protocol === 'http')
{
window.parent.postMessage(data, 'http://tutorial.clou7dlab.us');
}
}
}
catch (e) {}
}
......@@ -521,8 +521,9 @@ $(function ()
// Step is done changing.
function StepChanged(step, event, currentIndex, priorIndex) {
APT_OPTIONS.updatePage({ 'instantiate-step': currentIndex });
var cIndex = currentIndex;
if (currentIndex == 1) {
if (currentIndex == 1) {
// If the profile isn't parameterized, skip the second step
if (!ispprofile) {
if (priorIndex < currentIndex) {
......
......@@ -324,6 +324,17 @@ $(function ()
$('#profile_status_collapse').trigger('hide.bs.collapse');
}
$('#instructions').on('hide.bs.collapse', function () {
APT_OPTIONS.updatePage({ 'status_instructions': 'hidden' });
});
$('#instructions').on('show.bs.collapse', function () {
APT_OPTIONS.updatePage({ 'status_instructions': 'shown' });
});
addTutorialNotifyTab('profile');
addTutorialNotifyTab('listview');
addTutorialNotifyTab('manifest');
addTutorialNotifyTab('Idlegraphs');
StartCountdownClock(window.APT_OPTIONS.sliceExpires);
StartStatusWatch();
if (window.APT_OPTIONS.oneonly) {
......@@ -347,6 +358,18 @@ $(function ()
}
}
function addTutorialNotifyTab(id)
{
var allTabs = $('#quicktabs_ul li');
allTabs.each(function () {
if ($(this).find('a').attr('href') === ('#' + id)) {
$(this).on('show.bs.tab', function () {
APT_OPTIONS.updatePage({ 'status_tab': id });
});
}
});
}
//
// The status watch is a periodic timer, but we sometimes want to
// hold off running it for a while, and other times we want to run
......@@ -408,6 +431,7 @@ $(function ()
var status_html = "";
if (instanceStatus != lastStatus) {
APT_OPTIONS.updatePage({ 'instance-status': instanceStatus });
console.info(json);
status_html = status;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment