d2aura 26.0.13 → 26.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/eda/edaManagerApi.d.ts +50 -15
- package/api/eda/edaManagerApi.js +80 -29
- package/api/eda/edaManagerApi.js.map +1 -1
- package/api/eda/generated/events.d.ts +109 -60
- package/api/eda/generated/events.js +182 -88
- package/api/eda/generated/events.js.map +1 -1
- package/api/eda/generated/structures.d.ts +78 -14
- package/api/eda/generated/structures.js.map +1 -1
- package/core/i18n/d2aura.sk.json +30 -2
- package/coreui/components/edaManager/components/detail/components/edaVectorMassChangeButton.d.ts +1 -1
- package/coreui/components/edaManager/components/detail/components/edaVectorMassChangeButton.js +2 -2
- package/coreui/components/edaManager/components/detail/components/edaVectorMassChangeButton.js.map +1 -1
- package/coreui/components/edaManagerComponent/components/edaChartViewer.d.ts +14 -0
- package/coreui/components/edaManagerComponent/components/edaChartViewer.js +370 -0
- package/coreui/components/edaManagerComponent/components/edaChartViewer.js.map +1 -0
- package/coreui/components/edaManagerComponent/components/edaDataBasePanel.d.ts +4 -8
- package/coreui/components/edaManagerComponent/components/edaDataBasePanel.js +18 -75
- package/coreui/components/edaManagerComponent/components/edaDataBasePanel.js.map +1 -1
- package/coreui/components/edaManagerComponent/components/edaDetailPanel.d.ts +5 -14
- package/coreui/components/edaManagerComponent/components/edaDetailPanel.js +80 -19
- package/coreui/components/edaManagerComponent/components/edaDetailPanel.js.map +1 -1
- package/coreui/components/edaManagerComponent/components/edaGraphPanel.d.ts +2 -7
- package/coreui/components/edaManagerComponent/components/edaGraphPanel.js +15 -380
- package/coreui/components/edaManagerComponent/components/edaGraphPanel.js.map +1 -1
- package/coreui/components/edaManagerComponent/components/edaGroupDetailPanel.d.ts +3 -14
- package/coreui/components/edaManagerComponent/components/edaGroupDetailPanel.js +54 -67
- package/coreui/components/edaManagerComponent/components/edaGroupDetailPanel.js.map +1 -1
- package/coreui/components/edaManagerComponent/components/edaLoadingOverlay.d.ts +7 -0
- package/coreui/components/edaManagerComponent/components/edaLoadingOverlay.js +35 -0
- package/coreui/components/edaManagerComponent/components/edaLoadingOverlay.js.map +1 -0
- package/coreui/components/edaManagerComponent/components/edaSampleRangePickerPanel.d.ts +2 -16
- package/coreui/components/edaManagerComponent/components/edaSampleRangePickerPanel.js +47 -50
- package/coreui/components/edaManagerComponent/components/edaSampleRangePickerPanel.js.map +1 -1
- package/coreui/components/edaManagerComponent/components/edaScenarioDetailPanel.d.ts +3 -14
- package/coreui/components/edaManagerComponent/components/edaScenarioDetailPanel.js +67 -81
- package/coreui/components/edaManagerComponent/components/edaScenarioDetailPanel.js.map +1 -1
- package/coreui/components/edaManagerComponent/components/edaTableEditorDialog.d.ts +12 -0
- package/coreui/components/edaManagerComponent/components/edaTableEditorDialog.js +268 -0
- package/coreui/components/edaManagerComponent/components/edaTableEditorDialog.js.map +1 -0
- package/coreui/components/edaManagerComponent/components/edaTablePanel.d.ts +2 -6
- package/coreui/components/edaManagerComponent/components/edaTablePanel.js +119 -62
- package/coreui/components/edaManagerComponent/components/edaTablePanel.js.map +1 -1
- package/coreui/components/edaManagerComponent/components/edaTimeWindowPickerPanel.d.ts +2 -13
- package/coreui/components/edaManagerComponent/components/edaTimeWindowPickerPanel.js +57 -88
- package/coreui/components/edaManagerComponent/components/edaTimeWindowPickerPanel.js.map +1 -1
- package/coreui/components/edaManagerComponent/components/edaTreeView.d.ts +4 -51
- package/coreui/components/edaManagerComponent/components/edaTreeView.js +299 -259
- package/coreui/components/edaManagerComponent/components/edaTreeView.js.map +1 -1
- package/coreui/components/edaManagerComponent/components/edaVectorDetailPanel.d.ts +3 -21
- package/coreui/components/edaManagerComponent/components/edaVectorDetailPanel.js +160 -179
- package/coreui/components/edaManagerComponent/components/edaVectorDetailPanel.js.map +1 -1
- package/coreui/components/edaManagerComponent/components/exportDialog.d.ts +18 -0
- package/coreui/components/edaManagerComponent/components/exportDialog.js +157 -0
- package/coreui/components/edaManagerComponent/components/exportDialog.js.map +1 -0
- package/coreui/components/edaManagerComponent/constants/edaTypes.d.ts +10 -11
- package/coreui/components/edaManagerComponent/constants/edaTypes.js.map +1 -1
- package/coreui/components/edaManagerComponent/context/edaConfigContext.d.ts +26 -0
- package/coreui/components/edaManagerComponent/context/edaConfigContext.js +20 -0
- package/coreui/components/edaManagerComponent/context/edaConfigContext.js.map +1 -0
- package/coreui/components/edaManagerComponent/context/edaVectorDataContext.d.ts +9 -16
- package/coreui/components/edaManagerComponent/context/edaVectorDataContext.js.map +1 -1
- package/coreui/components/edaManagerComponent/context/edaVectorDataProvider.d.ts +0 -1
- package/coreui/components/edaManagerComponent/context/edaVectorDataProvider.js +71 -66
- package/coreui/components/edaManagerComponent/context/edaVectorDataProvider.js.map +1 -1
- package/coreui/components/edaManagerComponent/context/loadingContext.d.ts +1 -1
- package/coreui/components/edaManagerComponent/context/loadingContext.js.map +1 -1
- package/coreui/components/edaManagerComponent/context/{sharedSampleRange.d.ts → sharedSampleRangeContext.d.ts} +6 -3
- package/coreui/components/edaManagerComponent/context/sharedSampleRangeContext.js +3 -0
- package/coreui/components/edaManagerComponent/context/sharedSampleRangeContext.js.map +1 -0
- package/coreui/components/edaManagerComponent/context/useEdaActions.d.ts +7 -0
- package/coreui/components/edaManagerComponent/context/useEdaActions.js +22 -0
- package/coreui/components/edaManagerComponent/context/useEdaActions.js.map +1 -0
- package/coreui/components/edaManagerComponent/edaDetail.d.ts +7 -26
- package/coreui/components/edaManagerComponent/edaDetail.js +124 -106
- package/coreui/components/edaManagerComponent/edaDetail.js.map +1 -1
- package/coreui/components/edaManagerComponent/edaManager.d.ts +4 -11
- package/coreui/components/edaManagerComponent/edaManager.js +29 -22
- package/coreui/components/edaManagerComponent/edaManager.js.map +1 -1
- package/coreui/components/edaManagerComponent/edaNavigator.d.ts +4 -12
- package/coreui/components/edaManagerComponent/edaNavigator.js +36 -41
- package/coreui/components/edaManagerComponent/edaNavigator.js.map +1 -1
- package/coreui/components/edaManagerComponent/edaSelect.d.ts +2 -3
- package/coreui/components/edaManagerComponent/edaSelect.js +22 -44
- package/coreui/components/edaManagerComponent/edaSelect.js.map +1 -1
- package/coreui/components/edaManagerComponent/utils/export.d.ts +9 -0
- package/coreui/components/edaManagerComponent/utils/export.js +573 -0
- package/coreui/components/edaManagerComponent/utils/export.js.map +1 -0
- package/coreui/components/edaManagerComponent/utils/utils.d.ts +6 -12
- package/coreui/components/edaManagerComponent/utils/utils.js +26 -15
- package/coreui/components/edaManagerComponent/utils/utils.js.map +1 -1
- package/d2configuration/edaManager/DB.EM_EDA_DescriptiveVector.xml +65 -0
- package/d2configuration/edaManager/DB.EM_EDA_FunctionPrescription.xml +65 -0
- package/d2configuration/edaManager/E.EM_DETAIL_IMPL.xml +67 -1
- package/d2configuration/edaManager/E.EM_DETAIL_SQL.xml +85 -0
- package/d2configuration/edaManager/E.EM_DETAIL_UNIT.xml +123 -2
- package/d2configuration/edaManager/E.EM_NAVIGATOR_IMPL.xml +1 -1
- package/d2configuration/edaManager/E.EM_NAVIGATOR_UNIT.xml +1 -1
- package/d2configuration/edaManager/E.EM_VECTOR_IMPL.xml +20 -6
- package/d2configuration/edaManager/E.EM_VECTOR_UNIT.xml +95 -17
- package/d2configuration/edaManager/SD.EM_EDA_DescriptiveVector.xml +179 -0
- package/d2configuration/edaManager/SD.EM_EDA_FunctionPrescription.xml +91 -0
- package/d2configuration/edaManager/SD.EM_EDA_InsertValuesToVector_V1.xml +227 -0
- package/d2configuration/edaManager/SD.EM_EDA_PairVector.xml +454 -0
- package/d2configuration/edaManager/SD.EM_EDA_ReadValuesFromVector_V1.xml +13 -3
- package/d2configuration/edaManager/SD.EM_EDA_VectorStats.xml +91 -0
- package/d2configuration/edaManager/SD.EM_Filter_Condition.xml +1 -1
- package/package.json +5 -3
- package/coreui/components/edaManagerComponent/components/edaBasePanel.d.ts +0 -16
- package/coreui/components/edaManagerComponent/components/edaBasePanel.js +0 -85
- package/coreui/components/edaManagerComponent/components/edaBasePanel.js.map +0 -1
- package/coreui/components/edaManagerComponent/context/sharedSampleRange.js +0 -13
- package/coreui/components/edaManagerComponent/context/sharedSampleRange.js.map +0 -1
- package/d2configuration/edaManager/EDA_CancelSession.xml +0 -54
- package/d2configuration/edaManager/EDA_GetSessionId.xml +0 -54
- package/d2configuration/edaManager/EDA_ReadValuesFromVektorRec.xml +0 -54
- package/d2configuration/edaManager/EDA_StatVectorRec.xml +0 -56
|
@@ -0,0 +1,573 @@
|
|
|
1
|
+
import { create } from "xmlbuilder";
|
|
2
|
+
import { EdaSamplingType, EdaVectorType } from "../constants/edaTypes";
|
|
3
|
+
import dayjs from "d2core/dayjs";
|
|
4
|
+
import i18n from "d2core/i18n/i18n";
|
|
5
|
+
export async function exportVector(api, vector, config, dateTimeMask, setLoadingState, message) {
|
|
6
|
+
const resultData = [];
|
|
7
|
+
const root = create('vektor', { version: '1.0', encoding: 'UTF-8' });
|
|
8
|
+
let pairVector;
|
|
9
|
+
setLoadingState((s) => ({ ...s, loadingItem: vector.data.ZOBRAZ_MENO }));
|
|
10
|
+
if (vector.data.TYP === EdaVectorType.Pair) {
|
|
11
|
+
try {
|
|
12
|
+
const pairVectors = (await api.loadPairVectorData(vector.data.ID_VEKTOR)).data;
|
|
13
|
+
pairVector = pairVectors.length > 0 ? pairVectors[0] : undefined;
|
|
14
|
+
}
|
|
15
|
+
catch (e) {
|
|
16
|
+
message.error(String(e));
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
root.att("meno", vector.data.MENO);
|
|
20
|
+
root.att("id_vektor", vector.data.ID_VEKTOR);
|
|
21
|
+
root.att("typ", vector.data.TYP);
|
|
22
|
+
root.att("autor", vector.data.AUTOR);
|
|
23
|
+
root.att("private", vector.data.PRIVATE);
|
|
24
|
+
root.att("integral", vector.data.INTEGRAL);
|
|
25
|
+
root.att("zobraz_meno", vector.data.ZOBRAZ_MENO);
|
|
26
|
+
root.att("view_round", vector.data.VIEW_ROUND);
|
|
27
|
+
root.att("exec_round", vector.data.EXEC_ROUND);
|
|
28
|
+
root.att("view_dec_pl", vector.data.VIEW_DEC_PL);
|
|
29
|
+
root.att("exec_dec_pl", vector.data.EXEC_DEC_PL);
|
|
30
|
+
if (vector.data.POPIS !== undefined) {
|
|
31
|
+
root.att("popis", vector.data.POPIS);
|
|
32
|
+
}
|
|
33
|
+
if (vector.data.TYP !== EdaVectorType.Pair && vector.data.TECH_JEDNOTKY !== undefined) {
|
|
34
|
+
root.att("tech_jednotky", vector.data.TECH_JEDNOTKY);
|
|
35
|
+
}
|
|
36
|
+
if (vector.data.TYP === EdaVectorType.Pair && pairVector?.TECH_JEDNOTKY !== undefined) {
|
|
37
|
+
root.att("tech_jednotky", pairVector?.TECH_JEDNOTKY);
|
|
38
|
+
}
|
|
39
|
+
if (vector.data.TYP === EdaVectorType.Pair && pairVector?.TECH_JEDNOTKY_Y !== undefined) {
|
|
40
|
+
root.att("tech_jednotky", pairVector?.TECH_JEDNOTKY_Y);
|
|
41
|
+
}
|
|
42
|
+
if (vector.data.TYP_HODNOTY !== undefined) {
|
|
43
|
+
root.att("typ_hodnoty", vector.data.TYP_HODNOTY);
|
|
44
|
+
}
|
|
45
|
+
if (vector.data.PRIST_PRAVA_R !== undefined) {
|
|
46
|
+
root.att("prist_prava_r", vector.data.PRIST_PRAVA_R);
|
|
47
|
+
}
|
|
48
|
+
if (vector.data.PRIST_PRAVA_W !== undefined) {
|
|
49
|
+
root.att("prist_prava_w", vector.data.PRIST_PRAVA_W);
|
|
50
|
+
}
|
|
51
|
+
if (vector.data.MENOEX !== ".") {
|
|
52
|
+
root.att("menoex", vector.data.MENOEX);
|
|
53
|
+
}
|
|
54
|
+
if (vector.data.TIME_ZONE !== undefined) {
|
|
55
|
+
root.att("time_zone_offset", vector.data.TIME_ZONE);
|
|
56
|
+
}
|
|
57
|
+
if (vector.data.USER_CH !== undefined) {
|
|
58
|
+
root.att("user_ch", vector.data.USER_CH);
|
|
59
|
+
}
|
|
60
|
+
if (vector.data.DATA_OFFSET !== undefined) {
|
|
61
|
+
root.att("data_offset", vector.data.DATA_OFFSET);
|
|
62
|
+
}
|
|
63
|
+
if (vector.data.ID_TABLESPACE !== undefined) {
|
|
64
|
+
root.att("id_tablespace", vector.data.ID_TABLESPACE);
|
|
65
|
+
}
|
|
66
|
+
if (vector.data.VERSIONED_SINCE !== undefined) {
|
|
67
|
+
root.att("versioned_since", vector.data.VERSIONED_SINCE);
|
|
68
|
+
}
|
|
69
|
+
if (vector.data.ARCHIVE_NAME !== undefined) {
|
|
70
|
+
root.att("archive_name", vector.data.ARCHIVE_NAME);
|
|
71
|
+
}
|
|
72
|
+
if (vector.data.ARCHIVE_ROW !== undefined) {
|
|
73
|
+
root.att("archive_row", vector.data.ARCHIVE_ROW);
|
|
74
|
+
}
|
|
75
|
+
if (vector.data.ARCHIVE_COL !== undefined) {
|
|
76
|
+
root.att("archive_col", vector.data.ARCHIVE_COL);
|
|
77
|
+
}
|
|
78
|
+
if (vector.data.STATUS_TEXT !== undefined) {
|
|
79
|
+
root.att("status_text", vector.data.STATUS_TEXT);
|
|
80
|
+
}
|
|
81
|
+
if (vector.data.LOG_ACCESS !== undefined) {
|
|
82
|
+
root.att("log_access", vector.data.LOG_ACCESS);
|
|
83
|
+
}
|
|
84
|
+
if (vector.data.INTERVAL_STABLE !== undefined) {
|
|
85
|
+
root.att("interval_stable", vector.data.INTERVAL_STABLE);
|
|
86
|
+
}
|
|
87
|
+
if (vector.data.PERIOD_BEGIN_TIME !== undefined) {
|
|
88
|
+
root.att("period_begin_time", dayjs(vector.data.PERIOD_BEGIN_TIME).format(dateTimeMask));
|
|
89
|
+
}
|
|
90
|
+
if (vector.data.PERIOD_STEP_BASE !== undefined) {
|
|
91
|
+
root.att("period_step_base", vector.data.PERIOD_STEP_BASE);
|
|
92
|
+
}
|
|
93
|
+
if (vector.data.PERIOD_STEP_COUNT !== undefined) {
|
|
94
|
+
root.att("period_step_count", vector.data.PERIOD_STEP_COUNT);
|
|
95
|
+
}
|
|
96
|
+
if (vector.data.ID_VALIDATOR !== undefined) {
|
|
97
|
+
root.att("id_validator", vector.data.ID_VALIDATOR);
|
|
98
|
+
}
|
|
99
|
+
if (vector.data.ID_MASTER_ENTITY !== undefined) {
|
|
100
|
+
root.att("id_master_entity", vector.data.ID_MASTER_ENTITY);
|
|
101
|
+
}
|
|
102
|
+
if (vector.data.TYP === EdaVectorType.Pair && pairVector?.HODNOTA_X !== undefined) {
|
|
103
|
+
root.att("hodnota_x", pairVector?.HODNOTA_X);
|
|
104
|
+
}
|
|
105
|
+
if (vector.data.TYP === EdaVectorType.Pair && pairVector?.HODNOTA_Y !== undefined) {
|
|
106
|
+
root.att("hodnota_y", pairVector?.HODNOTA_Y);
|
|
107
|
+
}
|
|
108
|
+
if (config.exportValues && [EdaVectorType.FifteenMinutes, EdaVectorType.Hour, EdaVectorType.Day, EdaVectorType.Change].includes(vector.data.TYP)) {
|
|
109
|
+
resultData.push(...await exportSpecifiedVector(api, vector, config, dateTimeMask, setLoadingState, message));
|
|
110
|
+
}
|
|
111
|
+
if (config.exportValues && [EdaVectorType.Descriptive, EdaVectorType.Interval].includes(vector.data.TYP)) {
|
|
112
|
+
await exportDescriptiveVector(root, api, vector, dateTimeMask, message);
|
|
113
|
+
}
|
|
114
|
+
if ([EdaVectorType.FifteenMinutesCalc, EdaVectorType.HourCalc, EdaVectorType.DayCalc, EdaVectorType.ChangeCalc].includes(vector.data.TYP)) {
|
|
115
|
+
await exportCalcVector(root, api, vector, message);
|
|
116
|
+
}
|
|
117
|
+
if (vector.data.TYP === EdaVectorType.Pair) {
|
|
118
|
+
await exportPairVector(root, api, vector, config, dateTimeMask, message);
|
|
119
|
+
}
|
|
120
|
+
root.dtd({ pubID: '' });
|
|
121
|
+
resultData.push([`vekt_${vector.data.MENO}`, root.end({ pretty: true })]);
|
|
122
|
+
return resultData;
|
|
123
|
+
}
|
|
124
|
+
export async function exportGroup(api, group, config, dateTimeMask, setLoadingState, message) {
|
|
125
|
+
const resultData = [];
|
|
126
|
+
const root = create('skupina', { version: '1.0', encoding: 'UTF-8' });
|
|
127
|
+
root.att("meno", group.data.MENO);
|
|
128
|
+
root.att("id_skvektor", group.data.ID_SKVEKTOR);
|
|
129
|
+
root.att("autor", group.data.AUTOR);
|
|
130
|
+
root.att("zobraz_meno", group.data.ZOBRAZ_MENO);
|
|
131
|
+
root.att("private", group.data.PRIVATE);
|
|
132
|
+
if (group.data.POPIS !== undefined) {
|
|
133
|
+
root.att("popis", group.data.POPIS);
|
|
134
|
+
}
|
|
135
|
+
if (group.data.PRIST_PRAVA_R !== undefined) {
|
|
136
|
+
root.att("prist_prava_r", group.data.PRIST_PRAVA_R);
|
|
137
|
+
}
|
|
138
|
+
if (group.data.PRIST_PRAVA_W !== undefined) {
|
|
139
|
+
root.att("prist_prava_w", group.data.PRIST_PRAVA_W);
|
|
140
|
+
}
|
|
141
|
+
if (group.data.USERINPUTFLAG !== undefined) {
|
|
142
|
+
root.att("userinputflag", group.data.USERINPUTFLAG);
|
|
143
|
+
}
|
|
144
|
+
if (config.exportSubgroups) {
|
|
145
|
+
setLoadingState((s) => ({ ...s, loadingPercentage: 0, loadingItem: i18n("Loading subgroups") }));
|
|
146
|
+
let offset = 0;
|
|
147
|
+
let totalItems = 0;
|
|
148
|
+
let firstPage;
|
|
149
|
+
try {
|
|
150
|
+
firstPage = await api.getGroupChildren(group.data.ID_SKVEKTOR);
|
|
151
|
+
}
|
|
152
|
+
catch (e) {
|
|
153
|
+
message.error(String(e));
|
|
154
|
+
return [];
|
|
155
|
+
}
|
|
156
|
+
for (let item of firstPage.items) {
|
|
157
|
+
resultData.push(...await exportSubGroup(api, item, root, config, dateTimeMask, setLoadingState, message));
|
|
158
|
+
}
|
|
159
|
+
if (firstPage.leftCount > 0) {
|
|
160
|
+
totalItems = firstPage.items.length + firstPage.leftCount;
|
|
161
|
+
offset += firstPage.items.length;
|
|
162
|
+
while (offset < totalItems) {
|
|
163
|
+
let page;
|
|
164
|
+
setLoadingState((s) => ({ ...s, loadingPercentage: (offset / totalItems) * 100 }));
|
|
165
|
+
try {
|
|
166
|
+
page = await api.getGroupChildren(group.data.ID_SKVEKTOR, offset);
|
|
167
|
+
}
|
|
168
|
+
catch (e) {
|
|
169
|
+
message.error(String(e));
|
|
170
|
+
break;
|
|
171
|
+
}
|
|
172
|
+
for (let item of page.items) {
|
|
173
|
+
resultData.push(...await exportSubGroup(api, item, root, config, dateTimeMask, setLoadingState, message));
|
|
174
|
+
}
|
|
175
|
+
offset += page.items.length;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
{
|
|
180
|
+
setLoadingState((s) => ({ ...s, loadingPercentage: 0, loadingItem: i18n("Loading vectors") }));
|
|
181
|
+
let offset = 0;
|
|
182
|
+
let totalItems = 0;
|
|
183
|
+
let firstPage;
|
|
184
|
+
try {
|
|
185
|
+
firstPage = await api.getGroupVectors(group.data.ID_SKVEKTOR);
|
|
186
|
+
}
|
|
187
|
+
catch (e) {
|
|
188
|
+
message.error(String(e));
|
|
189
|
+
return [];
|
|
190
|
+
}
|
|
191
|
+
for (let item of firstPage.items) {
|
|
192
|
+
resultData.push(...await exportSubVector(api, item, root, config, dateTimeMask, setLoadingState, message));
|
|
193
|
+
}
|
|
194
|
+
if (firstPage.leftCount > 0) {
|
|
195
|
+
totalItems = firstPage.items.length + firstPage.leftCount;
|
|
196
|
+
offset += firstPage.items.length;
|
|
197
|
+
while (offset < totalItems) {
|
|
198
|
+
let page;
|
|
199
|
+
setLoadingState((s) => ({ ...s, loadingPercentage: (offset / totalItems) * 100 }));
|
|
200
|
+
try {
|
|
201
|
+
page = await api.getGroupVectors(group.data.ID_SKVEKTOR, offset);
|
|
202
|
+
}
|
|
203
|
+
catch (e) {
|
|
204
|
+
message.error(String(e));
|
|
205
|
+
break;
|
|
206
|
+
}
|
|
207
|
+
for (let item of page.items) {
|
|
208
|
+
resultData.push(...await exportSubVector(api, item, root, config, dateTimeMask, setLoadingState, message));
|
|
209
|
+
}
|
|
210
|
+
offset += page.items.length;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
root.dtd({ pubID: '' });
|
|
215
|
+
resultData.push([`skup_${group.data.MENO}`, root.end({ pretty: true })]);
|
|
216
|
+
return resultData;
|
|
217
|
+
}
|
|
218
|
+
export async function exportScenario(api, scenario, config, dateTimeMask, setLoadingState, message) {
|
|
219
|
+
const resultData = [];
|
|
220
|
+
const root = create('scenar', { version: '1.0', encoding: 'UTF-8' });
|
|
221
|
+
root.att("meno", scenario.data.MENO);
|
|
222
|
+
root.att("autor", scenario.data.AUTOR);
|
|
223
|
+
root.att("zobraz_meno", scenario.data.ZOBRAZ_MENO);
|
|
224
|
+
root.att("private", scenario.data.PRIVATE);
|
|
225
|
+
root.att("ano_diagram", scenario.data.ANO_DIAGRAM);
|
|
226
|
+
if (scenario.data.POPIS !== undefined) {
|
|
227
|
+
root.att("popis", scenario.data.POPIS);
|
|
228
|
+
}
|
|
229
|
+
if (scenario.data.CAS_DLZKA !== undefined) {
|
|
230
|
+
root.att("cas_dlzka", scenario.data.CAS_DLZKA);
|
|
231
|
+
}
|
|
232
|
+
if (scenario.data.CAS_POSUN !== undefined) {
|
|
233
|
+
root.att("cas_posun", scenario.data.CAS_POSUN);
|
|
234
|
+
}
|
|
235
|
+
if (scenario.data.CAS_JEMNOST !== undefined) {
|
|
236
|
+
root.att("cas_posun", scenario.data.CAS_JEMNOST);
|
|
237
|
+
}
|
|
238
|
+
if (scenario.data.PRIST_PRAVA_R !== undefined) {
|
|
239
|
+
root.att("prist_prava_r", scenario.data.PRIST_PRAVA_R);
|
|
240
|
+
}
|
|
241
|
+
if (scenario.data.PRIST_PRAVA_W !== undefined) {
|
|
242
|
+
root.att("prist_prava_w", scenario.data.PRIST_PRAVA_W);
|
|
243
|
+
}
|
|
244
|
+
if (scenario.data.FILTER !== undefined) {
|
|
245
|
+
root.att("filter", scenario.data.FILTER);
|
|
246
|
+
}
|
|
247
|
+
if (scenario.data.FILTER_USER !== undefined) {
|
|
248
|
+
root.att("filter_user", scenario.data.FILTER_USER);
|
|
249
|
+
}
|
|
250
|
+
if (scenario.data.FILTER_TYP !== undefined) {
|
|
251
|
+
root.att("filter_typ", scenario.data.FILTER_TYP);
|
|
252
|
+
}
|
|
253
|
+
if (scenario.data.DIAGRAM !== undefined) {
|
|
254
|
+
root.att("diagram", scenario.data.DIAGRAM);
|
|
255
|
+
}
|
|
256
|
+
if (scenario.data.ANO_ZMENA !== undefined) {
|
|
257
|
+
root.att("ano_zmena", scenario.data.ANO_ZMENA);
|
|
258
|
+
}
|
|
259
|
+
if (scenario.data.ANO_GRAFXY !== undefined) {
|
|
260
|
+
root.att("ano_grafxy", scenario.data.ANO_GRAFXY);
|
|
261
|
+
}
|
|
262
|
+
if (scenario.data.ANO_MATICA !== undefined) {
|
|
263
|
+
root.att("ano_matica", scenario.data.ANO_MATICA);
|
|
264
|
+
}
|
|
265
|
+
if (scenario.data.ANO_PAIR !== undefined) {
|
|
266
|
+
root.att("ano_matica", scenario.data.ANO_PAIR);
|
|
267
|
+
}
|
|
268
|
+
if (config.exportSubgroups) {
|
|
269
|
+
setLoadingState((s) => ({ ...s, loadingPercentage: 0, loadingItem: i18n("Loading subscenarios") }));
|
|
270
|
+
let offset = 0;
|
|
271
|
+
let totalItems = 0;
|
|
272
|
+
let firstPage;
|
|
273
|
+
try {
|
|
274
|
+
firstPage = await api.getScenarioChildren(scenario.data.ID_SCENAR);
|
|
275
|
+
}
|
|
276
|
+
catch (e) {
|
|
277
|
+
message.error(String(e));
|
|
278
|
+
return [];
|
|
279
|
+
}
|
|
280
|
+
for (let item of firstPage.items) {
|
|
281
|
+
resultData.push(...await exportSubScenarios(api, item, root, config, dateTimeMask, setLoadingState, message));
|
|
282
|
+
}
|
|
283
|
+
if (firstPage.leftCount > 0) {
|
|
284
|
+
totalItems = firstPage.items.length + firstPage.leftCount;
|
|
285
|
+
offset += firstPage.items.length;
|
|
286
|
+
while (offset < totalItems) {
|
|
287
|
+
let page;
|
|
288
|
+
setLoadingState((s) => ({ ...s, loadingPercentage: (offset / totalItems) * 100 }));
|
|
289
|
+
try {
|
|
290
|
+
page = await api.getScenarioChildren(scenario.data.ID_SCENAR, offset);
|
|
291
|
+
}
|
|
292
|
+
catch (e) {
|
|
293
|
+
message.error(String(e));
|
|
294
|
+
break;
|
|
295
|
+
}
|
|
296
|
+
for (let item of page.items) {
|
|
297
|
+
resultData.push(...await exportSubScenarios(api, item, root, config, dateTimeMask, setLoadingState, message));
|
|
298
|
+
}
|
|
299
|
+
offset += page.items.length;
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
{
|
|
304
|
+
setLoadingState((s) => ({ ...s, loadingPercentage: 0, loadingItem: i18n("Loading vectors") }));
|
|
305
|
+
let offset = 0;
|
|
306
|
+
let totalItems = 0;
|
|
307
|
+
let firstPage;
|
|
308
|
+
try {
|
|
309
|
+
firstPage = await api.getScenarioVectors(scenario.data.ID_SCENAR, undefined, undefined, true);
|
|
310
|
+
}
|
|
311
|
+
catch (e) {
|
|
312
|
+
message.error(String(e));
|
|
313
|
+
return [];
|
|
314
|
+
}
|
|
315
|
+
for (let item of firstPage.items) {
|
|
316
|
+
resultData.push(...await exportSubVector(api, item, root, config, dateTimeMask, setLoadingState, message));
|
|
317
|
+
}
|
|
318
|
+
if (firstPage.leftCount > 0) {
|
|
319
|
+
totalItems = firstPage.items.length + firstPage.leftCount;
|
|
320
|
+
offset += firstPage.items.length;
|
|
321
|
+
while (offset < totalItems) {
|
|
322
|
+
let page;
|
|
323
|
+
setLoadingState((s) => ({ ...s, loadingPercentage: (offset / totalItems) * 100 }));
|
|
324
|
+
try {
|
|
325
|
+
page = await api.getScenarioVectors(scenario.data.ID_SCENAR, offset, undefined, true);
|
|
326
|
+
}
|
|
327
|
+
catch (e) {
|
|
328
|
+
message.error(String(e));
|
|
329
|
+
break;
|
|
330
|
+
}
|
|
331
|
+
for (let item of page.items) {
|
|
332
|
+
resultData.push(...await exportSubVector(api, item, root, config, dateTimeMask, setLoadingState, message));
|
|
333
|
+
}
|
|
334
|
+
offset += page.items.length;
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
root.dtd({ pubID: '' });
|
|
339
|
+
resultData.push([`scenar_${scenario.data.MENO}`, root.end({ pretty: true })]);
|
|
340
|
+
return resultData;
|
|
341
|
+
}
|
|
342
|
+
async function exportCalcVector(root, api, vector, message) {
|
|
343
|
+
let data;
|
|
344
|
+
try {
|
|
345
|
+
data = await api.loadCalcVectorData(vector.data.ID_VEKTOR);
|
|
346
|
+
}
|
|
347
|
+
catch (e) {
|
|
348
|
+
message.error(String(e));
|
|
349
|
+
return;
|
|
350
|
+
}
|
|
351
|
+
if (data.data.length > 0) {
|
|
352
|
+
const prescription = data.data[0];
|
|
353
|
+
const element = root.ele("predpis");
|
|
354
|
+
if (prescription.POPIS !== undefined) {
|
|
355
|
+
element.att("popis", prescription.POPIS);
|
|
356
|
+
}
|
|
357
|
+
element.cdata(data.prescription);
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
async function exportDescriptiveVector(root, api, vector, dateTimeMask, message) {
|
|
361
|
+
let data;
|
|
362
|
+
try {
|
|
363
|
+
data = await api.loadDescriptiveVectorData(vector.data.ID_VEKTOR);
|
|
364
|
+
}
|
|
365
|
+
catch (e) {
|
|
366
|
+
message.error(String(e));
|
|
367
|
+
return;
|
|
368
|
+
}
|
|
369
|
+
const element = root.ele("popis");
|
|
370
|
+
for (let desc of data.data) {
|
|
371
|
+
element.att("idx", desc.IDX);
|
|
372
|
+
element.att("typ_periody", desc.TYP_PERIODY);
|
|
373
|
+
element.att("typ_hodnoty", desc.TYP_HODNOTY);
|
|
374
|
+
element.att("hodnota", desc.HODNOTA);
|
|
375
|
+
element.att("valid", desc.VALID);
|
|
376
|
+
if (desc.EDA_ID !== undefined) {
|
|
377
|
+
element.att("eda_id", desc.EDA_ID);
|
|
378
|
+
}
|
|
379
|
+
if (desc.TIME_FROM !== undefined) {
|
|
380
|
+
element.att("od", dayjs(desc.TIME_FROM).format(dateTimeMask));
|
|
381
|
+
}
|
|
382
|
+
if (desc.TIME_TO !== undefined) {
|
|
383
|
+
element.att("do", dayjs(desc.TIME_TO).format(dateTimeMask));
|
|
384
|
+
}
|
|
385
|
+
if (desc.HODNOTA2 !== undefined) {
|
|
386
|
+
element.att("hodnota2", desc.HODNOTA2);
|
|
387
|
+
}
|
|
388
|
+
if (desc.STAV !== undefined) {
|
|
389
|
+
element.att("stav", desc.STAV);
|
|
390
|
+
}
|
|
391
|
+
if (desc.DODATOK_ID !== undefined) {
|
|
392
|
+
element.att("dodatok_id", desc.DODATOK_ID);
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
async function exportSpecifiedVector(api, vector, config, dateTimeMask, setLoadingState, message) {
|
|
397
|
+
const exportInterval = getExportInterval(config.from, config.to, vector.data.DATA_OD !== undefined ? dayjs(vector.data.DATA_OD) : undefined, vector.data.DATA_DO !== undefined ? dayjs(vector.data.DATA_DO) : undefined);
|
|
398
|
+
if (exportInterval === undefined) {
|
|
399
|
+
return [];
|
|
400
|
+
}
|
|
401
|
+
const result = [];
|
|
402
|
+
const [from, to] = exportInterval;
|
|
403
|
+
const years = [];
|
|
404
|
+
let current = from;
|
|
405
|
+
while (current.isSameOrBefore(to, "year")) {
|
|
406
|
+
const yearEnd = current.endOf("year");
|
|
407
|
+
years.push({ start: current, end: yearEnd });
|
|
408
|
+
current = current.add(1, 'year').startOf('year');
|
|
409
|
+
}
|
|
410
|
+
for (const range of years.values()) {
|
|
411
|
+
let values;
|
|
412
|
+
setLoadingState((s) => ({ ...s, loadingItem: vector.data.ZOBRAZ_MENO + " - " + range.start.year() }));
|
|
413
|
+
try {
|
|
414
|
+
values = await api.readVectorValues(vector.data.ID_VEKTOR, range.start, range.end, EdaSamplingType.Default);
|
|
415
|
+
}
|
|
416
|
+
catch (e) {
|
|
417
|
+
message.error(String(e));
|
|
418
|
+
continue;
|
|
419
|
+
}
|
|
420
|
+
const root = create('vektor', { version: '1.0', encoding: 'UTF-8' });
|
|
421
|
+
if (!values.data) {
|
|
422
|
+
message.error(i18n("No vector data found"));
|
|
423
|
+
continue;
|
|
424
|
+
}
|
|
425
|
+
for (let value of values.data) {
|
|
426
|
+
const valueElement = root.ele("value");
|
|
427
|
+
valueElement.att("time", dayjs(value.val.valueTime).format(dateTimeMask));
|
|
428
|
+
if (value.val.value !== undefined && value.val.value !== null) {
|
|
429
|
+
valueElement.att("value", value.val.value);
|
|
430
|
+
}
|
|
431
|
+
if (value.val.flags?.includes("A")) {
|
|
432
|
+
valueElement.att("flagA", 1);
|
|
433
|
+
}
|
|
434
|
+
if (value.val.flags?.includes("B")) {
|
|
435
|
+
valueElement.att("flagB", 1);
|
|
436
|
+
}
|
|
437
|
+
if (value.val.flags?.includes("C")) {
|
|
438
|
+
valueElement.att("flagC", 1);
|
|
439
|
+
}
|
|
440
|
+
if (value.val.flags?.includes("D")) {
|
|
441
|
+
valueElement.att("flagD", 1);
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
root.dtd({ pubID: '' });
|
|
445
|
+
result.push([`vekt_${vector.data.MENO}_DATA_${range.start.year()}`, root.end({ pretty: true })]);
|
|
446
|
+
}
|
|
447
|
+
return result;
|
|
448
|
+
}
|
|
449
|
+
async function exportPairVector(root, api, vector, config, dateTimeMask, message) {
|
|
450
|
+
const exportInterval = getExportInterval(config.from, config.to, vector.data.DATA_OD !== undefined ? dayjs(vector.data.DATA_OD) : undefined, vector.data.DATA_DO !== undefined ? dayjs(vector.data.DATA_DO) : undefined);
|
|
451
|
+
if (exportInterval === undefined || !config.exportValues) {
|
|
452
|
+
return;
|
|
453
|
+
}
|
|
454
|
+
let pairData;
|
|
455
|
+
try {
|
|
456
|
+
pairData = await api.readPairVectorValues(vector.data.ID_VEKTOR, exportInterval[0], exportInterval[1], EdaSamplingType.Default);
|
|
457
|
+
}
|
|
458
|
+
catch (e) {
|
|
459
|
+
message.error(String(e));
|
|
460
|
+
return;
|
|
461
|
+
}
|
|
462
|
+
for (let data of pairData) {
|
|
463
|
+
const valueElement = root.ele("value");
|
|
464
|
+
valueElement.att("time", dayjs(data.valX.valueTime).format(dateTimeMask));
|
|
465
|
+
if (data.valX.valueTime !== undefined) {
|
|
466
|
+
valueElement.att("value_x", data.valX.value);
|
|
467
|
+
if (data.valX.flags?.includes("A")) {
|
|
468
|
+
valueElement.att("flagA_x", 1);
|
|
469
|
+
}
|
|
470
|
+
if (data.valX.flags?.includes("B")) {
|
|
471
|
+
valueElement.att("flagB_x", 1);
|
|
472
|
+
}
|
|
473
|
+
if (data.valX.flags?.includes("C")) {
|
|
474
|
+
valueElement.att("flagC_x", 1);
|
|
475
|
+
}
|
|
476
|
+
if (data.valX.flags?.includes("D")) {
|
|
477
|
+
valueElement.att("flagD_x", 1);
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
if (data.valY.valueTime !== undefined) {
|
|
481
|
+
valueElement.att("value_y", data.valY.value);
|
|
482
|
+
if (data.valY.flags?.includes("A")) {
|
|
483
|
+
valueElement.att("flagA_y", 1);
|
|
484
|
+
}
|
|
485
|
+
if (data.valY.flags?.includes("B")) {
|
|
486
|
+
valueElement.att("flagB_y", 1);
|
|
487
|
+
}
|
|
488
|
+
if (data.valY.flags?.includes("C")) {
|
|
489
|
+
valueElement.att("flagC_y", 1);
|
|
490
|
+
}
|
|
491
|
+
if (data.valY.flags?.includes("D")) {
|
|
492
|
+
valueElement.att("flagD_y", 1);
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
if (data.idx.value !== undefined) {
|
|
496
|
+
valueElement.att("idx", data.idx.value);
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
async function exportSubGroup(api, item, root, config, dateTimeMask, setLoadingState, message) {
|
|
501
|
+
let subgroup;
|
|
502
|
+
root.ele("podskupina", { meno: item.Name });
|
|
503
|
+
try {
|
|
504
|
+
subgroup = await api.loadGroupData(item.ID);
|
|
505
|
+
}
|
|
506
|
+
catch (e) {
|
|
507
|
+
message.error(String(e));
|
|
508
|
+
console.error(e);
|
|
509
|
+
return [];
|
|
510
|
+
}
|
|
511
|
+
if (subgroup) {
|
|
512
|
+
return await exportGroup(api, subgroup, config, dateTimeMask, setLoadingState, message);
|
|
513
|
+
}
|
|
514
|
+
return [];
|
|
515
|
+
}
|
|
516
|
+
async function exportSubVector(api, item, root, config, dateTimeMask, setLoadingState, message) {
|
|
517
|
+
let subVector;
|
|
518
|
+
if (!config.vectorTypes[item.Type]) {
|
|
519
|
+
return [];
|
|
520
|
+
}
|
|
521
|
+
root.ele("vektor", { meno: item.Name });
|
|
522
|
+
try {
|
|
523
|
+
subVector = await api.loadVectorData(item.ID);
|
|
524
|
+
}
|
|
525
|
+
catch (e) {
|
|
526
|
+
message.error(String(e));
|
|
527
|
+
console.error(e);
|
|
528
|
+
return [];
|
|
529
|
+
}
|
|
530
|
+
if (subVector) {
|
|
531
|
+
return await exportVector(api, subVector, config, dateTimeMask, setLoadingState, message);
|
|
532
|
+
}
|
|
533
|
+
return [];
|
|
534
|
+
}
|
|
535
|
+
async function exportSubScenarios(api, item, root, config, dateTimeMask, setLoadingState, message) {
|
|
536
|
+
let subScenario;
|
|
537
|
+
root.ele("podscenar", { meno: item.Name });
|
|
538
|
+
try {
|
|
539
|
+
subScenario = await api.loadScenarioData(item.ID);
|
|
540
|
+
}
|
|
541
|
+
catch (e) {
|
|
542
|
+
message.error(String(e));
|
|
543
|
+
console.error(e);
|
|
544
|
+
return [];
|
|
545
|
+
}
|
|
546
|
+
if (subScenario) {
|
|
547
|
+
return await exportScenario(api, subScenario, config, dateTimeMask, setLoadingState, message);
|
|
548
|
+
}
|
|
549
|
+
return [];
|
|
550
|
+
}
|
|
551
|
+
function getExportInterval(bt, et, vectorBt, vectorEt) {
|
|
552
|
+
if (vectorBt === undefined || vectorEt === undefined) {
|
|
553
|
+
return undefined;
|
|
554
|
+
}
|
|
555
|
+
if (bt !== undefined && et !== undefined) {
|
|
556
|
+
let start = undefined;
|
|
557
|
+
let end = undefined;
|
|
558
|
+
if (bt.isBefore(vectorBt)) {
|
|
559
|
+
start = bt;
|
|
560
|
+
}
|
|
561
|
+
if (et.isAfter(vectorEt)) {
|
|
562
|
+
end = bt;
|
|
563
|
+
}
|
|
564
|
+
if (start !== undefined && end !== undefined && start.isBefore(end)) {
|
|
565
|
+
return [start, end];
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
else {
|
|
569
|
+
return [vectorBt, vectorEt];
|
|
570
|
+
}
|
|
571
|
+
return undefined;
|
|
572
|
+
}
|
|
573
|
+
//# sourceMappingURL=export.js.map
|