Merged PR 13832: Fix InteractiveNoQuestion for Q&A url param, and Q&A Aad token
Fix InteractiveNoQuestion for Q&A url param, and Q&A Aad token using id instead of val for "InteractiveNoQuestion" radio button
This commit is contained in:
Родитель
9ab6852a50
Коммит
67458c8738
|
@ -687,6 +687,45 @@ function _Embed_QnaEmbed() {
|
|||
powerbi.embed(qnaContainer, config);
|
||||
}
|
||||
|
||||
function _Embed_QnaEmbed_Aad() {
|
||||
// Read embed application token from textbox
|
||||
var txtAccessToken = $('#txtAccessToken').val();
|
||||
|
||||
// Read embed URL from textbox
|
||||
var txtEmbedUrl = $('#txtQnaEmbed').val();
|
||||
|
||||
// Read dataset Id from textbox
|
||||
var txtDatasetId = $('#txtDatasetId').val();
|
||||
|
||||
// Read question from textbox
|
||||
var txtQuestion = $('#txtQuestion').val();
|
||||
|
||||
// Read Qna mode
|
||||
var qnaMode = $("input[name='qnaMode']:checked").val();
|
||||
|
||||
// Get models. models contains enums that can be used.
|
||||
var models = window['powerbi-client'].models;
|
||||
|
||||
// Embed configuration used to describe the what and how to embed.
|
||||
// This object is used when calling powerbi.embed.
|
||||
// You can find more information at https://github.com/Microsoft/PowerBI-JavaScript/wiki/Embed-Configuration-Details.
|
||||
var config= {
|
||||
type: 'qna',
|
||||
tokenType: models.TokenType.Aad,
|
||||
accessToken: txtAccessToken,
|
||||
embedUrl: txtEmbedUrl,
|
||||
datasetIds: [txtDatasetId],
|
||||
viewMode: models.QnaMode[qnaMode],
|
||||
question: txtQuestion
|
||||
};
|
||||
|
||||
// Get a reference to the embedded Q&A HTML element
|
||||
var qnaContainer = $('#qnaContainer')[0];
|
||||
|
||||
// Embed the Q&A and display it within the div container.
|
||||
powerbi.embed(qnaContainer, config);
|
||||
}
|
||||
|
||||
// ---- Report Operations ----------------------------------------------------
|
||||
|
||||
function _Report_GetId() {
|
||||
|
|
|
@ -13,6 +13,7 @@ const interactTooltipTimeout = 2000;
|
|||
const defaultTokenType = 1;
|
||||
const defaultQnaQuestion = "2014 total units YTD var % by month, manufacturer as clustered column chart";
|
||||
const defaultQnaMode = "Interactive";
|
||||
const interactiveNoQuestionMode = "InteractiveNoQuestion";
|
||||
|
||||
function OpenSamplesStep() {
|
||||
$('#steps-ul a').removeClass(active_class);
|
||||
|
@ -230,7 +231,7 @@ function getEmbedCode(mode, entityType)
|
|||
}
|
||||
else if (entityType == EntityType.Qna)
|
||||
{
|
||||
code = _Embed_QnaEmbed;
|
||||
code = GetParameterByName(SessionKeys.TokenType) === '0' /* AAD Token */ ? _Embed_QnaEmbed_Aad : _Embed_QnaEmbed;
|
||||
}
|
||||
return code;
|
||||
}
|
||||
|
@ -361,9 +362,10 @@ function OpenEmbedMode(mode, entityType, tokenType)
|
|||
setCodeAndShowEmbedSettings(mode, entityType, tokenType);
|
||||
let qnaMode = GetParameterByName(SessionKeys.QnaMode);
|
||||
if (qnaMode) {
|
||||
SetSession(SessionKeys.QnaMode, qnaMode);
|
||||
let modesRadios = $('input:radio[name=qnaMode]');
|
||||
modesRadios.filter('[value=' + qnaMode + ']').prop('checked', true);
|
||||
modesRadios.filter('[id=' + qnaMode + ']').prop('checked', true);
|
||||
qnaMode = qnaMode !== interactiveNoQuestionMode ? qnaMode : defaultQnaMode;
|
||||
SetSession(SessionKeys.QnaMode, qnaMode);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -4,15 +4,15 @@
|
|||
<div class="spacer" />
|
||||
<div id="modeSelector">
|
||||
<label class="radioContainer">
|
||||
<div onclick="ToggleQuestionBox(false);"><input type="radio" name="qnaMode" value="Interactive"> Show Q&A </input>
|
||||
<div onclick="ToggleQuestionBox(false);"><input type="radio" name="qnaMode" value="Interactive" id="InteractiveNoQuestion"> Show Q&A </input>
|
||||
<span class="checkmark"></span></div>
|
||||
</label>
|
||||
<label class="radioContainer">
|
||||
<div onclick="ToggleQuestionBox(true);"><input type="radio" name="qnaMode" value="Interactive" checked="checked"> Show Q&A, use predefined question </input>
|
||||
<div onclick="ToggleQuestionBox(true);"><input type="radio" name="qnaMode" value="Interactive" checked="checked" id="Interactive"> Show Q&A, use predefined question </input>
|
||||
<span class="checkmark"></span></div>
|
||||
</label>
|
||||
<label class="radioContainer">
|
||||
<div onclick="ToggleQuestionBox(true);"><input type="radio" name="qnaMode" value="ResultOnly"> Show answer only, use predefined question </input>
|
||||
<div onclick="ToggleQuestionBox(true);"><input type="radio" name="qnaMode" value="ResultOnly" id="ResultOnly"> Show answer only, use predefined question </input>
|
||||
<span class="checkmark"></span></div>
|
||||
</label>
|
||||
</div>
|
||||
|
|
Загрузка…
Ссылка в новой задаче