@webitel/ui-sdk 24.10.43 → 24.10.44
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/ui-sdk.js +1 -1
- package/dist/ui-sdk.umd.cjs +1 -1
- package/package.json +1 -1
- package/src/api/clients/_shared/generatePermissionsApi.js +1 -1
- package/src/api/clients/index.js +1 -1
- package/src/modules/ObjectPermissions/_internals/components/permissions-role-select.vue +6 -2
- package/src/modules/ObjectPermissions/_internals/components/permissions-tab-role-popup.vue +21 -12
- package/src/modules/ObjectPermissions/_internals/modules/filters/store/filters.store.js +1 -3
- package/src/modules/ObjectPermissions/_internals/store/helpers/createObjectPermissionsStoreModule.js +18 -6
- package/src/modules/ObjectPermissions/_internals/store/modules/headers.js +28 -0
- package/src/modules/ObjectPermissions/_internals/store/modules/objectPermissionsStoreModule.js +34 -7
- package/src/modules/ObjectPermissions/components/permissions-tab.vue +0 -1
- package/src/store/new/helpers/createApiStoreModule.js +1 -1
- package/src/store/new/helpers/createBaseStoreModule.js +1 -1
- package/src/store/new/helpers/createCardStoreModule.js +1 -1
- package/src/store/new/helpers/createStoreModule.js +1 -1
- package/src/store/new/helpers/createTableStoreModule.js +1 -1
- package/src/store/new/modules/apiStoreModule/apiStoreModule.js +31 -0
- package/src/store/new/modules/cardStoreModule/useCardStore.js +3 -1
- package/src/store/new/modules/tableStoreModule/tableStoreModule.js +20 -5
package/package.json
CHANGED
package/src/api/clients/index.js
CHANGED
|
@@ -11,7 +11,7 @@ import media from './media/media.js';
|
|
|
11
11
|
import queues from './queues/queues.js';
|
|
12
12
|
import roles from './roles/roles.js';
|
|
13
13
|
import users from './users/users.js';
|
|
14
|
-
import {
|
|
14
|
+
import { contactChatMessagesHistory, contacts } from './сontacts/index.js';
|
|
15
15
|
|
|
16
16
|
export {
|
|
17
17
|
agents,
|
|
@@ -3,15 +3,17 @@
|
|
|
3
3
|
class="permissions-role-select"
|
|
4
4
|
option-label="name"
|
|
5
5
|
v-bind="attrs"
|
|
6
|
+
:value="model"
|
|
7
|
+
@input="model = $event"
|
|
6
8
|
>
|
|
7
9
|
<template #singleLabel="{ option, optionLabel }">
|
|
8
|
-
<role-row :role="option
|
|
10
|
+
<role-row :role="option">
|
|
9
11
|
{{ option[optionLabel] || option }}
|
|
10
12
|
</role-row>
|
|
11
13
|
</template>
|
|
12
14
|
|
|
13
15
|
<template #option="{ option, optionLabel }">
|
|
14
|
-
<role-row :role="option
|
|
16
|
+
<role-row :role="option">
|
|
15
17
|
{{ option[optionLabel] || option }}
|
|
16
18
|
</role-row>
|
|
17
19
|
</template>
|
|
@@ -23,6 +25,8 @@ import { useAttrs } from 'vue';
|
|
|
23
25
|
import RoleRow from './permissions-role-row.vue';
|
|
24
26
|
|
|
25
27
|
const attrs = useAttrs();
|
|
28
|
+
|
|
29
|
+
const model = defineModel({ required: true });
|
|
26
30
|
</script>
|
|
27
31
|
|
|
28
32
|
<style lang="scss" scoped>
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
|
|
8
8
|
<wt-popup
|
|
9
9
|
:shown="shown"
|
|
10
|
-
overflow
|
|
11
10
|
size="sm"
|
|
11
|
+
overflow
|
|
12
12
|
@close="close"
|
|
13
13
|
>
|
|
14
14
|
<template #title>
|
|
@@ -16,14 +16,14 @@
|
|
|
16
16
|
</template>
|
|
17
17
|
<template #main>
|
|
18
18
|
<permissions-role-select
|
|
19
|
-
v-model="grantee"
|
|
19
|
+
v-model:model-value="grantee"
|
|
20
20
|
:clearable="false"
|
|
21
|
-
:placeholder="t('
|
|
21
|
+
:placeholder="t('objects.role', 1)"
|
|
22
22
|
:search-method="getAvailableGrantees"
|
|
23
23
|
/>
|
|
24
24
|
</template>
|
|
25
25
|
<template #actions>
|
|
26
|
-
<wt-button @click="save">
|
|
26
|
+
<wt-button @click="save(grantee)">
|
|
27
27
|
{{ t('objects.add') }}
|
|
28
28
|
</wt-button>
|
|
29
29
|
<wt-button
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
</template>
|
|
39
39
|
|
|
40
40
|
<script setup>
|
|
41
|
-
import { ref, useAttrs } from 'vue';
|
|
41
|
+
import { computed, ref, useAttrs } from 'vue';
|
|
42
42
|
import { useI18n } from 'vue-i18n';
|
|
43
43
|
import { useRoute, useRouter } from 'vue-router';
|
|
44
44
|
import { useStore } from 'vuex';
|
|
@@ -65,16 +65,25 @@ const existingGranteesList = computed(() => getNamespacedState(store.state, prop
|
|
|
65
65
|
|
|
66
66
|
const shown = computed(() => !!route.params.permissionId);
|
|
67
67
|
|
|
68
|
-
const add = () =>
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
68
|
+
const add = () => {
|
|
69
|
+
const { params, query, hash, name } = route;
|
|
70
|
+
|
|
71
|
+
router.push({
|
|
72
|
+
query,
|
|
73
|
+
hash,
|
|
74
|
+
name,
|
|
75
|
+
params: { ...params, permissionId: 'new' },
|
|
76
|
+
});
|
|
77
|
+
};
|
|
72
78
|
|
|
73
79
|
const close = () => {
|
|
80
|
+
const { query, hash, name } = route;
|
|
74
81
|
const { permissionId, ...params } = route.params;
|
|
75
82
|
|
|
76
83
|
return router.push({
|
|
77
|
-
|
|
84
|
+
query,
|
|
85
|
+
hash,
|
|
86
|
+
name,
|
|
78
87
|
params,
|
|
79
88
|
});
|
|
80
89
|
};
|
|
@@ -98,8 +107,8 @@ const getAvailableGrantees = async (params) => {
|
|
|
98
107
|
};
|
|
99
108
|
};
|
|
100
109
|
|
|
101
|
-
const save = async (
|
|
102
|
-
await store.dispatch(`${props.namespace}/ADD_ROLE_PERMISSIONS`,
|
|
110
|
+
const save = async (grantee) => {
|
|
111
|
+
await store.dispatch(`${props.namespace}/ADD_ROLE_PERMISSIONS`, grantee);
|
|
103
112
|
return close();
|
|
104
113
|
};
|
|
105
114
|
|
package/src/modules/ObjectPermissions/_internals/store/helpers/createObjectPermissionsStoreModule.js
CHANGED
|
@@ -1,15 +1,27 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import {
|
|
2
|
+
createBaseStoreModule,
|
|
3
|
+
createTableStoreModule,
|
|
4
|
+
} from '../../../../../store/new/index.js';
|
|
4
5
|
import objectPermissionsStoreModule
|
|
5
6
|
from '../modules/objectPermissionsStoreModule.js';
|
|
6
7
|
|
|
7
|
-
export const createObjectPermissionsStoreModule = (modules
|
|
8
|
+
export const createObjectPermissionsStoreModule = (modules) => {
|
|
8
9
|
const modulesArr = Array.isArray(modules) ? modules : [modules];
|
|
9
10
|
|
|
10
|
-
|
|
11
|
-
tableStoreModule(),
|
|
11
|
+
const tableSubmodule = createTableStoreModule([
|
|
12
12
|
objectPermissionsStoreModule(),
|
|
13
|
+
]);
|
|
14
|
+
|
|
15
|
+
const cardSubmodule = [
|
|
16
|
+
// empty, now permissions don't have standard card functionality
|
|
17
|
+
];
|
|
18
|
+
|
|
19
|
+
return createBaseStoreModule([
|
|
20
|
+
{
|
|
21
|
+
modules: {
|
|
22
|
+
table: tableSubmodule,
|
|
23
|
+
},
|
|
24
|
+
},
|
|
13
25
|
...modulesArr,
|
|
14
26
|
]);
|
|
15
27
|
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { SortSymbols } from '../../../../../scripts/sortQueryAdapters.js';
|
|
2
|
+
|
|
3
|
+
export default [
|
|
4
|
+
{
|
|
5
|
+
value: 'grantee',
|
|
6
|
+
locale: 'reusable.name',
|
|
7
|
+
field: 'grantee',
|
|
8
|
+
sort: SortSymbols.NONE,
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
value: 'read',
|
|
12
|
+
locale: 'reusable.read',
|
|
13
|
+
field: 'granted',
|
|
14
|
+
sort: SortSymbols.NONE,
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
value: 'edit',
|
|
18
|
+
locale: 'reusable.edit',
|
|
19
|
+
field: 'granted',
|
|
20
|
+
sort: SortSymbols.NONE,
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
value: 'delete',
|
|
24
|
+
locale: 'reusable.delete',
|
|
25
|
+
field: 'granted',
|
|
26
|
+
sort: SortSymbols.NONE,
|
|
27
|
+
},
|
|
28
|
+
];
|
package/src/modules/ObjectPermissions/_internals/store/modules/objectPermissionsStoreModule.js
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
|
+
import deepCopy from 'deep-copy';
|
|
1
2
|
import { AccessMode } from '../../enums/AccessMode.enum.js';
|
|
2
3
|
import generateFilters from '../../modules/filters/store/filters.store.js';
|
|
4
|
+
import headers from './headers.js';
|
|
5
|
+
|
|
6
|
+
const state = {
|
|
7
|
+
headers,
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const getters = {
|
|
11
|
+
REQUIRED_FIELDS: () => [],
|
|
12
|
+
};
|
|
3
13
|
|
|
4
14
|
const actions = {
|
|
5
15
|
CHANGE_ACCESS_MODE: async (context, { mode, ruleName, item }) => {
|
|
@@ -28,38 +38,55 @@ const actions = {
|
|
|
28
38
|
default:
|
|
29
39
|
return;
|
|
30
40
|
}
|
|
31
|
-
const changes =
|
|
41
|
+
const changes = [
|
|
42
|
+
{
|
|
32
43
|
grantee: +item.grantee.id,
|
|
33
44
|
grants: want,
|
|
34
|
-
|
|
45
|
+
}
|
|
46
|
+
];
|
|
35
47
|
try {
|
|
36
|
-
await context.dispatch('
|
|
37
|
-
item,
|
|
48
|
+
await context.dispatch('PATCH_ITEM_API', {
|
|
38
49
|
changes,
|
|
50
|
+
id: context.getters.PARENT_ID,
|
|
39
51
|
});
|
|
40
52
|
} finally {
|
|
41
53
|
await context.dispatch('LOAD_DATA_LIST');
|
|
42
54
|
}
|
|
43
55
|
},
|
|
44
56
|
ADD_ROLE_PERMISSIONS: async (context, role) => {
|
|
45
|
-
|
|
57
|
+
console.info(role);
|
|
58
|
+
const changes = [
|
|
59
|
+
{
|
|
46
60
|
grantee: +role.id,
|
|
47
61
|
grants: 'r',
|
|
48
|
-
|
|
62
|
+
}
|
|
63
|
+
];
|
|
49
64
|
try {
|
|
50
|
-
await context.dispatch('
|
|
65
|
+
await context.dispatch('PATCH_ITEM_API', {
|
|
51
66
|
changes,
|
|
67
|
+
id: context.getters.PARENT_ID,
|
|
52
68
|
});
|
|
53
69
|
} finally {
|
|
54
70
|
await context.dispatch('LOAD_DATA_LIST');
|
|
55
71
|
}
|
|
56
72
|
},
|
|
73
|
+
|
|
74
|
+
GET_LIST_API: (
|
|
75
|
+
context,
|
|
76
|
+
payload,
|
|
77
|
+
) => context.dispatch('api/GET_OBJECT_PERMISSIONS_LIST', payload),
|
|
78
|
+
PATCH_ITEM_API: (
|
|
79
|
+
context,
|
|
80
|
+
payload,
|
|
81
|
+
) => context.dispatch('api/PATCH_OBJECT_PERMISSIONS_ITEM', payload),
|
|
57
82
|
};
|
|
58
83
|
|
|
59
84
|
export default () => {
|
|
60
85
|
const filters = generateFilters();
|
|
61
86
|
|
|
62
87
|
return {
|
|
88
|
+
state: deepCopy(state),
|
|
89
|
+
getters,
|
|
63
90
|
actions,
|
|
64
91
|
modules: {
|
|
65
92
|
filters,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import apiStoreModule from '../modules/apiStoreModule/apiStoreModule.js';
|
|
2
2
|
import { createBaseStoreModule } from './createBaseStoreModule.js';
|
|
3
3
|
|
|
4
|
-
export const createApiStoreModule = (modules
|
|
4
|
+
export const createApiStoreModule = (modules) => {
|
|
5
5
|
const modulesArr = Array.isArray(modules) ? modules : [modules];
|
|
6
6
|
|
|
7
7
|
return createBaseStoreModule([apiStoreModule(), ...modulesArr]);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import baseStoreModule from '../modules/baseStoreModule/baseStoreModule.js';
|
|
2
2
|
import { createStoreModule } from './createStoreModule.js';
|
|
3
3
|
|
|
4
|
-
export const createBaseStoreModule = (modules
|
|
4
|
+
export const createBaseStoreModule = (modules) => {
|
|
5
5
|
const modulesArr = Array.isArray(modules) ? modules : [modules];
|
|
6
6
|
|
|
7
7
|
return createStoreModule([baseStoreModule(), ...modulesArr]);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import cardStoreModule from '../modules/cardStoreModule/cardStoreModule.js';
|
|
2
2
|
import { createBaseStoreModule } from './createBaseStoreModule.js';
|
|
3
3
|
|
|
4
|
-
export const createCardStoreModule = (modules
|
|
4
|
+
export const createCardStoreModule = (modules) => {
|
|
5
5
|
const modulesArr = Array.isArray(modules) ? modules : [modules];
|
|
6
6
|
|
|
7
7
|
return createBaseStoreModule([cardStoreModule(), ...modulesArr]);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import deepmerge from 'deepmerge';
|
|
2
2
|
import isPlainObject from 'lodash/isPlainObject.js';
|
|
3
3
|
|
|
4
|
-
export const createStoreModule = (modules
|
|
4
|
+
export const createStoreModule = (modules) => {
|
|
5
5
|
const modulesArr = Array.isArray(modules) ? modules : [modules];
|
|
6
6
|
|
|
7
7
|
const merged = deepmerge.all(modulesArr, {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import tableStoreModule from '../modules/tableStoreModule/tableStoreModule.js';
|
|
2
2
|
import { createBaseStoreModule } from './createBaseStoreModule.js';
|
|
3
3
|
|
|
4
|
-
export const createTableStoreModule = (modules
|
|
4
|
+
export const createTableStoreModule = (modules) => {
|
|
5
5
|
const modulesArr = Array.isArray(modules) ? modules : [modules];
|
|
6
6
|
|
|
7
7
|
return createBaseStoreModule([tableStoreModule(), ...modulesArr]);
|
|
@@ -63,6 +63,37 @@ const actions = {
|
|
|
63
63
|
id,
|
|
64
64
|
});
|
|
65
65
|
},
|
|
66
|
+
|
|
67
|
+
GET_OBJECT_PERMISSIONS_LIST: (
|
|
68
|
+
apiContext,
|
|
69
|
+
{ context: callerContext = {}, params = {} },
|
|
70
|
+
) => {
|
|
71
|
+
if (!apiContext.state.api.getList) throw Error('No API "getPermissionsList" method provided');
|
|
72
|
+
return apiContext.state.api.getPermissionsList({
|
|
73
|
+
...callerContext.state,
|
|
74
|
+
parentId: getParentIdFromContext(callerContext),
|
|
75
|
+
...params,
|
|
76
|
+
});
|
|
77
|
+
},
|
|
78
|
+
|
|
79
|
+
PATCH_OBJECT_PERMISSIONS_ITEM: (
|
|
80
|
+
apiContext,
|
|
81
|
+
{
|
|
82
|
+
context: callerContext = {},
|
|
83
|
+
id,
|
|
84
|
+
changes,
|
|
85
|
+
...rest
|
|
86
|
+
},
|
|
87
|
+
) => {
|
|
88
|
+
if (!apiContext.state.api.patch) throw Error('No API "patchPermissions" method provided');
|
|
89
|
+
return apiContext.state.api.patchPermissions({
|
|
90
|
+
...callerContext.state,
|
|
91
|
+
parentId: getParentIdFromContext(callerContext),
|
|
92
|
+
...rest,
|
|
93
|
+
id,
|
|
94
|
+
changes,
|
|
95
|
+
});
|
|
96
|
+
},
|
|
66
97
|
};
|
|
67
98
|
|
|
68
99
|
const mutations = {};
|
|
@@ -5,7 +5,9 @@ import getNamespacedState from '../../../helpers/getNamespacedState.js';
|
|
|
5
5
|
export const useCardStore = (namespace) => {
|
|
6
6
|
const store = useStore();
|
|
7
7
|
|
|
8
|
-
const cardNamespace =
|
|
8
|
+
const cardNamespace = namespace.endsWith('/card')
|
|
9
|
+
? namespace
|
|
10
|
+
: `${namespace}/card`;
|
|
9
11
|
|
|
10
12
|
const id = computed(() => getNamespacedState(store.state, cardNamespace).itemId);
|
|
11
13
|
const itemInstance = computed(() => getNamespacedState(store.state, cardNamespace).itemInstance);
|
|
@@ -19,13 +19,15 @@ const getters = {
|
|
|
19
19
|
// FIXME: maybe move to filters module?
|
|
20
20
|
FILTERS: (state, getters) => getters['filters/GET_FILTERS'],
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
REQUIRED_FIELDS: () => ['id'], // override me
|
|
23
|
+
|
|
24
|
+
FIELDS: (state, getters) => {
|
|
23
25
|
const fields = state.headers.reduce((fields, { show, field }) => {
|
|
24
26
|
if (show || show === undefined) return [...fields, field];
|
|
25
27
|
return fields;
|
|
26
28
|
}, []);
|
|
27
29
|
|
|
28
|
-
return [...new Set([
|
|
30
|
+
return [...new Set([getters.REQUIRED_FIELDS, ...fields])];
|
|
29
31
|
},
|
|
30
32
|
|
|
31
33
|
// main GET_LIST params collector
|
|
@@ -130,7 +132,10 @@ const actions = {
|
|
|
130
132
|
|
|
131
133
|
const params = context.getters.GET_LIST_PARAMS(query);
|
|
132
134
|
try {
|
|
133
|
-
const {
|
|
135
|
+
const {
|
|
136
|
+
items = [],
|
|
137
|
+
next = false,
|
|
138
|
+
} = await context.dispatch('GET_LIST_API', {
|
|
134
139
|
context,
|
|
135
140
|
params,
|
|
136
141
|
});
|
|
@@ -171,7 +176,7 @@ const actions = {
|
|
|
171
176
|
const changes = { [prop]: value };
|
|
172
177
|
|
|
173
178
|
try {
|
|
174
|
-
await context.dispatch('
|
|
179
|
+
await context.dispatch('PATCH_ITEM_API', {
|
|
175
180
|
context,
|
|
176
181
|
id,
|
|
177
182
|
etag,
|
|
@@ -208,7 +213,7 @@ const actions = {
|
|
|
208
213
|
|
|
209
214
|
DELETE_SINGLE: async (context, { id, etag }) => {
|
|
210
215
|
try {
|
|
211
|
-
await context.dispatch('
|
|
216
|
+
await context.dispatch('DELETE_ITEM_API', { context, id, etag });
|
|
212
217
|
} catch (err) {
|
|
213
218
|
throw err;
|
|
214
219
|
}
|
|
@@ -220,6 +225,16 @@ const actions = {
|
|
|
220
225
|
SET_SELECTED: (context, selected) => {
|
|
221
226
|
context.commit('SET', { path: 'selected', value: selected });
|
|
222
227
|
},
|
|
228
|
+
|
|
229
|
+
GET_LIST_API: (context, payload) => context.dispatch('api/GET_LIST', payload),
|
|
230
|
+
PATCH_ITEM_API: (
|
|
231
|
+
context,
|
|
232
|
+
payload,
|
|
233
|
+
) => context.dispatch('api/PATCH_ITEM', payload),
|
|
234
|
+
DELETE_ITEM_API: (
|
|
235
|
+
context,
|
|
236
|
+
payload,
|
|
237
|
+
) => context.dispatch('api/DELETE_ITEM', payload),
|
|
223
238
|
};
|
|
224
239
|
|
|
225
240
|
export default () => ({
|