@controleonline/ui-common 1.2.137 → 1.2.140
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.
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.2.
|
|
2
|
+
"version": "1.2.140",
|
|
3
3
|
"rc": 1,
|
|
4
|
-
"branch": "rc/1.2.
|
|
5
|
-
"baseMaster": "
|
|
6
|
-
"baseTag": "v1.2.
|
|
4
|
+
"branch": "rc/1.2.140-rc.1",
|
|
5
|
+
"baseMaster": "208f0d67142877d715cc1f2d7640cfafc8326451",
|
|
6
|
+
"baseTag": "v1.2.137",
|
|
7
7
|
"tasks": [
|
|
8
|
-
|
|
8
|
+
171,
|
|
9
|
+
180
|
|
9
10
|
],
|
|
10
11
|
"frozen": true,
|
|
11
12
|
"repositories": {
|
|
12
|
-
"ControleOnline/ui-common": "
|
|
13
|
+
"ControleOnline/ui-common": "65e6c3f3245bc019e1ee8c97a1819bb3f6a311c8"
|
|
13
14
|
}
|
|
14
15
|
}
|
package/package.json
CHANGED
|
@@ -26,182 +26,6 @@ const normalizeRuntimeMenuItem = (menu = {}) => ({
|
|
|
26
26
|
sortOrder: Number(menu?.sortOrder ?? menu?.sort_order ?? 0),
|
|
27
27
|
});
|
|
28
28
|
|
|
29
|
-
const MANAGER_RUNTIME_MENU_FALLBACK = [
|
|
30
|
-
{
|
|
31
|
-
id: 'manager-financeiro',
|
|
32
|
-
label: 'Financeiro',
|
|
33
|
-
icon: 'dollar-sign',
|
|
34
|
-
menus: [
|
|
35
|
-
{
|
|
36
|
-
id: 'financial_hub',
|
|
37
|
-
menuKey: 'financial_hub',
|
|
38
|
-
label: 'Financeiro',
|
|
39
|
-
route: 'FinancialHubPage',
|
|
40
|
-
icon: 'dollar-sign',
|
|
41
|
-
color: '#0284C7',
|
|
42
|
-
sortOrder: 10,
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
id: 'income_statement',
|
|
46
|
-
menuKey: 'income_statement',
|
|
47
|
-
label: 'Demonstrativo de resultados',
|
|
48
|
-
route: 'IncomeStatement',
|
|
49
|
-
icon: 'bar-chart-2',
|
|
50
|
-
color: '#0F766E',
|
|
51
|
-
sortOrder: 15,
|
|
52
|
-
},
|
|
53
|
-
],
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
id: 'manager-operacoes',
|
|
57
|
-
label: 'Operacoes',
|
|
58
|
-
icon: 'shopping-bag',
|
|
59
|
-
menus: [
|
|
60
|
-
{
|
|
61
|
-
id: 'orders',
|
|
62
|
-
menuKey: 'orders',
|
|
63
|
-
label: 'Pedidos',
|
|
64
|
-
route: 'OrderHistoryPage',
|
|
65
|
-
icon: 'shopping-bag',
|
|
66
|
-
color: '#0EA5E9',
|
|
67
|
-
sortOrder: 20,
|
|
68
|
-
},
|
|
69
|
-
],
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
id: 'manager-comercial',
|
|
73
|
-
label: 'Comercial',
|
|
74
|
-
icon: 'users',
|
|
75
|
-
menus: [
|
|
76
|
-
{
|
|
77
|
-
id: 'products',
|
|
78
|
-
menuKey: 'products',
|
|
79
|
-
label: 'Produtos',
|
|
80
|
-
route: 'ProductsPage',
|
|
81
|
-
icon: 'package',
|
|
82
|
-
color: '#16A34A',
|
|
83
|
-
sortOrder: 25,
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
id: 'clients',
|
|
87
|
-
menuKey: 'clients',
|
|
88
|
-
label: 'Cadastro de clientes',
|
|
89
|
-
route: 'ClientsIndex',
|
|
90
|
-
icon: 'users',
|
|
91
|
-
color: '#16A34A',
|
|
92
|
-
sortOrder: 30,
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
id: 'providers',
|
|
96
|
-
menuKey: 'providers',
|
|
97
|
-
label: 'Fornecedores',
|
|
98
|
-
route: 'ProvidersIndex',
|
|
99
|
-
icon: 'truck',
|
|
100
|
-
color: '#EA580C',
|
|
101
|
-
sortOrder: 35,
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
id: 'franchisees',
|
|
105
|
-
menuKey: 'franchisees',
|
|
106
|
-
label: 'Cadastro de franquias',
|
|
107
|
-
route: 'FranchiseesIndex',
|
|
108
|
-
icon: 'map-pin',
|
|
109
|
-
color: '#0EA5E9',
|
|
110
|
-
sortOrder: 40,
|
|
111
|
-
},
|
|
112
|
-
],
|
|
113
|
-
},
|
|
114
|
-
{
|
|
115
|
-
id: 'manager-configuracoes',
|
|
116
|
-
label: 'Configuracoes',
|
|
117
|
-
icon: 'settings',
|
|
118
|
-
menus: [
|
|
119
|
-
{
|
|
120
|
-
id: 'devices',
|
|
121
|
-
menuKey: 'devices',
|
|
122
|
-
label: 'Dispositivos',
|
|
123
|
-
route: 'DevicesIndex',
|
|
124
|
-
icon: 'credit-card',
|
|
125
|
-
color: '#e67e22',
|
|
126
|
-
sortOrder: 50,
|
|
127
|
-
},
|
|
128
|
-
{
|
|
129
|
-
id: 'configurator',
|
|
130
|
-
menuKey: 'configurator',
|
|
131
|
-
label: 'Configurador',
|
|
132
|
-
route: 'ConfiguratorPage',
|
|
133
|
-
icon: 'settings',
|
|
134
|
-
color: '#64748B',
|
|
135
|
-
sortOrder: 60,
|
|
136
|
-
},
|
|
137
|
-
{
|
|
138
|
-
id: 'product_showcases',
|
|
139
|
-
menuKey: 'product_showcases',
|
|
140
|
-
label: 'Vitrines de preços',
|
|
141
|
-
route: 'ProductShowcasesPage',
|
|
142
|
-
icon: 'grid',
|
|
143
|
-
color: '#0F766E',
|
|
144
|
-
sortOrder: 65,
|
|
145
|
-
},
|
|
146
|
-
],
|
|
147
|
-
},
|
|
148
|
-
];
|
|
149
|
-
|
|
150
|
-
const ADMIN_RUNTIME_MENU_FALLBACK = [
|
|
151
|
-
{
|
|
152
|
-
id: 'admin-configuracoes',
|
|
153
|
-
label: 'Configuracoes',
|
|
154
|
-
icon: 'settings',
|
|
155
|
-
menus: [
|
|
156
|
-
{
|
|
157
|
-
id: 'menu_access',
|
|
158
|
-
menuKey: 'menu_access',
|
|
159
|
-
label: 'Menus por perfil',
|
|
160
|
-
route: 'MenuAccessConfigPage',
|
|
161
|
-
icon: 'list',
|
|
162
|
-
color: '#64748B',
|
|
163
|
-
sortOrder: 10,
|
|
164
|
-
},
|
|
165
|
-
{
|
|
166
|
-
id: 'test_results',
|
|
167
|
-
menuKey: 'test_results',
|
|
168
|
-
label: 'Resultados de testes',
|
|
169
|
-
route: 'TestsPlaygroundPage',
|
|
170
|
-
icon: 'clipboard',
|
|
171
|
-
color: '#0EA5E9',
|
|
172
|
-
sortOrder: 20,
|
|
173
|
-
},
|
|
174
|
-
{
|
|
175
|
-
id: 'tenancies',
|
|
176
|
-
menuKey: 'tenancies',
|
|
177
|
-
label: 'Tenancies',
|
|
178
|
-
route: 'TenanciesPage',
|
|
179
|
-
icon: 'server',
|
|
180
|
-
color: '#0F766E',
|
|
181
|
-
sortOrder: 25,
|
|
182
|
-
},
|
|
183
|
-
{
|
|
184
|
-
id: 'people_domains',
|
|
185
|
-
menuKey: 'people_domains',
|
|
186
|
-
label: 'Domínios',
|
|
187
|
-
route: 'PeopleDomainsPage',
|
|
188
|
-
icon: 'globe',
|
|
189
|
-
color: '#0EA5E9',
|
|
190
|
-
sortOrder: 30,
|
|
191
|
-
},
|
|
192
|
-
{
|
|
193
|
-
id: 'flowcharts',
|
|
194
|
-
menuKey: 'flowcharts',
|
|
195
|
-
label: 'Fluxogramas',
|
|
196
|
-
route: 'FlowchartsPage',
|
|
197
|
-
icon: 'git-branch',
|
|
198
|
-
color: '#0F766E',
|
|
199
|
-
sortOrder: 40,
|
|
200
|
-
},
|
|
201
|
-
],
|
|
202
|
-
},
|
|
203
|
-
];
|
|
204
|
-
|
|
205
29
|
const cloneRuntimeMenuModules = modules =>
|
|
206
30
|
(Array.isArray(modules) ? modules : []).map(module => ({
|
|
207
31
|
...module,
|
|
@@ -226,10 +50,7 @@ const resolveRuntimeModuleSortOrder = module => {
|
|
|
226
50
|
return 0;
|
|
227
51
|
};
|
|
228
52
|
|
|
229
|
-
export const normalizeRuntimeMenuResponse =
|
|
230
|
-
result,
|
|
231
|
-
{appType, allowFallback = true} = {},
|
|
232
|
-
) => {
|
|
53
|
+
export const normalizeRuntimeMenuResponse = result => {
|
|
233
54
|
const modules =
|
|
234
55
|
result?.response?.data?.modules ||
|
|
235
56
|
result?.data?.modules ||
|
|
@@ -260,16 +81,6 @@ export const normalizeRuntimeMenuResponse = (
|
|
|
260
81
|
return normalizedModules;
|
|
261
82
|
}
|
|
262
83
|
|
|
263
|
-
const normalizedAppType = String(appType || '').trim().toUpperCase();
|
|
264
|
-
|
|
265
|
-
if (allowFallback && normalizedAppType === 'MANAGER') {
|
|
266
|
-
return cloneRuntimeMenuModules(MANAGER_RUNTIME_MENU_FALLBACK);
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
if (allowFallback && normalizedAppType === 'ADMIN') {
|
|
270
|
-
return cloneRuntimeMenuModules(ADMIN_RUNTIME_MENU_FALLBACK);
|
|
271
|
-
}
|
|
272
|
-
|
|
273
84
|
return [];
|
|
274
85
|
};
|
|
275
86
|
|
|
@@ -153,106 +153,15 @@ describe('runtimeMenu', () => {
|
|
|
153
153
|
).toEqual(['ToolbarPage']);
|
|
154
154
|
});
|
|
155
155
|
|
|
156
|
-
it('
|
|
157
|
-
const menus = normalizeRuntimeMenuResponse({}, {appType: 'MANAGER'});
|
|
158
|
-
|
|
159
|
-
expect(menus).toHaveLength(4);
|
|
160
|
-
expect(menus.map(module => module.label)).toEqual([
|
|
161
|
-
'Financeiro',
|
|
162
|
-
'Operacoes',
|
|
163
|
-
'Comercial',
|
|
164
|
-
'Configuracoes',
|
|
165
|
-
]);
|
|
166
|
-
expect(menus[0].menus[0]).toMatchObject({
|
|
167
|
-
label: 'Financeiro',
|
|
168
|
-
menuKey: 'financial_hub',
|
|
169
|
-
route: 'FinancialHubPage',
|
|
170
|
-
menuType: 'home',
|
|
171
|
-
});
|
|
172
|
-
expect(menus[0].menus[1]).toMatchObject({
|
|
173
|
-
label: 'Demonstrativo de resultados',
|
|
174
|
-
menuKey: 'income_statement',
|
|
175
|
-
route: 'IncomeStatement',
|
|
176
|
-
});
|
|
177
|
-
expect(menus[1].menus[0]).toMatchObject({
|
|
178
|
-
label: 'Pedidos',
|
|
179
|
-
menuKey: 'orders',
|
|
180
|
-
route: 'OrderHistoryPage',
|
|
181
|
-
});
|
|
182
|
-
expect(menus[2].menus[0]).toMatchObject({
|
|
183
|
-
label: 'Produtos',
|
|
184
|
-
menuKey: 'products',
|
|
185
|
-
route: 'ProductsPage',
|
|
186
|
-
});
|
|
187
|
-
expect(menus[2].menus[1]).toMatchObject({
|
|
188
|
-
label: 'Cadastro de clientes',
|
|
189
|
-
menuKey: 'clients',
|
|
190
|
-
route: 'ClientsIndex',
|
|
191
|
-
});
|
|
192
|
-
expect(menus[2].menus[2]).toMatchObject({
|
|
193
|
-
label: 'Fornecedores',
|
|
194
|
-
menuKey: 'providers',
|
|
195
|
-
route: 'ProvidersIndex',
|
|
196
|
-
});
|
|
197
|
-
expect(menus[2].menus[3]).toMatchObject({
|
|
198
|
-
label: 'Cadastro de franquias',
|
|
199
|
-
menuKey: 'franchisees',
|
|
200
|
-
route: 'FranchiseesIndex',
|
|
201
|
-
});
|
|
202
|
-
expect(menus[3].menus.map(item => item.route)).toEqual([
|
|
203
|
-
'DevicesIndex',
|
|
204
|
-
'ConfiguratorPage',
|
|
205
|
-
'ProductShowcasesPage',
|
|
206
|
-
]);
|
|
207
|
-
});
|
|
208
|
-
|
|
209
|
-
it('falls back to the admin starter menu when the runtime menu is empty', () => {
|
|
210
|
-
const menus = normalizeRuntimeMenuResponse({}, {appType: 'ADMIN'});
|
|
211
|
-
|
|
212
|
-
expect(menus).toHaveLength(1);
|
|
213
|
-
expect(menus[0].label).toBe('Configuracoes');
|
|
214
|
-
expect(menus[0].menus).toHaveLength(5);
|
|
215
|
-
expect(menus[0].menus[0]).toMatchObject({
|
|
216
|
-
label: 'Menus por perfil',
|
|
217
|
-
menuKey: 'menu_access',
|
|
218
|
-
route: 'MenuAccessConfigPage',
|
|
219
|
-
menuType: 'home',
|
|
220
|
-
});
|
|
221
|
-
expect(menus[0].menus[1]).toMatchObject({
|
|
222
|
-
label: 'Resultados de testes',
|
|
223
|
-
menuKey: 'test_results',
|
|
224
|
-
route: 'TestsPlaygroundPage',
|
|
225
|
-
menuType: 'home',
|
|
226
|
-
});
|
|
227
|
-
expect(menus[0].menus[2]).toMatchObject({
|
|
228
|
-
label: 'Tenancies',
|
|
229
|
-
menuKey: 'tenancies',
|
|
230
|
-
route: 'TenanciesPage',
|
|
231
|
-
menuType: 'home',
|
|
232
|
-
});
|
|
233
|
-
expect(menus[0].menus[3]).toMatchObject({
|
|
234
|
-
label: 'Domínios',
|
|
235
|
-
menuKey: 'people_domains',
|
|
236
|
-
route: 'PeopleDomainsPage',
|
|
237
|
-
menuType: 'home',
|
|
238
|
-
});
|
|
239
|
-
expect(menus[0].menus[4]).toMatchObject({
|
|
240
|
-
label: 'Fluxogramas',
|
|
241
|
-
menuKey: 'flowcharts',
|
|
242
|
-
route: 'FlowchartsPage',
|
|
243
|
-
menuType: 'home',
|
|
244
|
-
});
|
|
245
|
-
});
|
|
246
|
-
|
|
247
|
-
it('does not invent a fallback menu for non-manager apps', () => {
|
|
156
|
+
it('does not invent a fallback menu for the admin app', () => {
|
|
248
157
|
expect(
|
|
249
|
-
normalizeRuntimeMenuResponse({}, {appType: '
|
|
158
|
+
normalizeRuntimeMenuResponse({}, {appType: 'ADMIN'}),
|
|
250
159
|
).toEqual([]);
|
|
251
160
|
});
|
|
252
161
|
|
|
253
|
-
it('
|
|
162
|
+
it('does not invent a fallback menu for non-manager apps', () => {
|
|
254
163
|
expect(
|
|
255
|
-
normalizeRuntimeMenuResponse({}, {appType: '
|
|
164
|
+
normalizeRuntimeMenuResponse({}, {appType: 'SHOP'}),
|
|
256
165
|
).toEqual([]);
|
|
257
166
|
});
|
|
258
167
|
});
|