@tager/admin-import 0.1.1 → 1.0.0
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/dist/constants/paths.d.ts +4 -4
- package/dist/constants/routes.d.ts +3 -3
- package/dist/dev/App.vue.d.ts +5 -0
- package/dist/dev/config.d.ts +2 -0
- package/dist/dev/env.d.ts +1 -0
- package/dist/dev/main.d.ts +3 -0
- package/dist/index.mjs +439 -0
- package/dist/locales/apply.d.ts +1 -0
- package/dist/locales/en.d.ts +19 -20
- package/dist/locales/ru.d.ts +2 -3
- package/dist/main.d.ts +3 -3
- package/dist/services/requests.d.ts +8 -8
- package/dist/style.css +1 -0
- package/dist/typings/model.d.ts +33 -26
- package/dist/utils/paths.d.ts +4 -4
- package/dist/views/ImportForm/ImportForm.helpers.d.ts +9 -7
- package/dist/views/ImportForm/ImportForm.vue.d.ts +2688 -70
- package/dist/views/ImportForm/index.d.ts +1 -1
- package/dist/views/ImportList/ImportList.vue.d.ts +16 -41
- package/dist/views/ImportList/components/CellHistory/CellHistory.helpers.d.ts +1 -0
- package/dist/views/ImportList/components/CellHistory/CellHistory.vue.d.ts +19 -0
- package/dist/views/ImportList/components/CellHistory/index.d.ts +1 -0
- package/dist/views/ImportList/index.d.ts +1 -1
- package/package.json +49 -47
- package/src/constants/routes.ts +10 -10
- package/src/dev/App.vue +38 -0
- package/src/dev/config.ts +23 -0
- package/src/dev/env.ts +17 -0
- package/src/dev/main.ts +36 -0
- package/src/locales/apply.ts +9 -0
- package/src/locales/en.ts +2 -4
- package/src/locales/ru.ts +19 -21
- package/src/main.ts +2 -6
- package/src/typings/model.ts +14 -1
- package/src/views/ImportForm/ImportForm.helpers.ts +17 -2
- package/src/views/ImportForm/ImportForm.vue +109 -69
- package/src/views/ImportList/ImportList.vue +60 -63
- package/src/views/ImportList/components/CellHistory/CellHistory.helpers.ts +13 -0
- package/src/views/ImportList/components/CellHistory/CellHistory.vue +38 -0
- package/src/views/ImportList/components/CellHistory/index.ts +1 -0
- package/README.md +0 -1
- package/dist/dev.d.ts +0 -1
- package/dist/index.esm.js +0 -618
- package/dist/index.umd.js +0 -629
- package/src/dev.ts +0 -41
- package/src/typings/sfc.d.ts +0 -12
- package/src/typings/shims-tsx.d.ts +0 -13
- package/src/typings/shims-vue.d.ts +0 -11
- package/src/views/App.vue +0 -36
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const IMPORT_ROUTE_PATHS: {
|
|
2
|
-
readonly IMPORT_LIST: "/import";
|
|
3
|
-
readonly IMPORT_FORM: "/import/:importId";
|
|
4
|
-
};
|
|
1
|
+
export declare const IMPORT_ROUTE_PATHS: {
|
|
2
|
+
readonly IMPORT_LIST: "/import";
|
|
3
|
+
readonly IMPORT_FORM: "/import/:importId";
|
|
4
|
+
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const IMPORT_LIST_ROUTE:
|
|
3
|
-
export declare const IMPORT_FORM_ROUTE:
|
|
1
|
+
import type { RouteRecordRaw } from 'vue-router';
|
|
2
|
+
export declare const IMPORT_LIST_ROUTE: RouteRecordRaw;
|
|
3
|
+
export declare const IMPORT_FORM_ROUTE: RouteRecordRaw;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { MenuItemType } from "@tager/admin-layout";
|
|
2
|
+
declare const _default: import("vue").DefineComponent<{}, {
|
|
3
|
+
sidebarMenuList: MenuItemType[];
|
|
4
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
|
|
5
|
+
export default _default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function populateEnvironment(): void;
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,439 @@
|
|
|
1
|
+
import { i18n, request, useI18n, useToast, useResource, navigateBack, convertRequestErrorToMap } from "@tager/admin-services";
|
|
2
|
+
import { defineComponent, openBlock, createElementBlock, Fragment, renderList, createElementVNode, toDisplayString, createTextVNode, createCommentVNode, onMounted, resolveComponent, createBlock, withCtx, createVNode, computed, ref, watch, withModifiers } from "vue";
|
|
3
|
+
import { DataTable, useDataTable, FormFieldFileInput, FormFooter, FormFieldSelect } from "@tager/admin-ui";
|
|
4
|
+
import { Page } from "@tager/admin-layout";
|
|
5
|
+
import { universalFieldUtils, DynamicField } from "@tager/admin-dynamic-field";
|
|
6
|
+
import { compile } from "path-to-regexp";
|
|
7
|
+
import { useRouter } from "vue-router";
|
|
8
|
+
const EN = {
|
|
9
|
+
home: "Home",
|
|
10
|
+
import: "Import",
|
|
11
|
+
importList: "Import List",
|
|
12
|
+
importForm: "Import Form",
|
|
13
|
+
type: "Type",
|
|
14
|
+
importType: "Import type",
|
|
15
|
+
status: "status",
|
|
16
|
+
message: "Message",
|
|
17
|
+
log: "Log",
|
|
18
|
+
params: "Params",
|
|
19
|
+
file: "file",
|
|
20
|
+
newImport: "New import",
|
|
21
|
+
importCreation: "Import creation",
|
|
22
|
+
success: "Success",
|
|
23
|
+
error: "Error",
|
|
24
|
+
createdSuccessMessage: "Import has been successfully created",
|
|
25
|
+
createdErrorMessage: "Import creation has been failed"
|
|
26
|
+
};
|
|
27
|
+
const RU = {
|
|
28
|
+
home: "\u0413\u043B\u0430\u0432\u043D\u0430\u044F",
|
|
29
|
+
import: "\u0418\u043C\u043F\u043E\u0440\u0442",
|
|
30
|
+
importList: "\u0421\u043F\u0438\u0441\u043E\u043A \u0438\u043C\u043F\u043E\u0440\u0442\u043E\u0432",
|
|
31
|
+
importForm: "\u0424\u043E\u0440\u043C\u0430 \u0438\u043C\u043F\u043E\u0440\u0442\u0430",
|
|
32
|
+
type: "\u0422\u0438\u043F",
|
|
33
|
+
importType: "\u0422\u0438\u043F \u0438\u043C\u043F\u043E\u0440\u0442\u0430",
|
|
34
|
+
status: "\u0421\u0442\u0430\u0442\u0443\u0441",
|
|
35
|
+
message: "\u0421\u043E\u043E\u0431\u0449\u0435\u043D\u0438\u0435",
|
|
36
|
+
log: "\u041B\u043E\u0433",
|
|
37
|
+
params: "\u041F\u0430\u0440\u0430\u043C\u0435\u0442\u0440\u044B",
|
|
38
|
+
file: "\u0424\u0430\u0439\u043B",
|
|
39
|
+
newImport: "\u041D\u043E\u0432\u044B\u0439 \u0438\u043C\u043F\u043E\u0440\u0442",
|
|
40
|
+
importCreation: "\u0421\u043E\u0437\u0434\u0430\u043D\u0438\u0435 \u0438\u043C\u043F\u043E\u0440\u0442\u0430",
|
|
41
|
+
success: "\u0423\u0441\u043F\u0435\u0445",
|
|
42
|
+
error: "\u041E\u0448\u0438\u0431\u043A\u0430",
|
|
43
|
+
createdSuccessMessage: "\u0418\u043C\u043F\u043E\u0440\u0442 \u0431\u044B\u043B\u0430 \u0443\u0441\u043F\u0435\u0448\u043D\u043E \u0441\u043E\u0437\u0434\u0430\u043D",
|
|
44
|
+
createdErrorMessage: "\u0421\u043E\u0437\u0434\u0430\u043D\u0438\u0435 \u0438\u043C\u043F\u043E\u0440\u0442\u0430 \u043D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C"
|
|
45
|
+
};
|
|
46
|
+
function applyTranslations() {
|
|
47
|
+
i18n.addTranslations("en", "import", EN);
|
|
48
|
+
i18n.addTranslations("ru", "import", RU);
|
|
49
|
+
}
|
|
50
|
+
function getImportList(params) {
|
|
51
|
+
return request.get({ path: "/admin/tager/import", params });
|
|
52
|
+
}
|
|
53
|
+
function getModuleInfo() {
|
|
54
|
+
return request.get({ path: "/admin/tager/import/info" });
|
|
55
|
+
}
|
|
56
|
+
function createImport(payload) {
|
|
57
|
+
return request.post({ path: "/admin/tager/import", body: payload });
|
|
58
|
+
}
|
|
59
|
+
const IMPORT_ROUTE_PATHS = {
|
|
60
|
+
IMPORT_LIST: "/import",
|
|
61
|
+
IMPORT_FORM: "/import/:importId"
|
|
62
|
+
};
|
|
63
|
+
function getImportListUrl() {
|
|
64
|
+
return IMPORT_ROUTE_PATHS.IMPORT_LIST;
|
|
65
|
+
}
|
|
66
|
+
function getImportFormUrl(params) {
|
|
67
|
+
return compile(IMPORT_ROUTE_PATHS.IMPORT_FORM)(params);
|
|
68
|
+
}
|
|
69
|
+
function dateTimeFormat(value) {
|
|
70
|
+
const date = new Date(value);
|
|
71
|
+
return new Intl.DateTimeFormat("ru-RU", {
|
|
72
|
+
"year": "numeric",
|
|
73
|
+
month: "numeric",
|
|
74
|
+
day: "numeric",
|
|
75
|
+
hour: "numeric",
|
|
76
|
+
minute: "numeric",
|
|
77
|
+
second: "numeric"
|
|
78
|
+
}).format(date);
|
|
79
|
+
}
|
|
80
|
+
var CellHistory_vue_vue_type_style_index_0_scoped_true_lang = "";
|
|
81
|
+
var _export_sfc = (sfc, props) => {
|
|
82
|
+
const target = sfc.__vccOpts || sfc;
|
|
83
|
+
for (const [key, val] of props) {
|
|
84
|
+
target[key] = val;
|
|
85
|
+
}
|
|
86
|
+
return target;
|
|
87
|
+
};
|
|
88
|
+
const _sfc_main$2 = defineComponent({
|
|
89
|
+
name: "CellHistory",
|
|
90
|
+
props: {
|
|
91
|
+
history: {
|
|
92
|
+
type: Array,
|
|
93
|
+
default: () => []
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
setup() {
|
|
97
|
+
return {
|
|
98
|
+
dateTimeFormat
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
const _hoisted_1 = { key: 0 };
|
|
103
|
+
const _hoisted_2 = { class: "name" };
|
|
104
|
+
function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
|
|
105
|
+
return _ctx.history.length > 0 ? (openBlock(), createElementBlock("ul", _hoisted_1, [
|
|
106
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.history, (history, index) => {
|
|
107
|
+
return openBlock(), createElementBlock("li", { key: index }, [
|
|
108
|
+
createElementVNode("span", _hoisted_2, toDisplayString(history.status), 1),
|
|
109
|
+
createTextVNode(" " + toDisplayString(_ctx.dateTimeFormat(history.datetime)), 1)
|
|
110
|
+
]);
|
|
111
|
+
}), 128))
|
|
112
|
+
])) : createCommentVNode("", true);
|
|
113
|
+
}
|
|
114
|
+
var CellHistory = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render$2], ["__scopeId", "data-v-70566d6e"]]);
|
|
115
|
+
const _sfc_main$1 = defineComponent({
|
|
116
|
+
name: "ImportList",
|
|
117
|
+
components: { CellHistory, DataTable, Page },
|
|
118
|
+
setup() {
|
|
119
|
+
const { t } = useI18n();
|
|
120
|
+
const {
|
|
121
|
+
fetchEntityList: fetchImportList,
|
|
122
|
+
isLoading: isImportListLoading,
|
|
123
|
+
rowData: importList,
|
|
124
|
+
errorMessage,
|
|
125
|
+
searchQuery,
|
|
126
|
+
handleChange,
|
|
127
|
+
pageSize,
|
|
128
|
+
pageCount,
|
|
129
|
+
pageNumber
|
|
130
|
+
} = useDataTable({
|
|
131
|
+
fetchEntityList: (params) => getImportList({
|
|
132
|
+
pageNumber: params.pageNumber,
|
|
133
|
+
pageSize: params.pageSize
|
|
134
|
+
}),
|
|
135
|
+
initialValue: [],
|
|
136
|
+
resourceName: "Import list",
|
|
137
|
+
pageSize: 100
|
|
138
|
+
});
|
|
139
|
+
onMounted(() => {
|
|
140
|
+
fetchImportList();
|
|
141
|
+
});
|
|
142
|
+
const columnDefs = [
|
|
143
|
+
{
|
|
144
|
+
id: 1,
|
|
145
|
+
name: "ID",
|
|
146
|
+
field: "id",
|
|
147
|
+
style: { width: "50px", textAlign: "center" },
|
|
148
|
+
headStyle: { width: "50px", textAlign: "center" }
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
id: 2,
|
|
152
|
+
name: t("import:type"),
|
|
153
|
+
field: "strategy",
|
|
154
|
+
style: { width: "150px" },
|
|
155
|
+
headStyle: { width: "150px" }
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
id: 3,
|
|
159
|
+
name: t("import:params"),
|
|
160
|
+
field: "params",
|
|
161
|
+
type: "key-value",
|
|
162
|
+
format: ({ row }) => row.params ? row.params.map((param) => {
|
|
163
|
+
return {
|
|
164
|
+
key: param.label,
|
|
165
|
+
value: param.value
|
|
166
|
+
};
|
|
167
|
+
}) : null
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
id: 4,
|
|
171
|
+
name: t("import:status"),
|
|
172
|
+
field: "status",
|
|
173
|
+
style: { width: "120px" },
|
|
174
|
+
headStyle: { width: "120px" }
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
id: 5,
|
|
178
|
+
name: t("import:message"),
|
|
179
|
+
field: "message"
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
id: 6,
|
|
183
|
+
name: t("import:log"),
|
|
184
|
+
field: "history",
|
|
185
|
+
style: { width: "270px", whiteSpace: "nowrap" },
|
|
186
|
+
headStyle: { width: "270px" }
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
id: 7,
|
|
190
|
+
name: t("import:file"),
|
|
191
|
+
field: "file",
|
|
192
|
+
type: "file",
|
|
193
|
+
style: { width: "150px", textAlign: "center" },
|
|
194
|
+
headStyle: { width: "150px", textAlign: "center" }
|
|
195
|
+
}
|
|
196
|
+
];
|
|
197
|
+
return {
|
|
198
|
+
columnDefs,
|
|
199
|
+
getImportFormUrl,
|
|
200
|
+
rowData: importList,
|
|
201
|
+
isRowDataLoading: isImportListLoading,
|
|
202
|
+
errorMessage,
|
|
203
|
+
searchQuery,
|
|
204
|
+
handleChange,
|
|
205
|
+
pageSize,
|
|
206
|
+
pageCount,
|
|
207
|
+
pageNumber
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
});
|
|
211
|
+
function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
212
|
+
const _component_CellHistory = resolveComponent("CellHistory");
|
|
213
|
+
const _component_DataTable = resolveComponent("DataTable");
|
|
214
|
+
const _component_Page = resolveComponent("Page");
|
|
215
|
+
return openBlock(), createBlock(_component_Page, {
|
|
216
|
+
title: _ctx.$i18n.t("import:import"),
|
|
217
|
+
"header-buttons": [
|
|
218
|
+
{
|
|
219
|
+
text: _ctx.$i18n.t("import:newImport"),
|
|
220
|
+
href: _ctx.getImportFormUrl({ importId: "create" })
|
|
221
|
+
}
|
|
222
|
+
]
|
|
223
|
+
}, {
|
|
224
|
+
default: withCtx(() => [
|
|
225
|
+
createVNode(_component_DataTable, {
|
|
226
|
+
"column-defs": _ctx.columnDefs,
|
|
227
|
+
"row-data": _ctx.rowData,
|
|
228
|
+
loading: _ctx.isRowDataLoading,
|
|
229
|
+
"error-message": _ctx.errorMessage,
|
|
230
|
+
pagination: {
|
|
231
|
+
pageSize: _ctx.pageSize,
|
|
232
|
+
pageCount: _ctx.pageCount,
|
|
233
|
+
pageNumber: _ctx.pageNumber,
|
|
234
|
+
disabled: _ctx.isRowDataLoading
|
|
235
|
+
},
|
|
236
|
+
"use-search": false,
|
|
237
|
+
onChange: _ctx.handleChange
|
|
238
|
+
}, {
|
|
239
|
+
"cell(history)": withCtx(({ row }) => [
|
|
240
|
+
createVNode(_component_CellHistory, {
|
|
241
|
+
history: row.history
|
|
242
|
+
}, null, 8, ["history"])
|
|
243
|
+
]),
|
|
244
|
+
_: 1
|
|
245
|
+
}, 8, ["column-defs", "row-data", "loading", "error-message", "pagination", "onChange"])
|
|
246
|
+
]),
|
|
247
|
+
_: 1
|
|
248
|
+
}, 8, ["title", "header-buttons"]);
|
|
249
|
+
}
|
|
250
|
+
var ImportList = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1]]);
|
|
251
|
+
function convertImportFormValuesToCreationPayload(values, templateValues) {
|
|
252
|
+
var _a, _b, _c, _d;
|
|
253
|
+
return {
|
|
254
|
+
strategy: (_b = (_a = values.strategy) == null ? void 0 : _a.value) != null ? _b : "",
|
|
255
|
+
file: (_d = (_c = values.file) == null ? void 0 : _c.file.id) != null ? _d : "",
|
|
256
|
+
params: templateValues.map((field) => ({
|
|
257
|
+
name: field.config.name,
|
|
258
|
+
value: universalFieldUtils.getOutgoingValue(field)
|
|
259
|
+
}))
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
function convertStrategiesToStrategyOptionList(strategies) {
|
|
263
|
+
return strategies.map((strategy) => ({
|
|
264
|
+
value: strategy.id,
|
|
265
|
+
label: strategy.name
|
|
266
|
+
}));
|
|
267
|
+
}
|
|
268
|
+
const _sfc_main = defineComponent({
|
|
269
|
+
name: "ImportForm",
|
|
270
|
+
components: { Page, FormFieldFileInput, DynamicField, FormFooter, FormFieldSelect },
|
|
271
|
+
setup() {
|
|
272
|
+
const { t } = useI18n();
|
|
273
|
+
const toast = useToast();
|
|
274
|
+
const router = useRouter();
|
|
275
|
+
const [
|
|
276
|
+
fetchModuleInfo,
|
|
277
|
+
{ data: moduleInfo, loading: isModuleInfoLoading }
|
|
278
|
+
] = useResource({
|
|
279
|
+
fetchResource: getModuleInfo,
|
|
280
|
+
initialValue: {
|
|
281
|
+
fileScenario: "",
|
|
282
|
+
strategies: []
|
|
283
|
+
},
|
|
284
|
+
resourceName: "Module info"
|
|
285
|
+
});
|
|
286
|
+
const strategyFileScenario = computed(
|
|
287
|
+
() => moduleInfo.value.fileScenario
|
|
288
|
+
);
|
|
289
|
+
const strategyOptionList = computed(
|
|
290
|
+
() => convertStrategiesToStrategyOptionList(moduleInfo.value.strategies)
|
|
291
|
+
);
|
|
292
|
+
onMounted(() => {
|
|
293
|
+
fetchModuleInfo();
|
|
294
|
+
});
|
|
295
|
+
const errors = ref({});
|
|
296
|
+
const values = ref({ strategy: null, file: null });
|
|
297
|
+
const isSubmitting = ref(false);
|
|
298
|
+
const templateValues = ref([]);
|
|
299
|
+
function updateTemplateValues() {
|
|
300
|
+
var _a;
|
|
301
|
+
const selectedStrategy = moduleInfo.value.strategies.find(
|
|
302
|
+
(strategy) => {
|
|
303
|
+
var _a2;
|
|
304
|
+
return strategy.id === ((_a2 = values.value.strategy) == null ? void 0 : _a2.value);
|
|
305
|
+
}
|
|
306
|
+
);
|
|
307
|
+
const fieldTemplateList = (_a = selectedStrategy == null ? void 0 : selectedStrategy.fields) != null ? _a : [];
|
|
308
|
+
templateValues.value = fieldTemplateList.map(
|
|
309
|
+
(fieldConfig) => universalFieldUtils.createFormField(fieldConfig, null)
|
|
310
|
+
);
|
|
311
|
+
}
|
|
312
|
+
watch(
|
|
313
|
+
() => values.value.strategy,
|
|
314
|
+
() => {
|
|
315
|
+
updateTemplateValues();
|
|
316
|
+
}
|
|
317
|
+
);
|
|
318
|
+
onMounted(() => {
|
|
319
|
+
updateTemplateValues();
|
|
320
|
+
});
|
|
321
|
+
function submitForm(event) {
|
|
322
|
+
isSubmitting.value = true;
|
|
323
|
+
const creationPayload = convertImportFormValuesToCreationPayload(
|
|
324
|
+
values.value,
|
|
325
|
+
templateValues.value
|
|
326
|
+
);
|
|
327
|
+
createImport(creationPayload).then(() => {
|
|
328
|
+
errors.value = {};
|
|
329
|
+
if (event.type === "create" || event.type === "save" || event.type === "create_exit" || event.type === "save_exit") {
|
|
330
|
+
navigateBack(router, getImportListUrl());
|
|
331
|
+
}
|
|
332
|
+
toast.show({
|
|
333
|
+
variant: "success",
|
|
334
|
+
title: t("import:success"),
|
|
335
|
+
body: t("import:createdSuccessMessage")
|
|
336
|
+
});
|
|
337
|
+
}).catch((error) => {
|
|
338
|
+
console.error(error);
|
|
339
|
+
errors.value = convertRequestErrorToMap(error);
|
|
340
|
+
toast.show({
|
|
341
|
+
variant: "danger",
|
|
342
|
+
title: t("import:error"),
|
|
343
|
+
body: t("import:createdErrorMessage")
|
|
344
|
+
});
|
|
345
|
+
}).finally(() => {
|
|
346
|
+
isSubmitting.value = false;
|
|
347
|
+
});
|
|
348
|
+
}
|
|
349
|
+
const isContentLoading = computed(() => isModuleInfoLoading.value);
|
|
350
|
+
return {
|
|
351
|
+
values,
|
|
352
|
+
errors,
|
|
353
|
+
isSubmitting,
|
|
354
|
+
submitForm,
|
|
355
|
+
getImportListUrl,
|
|
356
|
+
strategyOptionList,
|
|
357
|
+
strategyFileScenario,
|
|
358
|
+
isContentLoading,
|
|
359
|
+
templateValues
|
|
360
|
+
};
|
|
361
|
+
}
|
|
362
|
+
});
|
|
363
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
364
|
+
const _component_FormFieldSelect = resolveComponent("FormFieldSelect");
|
|
365
|
+
const _component_FormFieldFileInput = resolveComponent("FormFieldFileInput");
|
|
366
|
+
const _component_DynamicField = resolveComponent("DynamicField");
|
|
367
|
+
const _component_FormFooter = resolveComponent("FormFooter");
|
|
368
|
+
const _component_Page = resolveComponent("Page");
|
|
369
|
+
return openBlock(), createBlock(_component_Page, {
|
|
370
|
+
title: _ctx.$i18n.t("import:importCreation"),
|
|
371
|
+
"is-content-loading": _ctx.isContentLoading
|
|
372
|
+
}, {
|
|
373
|
+
footer: withCtx(() => [
|
|
374
|
+
createVNode(_component_FormFooter, {
|
|
375
|
+
"back-href": _ctx.getImportListUrl(),
|
|
376
|
+
onSubmit: _ctx.submitForm,
|
|
377
|
+
"is-submitting": _ctx.isSubmitting,
|
|
378
|
+
"is-creation": true
|
|
379
|
+
}, null, 8, ["back-href", "onSubmit", "is-submitting"])
|
|
380
|
+
]),
|
|
381
|
+
default: withCtx(() => [
|
|
382
|
+
createElementVNode("form", {
|
|
383
|
+
novalidate: "",
|
|
384
|
+
onSubmit: _cache[2] || (_cache[2] = withModifiers(() => {
|
|
385
|
+
}, ["prevent"]))
|
|
386
|
+
}, [
|
|
387
|
+
createVNode(_component_FormFieldSelect, {
|
|
388
|
+
value: _ctx.values.strategy,
|
|
389
|
+
"onUpdate:value": _cache[0] || (_cache[0] = ($event) => _ctx.values.strategy = $event),
|
|
390
|
+
options: _ctx.strategyOptionList,
|
|
391
|
+
error: _ctx.errors.strategy,
|
|
392
|
+
name: "importType",
|
|
393
|
+
label: _ctx.$i18n.t("import:importType")
|
|
394
|
+
}, null, 8, ["value", "options", "error", "label"]),
|
|
395
|
+
createVNode(_component_FormFieldFileInput, {
|
|
396
|
+
value: _ctx.values.file,
|
|
397
|
+
"onUpdate:value": _cache[1] || (_cache[1] = ($event) => _ctx.values.file = $event),
|
|
398
|
+
error: _ctx.errors.file,
|
|
399
|
+
label: _ctx.$i18n.t("import:file"),
|
|
400
|
+
name: "file",
|
|
401
|
+
scenario: _ctx.strategyFileScenario
|
|
402
|
+
}, null, 8, ["value", "error", "label", "scenario"]),
|
|
403
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.templateValues, (field) => {
|
|
404
|
+
return openBlock(), createBlock(_component_DynamicField, {
|
|
405
|
+
key: field.config.name,
|
|
406
|
+
field
|
|
407
|
+
}, null, 8, ["field"]);
|
|
408
|
+
}), 128))
|
|
409
|
+
], 32)
|
|
410
|
+
]),
|
|
411
|
+
_: 1
|
|
412
|
+
}, 8, ["title", "is-content-loading"]);
|
|
413
|
+
}
|
|
414
|
+
var ImportForm = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
415
|
+
const IMPORT_LIST_ROUTE = {
|
|
416
|
+
path: IMPORT_ROUTE_PATHS.IMPORT_LIST,
|
|
417
|
+
component: ImportList,
|
|
418
|
+
name: "Import List",
|
|
419
|
+
meta: {
|
|
420
|
+
getBreadcrumbs: (route, i18n2) => [
|
|
421
|
+
{ url: "/", text: i18n2.t("import:home") },
|
|
422
|
+
{ url: route.path, text: i18n2.t("import:importList") }
|
|
423
|
+
]
|
|
424
|
+
}
|
|
425
|
+
};
|
|
426
|
+
const IMPORT_FORM_ROUTE = {
|
|
427
|
+
path: IMPORT_ROUTE_PATHS.IMPORT_FORM,
|
|
428
|
+
component: ImportForm,
|
|
429
|
+
name: "Import Form",
|
|
430
|
+
meta: {
|
|
431
|
+
getBreadcrumbs: (route, i18n2) => [
|
|
432
|
+
{ url: "/", text: i18n2.t("import:home") },
|
|
433
|
+
{ url: IMPORT_LIST_ROUTE.path, text: i18n2.t("import:importList") },
|
|
434
|
+
{ url: route.path, text: i18n2.t("import:importForm") }
|
|
435
|
+
]
|
|
436
|
+
}
|
|
437
|
+
};
|
|
438
|
+
applyTranslations();
|
|
439
|
+
export { IMPORT_FORM_ROUTE, IMPORT_LIST_ROUTE, createImport, getImportFormUrl, getImportList, getImportListUrl, getModuleInfo };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function applyTranslations(): void;
|
package/dist/locales/en.d.ts
CHANGED
|
@@ -1,20 +1,19 @@
|
|
|
1
|
-
declare const EN: {
|
|
2
|
-
home: string;
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
file: string;
|
|
13
|
-
newImport: string;
|
|
14
|
-
importCreation: string;
|
|
15
|
-
success: string;
|
|
16
|
-
error: string;
|
|
17
|
-
createdSuccessMessage: string;
|
|
18
|
-
createdErrorMessage: string;
|
|
19
|
-
};
|
|
20
|
-
export default EN;
|
|
1
|
+
export declare const EN: {
|
|
2
|
+
home: string;
|
|
3
|
+
import: string;
|
|
4
|
+
importList: string;
|
|
5
|
+
importForm: string;
|
|
6
|
+
type: string;
|
|
7
|
+
importType: string;
|
|
8
|
+
status: string;
|
|
9
|
+
message: string;
|
|
10
|
+
log: string;
|
|
11
|
+
params: string;
|
|
12
|
+
file: string;
|
|
13
|
+
newImport: string;
|
|
14
|
+
importCreation: string;
|
|
15
|
+
success: string;
|
|
16
|
+
error: string;
|
|
17
|
+
createdSuccessMessage: string;
|
|
18
|
+
createdErrorMessage: string;
|
|
19
|
+
};
|
package/dist/locales/ru.d.ts
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import EN from './en';
|
|
2
|
-
declare const RU: typeof EN;
|
|
3
|
-
export default RU;
|
|
1
|
+
import { EN } from './en';
|
|
2
|
+
export declare const RU: typeof EN;
|
package/dist/main.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './constants/routes';
|
|
2
|
-
export * from './utils/paths';
|
|
3
|
-
export * from './services/requests';
|
|
1
|
+
export * from './constants/routes';
|
|
2
|
+
export * from './utils/paths';
|
|
3
|
+
export * from './services/requests';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ResponseBody } from '@tager/admin-services';
|
|
2
|
-
import { ModuleInfoType, ImportCreatePayload, ImportType } from '../typings/model';
|
|
3
|
-
export declare function getImportList(params?: {
|
|
4
|
-
pageNumber?: number;
|
|
5
|
-
pageSize?: number;
|
|
6
|
-
}): Promise<ResponseBody<Array<ImportType>>>;
|
|
7
|
-
export declare function getModuleInfo(): Promise<ResponseBody<ModuleInfoType>>;
|
|
8
|
-
export declare function createImport(payload: ImportCreatePayload): Promise<ResponseBody<ImportType>>;
|
|
1
|
+
import { ResponseBody } from '@tager/admin-services';
|
|
2
|
+
import { ModuleInfoType, ImportCreatePayload, ImportType } from '../typings/model';
|
|
3
|
+
export declare function getImportList(params?: {
|
|
4
|
+
pageNumber?: number;
|
|
5
|
+
pageSize?: number;
|
|
6
|
+
}): Promise<ResponseBody<Array<ImportType>>>;
|
|
7
|
+
export declare function getModuleInfo(): Promise<ResponseBody<ModuleInfoType>>;
|
|
8
|
+
export declare function createImport(payload: ImportCreatePayload): Promise<ResponseBody<ImportType>>;
|
package/dist/style.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.name[data-v-70566d6e]{display:inline-block;width:100px}
|
package/dist/typings/model.d.ts
CHANGED
|
@@ -1,26 +1,33 @@
|
|
|
1
|
-
import { FileType } from '@tager/admin-services';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
readonly
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
readonly
|
|
9
|
-
readonly
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
readonly
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
readonly
|
|
16
|
-
readonly
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
1
|
+
import { FileType } from '@tager/admin-services';
|
|
2
|
+
import { FieldConfigUnion, FieldShortType, OutgoingValueUnion } from '@tager/admin-dynamic-field';
|
|
3
|
+
export interface HistoryType {
|
|
4
|
+
readonly datetime: string;
|
|
5
|
+
readonly status: string;
|
|
6
|
+
}
|
|
7
|
+
export interface ParamType {
|
|
8
|
+
readonly label: string;
|
|
9
|
+
readonly value: string;
|
|
10
|
+
}
|
|
11
|
+
export interface ImportType {
|
|
12
|
+
readonly id: number;
|
|
13
|
+
readonly strategy: string;
|
|
14
|
+
readonly status: string;
|
|
15
|
+
readonly message: string | null;
|
|
16
|
+
readonly history: Array<HistoryType>;
|
|
17
|
+
readonly params: Array<ParamType> | null;
|
|
18
|
+
readonly file: FileType | null;
|
|
19
|
+
}
|
|
20
|
+
export interface StrategyType {
|
|
21
|
+
readonly id: string;
|
|
22
|
+
readonly name: string;
|
|
23
|
+
readonly fields: Array<FieldConfigUnion>;
|
|
24
|
+
}
|
|
25
|
+
export interface ModuleInfoType {
|
|
26
|
+
readonly fileScenario: string;
|
|
27
|
+
readonly strategies: Array<StrategyType>;
|
|
28
|
+
}
|
|
29
|
+
export interface ImportCreatePayload {
|
|
30
|
+
strategy: string;
|
|
31
|
+
file: string;
|
|
32
|
+
params: Array<FieldShortType<OutgoingValueUnion>>;
|
|
33
|
+
}
|
package/dist/utils/paths.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare function getImportListUrl(): string;
|
|
2
|
-
export declare function getImportFormUrl(params: {
|
|
3
|
-
importId: string | number;
|
|
4
|
-
}): string;
|
|
1
|
+
export declare function getImportListUrl(): string;
|
|
2
|
+
export declare function getImportFormUrl(params: {
|
|
3
|
+
importId: string | number;
|
|
4
|
+
}): string;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { OptionType, SingleFileInputValueType } from '@tager/admin-ui';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { OptionType, SingleFileInputValueType } from '@tager/admin-ui';
|
|
2
|
+
import { FieldUnion } from '@tager/admin-dynamic-field';
|
|
3
|
+
import { ImportCreatePayload, StrategyType } from '../../typings/model';
|
|
4
|
+
export declare type FormValues = {
|
|
5
|
+
strategy: OptionType | null;
|
|
6
|
+
file: SingleFileInputValueType | null;
|
|
7
|
+
};
|
|
8
|
+
export declare function convertImportFormValuesToCreationPayload(values: FormValues, templateValues: Array<FieldUnion>): ImportCreatePayload;
|
|
9
|
+
export declare function convertStrategiesToStrategyOptionList(strategies: Array<StrategyType>): Array<OptionType>;
|