@@ -6,8 +6,10 @@ import '@material/mwc-textarea';
6
6
import {
7
7
ComplexAction ,
8
8
getNameAttribute ,
9
+ newActionEvent ,
9
10
newWizardEvent ,
10
- Wizard , WizardMenuActor
11
+ Wizard ,
12
+ WizardMenuActor ,
11
13
} from '../../../foundation.js' ;
12
14
13
15
import '../../../wizard-textfield.js' ;
@@ -16,8 +18,8 @@ import {
16
18
getCdcValue ,
17
19
getCtlModel ,
18
20
getFullPath ,
19
- PRIVATE_TYPE_104
20
- } from " ../foundation/foundation.js" ;
21
+ PRIVATE_TYPE_104 ,
22
+ } from ' ../foundation/foundation.js' ;
21
23
22
24
export function renderDOIWizard ( doiElement : Element ) : TemplateResult [ ] {
23
25
const iedElement = doiElement . closest ( 'IED' ) ;
@@ -26,84 +28,89 @@ export function renderDOIWizard(doiElement: Element): TemplateResult[] {
26
28
27
29
// Add the basic fields to the list.
28
30
const fields : TemplateResult [ ] = [
29
- html `< wizard-textfield
30
- label ="IED "
31
- .maybeValue =${ getNameAttribute ( iedElement ! ) }
32
- disabled
33
- readonly >
34
- </ wizard-textfield > ` ,
35
- html `< mwc-textarea
36
- label ="DOI "
37
- value ="${ fullpath } "
38
- rows ="2 "
39
- cols ="40 "
40
- readonly
41
- disabled >
42
- </ mwc-textarea > ` ,
43
- html `< wizard-textfield
44
- label ="cdc "
45
- .maybeValue =${ cdc }
46
- disabled
47
- readonly >
48
- </ wizard-textfield > ` ,
31
+ html `< wizard-textfield
32
+ label ="IED "
33
+ .maybeValue =${ getNameAttribute ( iedElement ! ) }
34
+ disabled
35
+ readonly
36
+ >
37
+ </ wizard-textfield > ` ,
38
+ html `< mwc-textarea
39
+ label ="DOI "
40
+ value ="${ fullpath } "
41
+ rows ="2 "
42
+ cols ="40 "
43
+ readonly
44
+ disabled
45
+ >
46
+ </ mwc-textarea > ` ,
47
+ html `< wizard-textfield label ="cdc " .maybeValue =${ cdc } disabled readonly >
48
+ </ wizard-textfield > ` ,
49
49
] ;
50
50
51
- const firstAddressElement = doiElement . querySelector ( `DAI > Private[type="${ PRIVATE_TYPE_104 } "] > Address` ) ;
51
+ const firstAddressElement = doiElement . querySelector (
52
+ `DAI > Private[type="${ PRIVATE_TYPE_104 } "] > Address`
53
+ ) ;
52
54
if ( firstAddressElement ) {
53
55
const ti = firstAddressElement . getAttribute ( 'ti' ) ;
54
56
55
- fields . push ( html `< wizard-textfield
56
- label ="ti "
57
- .maybeValue =${ ti }
58
- disabled
59
- readonly >
60
- </ wizard-textfield > `
61
- ) ;
57
+ fields . push ( html `< wizard-textfield
58
+ label ="ti "
59
+ .maybeValue =${ ti }
60
+ disabled
61
+ readonly
62
+ >
63
+ </ wizard-textfield > ` ) ;
62
64
}
63
65
64
66
const ctlModel = getCtlModel ( doiElement ) ;
65
67
if ( ctlModel !== null ) {
66
- fields . push ( html `< wizard-textfield
67
- label ="ctlModel "
68
- .maybeValue =${ ctlModel }
69
- disabled
70
- readonly >
71
- </ wizard-textfield > ` ) ;
68
+ fields . push ( html `< wizard-textfield
69
+ label ="ctlModel "
70
+ .maybeValue =${ ctlModel }
71
+ disabled
72
+ readonly
73
+ >
74
+ </ wizard-textfield > ` ) ;
72
75
}
73
76
74
77
return fields ;
75
78
}
76
79
77
80
export function remove104Private ( doiElement : Element ) : WizardMenuActor {
78
- // The 104 Private Element only contains Address Elements, so we can remove all the 104 Private Elements
79
- // to remove all the Address Elements also.
80
- const privateElements = doiElement . querySelectorAll ( `DAI > Private[type="${ PRIVATE_TYPE_104 } "]` ) ;
81
- const actions : ComplexAction [ ] = [ ] ;
82
- if ( privateElements . length > 0 ) {
83
- const complexAction : ComplexAction = {
84
- actions : [ ] ,
85
- title : get ( 'protocol104.values.removedAddresses' ,
86
- { name : getFullPath ( doiElement , 'SCL' ) ,
87
- nrOfAddresses : privateElements . length
81
+ return ( wizard : Element ) : void => {
82
+ // The 104 Private Element only contains Address Elements, so we can remove all the 104 Private Elements
83
+ // to remove all the Address Elements also.
84
+ const privateElements = doiElement . querySelectorAll (
85
+ `DAI > Private[type="${ PRIVATE_TYPE_104 } "]`
86
+ ) ;
87
+ if ( privateElements . length > 0 ) {
88
+ const complexAction : ComplexAction = {
89
+ actions : [ ] ,
90
+ title : get ( 'protocol104.values.removedAddresses' , {
91
+ name : getFullPath ( doiElement , 'SCL' ) ,
92
+ nrOfAddresses : privateElements . length ,
88
93
} ) ,
89
- } ;
90
- privateElements . forEach ( privateElement => {
91
- complexAction . actions . push ( { old : { parent : privateElement . parentElement ! , element : privateElement } } ) ;
92
- } ) ;
93
- actions . push ( complexAction ) ;
94
- }
94
+ } ;
95
+ privateElements . forEach ( privateElement => {
96
+ complexAction . actions . push ( {
97
+ old : {
98
+ parent : privateElement . parentElement ! ,
99
+ element : privateElement ,
100
+ } ,
101
+ } ) ;
102
+ } ) ;
95
103
96
- return ( ) : ComplexAction [ ] => {
97
- return actions ;
104
+ wizard . dispatchEvent ( newActionEvent ( complexAction ) ) ;
105
+ wizard . dispatchEvent ( newWizardEvent ( ) ) ;
106
+ }
98
107
} ;
99
108
}
100
109
101
110
export function showDOIInfoWizard ( doiElement : Element ) : Wizard {
102
111
function close ( ) {
103
112
return function ( ) {
104
- document
105
- . querySelector ( 'open-scd' ) !
106
- . dispatchEvent ( newWizardEvent ( ) ) ;
113
+ document . querySelector ( 'open-scd' ) ! . dispatchEvent ( newWizardEvent ( ) ) ;
107
114
return [ ] ;
108
115
} ;
109
116
}
0 commit comments