1
- import { OnInit , OnDestroy , ComponentFactoryResolver , ComponentFactory , ComponentRef , ViewChild , ViewContainerRef , ElementRef , Input , EventEmitter } from '@angular/core' ;
1
+ import { OnInit , OnDestroy , ComponentFactoryResolver , ComponentFactory , ComponentRef , ViewChild , ViewContainerRef , ElementRef , Input } from '@angular/core' ;
2
2
import { ArmObj } from '../../../../shared/models/arm/arm-obj' ;
3
3
import { Site } from '../../../../shared/models/arm/site' ;
4
4
import { PublishingCredentials } from '../../../../shared/models/publishing-credentials' ;
@@ -19,9 +19,7 @@ export abstract class AbstractConsoleComponent implements OnInit, OnDestroy {
19
19
public initialized = false ;
20
20
protected enterPressed = false ;
21
21
protected site : ArmObj < Site > ;
22
- protected siteInitialized = new EventEmitter ( ) ;
23
22
protected publishingCredentials : ArmObj < PublishingCredentials > ;
24
- protected publishingCredentialsInitialized = new EventEmitter ( ) ;
25
23
26
24
/*** Variables for Tab-key ***/
27
25
protected listOfDir : string [ ] = [ ] ;
@@ -39,8 +37,8 @@ export abstract class AbstractConsoleComponent implements OnInit, OnDestroy {
39
37
private _msgComponents : ComponentRef < any > [ ] = [ ] ;
40
38
private _currentPrompt : ComponentRef < any > = null ;
41
39
private _resourceIdSubscription : Subscription ;
42
- private _siteSubscription : Subscription ;
43
- private _publishingCredSubscription : Subscription ;
40
+ protected siteSubscription : Subscription ;
41
+ protected publishingCredSubscription : Subscription ;
44
42
45
43
@Input ( )
46
44
public appName : string ;
@@ -60,27 +58,25 @@ export abstract class AbstractConsoleComponent implements OnInit, OnDestroy {
60
58
ngOnInit ( ) {
61
59
this . _resourceIdSubscription = this . _consoleService . getResourceId ( ) . subscribe ( resourceId => {
62
60
this . resourceId = resourceId ; } ) ;
63
- this . _siteSubscription = this . _consoleService . getSite ( ) . subscribe ( site => {
64
- this . site = site ;
65
- this . siteInitialized . emit ( null ) ;
66
- } ) ;
67
- this . _publishingCredSubscription = this . _consoleService . getPublishingCredentials ( ) . subscribe ( publishingCredentials => {
68
- this . publishingCredentials = publishingCredentials ;
69
- this . publishingCredentialsInitialized . emit ( null ) ;
70
- } ) ;
61
+ this . initializeConsole ( ) ;
71
62
this . initialized = true ;
72
63
this . focusConsole ( ) ;
73
64
}
74
65
75
66
ngOnDestroy ( ) {
76
67
this . _resourceIdSubscription . unsubscribe ( ) ;
77
- this . _siteSubscription . unsubscribe ( ) ;
78
- this . _publishingCredSubscription . unsubscribe ( ) ;
68
+ this . siteSubscription . unsubscribe ( ) ;
69
+ this . publishingCredSubscription . unsubscribe ( ) ;
79
70
if ( this . lastAPICall && ! this . lastAPICall . closed ) {
80
71
this . lastAPICall . unsubscribe ( ) ;
81
72
}
82
73
}
83
74
75
+ /**
76
+ *
77
+ */
78
+ protected abstract initializeConsole ( ) ;
79
+
84
80
/**
85
81
* Mouse Press outside the console,
86
82
* i.e. the console no longer in focus
0 commit comments