@weconstudio/nuxt 0.0.0-stage → 1.72.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/LICENSE +1 -0
- package/README.md +115 -2
- package/dist/module.d.mts +7 -0
- package/dist/module.json +12 -0
- package/dist/module.mjs +250 -0
- package/dist/runtime/components/We/Autocomplete.d.vue.ts +13 -0
- package/dist/runtime/components/We/Autocomplete.vue +91 -0
- package/dist/runtime/components/We/Autocomplete.vue.d.ts +13 -0
- package/dist/runtime/components/We/BoldText.d.vue.ts +17 -0
- package/dist/runtime/components/We/BoldText.vue +29 -0
- package/dist/runtime/components/We/BoldText.vue.d.ts +17 -0
- package/dist/runtime/components/We/ColorPicker.d.vue.ts +11 -0
- package/dist/runtime/components/We/ColorPicker.vue +199 -0
- package/dist/runtime/components/We/ColorPicker.vue.d.ts +11 -0
- package/dist/runtime/components/We/ConfirmDialog.d.vue.ts +104 -0
- package/dist/runtime/components/We/ConfirmDialog.vue +143 -0
- package/dist/runtime/components/We/ConfirmDialog.vue.d.ts +104 -0
- package/dist/runtime/components/We/Datatable.d.vue.ts +40 -0
- package/dist/runtime/components/We/Datatable.vue +87 -0
- package/dist/runtime/components/We/Datatable.vue.d.ts +40 -0
- package/dist/runtime/components/We/DatatableInternal.d.vue.ts +194 -0
- package/dist/runtime/components/We/DatatableInternal.vue +638 -0
- package/dist/runtime/components/We/DatatableInternal.vue.d.ts +194 -0
- package/dist/runtime/components/We/DatePicker.d.vue.ts +51 -0
- package/dist/runtime/components/We/DatePicker.vue +901 -0
- package/dist/runtime/components/We/DatePicker.vue.d.ts +51 -0
- package/dist/runtime/components/We/Dt/Actions.d.vue.ts +51 -0
- package/dist/runtime/components/We/Dt/Actions.vue +106 -0
- package/dist/runtime/components/We/Dt/Actions.vue.d.ts +51 -0
- package/dist/runtime/components/We/Dt/BooleanFormatter.d.vue.ts +8 -0
- package/dist/runtime/components/We/Dt/BooleanFormatter.vue +26 -0
- package/dist/runtime/components/We/Dt/BooleanFormatter.vue.d.ts +8 -0
- package/dist/runtime/components/We/Dt/CardFilterContainer.d.vue.ts +17 -0
- package/dist/runtime/components/We/Dt/CardFilterContainer.vue +60 -0
- package/dist/runtime/components/We/Dt/CardFilterContainer.vue.d.ts +17 -0
- package/dist/runtime/components/We/Dt/CheckboxFilter.d.vue.ts +16 -0
- package/dist/runtime/components/We/Dt/CheckboxFilter.vue +47 -0
- package/dist/runtime/components/We/Dt/CheckboxFilter.vue.d.ts +16 -0
- package/dist/runtime/components/We/Dt/ChipGroupSelect.d.vue.ts +7 -0
- package/dist/runtime/components/We/Dt/ChipGroupSelect.vue +35 -0
- package/dist/runtime/components/We/Dt/ChipGroupSelect.vue.d.ts +7 -0
- package/dist/runtime/components/We/Dt/ClusterFilter.d.vue.ts +18 -0
- package/dist/runtime/components/We/Dt/ClusterFilter.vue +68 -0
- package/dist/runtime/components/We/Dt/ClusterFilter.vue.d.ts +18 -0
- package/dist/runtime/components/We/Dt/DatasetFormatter.d.vue.ts +19 -0
- package/dist/runtime/components/We/Dt/DatasetFormatter.vue +65 -0
- package/dist/runtime/components/We/Dt/DatasetFormatter.vue.d.ts +19 -0
- package/dist/runtime/components/We/Dt/DaterangeFilter.d.vue.ts +28 -0
- package/dist/runtime/components/We/Dt/DaterangeFilter.vue +140 -0
- package/dist/runtime/components/We/Dt/DaterangeFilter.vue.d.ts +28 -0
- package/dist/runtime/components/We/Dt/Filter.d.vue.ts +7 -0
- package/dist/runtime/components/We/Dt/Filter.vue +234 -0
- package/dist/runtime/components/We/Dt/Filter.vue.d.ts +7 -0
- package/dist/runtime/components/We/Dt/Filters.d.vue.ts +6 -0
- package/dist/runtime/components/We/Dt/Filters.vue +24 -0
- package/dist/runtime/components/We/Dt/Filters.vue.d.ts +6 -0
- package/dist/runtime/components/We/Dt/LuxonFormatter.d.vue.ts +12 -0
- package/dist/runtime/components/We/Dt/LuxonFormatter.vue +23 -0
- package/dist/runtime/components/We/Dt/LuxonFormatter.vue.d.ts +12 -0
- package/dist/runtime/components/We/Dt/SelectFilter.d.vue.ts +60 -0
- package/dist/runtime/components/We/Dt/SelectFilter.vue +333 -0
- package/dist/runtime/components/We/Dt/SelectFilter.vue.d.ts +60 -0
- package/dist/runtime/components/We/Dt/SelectResourceFilter.d.vue.ts +43 -0
- package/dist/runtime/components/We/Dt/SelectResourceFilter.vue +127 -0
- package/dist/runtime/components/We/Dt/SelectResourceFilter.vue.d.ts +43 -0
- package/dist/runtime/components/We/Dt/dt.types.d.ts +8 -0
- package/dist/runtime/components/We/EndpointSwitcher.d.vue.ts +12 -0
- package/dist/runtime/components/We/EndpointSwitcher.vue +256 -0
- package/dist/runtime/components/We/EndpointSwitcher.vue.d.ts +12 -0
- package/dist/runtime/components/We/Import.d.vue.ts +118 -0
- package/dist/runtime/components/We/Import.vue +730 -0
- package/dist/runtime/components/We/Import.vue.d.ts +118 -0
- package/dist/runtime/components/We/ImportDefaultValues.d.vue.ts +3666 -0
- package/dist/runtime/components/We/ImportDefaultValues.vue +115 -0
- package/dist/runtime/components/We/ImportDefaultValues.vue.d.ts +3666 -0
- package/dist/runtime/components/We/ImportMatchColumns.d.vue.ts +66 -0
- package/dist/runtime/components/We/ImportMatchColumns.vue +172 -0
- package/dist/runtime/components/We/ImportMatchColumns.vue.d.ts +66 -0
- package/dist/runtime/components/We/ImportPreviewResults.d.vue.ts +38 -0
- package/dist/runtime/components/We/ImportPreviewResults.vue +165 -0
- package/dist/runtime/components/We/ImportPreviewResults.vue.d.ts +38 -0
- package/dist/runtime/components/We/ImportSelectStart.d.vue.ts +47 -0
- package/dist/runtime/components/We/ImportSelectStart.vue +106 -0
- package/dist/runtime/components/We/ImportSelectStart.vue.d.ts +47 -0
- package/dist/runtime/components/We/Notification.d.vue.ts +7 -0
- package/dist/runtime/components/We/Notification.vue +49 -0
- package/dist/runtime/components/We/Notification.vue.d.ts +7 -0
- package/dist/runtime/components/We/S3Dropzone.d.vue.ts +17 -0
- package/dist/runtime/components/We/S3Dropzone.vue +527 -0
- package/dist/runtime/components/We/S3Dropzone.vue.d.ts +17 -0
- package/dist/runtime/components/We/Select.d.vue.ts +39 -0
- package/dist/runtime/components/We/Select.vue +354 -0
- package/dist/runtime/components/We/Select.vue.d.ts +39 -0
- package/dist/runtime/components/We/TipTap.d.vue.ts +26 -0
- package/dist/runtime/components/We/TipTap.vue +362 -0
- package/dist/runtime/components/We/TipTap.vue.d.ts +26 -0
- package/dist/runtime/components/We/datatable.props.d.ts +57 -0
- package/dist/runtime/components/We/datatable.props.js +60 -0
- package/dist/runtime/composables/datatable/useAutoFillHeight.d.ts +31 -0
- package/dist/runtime/composables/datatable/useAutoFillHeight.js +57 -0
- package/dist/runtime/composables/datatable/useDataTable.d.ts +33 -0
- package/dist/runtime/composables/datatable/useDataTable.js +161 -0
- package/dist/runtime/composables/datatable/useDatatableColumns.d.ts +12 -0
- package/dist/runtime/composables/datatable/useDatatableColumns.js +96 -0
- package/dist/runtime/composables/useApi.d.ts +56 -0
- package/dist/runtime/composables/useApi.js +230 -0
- package/dist/runtime/composables/useApiFetch.d.ts +2 -0
- package/dist/runtime/composables/useApiFetch.js +9 -0
- package/dist/runtime/composables/useApiUrl.d.ts +10 -0
- package/dist/runtime/composables/useApiUrl.js +37 -0
- package/dist/runtime/composables/useAuth.d.ts +9 -0
- package/dist/runtime/composables/useAuth.js +22 -0
- package/dist/runtime/composables/useBus.d.ts +8 -0
- package/dist/runtime/composables/useBus.js +18 -0
- package/dist/runtime/composables/useDateRangePresets.d.ts +21 -0
- package/dist/runtime/composables/useDateRangePresets.js +90 -0
- package/dist/runtime/composables/useForm.d.ts +29 -0
- package/dist/runtime/composables/useForm.js +74 -0
- package/dist/runtime/composables/useFormLock.d.ts +11 -0
- package/dist/runtime/composables/useFormLock.js +8 -0
- package/dist/runtime/composables/useFormWrapper.d.ts +16 -0
- package/dist/runtime/composables/useFormWrapper.js +36 -0
- package/dist/runtime/composables/useImportJob.d.ts +55 -0
- package/dist/runtime/composables/useImportJob.js +94 -0
- package/dist/runtime/composables/useLux.d.ts +1 -0
- package/dist/runtime/composables/useLux.js +8 -0
- package/dist/runtime/composables/useNotify.d.ts +12 -0
- package/dist/runtime/composables/useNotify.js +24 -0
- package/dist/runtime/composables/usePaginatedFetch.d.ts +24 -0
- package/dist/runtime/composables/usePaginatedFetch.js +154 -0
- package/dist/runtime/composables/useServerErrors.d.ts +16 -0
- package/dist/runtime/composables/useServerErrors.js +60 -0
- package/dist/runtime/composables/useValidators.d.ts +18 -0
- package/dist/runtime/composables/useValidators.js +56 -0
- package/dist/runtime/generator/code/dt.d.ts +8 -0
- package/dist/runtime/generator/code/dt.js +97 -0
- package/dist/runtime/generator/code/edit.d.ts +4 -0
- package/dist/runtime/generator/code/edit.js +41 -0
- package/dist/runtime/generator/code/form.d.ts +6 -0
- package/dist/runtime/generator/code/form.js +229 -0
- package/dist/runtime/generator/code/i18n.d.ts +5 -0
- package/dist/runtime/generator/code/i18n.js +43 -0
- package/dist/runtime/generator/code/index.d.ts +11 -0
- package/dist/runtime/generator/code/index.js +90 -0
- package/dist/runtime/generator/components/CodeSnippet.d.vue.ts +14 -0
- package/dist/runtime/generator/components/CodeSnippet.vue +49 -0
- package/dist/runtime/generator/components/CodeSnippet.vue.d.ts +14 -0
- package/dist/runtime/generator/components/Configuration.d.vue.ts +16 -0
- package/dist/runtime/generator/components/Configuration.vue +154 -0
- package/dist/runtime/generator/components/Configuration.vue.d.ts +16 -0
- package/dist/runtime/generator/components/GeneratorPage.d.vue.ts +50 -0
- package/dist/runtime/generator/components/GeneratorPage.vue +226 -0
- package/dist/runtime/generator/components/GeneratorPage.vue.d.ts +50 -0
- package/dist/runtime/generator/fs.d.ts +16 -0
- package/dist/runtime/generator/fs.js +79 -0
- package/dist/runtime/generator/index.d.vue.ts +52 -0
- package/dist/runtime/generator/index.vue +17 -0
- package/dist/runtime/generator/index.vue.d.ts +52 -0
- package/dist/runtime/internals/api.d.ts +3 -0
- package/dist/runtime/internals/api.js +16 -0
- package/dist/runtime/internals/bus.d.ts +1 -0
- package/dist/runtime/internals/bus.js +2 -0
- package/dist/runtime/internals/dt.d.ts +24 -0
- package/dist/runtime/internals/dt.js +57 -0
- package/dist/runtime/lang/en.json +211 -0
- package/dist/runtime/lang/it.json +211 -0
- package/dist/runtime/mixins/formValidator.d.ts +38 -0
- package/dist/runtime/mixins/formValidator.js +118 -0
- package/dist/runtime/plugins/api-legacy.d.ts +76 -0
- package/dist/runtime/plugins/api-legacy.js +11 -0
- package/dist/runtime/plugins/auth-legacy.d.ts +22 -0
- package/dist/runtime/plugins/auth-legacy.js +14 -0
- package/dist/runtime/plugins/bus-legacy.d.ts +6 -0
- package/dist/runtime/plugins/bus-legacy.js +9 -0
- package/dist/runtime/plugins/notify-legacy.d.ts +25 -0
- package/dist/runtime/plugins/notify-legacy.js +35 -0
- package/dist/runtime/plugins/portal.d.ts +2 -0
- package/dist/runtime/plugins/portal.js +5 -0
- package/dist/runtime/plugins/update-sanctum-app-config.d.ts +2 -0
- package/dist/runtime/plugins/update-sanctum-app-config.js +44 -0
- package/dist/runtime/plugins/vuetify-nuxt-icon.d.ts +4 -0
- package/dist/runtime/plugins/vuetify-nuxt-icon.js +30 -0
- package/dist/runtime/types/app-config.d.ts +24 -0
- package/dist/runtime/types/app-config.js +1 -0
- package/dist/runtime/types/icons.d.ts +82 -0
- package/dist/runtime/types/icons.js +84 -0
- package/dist/runtime/types/index.d.ts +2 -0
- package/dist/runtime/types/index.js +2 -0
- package/dist/runtime/types/module-options.d.ts +29 -0
- package/dist/runtime/types/module-options.js +0 -0
- package/dist/runtime/types/runtime-hooks.d.ts +17 -0
- package/dist/runtime/types/runtime-hooks.js +1 -0
- package/dist/runtime/utils/color.d.ts +10 -0
- package/dist/runtime/utils/color.js +38 -0
- package/dist/runtime/utils/file.d.ts +17 -0
- package/dist/runtime/utils/file.js +108 -0
- package/dist/runtime/utils/format.d.ts +1 -0
- package/dist/runtime/utils/format.js +14 -0
- package/dist/runtime/utils/make-enum.d.ts +15 -0
- package/dist/runtime/utils/make-enum.js +27 -0
- package/dist/runtime/utils/mergeDefaults.d.ts +1 -0
- package/dist/runtime/utils/mergeDefaults.js +18 -0
- package/dist/runtime/utils/object-to-formdata.d.ts +10 -0
- package/dist/runtime/utils/object-to-formdata.js +82 -0
- package/dist/runtime/utils/uuid.d.ts +1 -0
- package/dist/runtime/utils/uuid.js +9 -0
- package/dist/types.d.mts +9 -0
- package/package.json +92 -4
|
@@ -0,0 +1,730 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-container
|
|
3
|
+
fluid
|
|
4
|
+
class="pa-0"
|
|
5
|
+
>
|
|
6
|
+
<v-row>
|
|
7
|
+
<v-col
|
|
8
|
+
cols="12"
|
|
9
|
+
class="we-import"
|
|
10
|
+
>
|
|
11
|
+
<v-overlay
|
|
12
|
+
:model-value="loading"
|
|
13
|
+
contained
|
|
14
|
+
persistent
|
|
15
|
+
class="we-import__overlay align-center justify-center"
|
|
16
|
+
>
|
|
17
|
+
<v-card
|
|
18
|
+
class="text-center d-flex flex-column align-center justify-center"
|
|
19
|
+
width="180"
|
|
20
|
+
height="180"
|
|
21
|
+
>
|
|
22
|
+
<v-progress-circular
|
|
23
|
+
color="primary"
|
|
24
|
+
width="8"
|
|
25
|
+
size="80"
|
|
26
|
+
:indeterminate="progressPercent === null"
|
|
27
|
+
:model-value="progressPercent ?? 0"
|
|
28
|
+
>
|
|
29
|
+
<span
|
|
30
|
+
v-if="progressPercent !== null"
|
|
31
|
+
class="text-caption"
|
|
32
|
+
>{{ progressPercent }}%</span>
|
|
33
|
+
</v-progress-circular>
|
|
34
|
+
<div
|
|
35
|
+
v-if="progress"
|
|
36
|
+
class="mt-4 text-body-2"
|
|
37
|
+
>
|
|
38
|
+
{{ $t('weImport.messages.progress', { done: progress.done, total: progress.total }) }}
|
|
39
|
+
</div>
|
|
40
|
+
</v-card>
|
|
41
|
+
</v-overlay>
|
|
42
|
+
<v-stepper
|
|
43
|
+
v-model="step"
|
|
44
|
+
class="px-2 py-4"
|
|
45
|
+
elevation="0"
|
|
46
|
+
>
|
|
47
|
+
<v-stepper-header class="elevation-0">
|
|
48
|
+
<v-stepper-item
|
|
49
|
+
class="cursor-pointer"
|
|
50
|
+
color="primary"
|
|
51
|
+
:complete="step > 1"
|
|
52
|
+
:value="1"
|
|
53
|
+
@click="step = 1"
|
|
54
|
+
>
|
|
55
|
+
{{ $t("weImport.steps.1.header") }}
|
|
56
|
+
</v-stepper-item>
|
|
57
|
+
<v-divider />
|
|
58
|
+
|
|
59
|
+
<v-stepper-item
|
|
60
|
+
class="cursor-pointer"
|
|
61
|
+
color="primary"
|
|
62
|
+
:complete="step > 2"
|
|
63
|
+
:value="2"
|
|
64
|
+
@click="step2"
|
|
65
|
+
>
|
|
66
|
+
{{ $t("weImport.steps.2.header") }}
|
|
67
|
+
</v-stepper-item>
|
|
68
|
+
<v-divider />
|
|
69
|
+
<v-stepper-item
|
|
70
|
+
class="cursor-pointer"
|
|
71
|
+
color="primary"
|
|
72
|
+
:complete="step > 3"
|
|
73
|
+
:value="3"
|
|
74
|
+
@click="step3"
|
|
75
|
+
>
|
|
76
|
+
{{ $t("weImport.steps.3.header") }}
|
|
77
|
+
</v-stepper-item>
|
|
78
|
+
<v-divider />
|
|
79
|
+
<v-stepper-item
|
|
80
|
+
class="cursor-pointer"
|
|
81
|
+
color="primary"
|
|
82
|
+
:complete="step > 4"
|
|
83
|
+
:value="4"
|
|
84
|
+
>
|
|
85
|
+
{{ $t("weImport.steps.4.header") }}
|
|
86
|
+
</v-stepper-item>
|
|
87
|
+
<v-divider />
|
|
88
|
+
<v-stepper-item
|
|
89
|
+
class="cursor-pointer"
|
|
90
|
+
color="primary"
|
|
91
|
+
:complete="step > 5"
|
|
92
|
+
:value="5"
|
|
93
|
+
>
|
|
94
|
+
{{ $t("weImport.steps.5.header") }}
|
|
95
|
+
</v-stepper-item>
|
|
96
|
+
<v-divider />
|
|
97
|
+
<v-stepper-item
|
|
98
|
+
class="cursor-pointer"
|
|
99
|
+
:complete="step > 6"
|
|
100
|
+
:value="6"
|
|
101
|
+
>
|
|
102
|
+
{{ $t("weImport.steps.6.header") }}
|
|
103
|
+
</v-stepper-item>
|
|
104
|
+
</v-stepper-header>
|
|
105
|
+
<v-stepper-window class="rounded-lg">
|
|
106
|
+
<v-stepper-window-item :value="1">
|
|
107
|
+
<v-container>
|
|
108
|
+
<v-row>
|
|
109
|
+
<v-col cols="12">
|
|
110
|
+
<we-s-3-dropzone
|
|
111
|
+
ref="dz"
|
|
112
|
+
v-model="dropzoneFiles"
|
|
113
|
+
v-bind="$attrs"
|
|
114
|
+
:accepted-files="acceptedFiles"
|
|
115
|
+
:signed-url="signedUrl"
|
|
116
|
+
/>
|
|
117
|
+
</v-col>
|
|
118
|
+
<v-col
|
|
119
|
+
cols="12"
|
|
120
|
+
class="dt-example"
|
|
121
|
+
>
|
|
122
|
+
<p class="text-caption">
|
|
123
|
+
{{ $t('weImport.description') }}
|
|
124
|
+
</p>
|
|
125
|
+
<v-data-table
|
|
126
|
+
density="compact"
|
|
127
|
+
class="mt-4"
|
|
128
|
+
disabled
|
|
129
|
+
disable-sort
|
|
130
|
+
hide-default-footer
|
|
131
|
+
:headers="exampleColumn"
|
|
132
|
+
:items="exampleItems"
|
|
133
|
+
>
|
|
134
|
+
<template
|
|
135
|
+
v-for="c in exampleColumn"
|
|
136
|
+
#[`header.${c.id}`]=""
|
|
137
|
+
:key="c.id"
|
|
138
|
+
>
|
|
139
|
+
<div class="d-flex align-center">
|
|
140
|
+
{{ c.text }}
|
|
141
|
+
<v-tooltip
|
|
142
|
+
v-if="c.tooltip"
|
|
143
|
+
location="top"
|
|
144
|
+
>
|
|
145
|
+
<template #activator="{ props }">
|
|
146
|
+
<v-icon
|
|
147
|
+
size="20"
|
|
148
|
+
class="ml-1"
|
|
149
|
+
v-bind="props"
|
|
150
|
+
>
|
|
151
|
+
$help
|
|
152
|
+
</v-icon>
|
|
153
|
+
</template>
|
|
154
|
+
<span>{{ c.tooltip }}</span>
|
|
155
|
+
</v-tooltip>
|
|
156
|
+
</div>
|
|
157
|
+
</template>
|
|
158
|
+
</v-data-table>
|
|
159
|
+
</v-col>
|
|
160
|
+
<v-col class="d-flex">
|
|
161
|
+
<v-btn
|
|
162
|
+
class="ml-auto"
|
|
163
|
+
size="large"
|
|
164
|
+
color="primary"
|
|
165
|
+
:disabled="checkIfDisabled"
|
|
166
|
+
@click="step2"
|
|
167
|
+
>
|
|
168
|
+
{{ $t('weImport.steps.2.btn') }} <v-icon end>
|
|
169
|
+
$next
|
|
170
|
+
</v-icon>
|
|
171
|
+
</v-btn>
|
|
172
|
+
</v-col>
|
|
173
|
+
</v-row>
|
|
174
|
+
</v-container>
|
|
175
|
+
</v-stepper-window-item>
|
|
176
|
+
|
|
177
|
+
<v-stepper-window-item :value="2">
|
|
178
|
+
<v-alert
|
|
179
|
+
icon="mdi-lightbulb-on-outline"
|
|
180
|
+
color="info"
|
|
181
|
+
variant="tonal"
|
|
182
|
+
class="ma-4"
|
|
183
|
+
>
|
|
184
|
+
<div class="mb-0 d-flex flex-wrap">
|
|
185
|
+
<i18n-t keypath="weImport.steps.2.alert.selectRow.text">
|
|
186
|
+
<template #dataBlock>
|
|
187
|
+
<strong class="px-1">
|
|
188
|
+
{{ $t('weImport.steps.2.alert.selectRow.dataBlock') }}
|
|
189
|
+
</strong>
|
|
190
|
+
</template>
|
|
191
|
+
</i18n-t>
|
|
192
|
+
<v-icon
|
|
193
|
+
class="mx-1"
|
|
194
|
+
>
|
|
195
|
+
$arrowRightBold
|
|
196
|
+
</v-icon>
|
|
197
|
+
<i18n-t keypath="weImport.steps.2.alert.fileContainsOneOrMoreHeaderRows.text">
|
|
198
|
+
<template #headerRows>
|
|
199
|
+
<strong>{{ $t('weImport.steps.2.alert.fileContainsOneOrMoreHeaderRows.headerRows') }}</strong>
|
|
200
|
+
</template>
|
|
201
|
+
</i18n-t>
|
|
202
|
+
</div>
|
|
203
|
+
</v-alert>
|
|
204
|
+
<WeImportSelectStart
|
|
205
|
+
v-if="file"
|
|
206
|
+
v-model="currentRow"
|
|
207
|
+
:headers="previewHeaders"
|
|
208
|
+
:items="previewItems"
|
|
209
|
+
@back="step--"
|
|
210
|
+
@input="step3"
|
|
211
|
+
/>
|
|
212
|
+
</v-stepper-window-item>
|
|
213
|
+
|
|
214
|
+
<v-stepper-window-item :value="3">
|
|
215
|
+
<WeImportMatchColumns
|
|
216
|
+
:first-row="currentRow"
|
|
217
|
+
:headers="previewHeaders"
|
|
218
|
+
:items="previewItems"
|
|
219
|
+
:columns="matchColumns"
|
|
220
|
+
@back="step--"
|
|
221
|
+
@match="onMatch"
|
|
222
|
+
/>
|
|
223
|
+
</v-stepper-window-item>
|
|
224
|
+
<v-stepper-window-item :value="4">
|
|
225
|
+
<v-alert
|
|
226
|
+
icon="mdi-lightbulb-on-outline"
|
|
227
|
+
text
|
|
228
|
+
type="info"
|
|
229
|
+
variant="tonal"
|
|
230
|
+
class="ma-4"
|
|
231
|
+
>
|
|
232
|
+
<div class="mb-0">
|
|
233
|
+
<i18n-t keypath="weImport.steps.4.alert.text">
|
|
234
|
+
<template #defaultValues>
|
|
235
|
+
<strong>{{ $t('weImport.steps.4.alert.defaultValues') }}</strong>
|
|
236
|
+
</template>
|
|
237
|
+
</i18n-t>
|
|
238
|
+
</div>
|
|
239
|
+
</v-alert>
|
|
240
|
+
<WeImportDefaultValues
|
|
241
|
+
:headers="allColumns"
|
|
242
|
+
:matches="matches"
|
|
243
|
+
@back="step--"
|
|
244
|
+
@default-values="onDefaultValues"
|
|
245
|
+
>
|
|
246
|
+
<template
|
|
247
|
+
v-for="h in defaultFieldSlots"
|
|
248
|
+
#[h]="attrs"
|
|
249
|
+
>
|
|
250
|
+
<slot
|
|
251
|
+
v-bind="attrs"
|
|
252
|
+
:name="h"
|
|
253
|
+
/>
|
|
254
|
+
</template>
|
|
255
|
+
</WeImportDefaultValues>
|
|
256
|
+
</v-stepper-window-item>
|
|
257
|
+
|
|
258
|
+
<v-stepper-window-item :value="5">
|
|
259
|
+
<WeImportPreviewResults
|
|
260
|
+
v-if="resultItems.length"
|
|
261
|
+
:headers="resultHeaders"
|
|
262
|
+
:items="resultItems"
|
|
263
|
+
@back="backStep5"
|
|
264
|
+
@import="onImport"
|
|
265
|
+
/>
|
|
266
|
+
<div v-else>
|
|
267
|
+
<v-btn
|
|
268
|
+
size="large"
|
|
269
|
+
variant="outlined"
|
|
270
|
+
@click="step--"
|
|
271
|
+
>
|
|
272
|
+
<v-icon start>
|
|
273
|
+
$prev
|
|
274
|
+
</v-icon>{{ $t('weImport.buttons.back') }}
|
|
275
|
+
</v-btn>
|
|
276
|
+
</div>
|
|
277
|
+
</v-stepper-window-item>
|
|
278
|
+
|
|
279
|
+
<v-stepper-window-item :value="6">
|
|
280
|
+
<div class="text-center px-12 py-10">
|
|
281
|
+
<v-icon
|
|
282
|
+
:color="colorResultIcon"
|
|
283
|
+
size="x-large"
|
|
284
|
+
>
|
|
285
|
+
{{ resultIcon }}
|
|
286
|
+
</v-icon>
|
|
287
|
+
<div class="mt-4 text-h5">
|
|
288
|
+
<i18n-t keypath="weImport.steps.6.text.title">
|
|
289
|
+
<template #correctImportedColumns>
|
|
290
|
+
<strong>{{ correctImportedColumns }}</strong>
|
|
291
|
+
</template>
|
|
292
|
+
|
|
293
|
+
<template #elements>
|
|
294
|
+
{{ $t('weImport.steps.6.text.elements', correctImportedColumns) }}
|
|
295
|
+
</template>
|
|
296
|
+
|
|
297
|
+
<template #resultItemsLength>
|
|
298
|
+
<strong>{{ resultItems.length }}</strong>
|
|
299
|
+
</template>
|
|
300
|
+
</i18n-t>
|
|
301
|
+
</div>
|
|
302
|
+
<v-btn
|
|
303
|
+
v-if="errorItems.length > 0"
|
|
304
|
+
color="error"
|
|
305
|
+
class="ml-auto"
|
|
306
|
+
size="large"
|
|
307
|
+
@click="errorPanel = !errorPanel"
|
|
308
|
+
>
|
|
309
|
+
<v-icon start>
|
|
310
|
+
$alert
|
|
311
|
+
</v-icon>
|
|
312
|
+
{{ $t('weImport.buttons.showErrors') }}
|
|
313
|
+
</v-btn>
|
|
314
|
+
<div
|
|
315
|
+
v-if="errorPanel"
|
|
316
|
+
class="my-4"
|
|
317
|
+
>
|
|
318
|
+
<v-data-table
|
|
319
|
+
density="comfortable"
|
|
320
|
+
disable-sort
|
|
321
|
+
:headers="errorHeaders"
|
|
322
|
+
:items="errorItems"
|
|
323
|
+
class="elevation-1 dt-preview"
|
|
324
|
+
>
|
|
325
|
+
<template #[`item.row_number`]="{ item }">
|
|
326
|
+
{{ item.row_number }}
|
|
327
|
+
<v-tooltip
|
|
328
|
+
v-if="item._error"
|
|
329
|
+
location="top"
|
|
330
|
+
color="error"
|
|
331
|
+
>
|
|
332
|
+
<template #activator="{ props }">
|
|
333
|
+
<v-icon
|
|
334
|
+
|
|
335
|
+
class="ml-2"
|
|
336
|
+
color="error"
|
|
337
|
+
v-bind="props"
|
|
338
|
+
>
|
|
339
|
+
$warning
|
|
340
|
+
</v-icon>
|
|
341
|
+
</template>
|
|
342
|
+
<span>{{ item._error.join("\n") }}</span>
|
|
343
|
+
</v-tooltip>
|
|
344
|
+
</template>
|
|
345
|
+
|
|
346
|
+
<template
|
|
347
|
+
v-for="h in resultHeaders"
|
|
348
|
+
#[`item.${h.value}`]="{ item }"
|
|
349
|
+
>
|
|
350
|
+
<div
|
|
351
|
+
v-if="item[h.value]"
|
|
352
|
+
:key="h.value"
|
|
353
|
+
class="d-flex align-center"
|
|
354
|
+
>
|
|
355
|
+
{{ item[h.value].value }}
|
|
356
|
+
|
|
357
|
+
<v-tooltip
|
|
358
|
+
v-if="item[h.value].errors"
|
|
359
|
+
location="top"
|
|
360
|
+
color="error"
|
|
361
|
+
>
|
|
362
|
+
<template #activator="{ props }">
|
|
363
|
+
<v-icon
|
|
364
|
+
|
|
365
|
+
class="ml-2"
|
|
366
|
+
color="error"
|
|
367
|
+
v-bind="props"
|
|
368
|
+
>
|
|
369
|
+
$warning
|
|
370
|
+
</v-icon>
|
|
371
|
+
</template>
|
|
372
|
+
<span>{{ item[h.value].errors.join("\n") }}</span>
|
|
373
|
+
</v-tooltip>
|
|
374
|
+
</div>
|
|
375
|
+
</template>
|
|
376
|
+
</v-data-table>
|
|
377
|
+
</div>
|
|
378
|
+
<div class="w-100 d-flex">
|
|
379
|
+
<v-btn
|
|
380
|
+
color="primary"
|
|
381
|
+
class="ml-auto"
|
|
382
|
+
size="large"
|
|
383
|
+
@click="$emit('done')"
|
|
384
|
+
>
|
|
385
|
+
{{ $t('weImport.buttons.close') }}
|
|
386
|
+
</v-btn>
|
|
387
|
+
</div>
|
|
388
|
+
</div>
|
|
389
|
+
</v-stepper-window-item>
|
|
390
|
+
</v-stepper-window>
|
|
391
|
+
</v-stepper>
|
|
392
|
+
</v-col>
|
|
393
|
+
</v-row>
|
|
394
|
+
</v-container>
|
|
395
|
+
</template>
|
|
396
|
+
|
|
397
|
+
<style>
|
|
398
|
+
.dt-example {
|
|
399
|
+
opacity: 0.6;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
.dt-example:hover {
|
|
403
|
+
opacity: 1;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
.we-import {
|
|
407
|
+
position: relative;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
.we-import__overlay {
|
|
411
|
+
z-index: 100;
|
|
412
|
+
}
|
|
413
|
+
</style>
|
|
414
|
+
|
|
415
|
+
<script>
|
|
416
|
+
import { ImportJobError, isImportJob, pollImportJob } from "../../composables/useImportJob";
|
|
417
|
+
export default {
|
|
418
|
+
props: {
|
|
419
|
+
url: {
|
|
420
|
+
type: String,
|
|
421
|
+
required: true
|
|
422
|
+
},
|
|
423
|
+
acceptedFiles: {
|
|
424
|
+
type: String,
|
|
425
|
+
default: ".csv,.xls,.xlsx"
|
|
426
|
+
},
|
|
427
|
+
extraParams: {
|
|
428
|
+
type: Object,
|
|
429
|
+
default: () => ({})
|
|
430
|
+
},
|
|
431
|
+
signedUrl: {
|
|
432
|
+
type: String,
|
|
433
|
+
default: void 0
|
|
434
|
+
},
|
|
435
|
+
/**
|
|
436
|
+
* Quanto aspettare, in ms, un import che l'API esegue in coda prima di dichiararlo perso.
|
|
437
|
+
* Vale solo per i backend che accodano: gli altri rispondono nella stessa richiesta.
|
|
438
|
+
*/
|
|
439
|
+
pollTimeout: {
|
|
440
|
+
type: Number,
|
|
441
|
+
default: void 0
|
|
442
|
+
}
|
|
443
|
+
},
|
|
444
|
+
emits: ["done"],
|
|
445
|
+
data() {
|
|
446
|
+
return {
|
|
447
|
+
loading: false,
|
|
448
|
+
progress: null,
|
|
449
|
+
step: 1,
|
|
450
|
+
exampleItems: [],
|
|
451
|
+
previewHeaders: [],
|
|
452
|
+
previewItems: [],
|
|
453
|
+
currentRow: null,
|
|
454
|
+
resultItems: [],
|
|
455
|
+
matches: {},
|
|
456
|
+
file: null,
|
|
457
|
+
defaultValues: {},
|
|
458
|
+
errorPanel: false,
|
|
459
|
+
allColumns: [],
|
|
460
|
+
matchColumns: [],
|
|
461
|
+
dropzoneFiles: null
|
|
462
|
+
};
|
|
463
|
+
},
|
|
464
|
+
computed: {
|
|
465
|
+
resultHeaders() {
|
|
466
|
+
return this.allColumns.map((c) => ({
|
|
467
|
+
title: c.text,
|
|
468
|
+
value: c.id
|
|
469
|
+
}));
|
|
470
|
+
},
|
|
471
|
+
missingFields() {
|
|
472
|
+
const filledFields = Object.values(this.matches).map((item) => item.id);
|
|
473
|
+
return this.allColumns.filter((item) => !filledFields.includes(item.id));
|
|
474
|
+
},
|
|
475
|
+
correctImportedColumns() {
|
|
476
|
+
return this.resultItems.reduce((acc, i) => {
|
|
477
|
+
if (!i._error) {
|
|
478
|
+
acc++;
|
|
479
|
+
}
|
|
480
|
+
return acc;
|
|
481
|
+
}, 0);
|
|
482
|
+
},
|
|
483
|
+
errorHeaders() {
|
|
484
|
+
return [{ value: "row_number" }, ...this.resultHeaders];
|
|
485
|
+
},
|
|
486
|
+
errorItems() {
|
|
487
|
+
return this.resultItems.filter((item) => item._error);
|
|
488
|
+
},
|
|
489
|
+
resultIcon() {
|
|
490
|
+
if (this.correctImportedColumns === this.resultItems.length) {
|
|
491
|
+
return "$booleanOn";
|
|
492
|
+
} else if (this.correctImportedColumns === 0) {
|
|
493
|
+
return "$booleanOff";
|
|
494
|
+
} else {
|
|
495
|
+
return "$alert";
|
|
496
|
+
}
|
|
497
|
+
},
|
|
498
|
+
colorResultIcon() {
|
|
499
|
+
if (this.correctImportedColumns === this.resultItems.length) {
|
|
500
|
+
return "success";
|
|
501
|
+
} else if (this.correctImportedColumns === 0) {
|
|
502
|
+
return "error";
|
|
503
|
+
} else {
|
|
504
|
+
return "warning";
|
|
505
|
+
}
|
|
506
|
+
},
|
|
507
|
+
exampleColumn() {
|
|
508
|
+
return this.allColumns.filter((c) => !c.hidden);
|
|
509
|
+
},
|
|
510
|
+
defaultFieldSlots() {
|
|
511
|
+
return Object.keys(this.$slots).filter((h) => h.startsWith("default_values."));
|
|
512
|
+
},
|
|
513
|
+
checkIfDisabled() {
|
|
514
|
+
return !this.dropzoneFiles || this.dropzoneFiles.length === 0;
|
|
515
|
+
},
|
|
516
|
+
progressPercent() {
|
|
517
|
+
if (!this.progress?.total) {
|
|
518
|
+
return null;
|
|
519
|
+
}
|
|
520
|
+
return Math.round(this.progress.done / this.progress.total * 100);
|
|
521
|
+
}
|
|
522
|
+
},
|
|
523
|
+
created() {
|
|
524
|
+
this.jobAbort = new AbortController();
|
|
525
|
+
},
|
|
526
|
+
async mounted() {
|
|
527
|
+
await this.fetchExampleData();
|
|
528
|
+
},
|
|
529
|
+
beforeUnmount() {
|
|
530
|
+
this.jobAbort.abort();
|
|
531
|
+
},
|
|
532
|
+
methods: {
|
|
533
|
+
/**
|
|
534
|
+
* Esegue un'azione dell'import e ne restituisce il risultato.
|
|
535
|
+
*
|
|
536
|
+
* Se l'API risponde accodando il lavoro, ne aspetta la fine interrogandola; se risponde
|
|
537
|
+
* come ha sempre fatto, restituisce direttamente quello che ha ricevuto. Gli step del
|
|
538
|
+
* wizard ricevono lo stesso payload nei due casi.
|
|
539
|
+
*/
|
|
540
|
+
async runAction(body) {
|
|
541
|
+
const res = await this.$api.$post(this.url, body);
|
|
542
|
+
if (!isImportJob(res)) {
|
|
543
|
+
return res;
|
|
544
|
+
}
|
|
545
|
+
this.progress = null;
|
|
546
|
+
try {
|
|
547
|
+
return await pollImportJob(this.$api, this.url, {
|
|
548
|
+
jobId: res.job_id,
|
|
549
|
+
params: this.extraParams,
|
|
550
|
+
signal: this.jobAbort.signal,
|
|
551
|
+
timeout: this.pollTimeout,
|
|
552
|
+
onProgress: (progress) => {
|
|
553
|
+
this.progress = progress;
|
|
554
|
+
}
|
|
555
|
+
});
|
|
556
|
+
} finally {
|
|
557
|
+
this.progress = null;
|
|
558
|
+
}
|
|
559
|
+
},
|
|
560
|
+
/**
|
|
561
|
+
* Traduce in un messaggio per l'utente il fallimento di un lavoro accodato.
|
|
562
|
+
*/
|
|
563
|
+
notifyJobError(error) {
|
|
564
|
+
if (!(error instanceof ImportJobError)) {
|
|
565
|
+
return;
|
|
566
|
+
}
|
|
567
|
+
if (error.reason === "aborted") {
|
|
568
|
+
return;
|
|
569
|
+
}
|
|
570
|
+
this.$notify.error(
|
|
571
|
+
error.reason === "timeout" ? this.$t("weImport.messages.jobTimeout") : this.$t("weImport.messages.jobFailed")
|
|
572
|
+
);
|
|
573
|
+
},
|
|
574
|
+
async fetchExampleData() {
|
|
575
|
+
const body = {
|
|
576
|
+
...this.extraParams,
|
|
577
|
+
action: "example"
|
|
578
|
+
};
|
|
579
|
+
const res = await this.$api.$post(this.url, body);
|
|
580
|
+
const { items, headers } = res;
|
|
581
|
+
this.allColumns = Object.entries(headers).map(([id, options]) => {
|
|
582
|
+
const required = options.required;
|
|
583
|
+
const hide_from_defaults = options.hide_from_defaults || false;
|
|
584
|
+
const text = required ? `${options.text}*` : options.text;
|
|
585
|
+
return {
|
|
586
|
+
...options,
|
|
587
|
+
id,
|
|
588
|
+
value: id,
|
|
589
|
+
required,
|
|
590
|
+
hide_from_defaults,
|
|
591
|
+
text,
|
|
592
|
+
headerProps: {
|
|
593
|
+
class: required ? "bg-warning" : ""
|
|
594
|
+
},
|
|
595
|
+
tooltip: options.tooltip
|
|
596
|
+
};
|
|
597
|
+
});
|
|
598
|
+
this.exampleItems = items;
|
|
599
|
+
},
|
|
600
|
+
clearUploadedFile() {
|
|
601
|
+
this.$refs.dz.clearFile();
|
|
602
|
+
this.loading = false;
|
|
603
|
+
},
|
|
604
|
+
async step2() {
|
|
605
|
+
const files = this.$refs.dz?.getFiles();
|
|
606
|
+
if (files) {
|
|
607
|
+
this.file = files[0];
|
|
608
|
+
try {
|
|
609
|
+
await this.preparePreview();
|
|
610
|
+
this.step = 2;
|
|
611
|
+
} catch (e) {
|
|
612
|
+
this.clearUploadedFile();
|
|
613
|
+
console.error(e);
|
|
614
|
+
}
|
|
615
|
+
} else {
|
|
616
|
+
this.$notify.error(this.$t("weImport.messages.error"));
|
|
617
|
+
}
|
|
618
|
+
},
|
|
619
|
+
step3() {
|
|
620
|
+
if (this.step < 2) {
|
|
621
|
+
return;
|
|
622
|
+
}
|
|
623
|
+
if (!this.currentRow) {
|
|
624
|
+
return;
|
|
625
|
+
}
|
|
626
|
+
this.step = 3;
|
|
627
|
+
},
|
|
628
|
+
step5() {
|
|
629
|
+
if (this.step < 4) {
|
|
630
|
+
return;
|
|
631
|
+
}
|
|
632
|
+
if (!this.matches) {
|
|
633
|
+
return;
|
|
634
|
+
}
|
|
635
|
+
this.step = 5;
|
|
636
|
+
},
|
|
637
|
+
backStep5() {
|
|
638
|
+
this.step = this.missingFields.length === 0 ? 3 : 4;
|
|
639
|
+
},
|
|
640
|
+
async onImport(options) {
|
|
641
|
+
this.loading = true;
|
|
642
|
+
const body = {
|
|
643
|
+
...this.extraParams,
|
|
644
|
+
matches: this.matches,
|
|
645
|
+
first_row: this.currentRow,
|
|
646
|
+
action: "import",
|
|
647
|
+
dry_run: false,
|
|
648
|
+
file: this.file,
|
|
649
|
+
...options,
|
|
650
|
+
default_values: this.defaultValues
|
|
651
|
+
};
|
|
652
|
+
try {
|
|
653
|
+
const res = await this.runAction(body);
|
|
654
|
+
this.resultItems = res.results;
|
|
655
|
+
this.step = 6;
|
|
656
|
+
} catch (error) {
|
|
657
|
+
this.notifyJobError(error);
|
|
658
|
+
console.error(error);
|
|
659
|
+
}
|
|
660
|
+
this.loading = false;
|
|
661
|
+
},
|
|
662
|
+
onMatch(matches) {
|
|
663
|
+
this.matches = matches;
|
|
664
|
+
if (this.missingFields.length === 0) {
|
|
665
|
+
this.onDefaultValues({});
|
|
666
|
+
this.step = 5;
|
|
667
|
+
return;
|
|
668
|
+
}
|
|
669
|
+
this.step = 4;
|
|
670
|
+
},
|
|
671
|
+
async onDefaultValues(values) {
|
|
672
|
+
this.defaultValues = values;
|
|
673
|
+
this.loading = true;
|
|
674
|
+
const body = {
|
|
675
|
+
...this.extraParams,
|
|
676
|
+
matches: this.matches,
|
|
677
|
+
first_row: this.currentRow,
|
|
678
|
+
action: "import",
|
|
679
|
+
dry_run: true,
|
|
680
|
+
default_values: this.defaultValues,
|
|
681
|
+
file: this.file
|
|
682
|
+
};
|
|
683
|
+
try {
|
|
684
|
+
const res = await this.runAction(body);
|
|
685
|
+
this.resultItems = res.results;
|
|
686
|
+
this.step5();
|
|
687
|
+
} catch (error) {
|
|
688
|
+
this.notifyJobError(error);
|
|
689
|
+
console.error(error);
|
|
690
|
+
}
|
|
691
|
+
this.loading = false;
|
|
692
|
+
},
|
|
693
|
+
async preparePreview() {
|
|
694
|
+
this.loading = true;
|
|
695
|
+
const body = {
|
|
696
|
+
...this.extraParams,
|
|
697
|
+
action: "preview",
|
|
698
|
+
file: this.file
|
|
699
|
+
};
|
|
700
|
+
try {
|
|
701
|
+
const res = await this.runAction(body);
|
|
702
|
+
const { items, headers } = res;
|
|
703
|
+
this.previewHeaders = Object.keys(items[0]).map((key) => ({
|
|
704
|
+
value: key,
|
|
705
|
+
title: key
|
|
706
|
+
}));
|
|
707
|
+
this.previewItems = items.map((row, index) => {
|
|
708
|
+
return { rowNumber: index + 1, ...row };
|
|
709
|
+
});
|
|
710
|
+
this.matchColumns = Object.entries(headers).map(([id, options]) => {
|
|
711
|
+
const required = options.required;
|
|
712
|
+
const text = required ? `${options.text}*` : options.text;
|
|
713
|
+
return {
|
|
714
|
+
...options,
|
|
715
|
+
id,
|
|
716
|
+
required,
|
|
717
|
+
text
|
|
718
|
+
};
|
|
719
|
+
});
|
|
720
|
+
} catch (error) {
|
|
721
|
+
this.notifyJobError(error);
|
|
722
|
+
console.error(error);
|
|
723
|
+
throw error;
|
|
724
|
+
} finally {
|
|
725
|
+
this.loading = false;
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
};
|
|
730
|
+
</script>
|