@@ -33,6 +33,7 @@ import {default as LegacyConfirmServiceFactory} from 'app/services/Confirm.servi
3333import { default as InputDialog } from 'app/components/input-dialog/input-dialog.service' ;
3434import { QueryActions } from './components/query-actions-button/controller' ;
3535import { CancellationError } from 'app/errors/CancellationError' ;
36+ import { DemoService } from 'app/modules/demo/Demo.module' ;
3637
3738// Time line X axis descriptor.
3839const TIME_LINE = { value : - 1 , type : 'java.sql.Date' , label : 'TIME_LINE' } ;
@@ -285,24 +286,24 @@ class Paragraph {
285286
286287// Controller for SQL notebook screen.
287288export class NotebookCtrl {
288- static $inject = [ 'IgniteInput ' , '$rootScope ' , '$scope' , '$http' , '$q' , '$timeout' , '$transitions' , '$interval' , '$animate' , '$location' , '$anchorScroll' , '$state' , '$filter' , '$modal' , '$popover' , '$window' , 'IgniteLoading' , 'IgniteLegacyUtils' , 'IgniteMessages' , 'IgniteConfirm' , 'AgentManager' , 'IgniteChartColors' , 'IgniteNotebook' , 'IgniteNodes' , 'uiGridExporterConstants' , 'IgniteVersion' , 'IgniteActivitiesData' , 'JavaTypes' , 'IgniteCopyToClipboard' , 'CSV' , 'IgniteErrorParser' , 'DemoInfo' ] ;
289+ static $inject = [ 'Demo ' , 'IgniteInput ' , '$scope' , '$http' , '$q' , '$timeout' , '$transitions' , '$interval' , '$animate' , '$location' , '$anchorScroll' , '$state' , '$filter' , '$modal' , '$popover' , '$window' , 'IgniteLoading' , 'IgniteLegacyUtils' , 'IgniteMessages' , 'IgniteConfirm' , 'AgentManager' , 'IgniteChartColors' , 'IgniteNotebook' , 'IgniteNodes' , 'uiGridExporterConstants' , 'IgniteVersion' , 'IgniteActivitiesData' , 'JavaTypes' , 'IgniteCopyToClipboard' , 'CSV' , 'IgniteErrorParser' , 'DemoInfo' ] ;
289290
290291 /**
291292 * @param {CSV } CSV
292293 */
293- constructor ( private IgniteInput : InputDialog , $root , private $scope , $http , $q , $timeout , $transitions , $interval , $animate , $location , $anchorScroll , $state , $filter , $modal , $popover , $window , Loading , LegacyUtils , private Messages : ReturnType < typeof MessagesServiceFactory > , private Confirm : ReturnType < typeof LegacyConfirmServiceFactory > , agentMgr , IgniteChartColors , private Notebook : Notebook , Nodes , uiGridExporterConstants , Version , ActivitiesData , JavaTypes , IgniteCopyToClipboard , CSV , errorParser , DemoInfo ) {
294+ constructor ( private Demo : DemoService , private IgniteInput : InputDialog , private $scope , $http , $q , $timeout , $transitions , $interval , $animate , $location , $anchorScroll , $state , $filter , $modal , $popover , $window , Loading , LegacyUtils , private Messages : ReturnType < typeof MessagesServiceFactory > , private Confirm : ReturnType < typeof LegacyConfirmServiceFactory > , agentMgr , IgniteChartColors , private Notebook : Notebook , Nodes , uiGridExporterConstants , Version , ActivitiesData , JavaTypes , IgniteCopyToClipboard , CSV , errorParser , DemoInfo ) {
294295 const $ctrl = this ;
295296
296297 this . CSV = CSV ;
297- Object . assign ( this , { $root , $ scope, $http, $q, $timeout, $transitions, $interval, $animate, $location, $anchorScroll, $state, $filter, $modal, $popover, $window, Loading, LegacyUtils, Messages, Confirm, agentMgr, IgniteChartColors, Notebook, Nodes, uiGridExporterConstants, Version, ActivitiesData, JavaTypes, errorParser, DemoInfo } ) ;
298+ Object . assign ( this , { $scope, $http, $q, $timeout, $transitions, $interval, $animate, $location, $anchorScroll, $state, $filter, $modal, $popover, $window, Loading, LegacyUtils, Messages, Confirm, agentMgr, IgniteChartColors, Notebook, Nodes, uiGridExporterConstants, Version, ActivitiesData, JavaTypes, errorParser, DemoInfo } ) ;
298299
299300 // Define template urls.
300301 $ctrl . paragraphRateTemplateUrl = paragraphRateTemplateUrl ;
301302 $ctrl . cacheMetadataTemplateUrl = cacheMetadataTemplateUrl ;
302303 $ctrl . chartSettingsTemplateUrl = chartSettingsTemplateUrl ;
303304 $ctrl . demoStarted = false ;
304305
305- this . isDemo = $root . demoMode ;
306+ this . isDemo = this . Demo . enabled ;
306307
307308 const _tryStopRefresh = function ( paragraph ) {
308309 paragraph . cancelRefresh ( $interval ) ;
@@ -340,7 +341,7 @@ export class NotebookCtrl {
340341
341342 $scope . modes = LegacyUtils . mkOptions ( [ 'PARTITIONED' , 'REPLICATED' , 'LOCAL' ] ) ;
342343
343- $scope . loadingText = $root . demoMode ? 'Demo grid is starting. Please wait...' : 'Loading query notebook screen...' ;
344+ $scope . loadingText = this . Demo . enabled ? 'Demo grid is starting. Please wait...' : 'Loading query notebook screen...' ;
344345
345346 $scope . timeUnit = [
346347 { value : 1000 , label : 'seconds' , short : 's' } ,
@@ -933,7 +934,7 @@ export class NotebookCtrl {
933934 } ) ;
934935
935936 // Await for demo caches.
936- if ( ! $ctrl . demoStarted && $root . demoMode && nonEmpty ( cacheNames ) ) {
937+ if ( ! $ctrl . demoStarted && this . Demo . enabled && nonEmpty ( cacheNames ) ) {
937938 $ctrl . demoStarted = true ;
938939
939940 Loading . finish ( 'sqlLoading' ) ;
@@ -948,7 +949,7 @@ export class NotebookCtrl {
948949
949950 const _startWatch = ( ) => {
950951 const finishLoading$ = defer ( ( ) => {
951- if ( ! $root . demoMode )
952+ if ( ! this . Demo . enabled )
952953 Loading . finish ( 'sqlLoading' ) ;
953954 } ) . pipe ( take ( 1 ) ) ;
954955
@@ -1014,7 +1015,7 @@ export class NotebookCtrl {
10141015 $scope . rebuildScrollParagraphs ( ) ;
10151016 } )
10161017 . then ( ( ) => {
1017- if ( $root . demoMode && sessionStorage . showDemoInfo !== 'true' ) {
1018+ if ( this . Demo . enabled && sessionStorage . showDemoInfo !== 'true' ) {
10181019 sessionStorage . showDemoInfo = 'true' ;
10191020
10201021 this . DemoInfo . show ( ) . then ( _startWatch ) ;
0 commit comments