@@ -8,6 +8,10 @@ import PouchQuickSearch from
8
8
import marked from '../web_modules/marked/lib/marked.js' ;
9
9
import styles from '../web_modules/@advanced-rest-client/arc-app-mixin/AppStyles.js' ;
10
10
import '../web_modules/@api-components/api-candidates-dialog/api-candidates-dialog.js' ;
11
+ import '../web_modules/@advanced-rest-client/arc-models/client-certificate-model.js' ;
12
+ import '../web_modules/@anypoint-web-components/anypoint-dialog/anypoint-dialog.js' ;
13
+ import '../web_modules/@anypoint-web-components/anypoint-dialog/anypoint-dialog-scrollable.js' ;
14
+ import '../web_modules/@advanced-rest-client/client-certificates-panel/certificate-import.js' ;
11
15
import './electron-http-transport/electron-http-transport.js' ;
12
16
import poweredIcon from './poweredby.js' ;
13
17
window . PouchDB = PouchDB ;
@@ -32,6 +36,11 @@ class ArcElectron extends ArcAppMixin(LitElement) {
32
36
* When true it is rendering API console view.
33
37
*/
34
38
isApiConsole : { type : Boolean } ,
39
+ /**
40
+ * When set the certificates import panel is currently rendered.
41
+ * @type {Object }
42
+ */
43
+ ccImportOpened : { type : Boolean } ,
35
44
} ;
36
45
}
37
46
@@ -46,10 +55,12 @@ class ArcElectron extends ArcAppMixin(LitElement) {
46
55
this . _exchangeAssetHandler = this . _exchangeAssetHandler . bind ( this ) ;
47
56
this . _activeThemeHandler = this . _activeThemeHandler . bind ( this ) ;
48
57
this . _apiDataHandler = this . _apiDataHandler . bind ( this ) ;
58
+ this . _certCcImportHandler = this . _certCcImportHandler . bind ( this ) ;
49
59
/* global log */
50
60
this . log = log ;
51
61
this . sysVars = process . env ;
52
62
this . withEncrypt = true ;
63
+ this . clientCertificateImport = true ;
53
64
}
54
65
55
66
connectedCallback ( ) {
@@ -59,6 +70,7 @@ class ArcElectron extends ArcAppMixin(LitElement) {
59
70
window . addEventListener ( 'theme-activated' , this . _activeThemeHandler ) ;
60
71
window . addEventListener ( 'api-data-ready' , this . _apiDataHandler ) ;
61
72
this . addEventListener ( 'process-exchange-asset-data' , this . _exchangeAssetHandler ) ;
73
+ window . addEventListener ( 'client-certificate-import' , this . _certCcImportHandler ) ;
62
74
}
63
75
64
76
disconnectedCallback ( ) {
@@ -67,6 +79,7 @@ class ArcElectron extends ArcAppMixin(LitElement) {
67
79
window . removeEventListener ( 'content-copy' , this . _copyContentHandler ) ;
68
80
window . removeEventListener ( 'theme-activated' , this . _activeThemeHandler ) ;
69
81
window . removeEventListener ( 'api-data-ready' , this . _apiDataHandler ) ;
82
+ window . removeEventListener ( 'client-certificate-import' , this . _certCcImportHandler ) ;
70
83
}
71
84
72
85
_routeDataChanged ( ) {
@@ -109,6 +122,11 @@ class ArcElectron extends ArcAppMixin(LitElement) {
109
122
path = 'host-rules-editor/host-rules-editor' ;
110
123
scope = '@advanced-rest-client' ;
111
124
break ;
125
+ case 'client-certificates' :
126
+ id = 'client-certificates-panel' ;
127
+ path = 'client-certificates-panel/client-certificates-panel' ;
128
+ scope = '@advanced-rest-client' ;
129
+ break ;
112
130
}
113
131
if ( id ) {
114
132
const cls = window . customElements . get ( id ) ;
@@ -577,12 +595,29 @@ class ArcElectron extends ArcAppMixin(LitElement) {
577
595
` ;
578
596
}
579
597
598
+ /**
599
+ * Opens cliet cetrificates panel by setting `page` to `client-certificates`.
600
+ */
601
+ openClientCertificates ( ) {
602
+ this . page = 'client-certificates' ;
603
+ }
604
+
605
+ _certCcImportHandler ( ) {
606
+ this . ccImportOpened = true ;
607
+ }
608
+
609
+ _closeCcImportHandler ( ) {
610
+ this . ccImportOpened = false ;
611
+ }
612
+
580
613
render ( ) {
581
614
return html `
582
615
${ this . applicationTemplate ( ) }
583
616
${ this . apiCandidatedViewTemplate ( ) }
617
+ ${ this . _ccImportDialogTemplate ( ) }
584
618
< arc-onboarding > </ arc-onboarding >
585
- < paper-toast id ="errorToast " duration ="5000 "> </ paper-toast > ` ;
619
+ < paper-toast id ="errorToast " duration ="5000 "> </ paper-toast >
620
+ < client-certificate-model > </ client-certificate-model > ` ;
586
621
}
587
622
588
623
_pageTemplate ( ) {
@@ -598,6 +633,7 @@ class ArcElectron extends ArcAppMixin(LitElement) {
598
633
case 'rest-projects' : return this . restApisViewTemplate ( { explore : true } ) ;
599
634
case 'hosts-rules' : return this . hostsViewTemplate ( ) ;
600
635
case 'themes-panel' : return this . themesViewTemplate ( ) ;
636
+ case 'client-certificates' : return this . clientCertificatesTemplate ( ) ;
601
637
default : return super . _pageTemplate ( ) ;
602
638
}
603
639
}
@@ -829,13 +865,27 @@ class ArcElectron extends ArcAppMixin(LitElement) {
829
865
</ div > ` ;
830
866
}
831
867
832
- apiCandidatedViewTemplate ( opts ) {
833
- const {
834
- compatibility
835
- } = this ;
868
+ apiCandidatedViewTemplate ( opts = { } ) {
869
+ const { compatibility } = this ;
836
870
return html `< api-candidates-dialog
837
871
?compatibility ="${ compatibility } "
838
872
> </ api-candidates-dialog > ` ;
839
873
}
874
+
875
+ clientCertificatesTemplate ( ) {
876
+ return html `< client-certificates-panel > </ client-certificates-panel > ` ;
877
+ }
878
+
879
+ _ccImportDialogTemplate ( ) {
880
+ const { ccImportOpened } = this ;
881
+ return html `
882
+ < anypoint-dialog ?opened ="${ ccImportOpened } " modal >
883
+ < h2 > Import a certificate</ h2 >
884
+ < anypoint-dialog-scrollable >
885
+ < certificate-import @close ="${ this . _closeCcImportHandler } "> </ certificate-import >
886
+ </ anypoint-dialog-scrollable >
887
+ </ anypoint-dialog >
888
+ ` ;
889
+ }
840
890
}
841
891
window . customElements . define ( 'arc-electron' , ArcElectron ) ;
0 commit comments