@@ -7,12 +7,14 @@ import '@material/mwc-button';
7
7
import { newWizardEvent } from '../foundation.js' ;
8
8
import { TextFieldBase } from "@material/mwc-textfield/mwc-textfield-base" ;
9
9
import { dispatchEventOnOpenScd } from "./foundation.js" ;
10
+ import { Switch } from "@material/mwc-switch" ;
10
11
11
12
export type CompasSettingsRecord = {
12
13
sclDataServiceUrl : string ;
13
14
sclValidatorServiceUrl : string ;
14
15
cimMappingServiceUrl : string ;
15
16
sclAutoAlignmentServiceUrl : string ;
17
+ useWebsockets : 'on' | 'off' ;
16
18
} ;
17
19
18
20
export function CompasSettings ( ) {
@@ -23,7 +25,8 @@ export function CompasSettings() {
23
25
sclDataServiceUrl : this . getCompasSetting ( 'sclDataServiceUrl' ) ,
24
26
sclValidatorServiceUrl : this . getCompasSetting ( 'sclValidatorServiceUrl' ) ,
25
27
cimMappingServiceUrl : this . getCompasSetting ( 'cimMappingServiceUrl' ) ,
26
- sclAutoAlignmentServiceUrl : this . getCompasSetting ( 'sclAutoAlignmentServiceUrl' )
28
+ sclAutoAlignmentServiceUrl : this . getCompasSetting ( 'sclAutoAlignmentServiceUrl' ) ,
29
+ useWebsockets : this . getCompasSetting ( 'useWebsockets' )
27
30
} ;
28
31
} ,
29
32
@@ -32,7 +35,8 @@ export function CompasSettings() {
32
35
sclDataServiceUrl : '/compas-scl-data-service' ,
33
36
sclValidatorServiceUrl : '/compas-scl-validator' ,
34
37
cimMappingServiceUrl : '/compas-cim-mapping' ,
35
- sclAutoAlignmentServiceUrl : '/compas-scl-auto-alignment'
38
+ sclAutoAlignmentServiceUrl : '/compas-scl-auto-alignment' ,
39
+ useWebsockets : 'on'
36
40
}
37
41
} ,
38
42
@@ -72,6 +76,10 @@ export class CompasSettingsElement extends LitElement {
72
76
return < TextFieldBase > this . shadowRoot ! . querySelector ( 'mwc-textfield[id="sclAutoAlignmentServiceUrl"]' ) ;
73
77
}
74
78
79
+ getUseWebsockets ( ) : Switch {
80
+ return < Switch > this . shadowRoot ! . querySelector ( 'mwc-switch[id="useWebsockets"]' ) ;
81
+ }
82
+
75
83
valid ( ) : boolean {
76
84
return this . getSclDataServiceUrlField ( ) . checkValidity ( )
77
85
&& this . getSclValidatorServiceUrlField ( ) . checkValidity ( )
@@ -89,6 +97,7 @@ export class CompasSettingsElement extends LitElement {
89
97
CompasSettings ( ) . setCompasSetting ( 'sclValidatorServiceUrl' , this . getSclValidatorServiceUrlField ( ) . value ) ;
90
98
CompasSettings ( ) . setCompasSetting ( 'cimMappingServiceUrl' , this . getCimMappingServiceUrlField ( ) . value ) ;
91
99
CompasSettings ( ) . setCompasSetting ( 'sclAutoAlignmentServiceUrl' , this . getSclAutoAlignmentServiceUrlField ( ) . value ) ;
100
+ CompasSettings ( ) . setCompasSetting ( 'useWebsockets' , this . getUseWebsockets ( ) . checked ? 'on' : 'off' ) ;
92
101
return true ;
93
102
}
94
103
@@ -122,6 +131,11 @@ export class CompasSettingsElement extends LitElement {
122
131
label = "${ translate ( 'compas.settings.sclAutoAlignmentServiceUrl' ) } "
123
132
value = "${ this . compasSettings . sclAutoAlignmentServiceUrl } " required >
124
133
</ mwc- textfield>
134
+ <mwc- for mfield label= "${ translate ( 'compas.settings.useWebsockets' ) } " >
135
+ <mwc- switch id= "useWebsockets"
136
+ ?checked= ${ this . compasSettings . useWebsockets === 'on' } >
137
+ </ mwc- switch>
138
+ </ mwc- for mfield>
125
139
126
140
<mwc- butto n @click = ${ ( ) => {
127
141
if ( this . reset ( ) ) {
@@ -137,7 +151,7 @@ export class CompasSettingsElement extends LitElement {
137
151
width : 20vw ;
138
152
}
139
153
140
- mwc-textfield {
154
+ mwc-textfield , mwc-formfield {
141
155
margin : 10px ;
142
156
width : 100% ;
143
157
}
0 commit comments