@webitel/ui-sdk 24.8.27 → 24.8.29
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/package.json
CHANGED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { SystemSettingServiceApiFactory } from 'webitel-sdk';
|
|
2
|
+
import {
|
|
3
|
+
getDefaultGetListResponse,
|
|
4
|
+
getDefaultGetParams, getDefaultInstance, getDefaultOpenAPIConfig,
|
|
5
|
+
} from '../../defaults/index.js';
|
|
6
|
+
import applyTransform, {
|
|
7
|
+
camelToSnake,
|
|
8
|
+
merge,
|
|
9
|
+
notify,
|
|
10
|
+
sanitize,
|
|
11
|
+
snakeToCamel,
|
|
12
|
+
starToSearch,
|
|
13
|
+
} from '../../transformers/index.js';
|
|
14
|
+
|
|
15
|
+
const instance = getDefaultInstance();
|
|
16
|
+
const configuration = getDefaultOpenAPIConfig();
|
|
17
|
+
|
|
18
|
+
const configurationService = new SystemSettingServiceApiFactory(configuration, '', instance);
|
|
19
|
+
|
|
20
|
+
const getList = async (params) => {
|
|
21
|
+
const { page, size, search, sort, fields, name } = applyTransform(params, [
|
|
22
|
+
merge(getDefaultGetParams()),
|
|
23
|
+
starToSearch('search'),
|
|
24
|
+
]);
|
|
25
|
+
|
|
26
|
+
try {
|
|
27
|
+
const response = await configurationService.searchSystemSetting(page, size, search, sort, fields, name);
|
|
28
|
+
const { items, next } = applyTransform(response.data, [
|
|
29
|
+
snakeToCamel(),
|
|
30
|
+
merge(getDefaultGetListResponse()),
|
|
31
|
+
]);
|
|
32
|
+
return {
|
|
33
|
+
items,
|
|
34
|
+
next,
|
|
35
|
+
};
|
|
36
|
+
} catch (err) {
|
|
37
|
+
throw applyTransform(err, [notify]);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const get = async ({ itemId: id }) => {
|
|
42
|
+
try {
|
|
43
|
+
const response = await configurationService.readSystemSetting(id);
|
|
44
|
+
return applyTransform(response.data, [snakeToCamel()]);
|
|
45
|
+
} catch (err) {
|
|
46
|
+
throw applyTransform(err, [notify]);
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const fieldsToSend = ['id', 'name', 'value'];
|
|
51
|
+
|
|
52
|
+
const add = async ({ itemInstance }) => {
|
|
53
|
+
const item = applyTransform(itemInstance, [sanitize(fieldsToSend), camelToSnake()]);
|
|
54
|
+
try {
|
|
55
|
+
const response = await configurationService.createSystemSetting(item);
|
|
56
|
+
return applyTransform(response.data, [snakeToCamel()]);
|
|
57
|
+
} catch (err) {
|
|
58
|
+
throw applyTransform(err, [notify]);
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const update = async ({ itemInstance, itemId: id }) => {
|
|
63
|
+
const item = applyTransform(itemInstance, [sanitize(fieldsToSend), camelToSnake()]);
|
|
64
|
+
try {
|
|
65
|
+
const response = await configurationService.updateSystemSetting(id, item);
|
|
66
|
+
return applyTransform(response.data, [snakeToCamel()]);
|
|
67
|
+
} catch (err) {
|
|
68
|
+
throw applyTransform(err, [notify]);
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
const getLookup = (params) =>
|
|
73
|
+
getList({
|
|
74
|
+
...params,
|
|
75
|
+
fields: params.fields || ['name'],
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
const deleteItem = async ({ id }) => {
|
|
79
|
+
try {
|
|
80
|
+
const response = await configurationService.deleteSystemSetting(id);
|
|
81
|
+
return applyTransform(response.data, []);
|
|
82
|
+
} catch (err) {
|
|
83
|
+
throw applyTransform(err, [notify]);
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
const getObjectsList = async (params) => {
|
|
88
|
+
const { page, size, search, sort, fields } = applyTransform(params, [
|
|
89
|
+
merge(getDefaultGetParams()),
|
|
90
|
+
starToSearch('search'),
|
|
91
|
+
]);
|
|
92
|
+
|
|
93
|
+
try {
|
|
94
|
+
const response = await configurationService.searchAvailableSystemSetting(page, size, search, sort, fields);
|
|
95
|
+
const { items, next } = applyTransform(response.data, [
|
|
96
|
+
snakeToCamel(),
|
|
97
|
+
merge(getDefaultGetListResponse()),
|
|
98
|
+
]);
|
|
99
|
+
return {
|
|
100
|
+
items,
|
|
101
|
+
next,
|
|
102
|
+
};
|
|
103
|
+
} catch (err) {
|
|
104
|
+
throw applyTransform(err, [notify]);
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
const ConfigurationsAPI = {
|
|
109
|
+
getList,
|
|
110
|
+
get,
|
|
111
|
+
add,
|
|
112
|
+
update,
|
|
113
|
+
delete: deleteItem,
|
|
114
|
+
getLookup,
|
|
115
|
+
getObjectsList,
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
export default ConfigurationsAPI;
|
package/src/api/clients/index.js
CHANGED
|
@@ -10,6 +10,7 @@ import media from './media/media.js';
|
|
|
10
10
|
import queues from './queues/queues.js';
|
|
11
11
|
import roles from './roles/roles.js';
|
|
12
12
|
import users from './users/users.js';
|
|
13
|
+
import configurations from './configurations/configurations.js';
|
|
13
14
|
|
|
14
15
|
export {
|
|
15
16
|
agents,
|
|
@@ -24,4 +25,5 @@ export {
|
|
|
24
25
|
queues,
|
|
25
26
|
roles,
|
|
26
27
|
users,
|
|
28
|
+
configurations,
|
|
27
29
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import VueMultiselect from 'vue-multiselect';
|
|
2
2
|
import { ObserveVisibility } from 'vue-observe-visibility';
|
|
3
|
-
import validationMixin
|
|
3
|
+
import validationMixin
|
|
4
|
+
from '../../../mixins/validationMixin/validationMixin.js';
|
|
4
5
|
import debounce from '../../../scripts/debounce.js';
|
|
5
6
|
import isEmpty from '../../../scripts/isEmpty.js';
|
|
6
7
|
import labelUsageMixin from '../../wt-label/mixins/labelUsageMixin.js';
|