An error occurred while loading the file. Please try again.
-
mntmn authored
* The MongoDB/Mongoose data storage is removed in favor of Sequelize. This abstracts over SQLite or RDBMs like PostgreSQL and MSSQL. The default is SQLite, which significantly simplifies deployments in end-user environments. * As Spacedeck now has no more mandatory server dependencies, we can wrap it in Electron and ship it as a desktop application. * Removes docker-compose.yml * First version of import UI
ebac854d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
<template>
<v-sheet>
<v-card class="pa-2 ma-2">
<v-container>
<v-row no-gutters class="justify-center">
<v-col>
<VcsLabel html-for="fileInput">
IFC Datei:
</VcsLabel>
</v-col>
<v-col>
<VcsTextField id="fileInput" type="file" v-model="state.files" />
</v-col>
</v-row>
<v-row no-gutters class="justify-center">
</v-row>
<v-row no-gutters class="justify-center">
<VcsFormButton id="convertBtn" @click="convert()" :disabled="disable"> Konvertieren </VcsFormButton>
</v-row>
</v-container>
</v-card>
</v-sheet>
</template>
<script>
import { inject, ref } from 'vue';
import {
VcsSelect,
VcsCheckbox,
VcsRadio,
VcsFormButton,
VcsTextField,
NotificationType,
VcsFormattedNumber,
VcsFormSection,
VcsLabel,
VcsTextArea,
VcsSlider,
} from '@vcmap/ui';
import { VContainer, VRow, VForm, VCol } from 'vuetify/lib';
import { name } from '../package.json';
export const bimOptionsId = 'upload_ifc_id';
export default {
name: 'IFC Konvertierung',
components: {
VcsFormButton,
VcsSelect,
VcsTextField,
VcsCheckbox,
VcsRadio,
VcsFormattedNumber,
VcsFormSection,
VcsLabel,
VcsTextArea,
VForm,
VRow,
VCol,
VContainer,
VcsSlider,
},
setup(props, { emit }) {
const app = inject('vcsApp');
const { pluginState, config } = app.plugins.getByKey(name);
const disable = ref(false);
return {
closeSelf() {
emit('close');
},
convert() {
const fileInput = document.getElementById("fileInput");
const fd = new FormData();
fd.append('file', pluginState.files);
const req = fetch(config.convertLink, {
method: 'post',
body: fd /* or aFile[0]*/
}); // returns a promise
let filename = pluginState.files.name.replace(/\.[^/.]+$/, "") + ".glb";
disable.value = true;
const convertBtn = document.getElementById("convertBtn");
convertBtn.innerHTML = " Konvertierung läuft ";
req.then(function (res) {
disable.value = false;
convertBtn.innerHTML = " Konvertieren ";
emit('close');
if (res.ok) {
// status code was 200-299
app.notifier.add({
type: NotificationType.SUCCESS,
message: "Datei erfolgreich konvertiert",
timeout: 5000,
});
return res.blob();
} else {
app.notifier.add({
type: NotificationType.ERROR,
message: "Ein Fehler ist beim konvertieren aufgetreten, die Konvertierung unterstützt " +
"Dateien im IFC Format IFC2x3 und IFC4 Add2 TC1. Bitte stellen Sie sicher, dass die Datei " +
"die korrekte Version hat und nicht korrupt ist. Falls dies der Fall ist dann ist ein " +
"unbekannter Fehler beim Konvertieren aufgetreten, der nicht behoben werden konnte.",
});
}
}, function (error) {
app.notifier.add({
type: NotificationType.ERROR,
message: "Ein Fehler ist beim konvertieren aufgetreten, die Konvertierung unterstützt " +
"Dateien im IFC Format IFC2x3 und IFC4 Add2 TC1. Bitte stellen Sie sicher, dass die Datei " +
"die korrekte Version hat und nicht korrupt ist. Falls dies der Fall ist dann ist ein " +
"unbekannter Fehler beim Konvertieren aufgetreten, der nicht behoben werden konnte.",
});
}).then((blob) => {
if (blob != null) {
var url = window.URL.createObjectURL(blob);
var a = document.createElement('a');
a.href = url;
a.download = filename;
document.body.appendChild(a);
a.click();
a.remove();
}
})
},
disable,
state: pluginState,
};
},
};
</script>