d2aura 26.0.16 → 26.0.17
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 +8 -4
- package/api/eda/edaManagerApi.js +26 -2
- package/api/eda/edaManagerApi.js.map +1 -1
- package/api/eda/generated/events.d.ts +93 -70
- package/api/eda/generated/events.js +170 -129
- package/api/eda/generated/events.js.map +1 -1
- package/api/eda/generated/structures.d.ts +7 -6
- package/api/eda/generated/structures.js.map +1 -1
- package/api/webAuthn/webAuthnManageApi.d.ts +9 -0
- package/api/webAuthn/webAuthnManageApi.js +61 -0
- package/api/webAuthn/webAuthnManageApi.js.map +1 -0
- package/api/webPush/webPushApi.js.map +1 -1
- package/api/webPush/webPushUtils.js.map +1 -1
- package/core/i18n/d2aura.sk.json +30 -0
- package/coreui/auth/passkeyLogin.d.ts +8 -0
- package/coreui/auth/passkeyLogin.js +70 -0
- package/coreui/auth/passkeyLogin.js.map +1 -0
- package/coreui/auth/passkeyLoginButton.d.ts +9 -0
- package/coreui/auth/passkeyLoginButton.js +24 -0
- package/coreui/auth/passkeyLoginButton.js.map +1 -0
- package/coreui/components/edaManagerComponent/components/edaChartViewer.js +1 -1
- package/coreui/components/edaManagerComponent/components/edaChartViewer.js.map +1 -1
- package/coreui/components/edaManagerComponent/components/edaDataBasePanel.js +3 -6
- package/coreui/components/edaManagerComponent/components/edaDataBasePanel.js.map +1 -1
- package/coreui/components/edaManagerComponent/components/edaDetailPanel.js +1 -0
- package/coreui/components/edaManagerComponent/components/edaDetailPanel.js.map +1 -1
- package/coreui/components/edaManagerComponent/components/edaDialogTitle.d.ts +8 -0
- package/coreui/components/edaManagerComponent/components/edaDialogTitle.js +10 -0
- package/coreui/components/edaManagerComponent/components/edaDialogTitle.js.map +1 -0
- package/coreui/components/edaManagerComponent/components/edaGraphPanel.js +2 -1
- package/coreui/components/edaManagerComponent/components/edaGraphPanel.js.map +1 -1
- package/coreui/components/edaManagerComponent/components/edaGroupDetailPanel.js +1 -1
- package/coreui/components/edaManagerComponent/components/edaGroupDetailPanel.js.map +1 -1
- package/coreui/components/edaManagerComponent/components/edaLoadingOverlay.d.ts +1 -6
- package/coreui/components/edaManagerComponent/components/edaLoadingOverlay.js +9 -8
- package/coreui/components/edaManagerComponent/components/edaLoadingOverlay.js.map +1 -1
- package/coreui/components/edaManagerComponent/components/edaSampleRangePickerPanel.d.ts +0 -1
- package/coreui/components/edaManagerComponent/components/edaSampleRangePickerPanel.js +4 -4
- package/coreui/components/edaManagerComponent/components/edaSampleRangePickerPanel.js.map +1 -1
- package/coreui/components/edaManagerComponent/components/edaScenarioDetailPanel.js +1 -1
- package/coreui/components/edaManagerComponent/components/edaScenarioDetailPanel.js.map +1 -1
- package/coreui/components/edaManagerComponent/components/edaTablePanel.js +7 -24
- package/coreui/components/edaManagerComponent/components/edaTablePanel.js.map +1 -1
- package/coreui/components/edaManagerComponent/components/edaTreeView.js +117 -145
- package/coreui/components/edaManagerComponent/components/edaTreeView.js.map +1 -1
- package/coreui/components/edaManagerComponent/components/edaVectorDetailPanel.js +19 -16
- package/coreui/components/edaManagerComponent/components/edaVectorDetailPanel.js.map +1 -1
- package/coreui/components/edaManagerComponent/constants/actionTypes.d.ts +1 -0
- package/coreui/components/edaManagerComponent/constants/actionTypes.js +1 -0
- package/coreui/components/edaManagerComponent/constants/actionTypes.js.map +1 -1
- package/coreui/components/edaManagerComponent/constants/edaTypes.d.ts +6 -2
- package/coreui/components/edaManagerComponent/constants/edaTypes.js +1 -0
- package/coreui/components/edaManagerComponent/constants/edaTypes.js.map +1 -1
- package/coreui/components/edaManagerComponent/context/edaVectorDataContext.d.ts +0 -1
- package/coreui/components/edaManagerComponent/context/edaVectorDataContext.js.map +1 -1
- package/coreui/components/edaManagerComponent/context/edaVectorDataProvider.d.ts +2 -3
- package/coreui/components/edaManagerComponent/context/edaVectorDataProvider.js +77 -37
- package/coreui/components/edaManagerComponent/context/edaVectorDataProvider.js.map +1 -1
- package/coreui/components/edaManagerComponent/context/loadingContext.d.ts +11 -1
- package/coreui/components/edaManagerComponent/context/loadingContext.js +40 -2
- package/coreui/components/edaManagerComponent/context/loadingContext.js.map +1 -1
- package/coreui/components/edaManagerComponent/context/useEdaActions.d.ts +1 -0
- package/coreui/components/edaManagerComponent/context/useEdaActions.js +18 -9
- package/coreui/components/edaManagerComponent/context/useEdaActions.js.map +1 -1
- package/coreui/components/edaManagerComponent/dialogs/descriptiveVectorDialog/descriptiveVectorDetailPanel.js +5 -3
- package/coreui/components/edaManagerComponent/dialogs/descriptiveVectorDialog/descriptiveVectorDetailPanel.js.map +1 -1
- package/coreui/components/edaManagerComponent/dialogs/descriptiveVectorDialog/graphPanel.d.ts +0 -1
- package/coreui/components/edaManagerComponent/dialogs/descriptiveVectorDialog/graphPanel.js +3 -5
- package/coreui/components/edaManagerComponent/dialogs/descriptiveVectorDialog/graphPanel.js.map +1 -1
- package/coreui/components/edaManagerComponent/dialogs/descriptiveVectorDialog/tablePanel.d.ts +0 -1
- package/coreui/components/edaManagerComponent/dialogs/descriptiveVectorDialog/tablePanel.js +4 -6
- package/coreui/components/edaManagerComponent/dialogs/descriptiveVectorDialog/tablePanel.js.map +1 -1
- package/coreui/components/edaManagerComponent/dialogs/descriptiveVectorDialog/utils.js +1 -0
- package/coreui/components/edaManagerComponent/dialogs/descriptiveVectorDialog/utils.js.map +1 -1
- package/coreui/components/edaManagerComponent/dialogs/edaDescriptiveVectorEditorDialog.js +46 -12
- package/coreui/components/edaManagerComponent/dialogs/edaDescriptiveVectorEditorDialog.js.map +1 -1
- package/coreui/components/edaManagerComponent/dialogs/edaTableEditorDialog.js +10 -8
- package/coreui/components/edaManagerComponent/dialogs/edaTableEditorDialog.js.map +1 -1
- package/coreui/components/edaManagerComponent/dialogs/exportDialog.d.ts +1 -9
- package/coreui/components/edaManagerComponent/dialogs/exportDialog.js +48 -79
- package/coreui/components/edaManagerComponent/dialogs/exportDialog.js.map +1 -1
- package/coreui/components/edaManagerComponent/dialogs/importDialog.d.ts +10 -0
- package/coreui/components/edaManagerComponent/dialogs/importDialog.js +418 -0
- package/coreui/components/edaManagerComponent/dialogs/importDialog.js.map +1 -0
- package/coreui/components/edaManagerComponent/dialogs/importExport/export.d.ts +17 -0
- package/coreui/components/edaManagerComponent/dialogs/importExport/export.js +335 -0
- package/coreui/components/edaManagerComponent/dialogs/importExport/export.js.map +1 -0
- package/coreui/components/edaManagerComponent/dialogs/importExport/import.d.ts +58 -0
- package/coreui/components/edaManagerComponent/dialogs/importExport/import.js +375 -0
- package/coreui/components/edaManagerComponent/dialogs/importExport/import.js.map +1 -0
- package/coreui/components/edaManagerComponent/dialogs/importExport/types.d.ts +8 -0
- package/coreui/components/edaManagerComponent/dialogs/importExport/types.js +98 -0
- package/coreui/components/edaManagerComponent/dialogs/importExport/types.js.map +1 -0
- package/coreui/components/edaManagerComponent/dialogs/importExport/vectorTypeCheckbox.d.ts +5 -0
- package/coreui/components/edaManagerComponent/dialogs/importExport/vectorTypeCheckbox.js +13 -0
- package/coreui/components/edaManagerComponent/dialogs/importExport/vectorTypeCheckbox.js.map +1 -0
- package/coreui/components/edaManagerComponent/dialogs/importExport/vectorTypeSelection.d.ts +2 -0
- package/coreui/components/edaManagerComponent/dialogs/importExport/vectorTypeSelection.js +17 -0
- package/coreui/components/edaManagerComponent/dialogs/importExport/vectorTypeSelection.js.map +1 -0
- package/coreui/components/edaManagerComponent/dialogs/importExport/xmlAttributeHolder.d.ts +20 -0
- package/coreui/components/edaManagerComponent/dialogs/importExport/xmlAttributeHolder.js +36 -0
- package/coreui/components/edaManagerComponent/dialogs/importExport/xmlAttributeHolder.js.map +1 -0
- package/coreui/components/edaManagerComponent/dialogs/{groupVectorSelection.d.ts → vectorSelectionDialog.d.ts} +1 -1
- package/coreui/components/edaManagerComponent/dialogs/{groupVectorSelection.js → vectorSelectionDialog.js} +5 -4
- package/coreui/components/edaManagerComponent/dialogs/vectorSelectionDialog.js.map +1 -0
- package/coreui/components/edaManagerComponent/edaDetail.js +24 -20
- package/coreui/components/edaManagerComponent/edaDetail.js.map +1 -1
- package/coreui/components/edaManagerComponent/edaManager.js +9 -7
- package/coreui/components/edaManagerComponent/edaManager.js.map +1 -1
- package/coreui/components/edaManagerComponent/edaSelect.js +8 -11
- package/coreui/components/edaManagerComponent/edaSelect.js.map +1 -1
- package/coreui/components/edaManagerComponent/utils/utils.d.ts +7 -6
- package/coreui/components/edaManagerComponent/utils/utils.js +63 -5
- package/coreui/components/edaManagerComponent/utils/utils.js.map +1 -1
- package/coreui/components/passkey/passkeyManager.d.ts +7 -0
- package/coreui/components/passkey/passkeyManager.js +75 -0
- package/coreui/components/passkey/passkeyManager.js.map +1 -0
- package/coreui/components/webPush/webPushSwitch.js.map +1 -1
- package/coreui/images/logo.svg +9 -9
- package/coreui/images/logo_full.svg +11 -11
- package/package.json +9 -4
- package/coreui/components/edaManagerComponent/dialogs/groupVectorSelection.js.map +0 -1
- package/coreui/components/edaManagerComponent/utils/export.d.ts +0 -9
- package/coreui/components/edaManagerComponent/utils/export.js +0 -570
- package/coreui/components/edaManagerComponent/utils/export.js.map +0 -1
|
@@ -1,570 +0,0 @@
|
|
|
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) {
|
|
371
|
-
element.att("idx", desc.idx);
|
|
372
|
-
element.att("typ_periody", desc.periodType);
|
|
373
|
-
element.att("typ_hodnoty", desc.valueType);
|
|
374
|
-
element.att("hodnota", desc.value);
|
|
375
|
-
element.att("valid", desc.valid);
|
|
376
|
-
if (desc.timeFrom !== undefined) {
|
|
377
|
-
element.att("od", dayjs(desc.timeFrom).format(dateTimeMask));
|
|
378
|
-
}
|
|
379
|
-
if (desc.timeTo !== undefined) {
|
|
380
|
-
element.att("do", dayjs(desc.timeTo).format(dateTimeMask));
|
|
381
|
-
}
|
|
382
|
-
if (desc.value2 !== undefined) {
|
|
383
|
-
element.att("hodnota2", desc.value2);
|
|
384
|
-
}
|
|
385
|
-
if (desc.status !== undefined) {
|
|
386
|
-
element.att("stav", desc.status);
|
|
387
|
-
}
|
|
388
|
-
if (desc.supplement !== undefined) {
|
|
389
|
-
element.att("dodatok_id", desc.supplement);
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
|
-
async function exportSpecifiedVector(api, vector, config, dateTimeMask, setLoadingState, message) {
|
|
394
|
-
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);
|
|
395
|
-
if (exportInterval === undefined) {
|
|
396
|
-
return [];
|
|
397
|
-
}
|
|
398
|
-
const result = [];
|
|
399
|
-
const [from, to] = exportInterval;
|
|
400
|
-
const years = [];
|
|
401
|
-
let current = from;
|
|
402
|
-
while (current.isSameOrBefore(to, "year")) {
|
|
403
|
-
const yearEnd = current.endOf("year");
|
|
404
|
-
years.push({ start: current, end: yearEnd });
|
|
405
|
-
current = current.add(1, 'year').startOf('year');
|
|
406
|
-
}
|
|
407
|
-
for (const range of years.values()) {
|
|
408
|
-
let values;
|
|
409
|
-
setLoadingState((s) => ({ ...s, loadingItem: vector.data.ZOBRAZ_MENO + " - " + range.start.year() }));
|
|
410
|
-
try {
|
|
411
|
-
values = await api.readVectorValues(vector.data.ID_VEKTOR, range.start, range.end, EdaSamplingType.Default);
|
|
412
|
-
}
|
|
413
|
-
catch (e) {
|
|
414
|
-
message.error(String(e));
|
|
415
|
-
continue;
|
|
416
|
-
}
|
|
417
|
-
const root = create('vektor', { version: '1.0', encoding: 'UTF-8' });
|
|
418
|
-
if (!values.data) {
|
|
419
|
-
message.error(i18n("No vector data found"));
|
|
420
|
-
continue;
|
|
421
|
-
}
|
|
422
|
-
for (let value of values.data) {
|
|
423
|
-
const valueElement = root.ele("value");
|
|
424
|
-
valueElement.att("time", dayjs(value.val.valueTime).format(dateTimeMask));
|
|
425
|
-
if (value.val.value !== undefined && value.val.value !== null) {
|
|
426
|
-
valueElement.att("value", value.val.value);
|
|
427
|
-
}
|
|
428
|
-
if (value.val.flags?.includes("A")) {
|
|
429
|
-
valueElement.att("flagA", 1);
|
|
430
|
-
}
|
|
431
|
-
if (value.val.flags?.includes("B")) {
|
|
432
|
-
valueElement.att("flagB", 1);
|
|
433
|
-
}
|
|
434
|
-
if (value.val.flags?.includes("C")) {
|
|
435
|
-
valueElement.att("flagC", 1);
|
|
436
|
-
}
|
|
437
|
-
if (value.val.flags?.includes("D")) {
|
|
438
|
-
valueElement.att("flagD", 1);
|
|
439
|
-
}
|
|
440
|
-
}
|
|
441
|
-
root.dtd({ pubID: '' });
|
|
442
|
-
result.push([`vekt_${vector.data.MENO}_DATA_${range.start.year()}`, root.end({ pretty: true })]);
|
|
443
|
-
}
|
|
444
|
-
return result;
|
|
445
|
-
}
|
|
446
|
-
async function exportPairVector(root, api, vector, config, dateTimeMask, message) {
|
|
447
|
-
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);
|
|
448
|
-
if (exportInterval === undefined || !config.exportValues) {
|
|
449
|
-
return;
|
|
450
|
-
}
|
|
451
|
-
let pairData;
|
|
452
|
-
try {
|
|
453
|
-
pairData = await api.readPairVectorValues(vector.data.ID_VEKTOR, exportInterval[0], exportInterval[1], EdaSamplingType.Default);
|
|
454
|
-
}
|
|
455
|
-
catch (e) {
|
|
456
|
-
message.error(String(e));
|
|
457
|
-
return;
|
|
458
|
-
}
|
|
459
|
-
for (let data of pairData) {
|
|
460
|
-
const valueElement = root.ele("value");
|
|
461
|
-
valueElement.att("time", dayjs(data.valX.valueTime).format(dateTimeMask));
|
|
462
|
-
if (data.valX.valueTime !== undefined) {
|
|
463
|
-
valueElement.att("value_x", data.valX.value);
|
|
464
|
-
if (data.valX.flags?.includes("A")) {
|
|
465
|
-
valueElement.att("flagA_x", 1);
|
|
466
|
-
}
|
|
467
|
-
if (data.valX.flags?.includes("B")) {
|
|
468
|
-
valueElement.att("flagB_x", 1);
|
|
469
|
-
}
|
|
470
|
-
if (data.valX.flags?.includes("C")) {
|
|
471
|
-
valueElement.att("flagC_x", 1);
|
|
472
|
-
}
|
|
473
|
-
if (data.valX.flags?.includes("D")) {
|
|
474
|
-
valueElement.att("flagD_x", 1);
|
|
475
|
-
}
|
|
476
|
-
}
|
|
477
|
-
if (data.valY.valueTime !== undefined) {
|
|
478
|
-
valueElement.att("value_y", data.valY.value);
|
|
479
|
-
if (data.valY.flags?.includes("A")) {
|
|
480
|
-
valueElement.att("flagA_y", 1);
|
|
481
|
-
}
|
|
482
|
-
if (data.valY.flags?.includes("B")) {
|
|
483
|
-
valueElement.att("flagB_y", 1);
|
|
484
|
-
}
|
|
485
|
-
if (data.valY.flags?.includes("C")) {
|
|
486
|
-
valueElement.att("flagC_y", 1);
|
|
487
|
-
}
|
|
488
|
-
if (data.valY.flags?.includes("D")) {
|
|
489
|
-
valueElement.att("flagD_y", 1);
|
|
490
|
-
}
|
|
491
|
-
}
|
|
492
|
-
if (data.idx.value !== undefined) {
|
|
493
|
-
valueElement.att("idx", data.idx.value);
|
|
494
|
-
}
|
|
495
|
-
}
|
|
496
|
-
}
|
|
497
|
-
async function exportSubGroup(api, item, root, config, dateTimeMask, setLoadingState, message) {
|
|
498
|
-
let subgroup;
|
|
499
|
-
root.ele("podskupina", { meno: item.Name });
|
|
500
|
-
try {
|
|
501
|
-
subgroup = await api.loadGroupData(item.ID);
|
|
502
|
-
}
|
|
503
|
-
catch (e) {
|
|
504
|
-
message.error(String(e));
|
|
505
|
-
console.error(e);
|
|
506
|
-
return [];
|
|
507
|
-
}
|
|
508
|
-
if (subgroup) {
|
|
509
|
-
return await exportGroup(api, subgroup, config, dateTimeMask, setLoadingState, message);
|
|
510
|
-
}
|
|
511
|
-
return [];
|
|
512
|
-
}
|
|
513
|
-
async function exportSubVector(api, item, root, config, dateTimeMask, setLoadingState, message) {
|
|
514
|
-
let subVector;
|
|
515
|
-
if (!config.vectorTypes[item.Type]) {
|
|
516
|
-
return [];
|
|
517
|
-
}
|
|
518
|
-
root.ele("vektor", { meno: item.Name });
|
|
519
|
-
try {
|
|
520
|
-
subVector = await api.loadVectorData(item.ID);
|
|
521
|
-
}
|
|
522
|
-
catch (e) {
|
|
523
|
-
message.error(String(e));
|
|
524
|
-
console.error(e);
|
|
525
|
-
return [];
|
|
526
|
-
}
|
|
527
|
-
if (subVector) {
|
|
528
|
-
return await exportVector(api, subVector, config, dateTimeMask, setLoadingState, message);
|
|
529
|
-
}
|
|
530
|
-
return [];
|
|
531
|
-
}
|
|
532
|
-
async function exportSubScenarios(api, item, root, config, dateTimeMask, setLoadingState, message) {
|
|
533
|
-
let subScenario;
|
|
534
|
-
root.ele("podscenar", { meno: item.Name });
|
|
535
|
-
try {
|
|
536
|
-
subScenario = await api.loadScenarioData(item.ID);
|
|
537
|
-
}
|
|
538
|
-
catch (e) {
|
|
539
|
-
message.error(String(e));
|
|
540
|
-
console.error(e);
|
|
541
|
-
return [];
|
|
542
|
-
}
|
|
543
|
-
if (subScenario) {
|
|
544
|
-
return await exportScenario(api, subScenario, config, dateTimeMask, setLoadingState, message);
|
|
545
|
-
}
|
|
546
|
-
return [];
|
|
547
|
-
}
|
|
548
|
-
function getExportInterval(bt, et, vectorBt, vectorEt) {
|
|
549
|
-
if (vectorBt === undefined || vectorEt === undefined) {
|
|
550
|
-
return undefined;
|
|
551
|
-
}
|
|
552
|
-
if (bt !== undefined && et !== undefined) {
|
|
553
|
-
let start = undefined;
|
|
554
|
-
let end = undefined;
|
|
555
|
-
if (bt.isBefore(vectorBt)) {
|
|
556
|
-
start = bt;
|
|
557
|
-
}
|
|
558
|
-
if (et.isAfter(vectorEt)) {
|
|
559
|
-
end = bt;
|
|
560
|
-
}
|
|
561
|
-
if (start !== undefined && end !== undefined && start.isBefore(end)) {
|
|
562
|
-
return [start, end];
|
|
563
|
-
}
|
|
564
|
-
}
|
|
565
|
-
else {
|
|
566
|
-
return [vectorBt, vectorEt];
|
|
567
|
-
}
|
|
568
|
-
return undefined;
|
|
569
|
-
}
|
|
570
|
-
//# sourceMappingURL=export.js.map
|