@@ -2,7 +2,7 @@ import {customElement, html, LitElement, TemplateResult} from "lit-element";
2
2
import { get , translate } from "lit-translate" ;
3
3
import { TextFieldBase } from "@material/mwc-textfield/mwc-textfield-base" ;
4
4
5
- import { newLogEvent , newPendingStateEvent , newWizardEvent , Wizard , WizardInput } from "../foundation.js" ;
5
+ import { newLogEvent , newWizardEvent } from "../foundation.js" ;
6
6
7
7
import { CompasExistsIn } from "./CompasExistsIn.js" ;
8
8
import { CompasChangeSetRadiogroup } from "./CompasChangeSetRadiogroup.js" ;
@@ -50,12 +50,9 @@ export class CompasSaveTo extends CompasExistsIn(LitElement) {
50
50
51
51
await CompasSclDataService ( ) . addSclDocument ( docType , { sclName : name , comment : comment , doc : doc } )
52
52
. then ( sclDocument => {
53
- const openScd = getOpenScdElement ( ) ;
54
- openScd . dispatchEvent (
55
- newLogEvent ( {
56
- kind : 'reset'
57
- } ) ) ;
58
53
updateDocumentInOpenSCD ( sclDocument ) ;
54
+
55
+ const openScd = getOpenScdElement ( ) ;
59
56
openScd . dispatchEvent (
60
57
newLogEvent ( {
61
58
kind : 'info' ,
@@ -75,13 +72,9 @@ export class CompasSaveTo extends CompasExistsIn(LitElement) {
75
72
76
73
await CompasSclDataService ( ) . updateSclDocument ( docType , docId , { changeSet : changeSet ! , comment : comment , doc : doc } )
77
74
. then ( sclDocument => {
78
- const openScd = getOpenScdElement ( ) ;
79
- openScd . dispatchEvent (
80
- newLogEvent ( {
81
- kind : 'reset'
82
- } ) ) ;
83
75
updateDocumentInOpenSCD ( sclDocument ) ;
84
76
77
+ const openScd = getOpenScdElement ( ) ;
85
78
openScd . dispatchEvent (
86
79
newLogEvent ( {
87
80
kind : 'info' ,
@@ -125,37 +118,3 @@ export class CompasSaveTo extends CompasExistsIn(LitElement) {
125
118
` ;
126
119
}
127
120
}
128
-
129
- export interface SaveToCompasWizardOptions {
130
- docId : string ,
131
- docName : string
132
- }
133
- export function saveToCompasWizard ( doc : XMLDocument , saveToOptions : SaveToCompasWizardOptions ) : Wizard {
134
- function saveToCompas ( docId : string , docName : string , doc : XMLDocument ) {
135
- return function ( inputs : WizardInput [ ] , wizard : Element ) {
136
- const compasSaveTo = < CompasSaveTo > wizard . shadowRoot ! . querySelector ( 'compas-save-to' )
137
- if ( ! doc || ! compasSaveTo . valid ( ) ) {
138
- return [ ] ;
139
- }
140
-
141
- getOpenScdElement ( ) . dispatchEvent ( newPendingStateEvent ( compasSaveTo . saveToCompas ( docId , docName , doc ) ) ) ;
142
- return [ ] ;
143
- } ;
144
- }
145
-
146
- return [
147
- {
148
- title : get ( 'compas.saveTo.title' ) ,
149
- primary : {
150
- icon : 'save' ,
151
- label : get ( 'save' ) ,
152
- action : saveToCompas ( saveToOptions . docId , saveToOptions . docName , doc ) ,
153
- } ,
154
- content : [
155
- html `
156
- < compas-save-to .docName ="${ saveToOptions . docName } " .docId ="${ saveToOptions . docId } "/>
157
- ` ] ,
158
- } ,
159
- ] ;
160
- }
161
-
0 commit comments