@@ -39,6 +39,7 @@ function OpenEmbedStep(mode, entityType) {
3939 var embedContainer = $ ( "#embedContainer" ) ;
4040 var dashboardContainer = $ ( "#dashboardContainer" ) ;
4141 var tileContainer = $ ( "#tileContainer" ) ;
42+ var qnaContainer = $ ( "#qnaContainer" ) ;
4243
4344 if ( entityType == EntityType . Report )
4445 {
@@ -51,6 +52,7 @@ function OpenEmbedStep(mode, entityType) {
5152 embedContainer . show ( ) ;
5253 dashboardContainer . hide ( ) ;
5354 tileContainer . hide ( ) ;
55+ qnaContainer . hide ( ) ;
5456 } ) ;
5557 }
5658 else if ( entityType == EntityType . Dashboard )
@@ -64,9 +66,10 @@ function OpenEmbedStep(mode, entityType) {
6466 embedContainer . hide ( ) ;
6567 dashboardContainer . show ( ) ;
6668 tileContainer . hide ( ) ;
69+ qnaContainer . hide ( ) ;
6770 } ) ;
6871 }
69- else
72+ else if ( entityType == EntityType . Tile )
7073 {
7174 $ ( "#settings" ) . load ( "settings_embed_tile.html" , function ( ) {
7275 OpenEmbedMode ( mode , entityType ) ;
@@ -76,6 +79,20 @@ function OpenEmbedStep(mode, entityType) {
7679 embedContainer . hide ( ) ;
7780 dashboardContainer . hide ( ) ;
7881 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 ( ) ;
7996 } ) ;
8097 }
8198}
@@ -108,6 +125,14 @@ function OpenInteractStep() {
108125 LoadCodeArea ( "#embedCodeDiv" , _Dashboard_GetId ) ;
109126 } ) ;
110127 }
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+ }
111136 else
112137 {
113138 $ ( "#settings" ) . load ( "settings_interact.html" , function ( ) {
@@ -141,10 +166,14 @@ function setCodeArea(mode, entityType)
141166 {
142167 LoadCodeArea ( "#embedCodeDiv" , _Embed_DashboardEmbed ) ;
143168 }
144- else
169+ else if ( entityType == EntityType . Tile )
145170 {
146171 LoadCodeArea ( "#embedCodeDiv" , _Embed_TileEmbed ) ;
147172 }
173+ else if ( entityType == EntityType . Qna )
174+ {
175+ LoadCodeArea ( "#embedCodeDiv" , _Embed_QnaEmbed ) ;
176+ }
148177}
149178
150179function showEmbedSettings ( mode , entityType )
@@ -222,7 +251,7 @@ function OpenEmbedMode(mode, entityType)
222251 setCodeAndShowEmbedSettings ( mode , entityType ) ;
223252 }
224253 }
225- else
254+ else if ( entityType == EntityType . Tile )
226255 {
227256 if ( IsEmbeddingSampleTile ( ) )
228257 {
@@ -237,6 +266,21 @@ function OpenEmbedMode(mode, entityType)
237266 setCodeAndShowEmbedSettings ( mode , entityType ) ;
238267 }
239268 }
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+ }
240284}
241285
242286function setCodeAndShowEmbedSettings ( mode , entityType ) {
@@ -270,3 +314,19 @@ function IsEmbeddingSampleDashboard() {
270314function IsEmbeddingSampleTile ( ) {
271315 return GetSession ( SessionKeys . IsSampleTile ) == true ;
272316}
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