* VRFS-1811 - use step 2's selected inputs to populate track assignments

This commit is contained in:
Seth Call 2014-07-01 15:02:30 -05:00
parent 64b25e4b5f
commit c58cd234e7
4 changed files with 76 additions and 49 deletions

View File

@ -153,7 +153,9 @@
.css('min-width', '')
}
function loadChannels(forceInputsToUnassign) {
// inputChannelFilter is an optional argument that is used by the Gear Wizard.
// basically, if an input channel isn't in there, it's not going to be displayed
function loadChannels(forceInputsToUnassign, inputChannelFilter) {
var musicPorts = jamClient.FTUEGetChannels();
$unassignedInputsHolder.empty();
@ -172,6 +174,12 @@
//inputChannels = inputChannels.concat(inputChannels.concat(inputChannels.concat(inputChannels)))
context._.each(inputChannels, function (inputChannel) {
if(inputChannelFilter && !(inputChannelFilter.indexOf(inputChannel.id) > -1)) {
// skipping input channel because it's not in the filter
return;
}
var $channel = $(context._.template($templateAssignablePort.html(), inputChannel, { variable: 'data' }));
$channel.hover(
@ -431,8 +439,8 @@
return saved;
}
function reset(forceInputsToUnassign) {
loadChannels(forceInputsToUnassign);
function reset(forceInputsToUnassign, inputChannelFilter) {
loadChannels(forceInputsToUnassign, inputChannelFilter);
loadTrackInstruments(forceInputsToUnassign);
}

View File

@ -12,6 +12,7 @@
var $wizardSteps = null;
var $templateSteps = null;
var loopbackWizard = null;
var inputs = null;
var self = this;
@ -42,6 +43,8 @@
}
function newSession() {
inputs = null;
context._.each(STEPS, function(stepInfo, stepNumber) {
if(stepInfo.newSession) {
stepInfo.newSession.call(stepInfo);
@ -171,6 +174,13 @@
wizard.setBackState(enabled);
}
function setChosenInputs(_inputs) {
inputs = _inputs;
}
function getChosenInputs() {
return inputs;
}
function initialize(_loopbackWizard) {
@ -190,20 +200,23 @@
$wizardSteps = $dialog.find('.wizard-step');
$templateSteps = $('#template-ftuesteps');
stepUnderstandGear.initialize($wizardSteps.filter($('[layout-wizard-step=0]')));
stepSelectGear.initialize($wizardSteps.filter($('[layout-wizard-step=1]')));
stepConfigureTracks.initialize($wizardSteps.filter($('[layout-wizard-step=2]')));
stepConfigureVoiceChat.initialize($wizardSteps.filter($('[layout-wizard-step=3]')));
stepDirectMonitoring.initialize($wizardSteps.filter($('[layout-wizard-step=4]')));
stepNetworkTest.initialize($wizardSteps.filter($('[layout-wizard-step=5]')));
stepSuccess.initialize($wizardSteps.filter($('[layout-wizard-step=6]')));
wizard = new context.JK.Wizard(app);
stepUnderstandGear.initialize($wizardSteps.filter($('[layout-wizard-step=0]')), self);
stepSelectGear.initialize($wizardSteps.filter($('[layout-wizard-step=1]')), self);
stepConfigureTracks.initialize($wizardSteps.filter($('[layout-wizard-step=2]')), self);
stepConfigureVoiceChat.initialize($wizardSteps.filter($('[layout-wizard-step=3]')), self);
stepDirectMonitoring.initialize($wizardSteps.filter($('[layout-wizard-step=4]')), self);
stepNetworkTest.initialize($wizardSteps.filter($('[layout-wizard-step=5]')), self);
stepSuccess.initialize($wizardSteps.filter($('[layout-wizard-step=6]')), self);
wizard.initialize($dialog, $wizardSteps, STEPS);
events();
}
this.setChosenInputs = setChosenInputs; // so step 2 can 'talk' to step 3
this.getChosenInputs = getChosenInputs;
this.setNextState = setNextState;
this.setBackState = setBackState;
this.initialize = initialize;

View File

@ -14,6 +14,7 @@
var $step = null;
var successfullyAssignedOnce = false;
var wizard = null;
function handleHelp() {
return "https://jamkazam.desk.com/customer/portal/articles/1599961-first-time-setup---step-3---configure-tracks";
@ -37,11 +38,13 @@
function beforeShow() {
var forceInputsToUnassigned = !successfullyAssignedOnce;
configureTracksHelper.reset(forceInputsToUnassigned)
console.log("wizard.getChosenInputs()", wizard.getChosenInputs());
configureTracksHelper.reset(forceInputsToUnassigned, wizard.getChosenInputs())
}
function initialize(_$step) {
function initialize(_$step, _wizard) {
$step = _$step;
wizard = _wizard;
configureTracksHelper.initialize($step);
}

View File

@ -19,6 +19,7 @@
var frameBuffers = new context.JK.FrameBuffers(app);
var gearTest = new context.JK.GearTest(app);
var loopbackShowing = false;
var wizard = null;
// the goal of lastFailureAnalytics and trackedPass are to send only a single AudioTest 'Pass' or 'Failed' event, per FTUE wizard open/close
var lastFailureAnalytics = {};
@ -806,47 +807,48 @@
function handleNext() {
var $assignedInputs = $inputChannels.find('input[type="checkbox"]:checked');
var $assignedOutputs = $outputChannels.find('input[type="checkbox"]:checked');
var errors = [];
if($assignedInputs.length == 0) {
errors.push("There must be at least one selected input ports.");
}
if($assignedInputs.length > 12) {
errors.push("There can only be up to 12 selected inputs ports.");
}
if($assignedOutputs.length != 2) {
errors.push("There must be exactly 2 selected output ports.");
}
var $errors = $('<ul></ul>');
context._.each(errors, function(error) {
$errors.append('<li>' + error + '</li>');
});
if(errors.length > 0) {
context.JK.Banner.showAlert({html:$errors});
return false;
}
if(!savedProfile) {
var $assignedInputs = $inputChannels.find('input[type="checkbox"]:checked');
var $assignedOutputs = $outputChannels.find('input[type="checkbox"]:checked');
var errors = [];
if($assignedInputs.length == 0) {
errors.push("There must be at least one selected input ports.");
}
if($assignedInputs.length > 12) {
errors.push("There can only be up to 12 selected inputs ports.");
}
if($assignedOutputs.length != 2) {
errors.push("There must be exactly 2 selected output ports.");
}
var $errors = $('<ul></ul>');
context._.each(errors, function(error) {
$errors.append('<li>' + error + '</li>');
});
if(errors.length > 0) {
context.JK.Banner.showAlert({html:$errors});
context.jamClient.FTUESetMusicProfileName(gearUtils.createProfileName(selectedDeviceInfo));
var result = context.jamClient.FTUESave(true);
if(result && result != "") {
// failed
logger.warn("unable to FTUESave(true). reason:" + result);
context.JK.Banner.alertSupportedNeeded("Unable to persist the audio profile. " + result);
return false;
}
else {
context.jamClient.FTUESetMusicProfileName(gearUtils.createProfileName(selectedDeviceInfo));
var result = context.jamClient.FTUESave(true);
if(result && result != "") {
// failed
logger.warn("unable to FTUESave(true). reason:" + result);
context.JK.Banner.alertSupportedNeeded("Unable to persist the audio profile. " + result);
return false;
}
else {
context.JK.GA.trackAudioTestCompletion(context.JK.detectOS());
trackedPass = true;
lastFailureAnalytics = null;
savedProfile = true;
return true;
}
context.JK.GA.trackAudioTestCompletion(context.JK.detectOS());
trackedPass = true;
lastFailureAnalytics = null;
savedProfile = true;
}
}
// keep the shared state between step 2 and step 3 up-to-date
wizard.setChosenInputs(context._.map($assignedInputs, function(input) { return $(input).attr('data-id') }));
return true;
}
function onFocus() {
@ -892,8 +894,9 @@
updateDialogForCurrentDevices();
}
function initialize(_$step) {
function initialize(_$step, _wizard) {
$step = _$step;
wizard = _wizard;
$watchVideoInput = $step.find('.watch-video.audio-input');
$watchVideoOutput = $step.find('.watch-video.audio-output');