complexqa_frontend_core 1.16.3 → 1.17.2

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.
@@ -0,0 +1,70 @@
1
+ import { typeTestRunResult } from '../../../types/family_elements/typeTestRunResult.js';
2
+ import { typeTestCase } from '../../../types/family_elements/typeTestCase.js';
3
+ import { UserService } from '../../../services/UserService.js';
4
+ import { createColumn, createGoToColumn, createRowSelectColumn } from '../helpers/column_factory.js';
5
+ import { createListingFor, registerSection } from '../helpers/section_registry.js';
6
+
7
+ function build_test_run_result_listing_columns(locale, { include_select = true } = {})
8
+ {
9
+ const model = new typeTestRunResult();
10
+ const test_case_model = new typeTestCase();
11
+ const columns = [];
12
+
13
+ if (include_select)
14
+ {
15
+ columns.push(createRowSelectColumn());
16
+ }
17
+
18
+ columns.push(createColumn(model, locale, 'test_case_id.test_case_title', {
19
+ header_name : test_case_model.get_attribute_name_translate('test_case_title', locale),
20
+ width : '480',
21
+ is_editable : false,
22
+ is_required : true,
23
+ }));
24
+ columns.push(createColumn(model, locale, 'assigned_to', { width: '220', is_editable: true, is_required: true }));
25
+ columns.push(createColumn(model, locale, 'created_at', { width: '200', is_required: true }));
26
+ columns.push(createColumn(model, locale, 'updated_at', { width: '200', is_required: true }));
27
+ columns.push(createColumn(model, locale, 'completed_at', { width: '200', is_required: true }));
28
+ columns.push(createColumn(model, locale, 'test_result_status', { width: '150', is_editable: true, is_required: true }));
29
+ columns.push(createGoToColumn(model, locale));
30
+
31
+ return columns;
32
+ }
33
+
34
+
35
+ function build_test_run_result_details_columns(locale)
36
+ {
37
+ const model = new typeTestRunResult();
38
+ const fields = [
39
+ 'test_case_id',
40
+ 'test_run_id',
41
+ 'test_result_status',
42
+ 'assigned_to',
43
+ 'created_at',
44
+ 'updated_at',
45
+ 'completed_at',
46
+ ];
47
+
48
+ return fields.map((field, index) => createColumn(model, locale, field, {
49
+ sort_order : String(index + 1),
50
+ is_editable : ![ 'test_case_id', 'test_run_id', 'created_at', 'updated_at', 'completed_at' ].includes(field),
51
+ is_sortable : false,
52
+ is_filter : false,
53
+ }));
54
+ }
55
+
56
+
57
+ export function bootstrap_test_run_result(config)
58
+ {
59
+ const locale = UserService.get_current_language();
60
+
61
+ registerSection(config, 'test_run_result', 'listing', build_test_run_result_listing_columns(locale), {
62
+ for: createListingFor([ 'project_id', 'test_case_id', 'test_run_id' ]),
63
+ });
64
+
65
+ registerSection(config, 'test_run_result', 'todo', build_test_run_result_listing_columns(locale, { include_select: false }), {
66
+ contained_element_type: 'project',
67
+ });
68
+
69
+ registerSection(config, 'test_run_result', 'details', build_test_run_result_details_columns(locale));
70
+ }
@@ -0,0 +1,25 @@
1
+ import { typeUser } from '../../../types/family_elements/typeUser.js';
2
+ import { UserService } from '../../../services/UserService.js';
3
+ import { createColumn } from '../helpers/column_factory.js';
4
+ import { registerSection } from '../helpers/section_registry.js';
5
+
6
+ function build_user_profile_columns(locale)
7
+ {
8
+ const model = new typeUser();
9
+ const fields = [ 'first_name', 'last_name', 'email' ];
10
+
11
+ return fields.map((field, index) => createColumn(model, locale, field, {
12
+ sort_order : String(index + 1),
13
+ is_editable : field !== 'email',
14
+ is_sortable : false,
15
+ is_filter : false,
16
+ }));
17
+ }
18
+
19
+
20
+ export function bootstrap_user(config)
21
+ {
22
+ const locale = UserService.get_current_language();
23
+
24
+ registerSection(config, 'user', 'profile', build_user_profile_columns(locale));
25
+ }
@@ -0,0 +1,124 @@
1
+ import { LOCALE_AG_GRID_RU } from '../locale_table_ru.js';
2
+ import { LOCALE_AG_GRID_EG } from '../table_locale_ar.js';
3
+ import { typeTestCase } from '../../types/family_elements/typeTestCase.js';
4
+ import { typeProject } from '../../types/family_elements/typeProject.js';
5
+ import { typeTestRun } from '../../types/family_elements/typeTestRun.js';
6
+ import { typeBug } from '../../types/family_elements/typeBug.js';
7
+ import { typeTestRunResult } from '../../types/family_elements/typeTestRunResult.js';
8
+ import { typeTestAccount } from '../../types/family_elements/typeTestAccount.js';
9
+ import { typeTeamMember } from '../../types/family_elements/typeTeamMember.js';
10
+ import { typeTestCaseStep } from '../../types/family_elements/typeTestCaseStep.js';
11
+ import { typeUser } from '../../types/family_elements/typeUser.js';
12
+ import { typeTeam } from '../../types/family_elements/typeTeam.js';
13
+
14
+ const ROW_NODE_MODELS = {
15
+ test_case : typeTestCase,
16
+ project : typeProject,
17
+ test_run : typeTestRun,
18
+ bug : typeBug,
19
+ test_run_result : typeTestRunResult,
20
+ test_account : typeTestAccount,
21
+ team_member : typeTeamMember,
22
+ test_case_step : typeTestCaseStep,
23
+ user : typeUser,
24
+ team : typeTeam,
25
+ };
26
+
27
+ /**
28
+ * Базовые опции ag-grid, общие для всех таблиц.
29
+ *
30
+ * @version v.0.2 (12/06/2026)
31
+ */
32
+ export class TableBaseConfig
33
+ {
34
+ /**
35
+ * @param {string} element_type
36
+ * @param {string} section
37
+ * @param {string} lang
38
+ */
39
+ static get_config(element_type, section, lang)
40
+ {
41
+ let response = this.config;
42
+
43
+ response.getRowNodeId = this.#getRowNodeId(element_type);
44
+
45
+ if (lang !== 'en')
46
+ {
47
+ response.localeText = TableBaseConfig.#localeText(lang);
48
+ }
49
+
50
+ return response;
51
+ }
52
+
53
+
54
+ /**
55
+ * @param lang
56
+ * @returns {{}}
57
+ */
58
+ static #localeText(lang)
59
+ {
60
+ let response = {};
61
+ switch (lang)
62
+ {
63
+ case 'ru':
64
+ response = LOCALE_AG_GRID_RU;
65
+ break;
66
+ case 'ar':
67
+ response = LOCALE_AG_GRID_EG;
68
+ break;
69
+ }
70
+
71
+ return response;
72
+ }
73
+
74
+
75
+ /**
76
+ * @param element_type
77
+ * @returns {function(*): number}
78
+ */
79
+ static #getRowNodeId(element_type)
80
+ {
81
+ return function (data)
82
+ {
83
+ let id = 0;
84
+ const ModelClass = ROW_NODE_MODELS[ element_type ];
85
+
86
+ if (ModelClass)
87
+ {
88
+ const model = new ModelClass();
89
+ const key = model.get_primary_key();
90
+
91
+ if (data?.[ key ])
92
+ {
93
+ id = data[ key ];
94
+ }
95
+ }
96
+
97
+ return id;
98
+ };
99
+ }
100
+
101
+
102
+ static config = {
103
+ defaultColDef: {
104
+ filter : true,
105
+ sortable : true,
106
+ resizable: true,
107
+ editable : false,
108
+ },
109
+ suppressMenuHide : true,
110
+ columnHoverHighlight : false,
111
+ enableBrowserTooltips : false,
112
+ rowSelection : 'multiple',
113
+ rowMultiSelectWithClick : false,
114
+ suppressRowClickSelection: true,
115
+ enableRangeSelection : true,
116
+ headerHeight: '44',
117
+ rowHeight : '44',
118
+ groupIncludeFooter : false,
119
+ groupIncludeTotalFooter: false,
120
+ overlayLoadingTemplate : '<span class="ag-overlay-loading-center">wait</span>',
121
+ overlayNoRowsTemplate : '<span class="ag-overlay-loading-center">no data</span>',
122
+ suppressNoRowsOverlay : false,
123
+ };
124
+ }
@@ -0,0 +1,88 @@
1
+ import { abstractAppConfiguration } from '../abstract_app_configuration.js';
2
+ import { bootstrap_bug } from './sections/bug.js';
3
+ import { bootstrap_test_case } from './sections/test_case.js';
4
+ import { bootstrap_test_case_step } from './sections/test_case_step.js';
5
+ import { bootstrap_test_run } from './sections/test_run.js';
6
+ import { bootstrap_test_run_result } from './sections/test_run_result.js';
7
+ import { bootstrap_test_account } from './sections/test_account.js';
8
+ import { bootstrap_team_member } from './sections/team_member.js';
9
+ import { bootstrap_user } from './sections/user.js';
10
+ import { bootstrap_team } from './sections/team.js';
11
+ import { bootstrap_project } from './sections/project.js';
12
+
13
+ /**
14
+ * Реестр конфигураций таблиц (ag-grid).
15
+ *
16
+ * @version v.0.2 (12/06/2026)
17
+ */
18
+ export class TableConfiguration extends abstractAppConfiguration
19
+ {
20
+ static config = {};
21
+
22
+ static state = {
23
+ loaded: false
24
+ }
25
+
26
+
27
+ /**
28
+ * @param init_options
29
+ */
30
+ constructor(init_options = false)
31
+ {
32
+ super();
33
+ if (this.constructor._instance)
34
+ {
35
+ return this.constructor._instance;
36
+ }
37
+
38
+ this.init_options = init_options;
39
+ this.constructor._instance = this;
40
+
41
+ TableConfiguration.bootstrap();
42
+ }
43
+
44
+
45
+ /**
46
+ * @param {string} element_type
47
+ * @param {string} section
48
+ * @param {string} lang
49
+ *
50
+ * @todo - header_name модифицируем под локаль
51
+ */
52
+ static get_config(element_type, section, lang)
53
+ {
54
+ if (!this.state.loaded)
55
+ {
56
+ this.bootstrap();
57
+ }
58
+
59
+ if (this.config?.[ element_type ]?.[ section ])
60
+ {
61
+ return this.config?.[ element_type ]?.[ section ];
62
+ }
63
+
64
+ return false;
65
+ }
66
+
67
+
68
+ static bootstrap()
69
+ {
70
+ if (this.state.loaded)
71
+ {
72
+ return;
73
+ }
74
+
75
+ bootstrap_bug(this.config);
76
+ bootstrap_test_case(this.config);
77
+ bootstrap_test_case_step(this.config);
78
+ bootstrap_test_run(this.config);
79
+ bootstrap_test_run_result(this.config);
80
+ bootstrap_test_account(this.config);
81
+ bootstrap_team_member(this.config);
82
+ bootstrap_user(this.config);
83
+ bootstrap_team(this.config);
84
+ bootstrap_project(this.config);
85
+
86
+ this.state.loaded = true;
87
+ }
88
+ }
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Точка входа dev-сборки: всё публичное API ядра в глобальной области (window).
3
+ * Используется в demo/index.html и в консоли браузера по документации.
4
+ */
5
+ import * as Core from './index.js';
6
+ import * as Utils from './utils/utils.js';
7
+ import { ApiException } from './exceptions/ApiException.js';
8
+ import { MenuConfigurationMain } from './app_configuration/menu_configuration_main.js';
9
+ import { MenuConfigurationSecondary } from './app_configuration/menu_configuration_secondary.js';
10
+
11
+ const EXTRA_GLOBALS = {
12
+ ApiException,
13
+ MenuConfigurationMain,
14
+ MenuConfigurationSecondary,
15
+ };
16
+
17
+ /** Утилиты, которые должны быть доступны в консоли как глобальные функции */
18
+ const UTIL_GLOBAL_NAMES = [
19
+ 'is_array',
20
+ 'is_number',
21
+ 'is_object',
22
+ 'is_string',
23
+ 'echo',
24
+ 'echo_table',
25
+ 'count',
26
+ 'cls',
27
+ 'clone_object',
28
+ 'in_array',
29
+ ];
30
+
31
+ function assignDevGlobals()
32
+ {
33
+ for (const [ name, value ] of Object.entries(Core))
34
+ {
35
+ if (value !== undefined)
36
+ {
37
+ window[ name ] = value;
38
+ }
39
+ }
40
+
41
+ for (const [ name, value ] of Object.entries(EXTRA_GLOBALS))
42
+ {
43
+ if (value !== undefined)
44
+ {
45
+ window[ name ] = value;
46
+ }
47
+ }
48
+
49
+ for (const name of UTIL_GLOBAL_NAMES)
50
+ {
51
+ if (Utils[ name ] !== undefined)
52
+ {
53
+ window[ name ] = Utils[ name ];
54
+ }
55
+ }
56
+ }
57
+
58
+ assignDevGlobals();
package/publish/index.js CHANGED
@@ -4,8 +4,8 @@ export { TeamService } from './services/TeamService.js';
4
4
 
5
5
  export { typeFOR } from './types/family_service/typeFOR.js';
6
6
  export { typeFilter } from './types/family_service/typeFilter.js';
7
- export { TableBaseConfig } from './app_configuration/table_base_config.js';
8
- export { TableConfiguration } from './app_configuration/table_configuration.js';
7
+ export { TableBaseConfig } from './app_configuration/table/table_base_config.js';
8
+ export { TableConfiguration } from './app_configuration/table/table_configuration.js';
9
9
 
10
10
  export { typeProject } from './types/family_elements/typeProject.js';
11
11
  export { typeTestSuite } from './types/family_elements/typeTestSuite.js'
@@ -36,6 +36,8 @@ export { DeveloperService } from './services/DeveloperService.js';
36
36
 
37
37
  export { GeneralException } from './exceptions/GeneralException.js';
38
38
 
39
+ export { is_array, is_number, is_object, is_string, echo, echo_table, count, cls, clone_object } from './utils/utils.js'
40
+
39
41
  /**
40
42
  *
41
43
  * @version v.0.1 (21/06/2025)
@@ -17,6 +17,27 @@ export class typeTableColumn extends familyService
17
17
  is_hide;
18
18
  is_editable;
19
19
 
20
+ /**
21
+ * Семантический тип колонки для фабрики ColDef (этап 3).
22
+ * @type {'data'|'row_select'|'goto'|'sort_action'|'copy'}
23
+ */
24
+ column_kind = 'data';
25
+
26
+ /**
27
+ * Обязательное поле при создании/редактировании строки.
28
+ */
29
+ is_required = false;
30
+
31
+ /**
32
+ * Поле-заголовок сущности (например test_case_title).
33
+ */
34
+ is_title = false;
35
+
36
+ /**
37
+ * Тип сущности для перевода header_name, если отличается от основной.
38
+ */
39
+ header_element_type = false;
40
+
20
41
 
21
42
  constructor(data = false)
22
43
  {
@@ -1,124 +0,0 @@
1
- import { LOCALE_AG_GRID_RU } from "./locale_table_ru.js";
2
- import { LOCALE_AG_GRID_EG } from "./table_locale_ar.js";
3
- import { typeTestCase } from "../types/family_elements/typeTestCase.js";
4
- import { typeProject } from "../types/family_elements/typeProject.js";
5
-
6
- /**
7
- *
8
- * @version v.0.1 (17/08/2025)
9
- */
10
- export class TableBaseConfig
11
- {
12
-
13
-
14
- /**
15
- *
16
- * @version v.0.1 (17/08/2025)
17
- * @param {string} element_type
18
- * @param {string} section
19
- * @param {string} lang
20
- *
21
- * @todo - header_name модифицируем под локаль
22
- */
23
- static get_config(element_type, section, lang)
24
- {
25
- let response = this.config;
26
-
27
- response.getRowNodeId = this.#getRowNodeId(element_type);
28
-
29
- if (lang !== 'en')
30
- {
31
- response.localeText = TableBaseConfig.#localeText(lang);
32
- }
33
-
34
- return response;
35
- }
36
-
37
-
38
- /**
39
- *
40
- * @param lang
41
- * @returns {{}}
42
- */
43
- static #localeText(lang)
44
- {
45
- let response = {};
46
- switch (lang)
47
- {
48
- case 'ru':
49
- response = LOCALE_AG_GRID_RU
50
- break;
51
- case 'ar':
52
- response = LOCALE_AG_GRID_EG
53
- break;
54
- }
55
-
56
- return response;
57
- }
58
-
59
-
60
- /**
61
- *
62
- * @version v.0.1 (17/08/2025)
63
- * @param element_type
64
- * @returns {function(*): number}
65
- *
66
- */
67
- static #getRowNodeId(element_type)
68
- {
69
- return function (data)
70
- {
71
- let id = 0;
72
- let model = false;
73
-
74
- switch (element_type)
75
- {
76
- case 'test_case':
77
- model = new typeTestCase();
78
- break;
79
- case 'project':
80
- model = new typeProject();
81
- break;
82
- }
83
-
84
- if (model)
85
- {
86
- let key = model.get_primary_key();
87
- if (data?.[key])
88
- {
89
- id= data?.[key];
90
- }
91
- }
92
-
93
- return id;
94
- }
95
- }
96
-
97
-
98
- /**
99
- *
100
- * @version v.0.1 (17/08/2025)
101
- */
102
- static config = {
103
- defaultColDef: {
104
- filter : true,
105
- sortable : true,
106
- resizable: true,
107
- editable : false,
108
- },
109
- suppressMenuHide : true,
110
- columnHoverHighlight : false,
111
- enableBrowserTooltips : false,
112
- rowSelection : 'multiple',
113
- rowMultiSelectWithClick : false,
114
- suppressRowClickSelection: true,
115
- enableRangeSelection : true,
116
- headerHeight: '44',
117
- rowHeight : '44',
118
- groupIncludeFooter : false,
119
- groupIncludeTotalFooter: false,
120
- overlayLoadingTemplate : '<span class="ag-overlay-loading-center">wait</span>',
121
- overlayNoRowsTemplate : '<span class="ag-overlay-loading-center">no data</span>',
122
- suppressNoRowsOverlay : false,
123
- };
124
- }