Skip to content

Commit acd0030

Browse files
author
Dennis Labordus
committed
Refactoring foundation functions, more stable.
Signed-off-by: Dennis Labordus <[email protected]>
1 parent fac8ce9 commit acd0030

File tree

2 files changed

+9
-14
lines changed

2 files changed

+9
-14
lines changed

src/compas-editors/CompasVersions.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import {
1717
dispatchEventOnOpenScd,
1818
getOpenScdElement,
1919
getTypeFromDocName,
20-
setDocIdOnOpenScd,
2120
updateDocumentInOpenSCD
2221
} from "../compas/foundation.js";
2322
import {addVersionToCompasWizard} from "../compas/CompasUploadVersion.js";
@@ -284,12 +283,15 @@ function confirmDeleteCompasWizard(docName: string, docId: string): Wizard {
284283
CompasSclDataService()
285284
.deleteSclDocument(type, docId)
286285
.then (() => {
287-
setDocIdOnOpenScd('');
288-
dispatchEventOnOpenScd(
289-
newLogEvent({
290-
kind: 'info',
291-
title: get('compas.versions.deleteSuccess')
292-
}));
286+
const openScd = getOpenScdElement();
287+
if (openScd !== null) {
288+
openScd.docId = '';
289+
openScd.dispatchEvent(
290+
newLogEvent({
291+
kind: 'info',
292+
title: get('compas.versions.deleteSuccess')
293+
}));
294+
}
293295
})
294296
.catch(createLogEvent);
295297

src/compas/foundation.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,6 @@ export function dispatchEventOnOpenScd(event: Event): void {
3333
}
3434
}
3535

36-
export function setDocIdOnOpenScd(docId: string): void {
37-
const openScd = getOpenScdElement();
38-
if (openScd !== null) {
39-
openScd.docId = docId;
40-
}
41-
}
42-
4336
export function updateDocumentInOpenSCD(doc: Document, docName?: string): void {
4437
const id = (doc.querySelectorAll(':root > Header') ?? []).item(0)?.getAttribute('id') ?? '';
4538

0 commit comments

Comments
 (0)