@tager/admin-export 1.0.3 → 1.0.5
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/index.mjs +39 -9
- package/dist/locales/en.d.ts +4 -0
- package/dist/style.css +1 -1
- package/dist/typings/model.d.ts +3 -2
- package/dist/views/ExportList/ExportList.helpers.d.ts +3 -0
- package/dist/views/ExportList/components/CellHistory/CellHistory.vue.d.ts +4 -2
- package/package.json +1 -1
- package/src/locales/en.ts +7 -2
- package/src/locales/ru.ts +5 -0
- package/src/typings/model.ts +4 -2
- package/src/views/ExportList/ExportList.helpers.ts +21 -0
- package/src/views/ExportList/ExportList.vue +8 -0
- package/src/views/ExportList/components/CellHistory/CellHistory.vue +9 -4
package/dist/index.mjs
CHANGED
|
@@ -13,10 +13,10 @@ const EN = {
|
|
|
13
13
|
type: "Type",
|
|
14
14
|
params: "Params",
|
|
15
15
|
exportType: "Export type",
|
|
16
|
-
status: "
|
|
16
|
+
status: "Status",
|
|
17
17
|
message: "Message",
|
|
18
18
|
log: "Log",
|
|
19
|
-
file: "
|
|
19
|
+
file: "File",
|
|
20
20
|
newExport: "New export",
|
|
21
21
|
exportCreation: "Export creation",
|
|
22
22
|
success: "Success",
|
|
@@ -27,7 +27,11 @@ const EN = {
|
|
|
27
27
|
format: "Format",
|
|
28
28
|
delimiter: "Delimiter",
|
|
29
29
|
comma: "Comma",
|
|
30
|
-
semicolon: "Semicolon"
|
|
30
|
+
semicolon: "Semicolon",
|
|
31
|
+
statusCreated: "Created",
|
|
32
|
+
statusInProgress: "In Progress",
|
|
33
|
+
statusCompleted: "Completed",
|
|
34
|
+
statusFailure: "Failed"
|
|
31
35
|
};
|
|
32
36
|
const RU = {
|
|
33
37
|
home: "\u0413\u043B\u0430\u0432\u043D\u0430\u044F",
|
|
@@ -51,7 +55,11 @@ const RU = {
|
|
|
51
55
|
format: "\u0424\u043E\u0440\u043C\u0430\u0442",
|
|
52
56
|
delimiter: "\u0420\u0430\u0437\u0434\u0435\u043B\u0438\u0442\u0435\u043B\u044C",
|
|
53
57
|
comma: "\u0417\u0430\u043F\u044F\u0442\u0430\u044F",
|
|
54
|
-
semicolon: "\u0422\u043E\u0447\u043A\u0430 \u0441 \u0437\u0430\u043F\u044F\u0442\u043E\u0439"
|
|
58
|
+
semicolon: "\u0422\u043E\u0447\u043A\u0430 \u0441 \u0437\u0430\u043F\u044F\u0442\u043E\u0439",
|
|
59
|
+
statusCreated: "\u0421\u043E\u0437\u0434\u0430\u043D",
|
|
60
|
+
statusInProgress: "\u0412 \u043F\u0440\u043E\u0446\u0435\u0441\u0441\u0435",
|
|
61
|
+
statusCompleted: "\u0417\u0430\u0432\u0435\u0440\u0448\u0435\u043D",
|
|
62
|
+
statusFailure: "\u041E\u0448\u0438\u0431\u043A\u0430"
|
|
55
63
|
};
|
|
56
64
|
function applyTranslations() {
|
|
57
65
|
i18n.addTranslations("en", "export", EN);
|
|
@@ -87,6 +95,20 @@ function dateTimeFormat(value) {
|
|
|
87
95
|
second: "numeric"
|
|
88
96
|
}).format(date);
|
|
89
97
|
}
|
|
98
|
+
function getExportStatusLabel(status, t) {
|
|
99
|
+
switch (status) {
|
|
100
|
+
case "CREATED":
|
|
101
|
+
return t("export:statusCreated");
|
|
102
|
+
case "IN_PROGRESS":
|
|
103
|
+
return t("export:statusInProgress");
|
|
104
|
+
case "COMPLETED":
|
|
105
|
+
return t("export:statusCompleted");
|
|
106
|
+
case "FAILURE":
|
|
107
|
+
return t("export:statusFailure");
|
|
108
|
+
default:
|
|
109
|
+
return "Unknown";
|
|
110
|
+
}
|
|
111
|
+
}
|
|
90
112
|
var CellHistory_vue_vue_type_style_index_0_scoped_true_lang = "";
|
|
91
113
|
var _export_sfc = (sfc, props) => {
|
|
92
114
|
const target = sfc.__vccOpts || sfc;
|
|
@@ -105,7 +127,8 @@ const _sfc_main$2 = defineComponent({
|
|
|
105
127
|
},
|
|
106
128
|
setup() {
|
|
107
129
|
return {
|
|
108
|
-
dateTimeFormat
|
|
130
|
+
dateTimeFormat,
|
|
131
|
+
getExportStatusLabel
|
|
109
132
|
};
|
|
110
133
|
}
|
|
111
134
|
});
|
|
@@ -115,13 +138,13 @@ function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
115
138
|
return _ctx.history.length > 0 ? (openBlock(), createElementBlock("ul", _hoisted_1$1, [
|
|
116
139
|
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.history, (history, index) => {
|
|
117
140
|
return openBlock(), createElementBlock("li", { key: index }, [
|
|
118
|
-
createElementVNode("span", _hoisted_2, toDisplayString(history.status), 1),
|
|
141
|
+
createElementVNode("span", _hoisted_2, toDisplayString(_ctx.getExportStatusLabel(history.status, _ctx.$i18n.t)), 1),
|
|
119
142
|
createTextVNode(" " + toDisplayString(_ctx.dateTimeFormat(history.datetime)), 1)
|
|
120
143
|
]);
|
|
121
144
|
}), 128))
|
|
122
145
|
])) : createCommentVNode("", true);
|
|
123
146
|
}
|
|
124
|
-
var CellHistory = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render$2], ["__scopeId", "data-v-
|
|
147
|
+
var CellHistory = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render$2], ["__scopeId", "data-v-2c813c30"]]);
|
|
125
148
|
const _sfc_main$1 = defineComponent({
|
|
126
149
|
name: "ExportList",
|
|
127
150
|
components: {
|
|
@@ -164,7 +187,8 @@ const _sfc_main$1 = defineComponent({
|
|
|
164
187
|
id: 2,
|
|
165
188
|
name: t("export:status"),
|
|
166
189
|
field: "status",
|
|
167
|
-
width: "120px"
|
|
190
|
+
width: "120px",
|
|
191
|
+
format: ({ row }) => getExportStatusLabel(row.status, t)
|
|
168
192
|
},
|
|
169
193
|
{
|
|
170
194
|
id: 3,
|
|
@@ -208,7 +232,13 @@ const _sfc_main$1 = defineComponent({
|
|
|
208
232
|
name: t("export:file"),
|
|
209
233
|
field: "file",
|
|
210
234
|
type: "file",
|
|
211
|
-
width: "100px"
|
|
235
|
+
width: "100px",
|
|
236
|
+
style: {
|
|
237
|
+
textAlign: "center"
|
|
238
|
+
},
|
|
239
|
+
headStyle: {
|
|
240
|
+
textAlign: "center"
|
|
241
|
+
}
|
|
212
242
|
}
|
|
213
243
|
];
|
|
214
244
|
return {
|
package/dist/locales/en.d.ts
CHANGED
package/dist/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.name[data-v-
|
|
1
|
+
.name[data-v-2c813c30]{display:inline-block;width:100px}.field[data-v-559849fa]{display:grid;grid-template-columns:repeat(2,1fr);column-gap:20px}
|
package/dist/typings/model.d.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { FileType } from '@tager/admin-services';
|
|
2
2
|
import { FieldConfigUnion, FieldShortType, OutgoingValueUnion } from '@tager/admin-dynamic-field';
|
|
3
|
+
export declare type ExportStatus = 'CREATED' | 'IN_PROGRESS' | 'COMPLETED' | 'FAILURE';
|
|
3
4
|
export interface HistoryType {
|
|
4
5
|
readonly datetime: string;
|
|
5
|
-
readonly status:
|
|
6
|
+
readonly status: ExportStatus;
|
|
6
7
|
}
|
|
7
8
|
export interface ExportType {
|
|
8
9
|
readonly id: number;
|
|
9
10
|
readonly strategy: string;
|
|
10
|
-
readonly status:
|
|
11
|
+
readonly status: ExportStatus;
|
|
11
12
|
readonly message: string | null;
|
|
12
13
|
readonly history: Array<HistoryType>;
|
|
13
14
|
readonly file: FileType | null;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { PropType } from
|
|
1
|
+
import { PropType } from 'vue';
|
|
2
|
+
import { HistoryType } from '../../../../typings/model';
|
|
2
3
|
import { dateTimeFormat } from './CellHistory.helpers';
|
|
3
|
-
import {
|
|
4
|
+
import { getExportStatusLabel } from "../../ExportList.helpers";
|
|
4
5
|
declare const _default: import("vue").DefineComponent<{
|
|
5
6
|
history: {
|
|
6
7
|
type: PropType<HistoryType[]>;
|
|
@@ -8,6 +9,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
8
9
|
};
|
|
9
10
|
}, {
|
|
10
11
|
dateTimeFormat: typeof dateTimeFormat;
|
|
12
|
+
getExportStatusLabel: typeof getExportStatusLabel;
|
|
11
13
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
12
14
|
history: {
|
|
13
15
|
type: PropType<HistoryType[]>;
|
package/package.json
CHANGED
package/src/locales/en.ts
CHANGED
|
@@ -6,10 +6,10 @@ export const EN = {
|
|
|
6
6
|
type: 'Type',
|
|
7
7
|
params: 'Params',
|
|
8
8
|
exportType: 'Export type',
|
|
9
|
-
status: '
|
|
9
|
+
status: 'Status',
|
|
10
10
|
message: 'Message',
|
|
11
11
|
log: 'Log',
|
|
12
|
-
file: '
|
|
12
|
+
file: 'File',
|
|
13
13
|
newExport: 'New export',
|
|
14
14
|
exportCreation: 'Export creation',
|
|
15
15
|
success: 'Success',
|
|
@@ -21,4 +21,9 @@ export const EN = {
|
|
|
21
21
|
delimiter: 'Delimiter',
|
|
22
22
|
comma: 'Comma',
|
|
23
23
|
semicolon: 'Semicolon',
|
|
24
|
+
|
|
25
|
+
statusCreated: 'Created',
|
|
26
|
+
statusInProgress: 'In Progress',
|
|
27
|
+
statusCompleted: 'Completed',
|
|
28
|
+
statusFailure: 'Failed',
|
|
24
29
|
};
|
package/src/locales/ru.ts
CHANGED
package/src/typings/model.ts
CHANGED
|
@@ -5,15 +5,17 @@ import {
|
|
|
5
5
|
OutgoingValueUnion,
|
|
6
6
|
} from '@tager/admin-dynamic-field';
|
|
7
7
|
|
|
8
|
+
export type ExportStatus = 'CREATED' | 'IN_PROGRESS' | 'COMPLETED' | 'FAILURE';
|
|
9
|
+
|
|
8
10
|
export interface HistoryType {
|
|
9
11
|
readonly datetime: string;
|
|
10
|
-
readonly status:
|
|
12
|
+
readonly status: ExportStatus;
|
|
11
13
|
}
|
|
12
14
|
|
|
13
15
|
export interface ExportType {
|
|
14
16
|
readonly id: number;
|
|
15
17
|
readonly strategy: string;
|
|
16
|
-
readonly status:
|
|
18
|
+
readonly status: ExportStatus;
|
|
17
19
|
readonly message: string | null;
|
|
18
20
|
readonly history: Array<HistoryType>;
|
|
19
21
|
readonly file: FileType | null;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { TranslateFunction } from '@tager/admin-services';
|
|
2
|
+
|
|
3
|
+
import { ExportStatus } from '../../typings/model';
|
|
4
|
+
|
|
5
|
+
export function getExportStatusLabel(
|
|
6
|
+
status: ExportStatus,
|
|
7
|
+
t: TranslateFunction
|
|
8
|
+
): string {
|
|
9
|
+
switch (status) {
|
|
10
|
+
case 'CREATED':
|
|
11
|
+
return t('export:statusCreated');
|
|
12
|
+
case 'IN_PROGRESS':
|
|
13
|
+
return t('export:statusInProgress');
|
|
14
|
+
case 'COMPLETED':
|
|
15
|
+
return t('export:statusCompleted');
|
|
16
|
+
case 'FAILURE':
|
|
17
|
+
return t('export:statusFailure');
|
|
18
|
+
default:
|
|
19
|
+
return 'Unknown';
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -45,6 +45,7 @@ import { ExportType } from '../../typings/model';
|
|
|
45
45
|
import { getExportFormUrl } from '../../utils/paths';
|
|
46
46
|
|
|
47
47
|
import { CellHistory } from './components/CellHistory';
|
|
48
|
+
import { getExportStatusLabel } from './ExportList.helpers';
|
|
48
49
|
|
|
49
50
|
export default defineComponent({
|
|
50
51
|
name: 'ExportList',
|
|
@@ -93,6 +94,7 @@ export default defineComponent({
|
|
|
93
94
|
name: t('export:status'),
|
|
94
95
|
field: 'status',
|
|
95
96
|
width: '120px',
|
|
97
|
+
format: ({row}) => getExportStatusLabel(row.status, t)
|
|
96
98
|
},
|
|
97
99
|
{
|
|
98
100
|
id: 3,
|
|
@@ -139,6 +141,12 @@ export default defineComponent({
|
|
|
139
141
|
field: 'file',
|
|
140
142
|
type: 'file',
|
|
141
143
|
width: '100px',
|
|
144
|
+
style:{
|
|
145
|
+
textAlign: 'center'
|
|
146
|
+
},
|
|
147
|
+
headStyle:{
|
|
148
|
+
textAlign: 'center'
|
|
149
|
+
}
|
|
142
150
|
},
|
|
143
151
|
];
|
|
144
152
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<ul v-if="history.length > 0">
|
|
3
3
|
<li v-for="(history, index) of history" :key="index">
|
|
4
4
|
<span class="name">
|
|
5
|
-
{{ history.status }}
|
|
5
|
+
{{ getExportStatusLabel(history.status, $i18n.t) }}
|
|
6
6
|
</span>
|
|
7
7
|
{{ dateTimeFormat(history.datetime) }}
|
|
8
8
|
</li>
|
|
@@ -10,12 +10,16 @@
|
|
|
10
10
|
</template>
|
|
11
11
|
|
|
12
12
|
<script lang="ts">
|
|
13
|
-
import {defineComponent, PropType} from
|
|
14
|
-
|
|
15
|
-
import {HistoryType} from
|
|
13
|
+
import { defineComponent, PropType } from 'vue';
|
|
14
|
+
|
|
15
|
+
import { HistoryType } from '../../../../typings/model';
|
|
16
|
+
|
|
17
|
+
import { dateTimeFormat } from './CellHistory.helpers';
|
|
18
|
+
import { getExportStatusLabel } from "../../ExportList.helpers";
|
|
16
19
|
|
|
17
20
|
export default defineComponent({
|
|
18
21
|
name: 'CellHistory',
|
|
22
|
+
|
|
19
23
|
props: {
|
|
20
24
|
history: {
|
|
21
25
|
type: Array as PropType<HistoryType[]>,
|
|
@@ -25,6 +29,7 @@ export default defineComponent({
|
|
|
25
29
|
setup() {
|
|
26
30
|
return {
|
|
27
31
|
dateTimeFormat,
|
|
32
|
+
getExportStatusLabel,
|
|
28
33
|
};
|
|
29
34
|
},
|
|
30
35
|
});
|