@@ -9,12 +9,12 @@ import {
9
9
import { translate } from 'lit-translate' ;
10
10
11
11
import '@material/mwc-icon' ;
12
- import '@material/mwc-list' ;
13
12
import '@material/mwc-list/mwc-list-item' ;
14
13
15
- import './elements/goose-message .js' ;
14
+ import '../../filtered-list .js' ;
16
15
import { compareNames , getNameAttribute } from '../../foundation.js' ;
17
- import { styles } from './foundation.js' ;
16
+ import { newGOOSESelectEvent , styles } from './foundation.js' ;
17
+ import { gooseIcon } from '../../icons/icons.js' ;
18
18
19
19
/** An sub element for showing all published GOOSE messages per IED. */
20
20
@customElement ( 'publisher-goose-list' )
@@ -43,33 +43,49 @@ export class PublisherGOOSEList extends LitElement {
43
43
) ;
44
44
}
45
45
46
+ private onGooseSelect ( element : Element ) : void {
47
+ const ln = element . parentElement ;
48
+ const dataset = ln ?. querySelector (
49
+ `DataSet[name=${ element . getAttribute ( 'datSet' ) } ]`
50
+ ) ;
51
+ this . dispatchEvent ( newGOOSESelectEvent ( element , dataset ! ) ) ;
52
+ }
53
+
54
+ renderGoose ( element : Element ) : TemplateResult {
55
+ return html `<mwc- lis t- item
56
+ @click = ${ ( ) => this . onGooseSelect ( element ) }
57
+ graphic= "large"
58
+ >
59
+ <span> ${ element . getAttribute ( 'name' ) } </ span>
60
+ <mwc- icon slot= "graphic" > ${ gooseIcon } </ mwc- icon>
61
+ </ mwc- lis t- item> ` ;
62
+ }
63
+
46
64
render ( ) : TemplateResult {
47
65
return html ` <section>
48
66
<h1> ${ translate ( 'subscription.publisherGoose.title' ) } </ h1>
49
- <mwc- lis t>
50
- ${ this . ieds . map ( ied =>
51
- ied . querySelector ( 'GSEControl' )
52
- ? html `
53
- <mwc- lis t- item noninteractive graphic= "icon" >
54
- <span class= "iedListTitle" > ${ getNameAttribute ( ied ) } </ span>
55
- <mwc- icon slot= "graphic" > developer_board </ mwc- icon>
56
- </ mwc- lis t- item>
57
- <li divider role= "separator" > </ li>
58
- ${ this . getGSEControls ( ied ) . map (
59
- control =>
60
- html `<goose- message .element = ${ control } > </ goose- message> `
61
- ) }
62
- `
63
- : ``
67
+ <filtered- lis t>
68
+ ${ this . ieds . map (
69
+ ied =>
70
+ html `
71
+ <mwc- lis t- item noninteractive graphic= "icon" >
72
+ <span class= "iedListTitle" > ${ getNameAttribute ( ied ) } </ span>
73
+ <mwc- icon slot= "graphic" > developer_board </ mwc- icon>
74
+ </ mwc- lis t- item>
75
+ <li divider role= "separator" > </ li>
76
+ ${ this . getGSEControls ( ied ) . map ( control =>
77
+ this . renderGoose ( control )
78
+ ) }
79
+ `
64
80
) }
65
- </ mwc - lis t>
81
+ </ filtered - lis t>
66
82
</ section> ` ;
67
83
}
68
84
69
85
static styles = css `
70
86
${ styles }
71
87
72
- mwc -list {
88
+ filtered -list {
73
89
height : 100vh ;
74
90
overflow-y : scroll;
75
91
}
0 commit comments