complexqa_frontend_core 1.18.2 → 1.18.4
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 +1 -1
- package/publish/app_configuration/table/sections/execution_context.js +9 -2
- package/publish/types/core/0_familyGeneralElement.js +67 -0
- package/publish/types/core/1_familyContext.js +50 -0
- package/publish/types/core/type_class_resolver.js +38 -0
- package/publish/types/family_context/typeBrowserContext.js +4 -0
- package/publish/types/family_context/typeDeploymentTargetContext.js +4 -0
- package/publish/types/family_context/typeDeviceContext.js +4 -0
- package/publish/types/family_context/typeExecutionContext.js +6 -6
- package/publish/types/family_context/typeLocaleContext.js +4 -0
- package/publish/types/family_context/typeOsContext.js +4 -0
- package/publish/types/family_context/typeScreenResolutionContext.js +4 -0
package/package.json
CHANGED
|
@@ -19,7 +19,7 @@ function build_execution_context_listing_columns(locale)
|
|
|
19
19
|
return [
|
|
20
20
|
createPrimaryKeyColumn(model, locale, { is_editable: false }),
|
|
21
21
|
createColumn(model, locale, 'context_title', { width: '420', is_editable: true, is_required: false }),
|
|
22
|
-
...FK_FIELDS.map((field) => createColumn(model, locale, field, { width: '200', is_editable:
|
|
22
|
+
...FK_FIELDS.map((field) => createColumn(model, locale, field, { width: '200', is_editable: true })),
|
|
23
23
|
createColumn(model, locale, 'protocol', { width: '120', is_editable: true }),
|
|
24
24
|
createColumn(model, locale, 'host', { width: '200', is_editable: true }),
|
|
25
25
|
createColumn(model, locale, 'build_version', { width: '160', is_editable: true }),
|
|
@@ -46,7 +46,14 @@ function build_execution_context_details_columns(locale)
|
|
|
46
46
|
'updated_at',
|
|
47
47
|
];
|
|
48
48
|
|
|
49
|
-
const editableFields = new Set([
|
|
49
|
+
const editableFields = new Set([
|
|
50
|
+
'context_title',
|
|
51
|
+
...FK_FIELDS,
|
|
52
|
+
'protocol',
|
|
53
|
+
'host',
|
|
54
|
+
'base_url',
|
|
55
|
+
'build_version',
|
|
56
|
+
]);
|
|
50
57
|
|
|
51
58
|
return fields.map((field, index) => createColumn(model, locale, field, {
|
|
52
59
|
sort_order : String(index + 1),
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { clone_object, echo, in_array, is_array } from "../../utils/utils.js";
|
|
2
|
+
import { is_type_class_token, resolve_type_class } from "./type_class_resolver.js";
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Базовый абстрактный класс для всех типов
|
|
@@ -156,6 +157,72 @@ export class familyGeneralElement
|
|
|
156
157
|
}
|
|
157
158
|
|
|
158
159
|
|
|
160
|
+
/**
|
|
161
|
+
* Токен целевого типа для FK/reference-атрибута (`typeBrowserContext`, …).
|
|
162
|
+
*
|
|
163
|
+
* @param {string} attribute
|
|
164
|
+
* @returns {string|false}
|
|
165
|
+
*/
|
|
166
|
+
get_attribute_reference_type_token(attribute)
|
|
167
|
+
{
|
|
168
|
+
const scheme = this.get_attribute_structure_scheme(attribute);
|
|
169
|
+
|
|
170
|
+
if (!scheme)
|
|
171
|
+
{
|
|
172
|
+
return false;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
for (const rule of scheme)
|
|
176
|
+
{
|
|
177
|
+
if (!is_type_class_token(rule))
|
|
178
|
+
{
|
|
179
|
+
continue;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
const TypeClass = resolve_type_class(rule);
|
|
183
|
+
const probe = new TypeClass();
|
|
184
|
+
|
|
185
|
+
if (typeof probe.get_reference_meta === 'function')
|
|
186
|
+
{
|
|
187
|
+
return rule;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
return false;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* @param {string} attribute
|
|
197
|
+
* @returns {boolean}
|
|
198
|
+
*/
|
|
199
|
+
is_reference_attribute(attribute)
|
|
200
|
+
{
|
|
201
|
+
return Boolean(this.get_attribute_reference_type_token(attribute));
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Метаданные reference из целевого типа (api, primary_key, search, scope_filters).
|
|
207
|
+
*
|
|
208
|
+
* @param {string} attribute
|
|
209
|
+
* @returns {object|false}
|
|
210
|
+
*/
|
|
211
|
+
get_attribute_reference_meta(attribute)
|
|
212
|
+
{
|
|
213
|
+
const token = this.get_attribute_reference_type_token(attribute);
|
|
214
|
+
|
|
215
|
+
if (!token)
|
|
216
|
+
{
|
|
217
|
+
return false;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
const TypeClass = resolve_type_class(token);
|
|
221
|
+
|
|
222
|
+
return new TypeClass().get_reference_meta();
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
|
|
159
226
|
/**
|
|
160
227
|
*
|
|
161
228
|
* @version v.0.1 (26/05/2024)
|
|
@@ -31,6 +31,23 @@ export class familyContext extends familyGeneralElement
|
|
|
31
31
|
*/
|
|
32
32
|
context_axis = false;
|
|
33
33
|
|
|
34
|
+
/** @type {'reference'} */
|
|
35
|
+
static reference_api_namespace = 'reference';
|
|
36
|
+
|
|
37
|
+
static reference_label_key = 'context_name';
|
|
38
|
+
|
|
39
|
+
static reference_search = {
|
|
40
|
+
attribute: 'context_name',
|
|
41
|
+
operator : 'LIKE',
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
static reference_scope_filters = [ 'project_id' ];
|
|
45
|
+
|
|
46
|
+
reference_api_namespace = familyContext.reference_api_namespace;
|
|
47
|
+
reference_label_key = familyContext.reference_label_key;
|
|
48
|
+
reference_search = familyContext.reference_search;
|
|
49
|
+
reference_scope_filters = familyContext.reference_scope_filters;
|
|
50
|
+
|
|
34
51
|
available_enum_values = familyContext.get_base_available_enum_values();
|
|
35
52
|
|
|
36
53
|
enum_value_translate_matrix = familyContext.get_base_enum_value_translate_matrix();
|
|
@@ -78,6 +95,39 @@ export class familyContext extends familyGeneralElement
|
|
|
78
95
|
}
|
|
79
96
|
|
|
80
97
|
|
|
98
|
+
/**
|
|
99
|
+
* Метаданные для live search / выбора записи справочника как FK.
|
|
100
|
+
*
|
|
101
|
+
* @returns {object|false}
|
|
102
|
+
*/
|
|
103
|
+
get_reference_meta()
|
|
104
|
+
{
|
|
105
|
+
if (!this.reference_api_key)
|
|
106
|
+
{
|
|
107
|
+
return false;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
return {
|
|
111
|
+
type_token : this.constructor.name,
|
|
112
|
+
api_namespace : this.reference_api_namespace,
|
|
113
|
+
api_key : this.reference_api_key,
|
|
114
|
+
primary_key : this.primary_key,
|
|
115
|
+
label_key : this.reference_label_key,
|
|
116
|
+
search : { ...this.reference_search },
|
|
117
|
+
scope_filters : [ ...this.reference_scope_filters ],
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* @returns {string}
|
|
124
|
+
*/
|
|
125
|
+
get_element_name()
|
|
126
|
+
{
|
|
127
|
+
return this.context_name || String(this?.[ this.primary_key ] ?? '');
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
|
|
81
131
|
/**
|
|
82
132
|
* Общие поля записи справочника (добавляются в structure_scheme наследников).
|
|
83
133
|
*
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Реестр токен → класс. Заполняется из файлов типов через register_type_class().
|
|
3
|
+
* Метаданные reference живут в классе; здесь только резолв имени.
|
|
4
|
+
*
|
|
5
|
+
* @type {Object<string, typeof import('./0_familyGeneralElement.js').familyGeneralElement>}
|
|
6
|
+
*/
|
|
7
|
+
export const TYPE_CLASS_MAP = {};
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @param {string} token
|
|
12
|
+
* @param {typeof import('./0_familyGeneralElement.js').familyGeneralElement} TypeClass
|
|
13
|
+
* @returns {void}
|
|
14
|
+
*/
|
|
15
|
+
export function register_type_class(token, TypeClass)
|
|
16
|
+
{
|
|
17
|
+
TYPE_CLASS_MAP[ token ] = TypeClass;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* @param {string} token
|
|
23
|
+
* @returns {typeof import('./0_familyGeneralElement.js').familyGeneralElement|false}
|
|
24
|
+
*/
|
|
25
|
+
export function resolve_type_class(token)
|
|
26
|
+
{
|
|
27
|
+
return TYPE_CLASS_MAP?.[ token ] || false;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* @param {string} rule
|
|
33
|
+
* @returns {boolean}
|
|
34
|
+
*/
|
|
35
|
+
export function is_type_class_token(rule)
|
|
36
|
+
{
|
|
37
|
+
return typeof rule === 'string' && rule.startsWith('type') && Boolean(TYPE_CLASS_MAP?.[ rule ]);
|
|
38
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { familyContext } from "../core/1_familyContext.js";
|
|
2
2
|
import { is_object } from "../../utils/utils.js";
|
|
3
|
+
import { register_type_class } from "../core/type_class_resolver.js";
|
|
3
4
|
|
|
4
5
|
|
|
5
6
|
/**
|
|
@@ -19,6 +20,7 @@ export class typeBrowserContext extends familyContext
|
|
|
19
20
|
|
|
20
21
|
primary_key = 'browser_context_id';
|
|
21
22
|
api_key = 'browser_context';
|
|
23
|
+
reference_api_key = 'context_browser';
|
|
22
24
|
|
|
23
25
|
structure_scheme = {
|
|
24
26
|
browser_context_id: 'integer | require',
|
|
@@ -57,3 +59,5 @@ export class typeBrowserContext extends familyContext
|
|
|
57
59
|
return this;
|
|
58
60
|
}
|
|
59
61
|
}
|
|
62
|
+
|
|
63
|
+
register_type_class('typeBrowserContext', typeBrowserContext);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { familyContext } from "../core/1_familyContext.js";
|
|
2
2
|
import { is_object } from "../../utils/utils.js";
|
|
3
|
+
import { register_type_class } from "../core/type_class_resolver.js";
|
|
3
4
|
|
|
4
5
|
|
|
5
6
|
/**
|
|
@@ -19,6 +20,7 @@ export class typeDeploymentTargetContext extends familyContext
|
|
|
19
20
|
|
|
20
21
|
primary_key = 'deployment_target_context_id';
|
|
21
22
|
api_key = 'deployment_target_context';
|
|
23
|
+
reference_api_key = 'context_deployment_target';
|
|
22
24
|
|
|
23
25
|
structure_scheme = {
|
|
24
26
|
deployment_target_context_id: 'integer | require',
|
|
@@ -96,3 +98,5 @@ export class typeDeploymentTargetContext extends familyContext
|
|
|
96
98
|
return this;
|
|
97
99
|
}
|
|
98
100
|
}
|
|
101
|
+
|
|
102
|
+
register_type_class('typeDeploymentTargetContext', typeDeploymentTargetContext);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { familyContext } from "../core/1_familyContext.js";
|
|
2
2
|
import { is_object } from "../../utils/utils.js";
|
|
3
|
+
import { register_type_class } from "../core/type_class_resolver.js";
|
|
3
4
|
|
|
4
5
|
|
|
5
6
|
/**
|
|
@@ -19,6 +20,7 @@ export class typeDeviceContext extends familyContext
|
|
|
19
20
|
|
|
20
21
|
primary_key = 'device_context_id';
|
|
21
22
|
api_key = 'device_context';
|
|
23
|
+
reference_api_key = 'context_devices';
|
|
22
24
|
|
|
23
25
|
structure_scheme = {
|
|
24
26
|
device_context_id: 'integer | require',
|
|
@@ -84,3 +86,5 @@ export class typeDeviceContext extends familyContext
|
|
|
84
86
|
return this;
|
|
85
87
|
}
|
|
86
88
|
}
|
|
89
|
+
|
|
90
|
+
register_type_class('typeDeviceContext', typeDeviceContext);
|
|
@@ -42,12 +42,12 @@ export class typeExecutionContext extends familyGeneralElement
|
|
|
42
42
|
team_id : 'integer | require',
|
|
43
43
|
context_title : 'string | optional',
|
|
44
44
|
context_description : 'string | StringHtml | optional',
|
|
45
|
-
browser_context_id : 'integer | optional',
|
|
46
|
-
os_context_id : 'integer | optional',
|
|
47
|
-
screen_resolution_context_id: 'integer | optional',
|
|
48
|
-
device_context_id : 'integer | optional',
|
|
49
|
-
locale_context_id : 'integer | optional',
|
|
50
|
-
deployment_target_context_id: 'integer | optional',
|
|
45
|
+
browser_context_id : 'integer | typeBrowserContext | optional',
|
|
46
|
+
os_context_id : 'integer | typeOsContext | optional',
|
|
47
|
+
screen_resolution_context_id: 'integer | typeScreenResolutionContext | optional',
|
|
48
|
+
device_context_id : 'integer | typeDeviceContext | optional',
|
|
49
|
+
locale_context_id : 'integer | typeLocaleContext | optional',
|
|
50
|
+
deployment_target_context_id: 'integer | typeDeploymentTargetContext | optional',
|
|
51
51
|
protocol : 'string | enum | optional',
|
|
52
52
|
host : 'string | max:255 | optional',
|
|
53
53
|
base_url : 'string | max:2048 | optional',
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { familyContext } from "../core/1_familyContext.js";
|
|
2
2
|
import { is_object } from "../../utils/utils.js";
|
|
3
|
+
import { register_type_class } from "../core/type_class_resolver.js";
|
|
3
4
|
|
|
4
5
|
|
|
5
6
|
/**
|
|
@@ -21,6 +22,7 @@ export class typeLocaleContext extends familyContext
|
|
|
21
22
|
|
|
22
23
|
primary_key = 'locale_context_id';
|
|
23
24
|
api_key = 'locale_context';
|
|
25
|
+
reference_api_key = 'context_locale';
|
|
24
26
|
|
|
25
27
|
structure_scheme = {
|
|
26
28
|
locale_context_id: 'integer | require',
|
|
@@ -73,3 +75,5 @@ export class typeLocaleContext extends familyContext
|
|
|
73
75
|
return this;
|
|
74
76
|
}
|
|
75
77
|
}
|
|
78
|
+
|
|
79
|
+
register_type_class('typeLocaleContext', typeLocaleContext);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { familyContext } from "../core/1_familyContext.js";
|
|
2
2
|
import { is_object } from "../../utils/utils.js";
|
|
3
|
+
import { register_type_class } from "../core/type_class_resolver.js";
|
|
3
4
|
|
|
4
5
|
|
|
5
6
|
/**
|
|
@@ -19,6 +20,7 @@ export class typeOsContext extends familyContext
|
|
|
19
20
|
|
|
20
21
|
primary_key = 'os_context_id';
|
|
21
22
|
api_key = 'os_context';
|
|
23
|
+
reference_api_key = 'context_os';
|
|
22
24
|
|
|
23
25
|
structure_scheme = {
|
|
24
26
|
os_context_id: 'integer | require',
|
|
@@ -84,3 +86,5 @@ export class typeOsContext extends familyContext
|
|
|
84
86
|
return this;
|
|
85
87
|
}
|
|
86
88
|
}
|
|
89
|
+
|
|
90
|
+
register_type_class('typeOsContext', typeOsContext);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { familyContext } from "../core/1_familyContext.js";
|
|
2
2
|
import { is_object } from "../../utils/utils.js";
|
|
3
|
+
import { register_type_class } from "../core/type_class_resolver.js";
|
|
3
4
|
|
|
4
5
|
|
|
5
6
|
/**
|
|
@@ -23,6 +24,7 @@ export class typeScreenResolutionContext extends familyContext
|
|
|
23
24
|
|
|
24
25
|
primary_key = 'screen_resolution_context_id';
|
|
25
26
|
api_key = 'screen_resolution_context';
|
|
27
|
+
reference_api_key = 'context_screen_resolution';
|
|
26
28
|
|
|
27
29
|
structure_scheme = {
|
|
28
30
|
screen_resolution_context_id: 'integer | require',
|
|
@@ -97,3 +99,5 @@ export class typeScreenResolutionContext extends familyContext
|
|
|
97
99
|
return this;
|
|
98
100
|
}
|
|
99
101
|
}
|
|
102
|
+
|
|
103
|
+
register_type_class('typeScreenResolutionContext', typeScreenResolutionContext);
|