@@ -39,6 +39,7 @@ function OpenEmbedStep(mode, entityType) {
39
39
var embedContainer = $ ( "#embedContainer" ) ;
40
40
var dashboardContainer = $ ( "#dashboardContainer" ) ;
41
41
var tileContainer = $ ( "#tileContainer" ) ;
42
+ var qnaContainer = $ ( "#qnaContainer" ) ;
42
43
43
44
if ( entityType == EntityType . Report )
44
45
{
@@ -51,6 +52,7 @@ function OpenEmbedStep(mode, entityType) {
51
52
embedContainer . show ( ) ;
52
53
dashboardContainer . hide ( ) ;
53
54
tileContainer . hide ( ) ;
55
+ qnaContainer . hide ( ) ;
54
56
} ) ;
55
57
}
56
58
else if ( entityType == EntityType . Dashboard )
@@ -64,9 +66,10 @@ function OpenEmbedStep(mode, entityType) {
64
66
embedContainer . hide ( ) ;
65
67
dashboardContainer . show ( ) ;
66
68
tileContainer . hide ( ) ;
69
+ qnaContainer . hide ( ) ;
67
70
} ) ;
68
71
}
69
- else
72
+ else if ( entityType == EntityType . Tile )
70
73
{
71
74
$ ( "#settings" ) . load ( "settings_embed_tile.html" , function ( ) {
72
75
OpenEmbedMode ( mode , entityType ) ;
@@ -76,6 +79,20 @@ function OpenEmbedStep(mode, entityType) {
76
79
embedContainer . hide ( ) ;
77
80
dashboardContainer . hide ( ) ;
78
81
tileContainer . show ( ) ;
82
+ qnaContainer . hide ( ) ;
83
+ } ) ;
84
+ }
85
+ else if ( entityType == EntityType . Qna )
86
+ {
87
+ $ ( "#settings" ) . load ( "settings_embed_qna.html" , function ( ) {
88
+ OpenEmbedMode ( mode , entityType ) ;
89
+
90
+ qnaContainer . height ( qnaContainer . width ( ) * 0.59 ) ;
91
+
92
+ embedContainer . hide ( ) ;
93
+ dashboardContainer . hide ( ) ;
94
+ tileContainer . hide ( ) ;
95
+ qnaContainer . show ( ) ;
79
96
} ) ;
80
97
}
81
98
}
@@ -108,6 +125,14 @@ function OpenInteractStep() {
108
125
LoadCodeArea ( "#embedCodeDiv" , _Dashboard_GetId ) ;
109
126
} ) ;
110
127
}
128
+ else if ( entityType == EntityType . Qna )
129
+ {
130
+ $ ( "#settings" ) . load ( "settings_interact_qna.html" , function ( ) {
131
+ SetToggleHandler ( "qna-operations-div" ) ;
132
+ SetToggleHandler ( "qna-events-operations-div" ) ;
133
+ LoadCodeArea ( "#embedCodeDiv" , _Qna_SetQuestion ) ;
134
+ } ) ;
135
+ }
111
136
else
112
137
{
113
138
$ ( "#settings" ) . load ( "settings_interact.html" , function ( ) {
@@ -141,10 +166,14 @@ function setCodeArea(mode, entityType)
141
166
{
142
167
LoadCodeArea ( "#embedCodeDiv" , _Embed_DashboardEmbed ) ;
143
168
}
144
- else
169
+ else if ( entityType == EntityType . Tile )
145
170
{
146
171
LoadCodeArea ( "#embedCodeDiv" , _Embed_TileEmbed ) ;
147
172
}
173
+ else if ( entityType == EntityType . Qna )
174
+ {
175
+ LoadCodeArea ( "#embedCodeDiv" , _Embed_QnaEmbed ) ;
176
+ }
148
177
}
149
178
150
179
function showEmbedSettings ( mode , entityType )
@@ -222,7 +251,7 @@ function OpenEmbedMode(mode, entityType)
222
251
setCodeAndShowEmbedSettings ( mode , entityType ) ;
223
252
}
224
253
}
225
- else
254
+ else if ( entityType == EntityType . Tile )
226
255
{
227
256
if ( IsEmbeddingSampleTile ( ) )
228
257
{
@@ -237,6 +266,21 @@ function OpenEmbedMode(mode, entityType)
237
266
setCodeAndShowEmbedSettings ( mode , entityType ) ;
238
267
}
239
268
}
269
+ else if ( entityType == EntityType . Qna )
270
+ {
271
+ if ( IsEmbeddingSampleQna ( ) )
272
+ {
273
+ LoadSampleQnaIntoSession ( ) . then ( function ( response ) {
274
+ SetTextBoxesFromSessionOrUrlParam ( "#txtAccessToken" , "#txtQnaEmbed" , "#txtDatasetId" ) ;
275
+ setCodeAndShowEmbedSettings ( mode , entityType ) ;
276
+ } ) ;
277
+ }
278
+ else
279
+ {
280
+ SetTextBoxesFromSessionOrUrlParam ( "#txtAccessToken" , "#txtQnaEmbed" , "#txtDatasetId" ) ;
281
+ setCodeAndShowEmbedSettings ( mode , entityType ) ;
282
+ }
283
+ }
240
284
}
241
285
242
286
function setCodeAndShowEmbedSettings ( mode , entityType ) {
@@ -270,3 +314,19 @@ function IsEmbeddingSampleDashboard() {
270
314
function IsEmbeddingSampleTile ( ) {
271
315
return GetSession ( SessionKeys . IsSampleTile ) == true ;
272
316
}
317
+
318
+ function IsEmbeddingSampleQna ( ) {
319
+ return GetSession ( SessionKeys . IsSampleQna ) == true ;
320
+ }
321
+
322
+ function ToggleQuestionBox ( enabled ) {
323
+ let txtQuestion = $ ( "#txtQuestion" ) ;
324
+ if ( enabled === true ) {
325
+ txtQuestion . val ( "This year sales by store type by postal code as map" ) ;
326
+ txtQuestion . prop ( 'disabled' , false ) ;
327
+ }
328
+ else {
329
+ txtQuestion . val ( "" ) ;
330
+ txtQuestion . prop ( 'disabled' , true ) ;
331
+ }
332
+ }
0 commit comments