ru.coon 2.7.32 → 2.7.34

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.
Files changed (34) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/package.json +1 -1
  3. package/src/common/panel/MainUploadPanel.js +16 -1
  4. package/src/nav/AppNavigationMenu.js +2 -2
  5. package/src/nav/AppNavigationMenu.scss +11 -5
  6. package/src/nav/menu/WorkspaceMenuView.js +7 -0
  7. package/src/report/component/EXTJSReportUploadForm.js +1 -0
  8. package/src/report/component/ReportPanel.js +2 -0
  9. package/src/report/plugin/configPanel/CopyRowsFromGridConfigPanel.js +1 -0
  10. package/src/security/component/RoleAccessPanel.js +5 -1
  11. package/src/security/component/ui/UiCPRestrictionEditor.js +31 -8
  12. package/src/security/component/ui/UiCPRestrictionEditorController.js +53 -18
  13. package/src/security/component/url/UrlRestrictionEditor.js +55 -0
  14. package/src/security/component/url/UrlRestrictionEditorController.js +5 -0
  15. package/src/security/securitySettingComponent/RoleEditPanel.js +83 -0
  16. package/src/security/securitySettingComponent/RoleEditPanel.scss +17 -0
  17. package/src/security/securitySettingComponent/RoleEditPanelController.js +211 -0
  18. package/src/security/securitySettingComponent/RoleListPanel.js +35 -0
  19. package/src/security/securitySettingComponent/RoleListPanelController.js +240 -0
  20. package/src/security/securitySettingComponent/command/GitOpaDownloadCommand.js +33 -0
  21. package/src/security/securitySettingComponent/menu/RoleEditMenuController.js +171 -0
  22. package/src/security/securitySettingComponent/menu/RoleEditMenuPanel.js +72 -0
  23. package/src/security/securitySettingComponent/report/RoleEditReportController.js +111 -0
  24. package/src/security/securitySettingComponent/report/RoleEditReportPanel.js +88 -0
  25. package/src/security/securitySettingComponent/uiCP/RoleEditUiCPController.js +139 -0
  26. package/src/security/securitySettingComponent/uiCP/RoleEditUiCPPanel.js +88 -0
  27. package/src/security/securitySettingComponent/url/RoleEditUrlController.js +40 -0
  28. package/src/security/securitySettingComponent/url/RoleEditUrlPanel.js +53 -0
  29. package/src/security/securitySettingComponent/user/RoleEditUserController.js +61 -0
  30. package/src/security/securitySettingComponent/user/RoleEditUserPanel.js +49 -0
  31. package/src/uielement/component/EXTJSUiPanelUploadForm.js +1 -0
  32. package/src/uielement/component/formchips/FilterConditionToolbar.js +3 -6
  33. package/src/uielement/component/formchips/FilterConditionToolbarController.js +10 -1
  34. package/src/version.js +1 -1
@@ -0,0 +1,171 @@
1
+ Ext.define('Coon.security.securitySettingComponent.menu.RoleEditMenuController', {
2
+ extend: 'Ext.app.ViewController',
3
+
4
+ alias: 'controller.RoleEditMenuController',
5
+
6
+ reportId: 'MENU_ALLITEMS',
7
+
8
+ init() {
9
+ const menuGrid = this.getView();
10
+ menuGrid.on('styleGrid', function() {
11
+ this.refreshTreeStyle();
12
+ }, this);
13
+ menuGrid.getView().on({
14
+ refresh: {
15
+ fn: function() {
16
+ this.refreshTreeStyle();
17
+ },
18
+ scope: this,
19
+ },
20
+ scrollend: {
21
+ fn: function() {
22
+ this.refreshTreeStyle();
23
+ },
24
+ scope: this,
25
+ },
26
+ afteritemexpand: {
27
+ fn: function(node) {
28
+ this.refreshTreeStyle(node);
29
+ },
30
+ scope: this,
31
+ },
32
+ afteritemcollapse: {
33
+ fn: function(node) {
34
+ this.refreshTreeStyle(node);
35
+ },
36
+ scope: this,
37
+ },
38
+ });
39
+ },
40
+
41
+ refreshTreeStyle(node) {
42
+ const menuGrid = this.getView();
43
+ const styledRows =[];
44
+ const unStyledRows =[];
45
+ const cascadeNode = (node) => {
46
+ node.cascade((childNode) => {
47
+ !childNode.isRoot() && childNode.get('menuCheck') ? styledRows.push(childNode) : unStyledRows.push(childNode);
48
+ });
49
+ };
50
+ node = node || menuGrid.getRootNode();
51
+ cascadeNode(node);
52
+ styledRows.length && styledRows.map((r) => {
53
+ menuGrid.getView().removeRowCls(r, 'unchecked-row');
54
+ menuGrid.getView().addRowCls(r, 'checked-row');
55
+ });
56
+ unStyledRows.length && unStyledRows.map((r) => {
57
+ menuGrid.getView().removeRowCls(r, 'checked-row');
58
+ menuGrid.getView().addRowCls(r, 'unchecked-row');
59
+ });
60
+ },
61
+
62
+ getData(newRoleName, shouldDeleteCurrentRole) {
63
+ const menuData = [];
64
+ this.getView().getStore().clearFilter();
65
+ this.getView().getRootNode().cascade((childNode) => {
66
+ const menu = childNode.get('MENU_ENTRY_CD');
67
+ childNode.get('menuCheck') && menu && menuData.push(menu);
68
+ });
69
+ this.menuGitDataContent[this.role] = menuData;
70
+ if (newRoleName) {
71
+ this.menuGitDataContent[newRoleName] = menuData;
72
+ }
73
+ if (shouldDeleteCurrentRole) {
74
+ delete this.menuGitDataContent[this.role];
75
+ }
76
+ return JSON.stringify(this.menuGitDataContent);
77
+ },
78
+
79
+ onCheckChange(col, rowIndex, checked, record) {
80
+ const parentNode = record.parentNode;
81
+ if (record.hasChildNodes()) {
82
+ record.cascade((child) => child.set('menuCheck', checked));
83
+ }
84
+ const checkParentFunction = (node) => {
85
+ if (!node || node.isRoot()) {
86
+ return;
87
+ }
88
+ if (!checked && node.get('menuCheck') && !node.findChild('menuCheck', true) ||
89
+ (checked && !node.get('menuCheck'))) {
90
+ node.set('menuCheck', checked);
91
+ checkParentFunction(node.parentNode);
92
+ }
93
+ };
94
+ checkParentFunction(parentNode);
95
+ col.up('treepanel').fireEvent('styleGrid');
96
+ },
97
+
98
+ loadAllMenuData(data, role) {
99
+ this.menuGitDataContent = data;
100
+ this.role = role;
101
+ const menuGitData = this.menuGitDataContent[this.role];
102
+ return Coon.util.promisifyCmd('command.GetDynamicReportDataCommand', this.reportId)
103
+ .then((data) => {
104
+ if (Ext.isArray(data.list)) {
105
+ const transformData = data.list.map((el) => {
106
+ return Coon.Function.convertObjectByMapping(el, {
107
+ MENU_ENTRY_DESCR: 'text',
108
+ });
109
+ });
110
+ this.allMenuData = transformData.reduce((acc, el) => {
111
+ el.leaf = el.LEAF_SW === 'Y';
112
+ el.menuCheck = !!menuGitData.find((menu) => menu === el.MENU_ENTRY_CD);
113
+ if (!acc.find((item) => item.ws === el.WORKSPACE_CD)) {
114
+ acc.push({
115
+ text: el.WORKSPACE_DESCR,
116
+ ws: el.WORKSPACE_CD,
117
+ leaf: false,
118
+ expanded: false,
119
+ children: [],
120
+ });
121
+ }
122
+ const found = acc.find((item) => item.ws === el.WORKSPACE_CD);
123
+ if (el.menuCheck) {
124
+ found.menuCheck = el.menuCheck;
125
+ }
126
+ if (!el.leaf) {
127
+ el.expanded = false;
128
+ el.children = transformData.filter((item) =>
129
+ item.PARENT_MENU_ENTRY_CD === el.MENU_ENTRY_CD);
130
+ }
131
+ !el.PARENT_MENU_ENTRY_CD && found.children.push(el);
132
+ return acc;
133
+ }, []);
134
+ this.getView().getStore().setRoot({expanded: true, children: this.allMenuData});
135
+ this.getView().fireEvent('styleGrid');
136
+ } else {
137
+ Ext.Msg.alert('Ошибка', 'Некорректный формат ответа или нет данных');
138
+ }
139
+ })
140
+ .catch((error) => {
141
+ Ext.Msg.alert('Ошибка', error.message);
142
+ });
143
+ },
144
+
145
+ filterTree(e, field) {
146
+ this.getView().getRootNode().cascade((node) => {
147
+ if (node.get('text').toLowerCase().includes(field.getValue().toLowerCase())) {
148
+ node.bubble((parentNode) => parentNode.expand());
149
+ }
150
+ });
151
+ },
152
+
153
+ collapseAll() {
154
+ this.getView().getRootNode().cascade((node) => {
155
+ if (node.isRoot()) {
156
+ return;
157
+ }
158
+ node.collapse();
159
+ });
160
+ },
161
+
162
+ expandAll() {
163
+ this.getView().getRootNode().cascade((node) => {
164
+ if (node.isRoot()) {
165
+ return;
166
+ }
167
+ node.expand();
168
+ });
169
+ },
170
+
171
+ });
@@ -0,0 +1,72 @@
1
+ Ext.define('Coon.security.securitySettingComponent.menu.RoleEditMenuPanel', {
2
+ extend: 'Ext.tree.Panel',
3
+ alias: 'widget.RoleEditMenuPanel',
4
+ controller: 'RoleEditMenuController',
5
+
6
+ cls: 'RoleEditPanel',
7
+
8
+ requires: [],
9
+
10
+ layout: {
11
+ type: 'hbox',
12
+ align: 'stretch',
13
+ },
14
+ title: 'Меню',
15
+ rootVisible: false,
16
+ store: {
17
+ type: 'tree',
18
+ statefulFilters: true,
19
+ },
20
+ tbar: {
21
+ items: [
22
+ {
23
+ xtype: 'textfield',
24
+ fieldLabel: 'Поиск',
25
+ keyMapEnabled: true,
26
+ tooltip: 'Для поиска нажмите Enter',
27
+ keyMap: {
28
+ Enter: {
29
+ handler: 'filterTree',
30
+ },
31
+ },
32
+ },
33
+ {
34
+ text: 'Свернуть все',
35
+ handler: 'collapseAll',
36
+ },
37
+ {
38
+ text: 'Развернуть все',
39
+ handler: 'expandAll',
40
+ }
41
+ ],
42
+ },
43
+ columns: [
44
+ {
45
+ xtype: 'hintColumn',
46
+ dataIndex: 'WORKSPACE_CD',
47
+ text: 'WORKSPACE_CD',
48
+ hidden: true,
49
+ },
50
+ {
51
+ xtype: 'hintColumn',
52
+ dataIndex: 'MENU_ENTRY_CD',
53
+ text: 'MENU_ENTRY_CD',
54
+ hidden: true,
55
+ },
56
+ {
57
+ xtype: 'treecolumn',
58
+ dataIndex: 'text',
59
+ text: 'Меню',
60
+ flex: 1,
61
+ },
62
+ {
63
+ xtype: 'checkcolumn',
64
+ dataIndex: 'menuCheck',
65
+ text: 'v',
66
+ editable: true,
67
+ listeners: {
68
+ checkchange: 'onCheckChange',
69
+ },
70
+ }
71
+ ],
72
+ });
@@ -0,0 +1,111 @@
1
+ Ext.define('Coon.security.securitySettingComponent.report.RoleEditReportController', {
2
+ extend: 'Ext.app.ViewController',
3
+
4
+ alias: 'controller.RoleEditReportController',
5
+
6
+ init() {
7
+ this.lookup('reportPluginsGrid').getStore().on('datachanged', this.onEditReportGridButtonHandler.bind(this));
8
+ },
9
+
10
+ loadReportData(data, role) {
11
+ this.reportGitDataContent = data;
12
+ this.role = role;
13
+ this.reportGitDataObject = Object.entries(this.reportGitDataContent).reduce((acc, [repId, pluginsByRole]) => {
14
+ if (pluginsByRole[this.role] && pluginsByRole[this.role].length) {
15
+ acc[repId] = pluginsByRole[this.role];
16
+ }
17
+ return acc;
18
+ }, {});
19
+ this.lookup('reportsGrid').getStore().loadData(Object.keys(this.reportGitDataObject).map((report) => {
20
+ return {'report': report};
21
+ }));
22
+ },
23
+
24
+ getData(newRoleName, shouldDeleteCurrentRole) {
25
+ Object.keys(this.reportGitDataContent).map((repId) => {
26
+ if (newRoleName) {
27
+ this.reportGitDataContent[repId][newRoleName] = this.reportGitDataContent[repId][this.role];
28
+ }
29
+ if (shouldDeleteCurrentRole) {
30
+ delete this.reportGitDataContent[repId][this.role];
31
+ }
32
+ });
33
+ return JSON.stringify(this.reportGitDataContent);
34
+ },
35
+
36
+ onEditReportGridButtonHandler(store) {
37
+ const selection = this.lookup('reportsGrid').getSelection()[0];
38
+ if (!selection) {
39
+ return;
40
+ }
41
+ const masterReport = selection.get('report');
42
+ const plugins = store.getRange().map((record) => record.get('plugin'));
43
+ this.reportGitDataContent[masterReport][this.role] = plugins;
44
+ },
45
+
46
+ selectReport(grid, selected) {
47
+ const reportPluginsGrid = this.lookup('reportPluginsGrid');
48
+ reportPluginsGrid.getStore().removeAll();
49
+ if (!selected.length) {
50
+ return;
51
+ }
52
+ const reportPlugins = this.reportGitDataObject[selected[0].get('report')] || [];
53
+ this.lookup('reportPluginsGrid').getStore().loadData(reportPlugins.map((plugin) => {
54
+ return {'plugin': plugin};
55
+ }));
56
+ this.lookup('deleteReportPluginRecordButton').setDisabled(selected);
57
+ },
58
+
59
+ addReportRecordHandler() {
60
+ const reportsGrid = this.lookup('reportsGrid');
61
+ const panel = Ext.widget('ReportPanel', {
62
+ reportId: 'REPORTS',
63
+ preprocessPluginConfig: (config, xtype) => !['OpenCustomPanelButtonPlugin', 'ExecuteCommandButtonPlugin',
64
+ 'CopyRowsFromGrid', 'OpenURLButtonPlugin'].includes(xtype) && config,
65
+ });
66
+ const win = Ext.widget('WindowWrap', {
67
+ items: panel,
68
+ });
69
+ win.down('ReportPanel').on('itemdblclick', (_, record) => {
70
+ if (reportsGrid.getStore().find('report', record.get('CM_REPORT_CD')) === -1) {
71
+ reportsGrid.getStore().add({
72
+ report: record.get('CM_REPORT_CD'),
73
+ });
74
+ this.reportGitDataContent[record.get('CM_REPORT_CD')] = {};
75
+ this.reportGitDataContent[record.get('CM_REPORT_CD')][this.role] = [];
76
+ }
77
+ reportsGrid.setSelection(reportsGrid.getStore().find('report', record.get('CM_REPORT_CD')));
78
+ win.close();
79
+ });
80
+ win.show();
81
+ },
82
+
83
+ addReportPluginHandler() {
84
+ this.lookup('reportPluginsGrid').getStore().add({});
85
+ },
86
+
87
+ deleteReportRecordHandler() {
88
+ const reportsGrid = this.lookup('reportsGrid');
89
+ const selectedRecord = reportsGrid.selection;
90
+ delete this.reportGitDataContent[selectedRecord.get('report')][this.role];
91
+ reportsGrid.getStore().remove(selectedRecord);
92
+ },
93
+
94
+ deleteReportPluginRecordHandler() {
95
+ const selectedReportPluginRecord = this.lookup('reportPluginsGrid').getSelection()[0];
96
+ const masterReport = this.lookup('reportsGrid').getSelection()[0].get('report');
97
+ const plugin = selectedReportPluginRecord.get('plugin');
98
+ const pluginArray = this.reportGitDataContent[masterReport][this.role];
99
+ if (pluginArray && pluginArray.length) {
100
+ const index = pluginArray.findIndex((el) => el === plugin);
101
+ index !== -1 && pluginArray.splice(index, 1);
102
+ if (!pluginArray.length) {
103
+ delete this.reportGitDataContent[masterReport][this.role];
104
+ }
105
+ if (Ext.isEmpty(this.reportGitDataContent[masterReport])) {
106
+ delete this.reportGitDataContent[masterReport];
107
+ }
108
+ }
109
+ this.lookup('reportPluginsGrid').getStore().remove(selectedReportPluginRecord);
110
+ },
111
+ });
@@ -0,0 +1,88 @@
1
+ Ext.define('Coon.security.securitySettingComponent.report.RoleEditReportPanel', {
2
+ extend: 'Ext.Panel',
3
+ alias: 'widget.RoleEditReportPanel',
4
+ controller: 'RoleEditReportController',
5
+ uses: [],
6
+ requires: [],
7
+
8
+ layout: {
9
+ type: 'hbox',
10
+ align: 'stretch',
11
+ },
12
+
13
+ items: [
14
+ {
15
+ xtype: 'grid',
16
+ flex: 1,
17
+ reference: 'reportsGrid',
18
+ store: {},
19
+ columns: [
20
+ {dataIndex: 'report', text: 'Репорт', flex: 1}
21
+ ],
22
+ listeners: {
23
+ selectionChange: 'selectReport',
24
+ },
25
+ tbar: {
26
+ items: [
27
+ {
28
+ text: 'Добавить',
29
+ ui: 'orange-button',
30
+ handler: 'addReportRecordHandler',
31
+ },
32
+ {
33
+ text: 'Удалить',
34
+ ui: 'green-button',
35
+ handler: 'deleteReportRecordHandler',
36
+ disabled: true,
37
+ bind: {
38
+ disabled: '{!reportsGrid.selection}',
39
+ },
40
+ }
41
+ ],
42
+ },
43
+ },
44
+ {
45
+ xtype: 'grid',
46
+ flex: 1,
47
+ reference: 'reportPluginsGrid',
48
+ store: {},
49
+ columns: [
50
+ {
51
+ dataIndex: 'plugin',
52
+ text: 'Плагины',
53
+ flex: 1,
54
+ editor: {
55
+ xtype: 'textfield',
56
+ },
57
+ }
58
+ ],
59
+ plugins: [
60
+ 'cellediting'
61
+ ],
62
+ tbar: {
63
+ items: [
64
+ {
65
+ text: 'Добавить',
66
+ ui: 'orange-button',
67
+ handler: 'addReportPluginHandler',
68
+ disabled: true,
69
+ bind: {
70
+ disabled: '{!reportsGrid.selection}',
71
+ },
72
+ },
73
+ {
74
+ text: 'Удалить',
75
+ ui: 'green-button',
76
+ handler: 'deleteReportPluginRecordHandler',
77
+ disabled: true,
78
+ reference: 'deleteReportPluginRecordButton',
79
+ bind: {
80
+ disabled: '{!reportPluginsGrid.selection}',
81
+ },
82
+ }
83
+ ],
84
+ },
85
+ }
86
+ ],
87
+
88
+ });
@@ -0,0 +1,139 @@
1
+ Ext.define('Coon.security.securitySettingComponent.uiCP.RoleEditUiCPController', {
2
+ extend: 'Ext.app.ViewController',
3
+
4
+ alias: 'controller.RoleEditUiCPController',
5
+
6
+ init() {
7
+ this.lookup('UICPButtonsGrid').getStore().on('datachanged', this.onEditUICPGridButtonHandler.bind(this));
8
+ },
9
+
10
+ loadUiCPData(data, role) {
11
+ this.uiCpGitDataContent = data;
12
+ this.role = role;
13
+ this.uiCpGitDataObject = {};
14
+ Object.keys(this.uiCpGitDataContent).map((uiName) => {
15
+ const buttonArr = Object.entries(this.uiCpGitDataContent[uiName].buttons).reduce((acc, [butName, butRoles]) => {
16
+ if (butRoles.find((el) => el === this.role)) {
17
+ acc.push(butName);
18
+ }
19
+ return acc;
20
+ }, []);
21
+ if (!Ext.isEmpty(buttonArr)) {
22
+ this.uiCpGitDataObject[uiName] = buttonArr;
23
+ }
24
+ });
25
+ this.lookup('uiCpGrid').getStore().loadData(Object.keys(this.uiCpGitDataObject).map((uiElement) => {
26
+ return {'uiElement': uiElement};
27
+ }));
28
+ },
29
+
30
+ getData(newRoleName, shouldDeleteCurrentRole) {
31
+ Object.keys(this.uiCpGitDataContent).map((uiElId) => {
32
+ const uiElIdButton = this.uiCpGitDataContent[uiElId]['buttons'];
33
+ Object.keys(uiElIdButton).forEach((button) => {
34
+ if (newRoleName && !uiElIdButton[button].includes(newRoleName)) {
35
+ uiElIdButton[button].push(newRoleName);
36
+ }
37
+ if (shouldDeleteCurrentRole) {
38
+ const index = uiElIdButton[button].findIndex((role) => role === this.role);
39
+ if (index !== -1) {
40
+ uiElIdButton[button].splice(index, 1);
41
+ }
42
+ }
43
+ });
44
+ });
45
+ return JSON.stringify(this.uiCpGitDataContent);
46
+ },
47
+
48
+ beforeEditUICPButtonRecordHandler(editor, context) {
49
+ if (context.value) {
50
+ this.deleteUICPButtonRecordHandler();
51
+ }
52
+ },
53
+
54
+ onEditUICPGridButtonHandler(store) {
55
+ const selection = this.lookup('uiCpGrid').getSelection()[0];
56
+ if (!selection) {
57
+ return;
58
+ }
59
+ const masterUiElement = selection.get('uiElement');
60
+ const buttons = store.getRange().map((record) => record.get('button'));
61
+ buttons.map((button) => {
62
+ if (!button) {
63
+ return;
64
+ }
65
+ const buttonsObject = this.uiCpGitDataContent[masterUiElement]['buttons'];
66
+ buttonsObject[button] = buttonsObject[button] || [];
67
+ if (!buttonsObject[button].includes(this.role)) {
68
+ buttonsObject[button].push(this.role);
69
+ }
70
+ });
71
+ },
72
+
73
+ selectUi(grid, selected) {
74
+ const UICPButtonsGrid = this.lookup('UICPButtonsGrid');
75
+ UICPButtonsGrid.getStore().removeAll();
76
+ if (!selected.length) {
77
+ return;
78
+ }
79
+ const uiButtons = this.uiCpGitDataObject[selected[0].get('uiElement')] || [];
80
+ uiButtons.length && UICPButtonsGrid.getStore().loadData(uiButtons.map((button) => {
81
+ return {'button': button};
82
+ }));
83
+ this.lookup('deleteUICPButtonRecordButton').setDisabled(true);
84
+ },
85
+
86
+ addUICPRecordHandler() {
87
+ const uiCpGrid = this.lookup('uiCpGrid');
88
+ const panel = Ext.widget('ReportPanel', {
89
+ reportId: 'UI_CUSTOM_PANELS_LIST',
90
+ autoFilter: true,
91
+ preprocessPluginConfig: (config, xtype) => !['OpenCustomPanelButtonPlugin', 'ExecuteCommandButtonPlugin',
92
+ 'CopyRowsFromGrid', 'OpenURLButtonPlugin'].includes(xtype) && config,
93
+ });
94
+ const win = Ext.widget('WindowWrap', {
95
+ items: panel,
96
+ });
97
+ win.down('ReportPanel').on('itemdblclick', (_, record) => {
98
+ if (uiCpGrid.getStore().find('uiElement', record.get('UI_ELEMENT_CD')) === -1) {
99
+ uiCpGrid.getStore().add({
100
+ uiElement: record.get('UI_ELEMENT_CD'),
101
+ });
102
+ }
103
+ uiCpGrid.setSelection(uiCpGrid.getStore().find('uiElement', record.get('UI_ELEMENT_CD')));
104
+ this.uiCpGitDataContent[record.get('UI_ELEMENT_CD')] = this.uiCpGitDataContent[record.get('UI_ELEMENT_CD')] || {buttons: {}};
105
+ win.close();
106
+ });
107
+ win.show();
108
+ },
109
+
110
+ addUiCPButtonHandler() {
111
+ this.lookup('UICPButtonsGrid').getStore().add({});
112
+ },
113
+
114
+ deleteUICPRecordHandler() {
115
+ const uiCpGrid = this.lookup('uiCpGrid');
116
+ const selectedRecord = uiCpGrid.selection;
117
+ delete this.uiCpGitDataContent[selectedRecord.get('uiElement')];
118
+ uiCpGrid.getStore().remove(selectedRecord);
119
+ },
120
+
121
+ deleteUICPButtonRecordHandler() {
122
+ const selectedUICPButtonRecord = this.lookup('UICPButtonsGrid').getSelection()[0];
123
+ const masterUiElement = this.lookup('uiCpGrid').getSelection()[0].get('uiElement');
124
+ const button = selectedUICPButtonRecord.get('button');
125
+ const buttonArray = this.uiCpGitDataContent[masterUiElement] && this.uiCpGitDataContent[masterUiElement]['buttons'][button];
126
+ if (buttonArray && buttonArray.length) {
127
+ const index = buttonArray.findIndex((role) => role === this.role);
128
+ index !== -1 && buttonArray.splice(index, 1);
129
+ if (!buttonArray.length) {
130
+ delete this.uiCpGitDataContent[masterUiElement]['buttons'][button];
131
+ }
132
+ if (Ext.isEmpty(this.uiCpGitDataContent[masterUiElement]['buttons'])) {
133
+ delete this.uiCpGitDataContent[masterUiElement];
134
+ }
135
+ }
136
+ this.lookup('UICPButtonsGrid').getStore().remove(selectedUICPButtonRecord);
137
+ },
138
+
139
+ });
@@ -0,0 +1,88 @@
1
+ Ext.define('Coon.security.securitySettingComponent.uiCP.RoleEditUiCPPanel', {
2
+ extend: 'Ext.Panel',
3
+ alias: 'widget.RoleEditUiCPPanel',
4
+ controller: 'RoleEditUiCPController',
5
+ uses: [],
6
+ requires: [],
7
+
8
+ layout: {
9
+ type: 'hbox',
10
+ align: 'stretch',
11
+ },
12
+
13
+ items: [
14
+ {
15
+ xtype: 'grid',
16
+ flex: 1,
17
+ reference: 'uiCpGrid',
18
+ store: {},
19
+ columns: [
20
+ {dataIndex: 'uiElement', text: 'Панель', flex: 1}
21
+ ],
22
+ listeners: {
23
+ selectionChange: 'selectUi',
24
+ },
25
+ tbar: {
26
+ items: [
27
+ {
28
+ text: 'Добавить',
29
+ ui: 'orange-button',
30
+ handler: 'addUICPRecordHandler',
31
+ },
32
+ {
33
+ text: 'Удалить',
34
+ ui: 'green-button',
35
+ handler: 'deleteUICPRecordHandler',
36
+ disabled: true,
37
+ bind: {
38
+ disabled: '{!uiCpGrid.selection}',
39
+ },
40
+ }
41
+ ],
42
+ },
43
+ },
44
+ {
45
+ xtype: 'grid',
46
+ flex: 1,
47
+ reference: 'UICPButtonsGrid',
48
+ store: {},
49
+ columns: [
50
+ {
51
+ dataIndex: 'button',
52
+ text: 'Кнопки',
53
+ flex: 1,
54
+ editor: {
55
+ xtype: 'textfield',
56
+ },
57
+ }
58
+ ],
59
+ plugins: [
60
+ {
61
+ ptype: 'cellediting',
62
+ listeners: {
63
+ beforeEdit: 'beforeEditUICPButtonRecordHandler',
64
+ },
65
+ }
66
+ ],
67
+ tbar: {
68
+ items: [
69
+ {
70
+ text: 'Добавить',
71
+ ui: 'orange-button',
72
+ handler: 'addUiCPButtonHandler',
73
+ },
74
+ {
75
+ text: 'Удалить',
76
+ ui: 'green-button',
77
+ handler: 'deleteUICPButtonRecordHandler',
78
+ disabled: true,
79
+ reference: 'deleteUICPButtonRecordButton',
80
+ bind: {
81
+ disabled: '{!UICPButtonsGrid.selection}',
82
+ },
83
+ }
84
+ ],
85
+ },
86
+ }
87
+ ],
88
+ });