ru.coon 2.5.51 → 2.5.53

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/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ # Version 2.5.53, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/71f06d3a65bdf8040963d24a7ff0e6ac59946c7a)
2
+ * ## Features
3
+ * <span style='color:green'>feat: HT-7346: remove callback prepare data function</span> ([968a10], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/968a10cd85fb68fb13f4f3887d1785c73934e4cd))
4
+ * <span style='color:green'>feat: BFL-10334: add export csv button</span> ([5c067e], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/5c067e688795ac9b4341be80ab0909572d899f90))
5
+ * <span style='color:green'>feat: BFL-10334: add export csv button</span> ([afe199], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/afe199fc47b3587dc076debbc9b8e824c4421ed8))
6
+ * <span style='color:green'>feat: HT-7346: get save function return value for call close window functiion</span> ([f0bea7], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/f0bea74091a045b2477d8518d5d07c4ee2ae3fa1))
7
+ * <span style='color:green'>feat: HT-7346: get save function return value for call close window functiion</span> ([86806d], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/86806d51d6a38fce1a4754d3c8497a6957841e1d))
8
+
9
+ * ## Fixes
10
+ * <span style='color:red'> HT-7346: fix add docked and throw promise error</span> ([46b17e], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/46b17e452222787468ef0e65e49cd8e40cc9797e))
11
+
12
+ * upd ([3b137b], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/3b137bc6ff518b9769e55674484c1d3e14469e23))
13
+ * update: CHANGELOG.md ([d9c853], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/d9c8532cdef4cf46572967c94895486657a5bba1))
14
+
1
15
  # Version 2.5.51, [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/86e7f44d186c08b70ff00747e70cbb182686afd7)
2
16
  * ## Features
3
17
  * <span style='color:green'>feat: Добавлен вывод информации о количестве отчетов, в которых используются настройки экземпляра плагина. Closes HT-7432.</span> ([ccd4b9], [link](http://gitlab-dbr.sigma-it.local/dbr/ru.coon/-/commit/ccd4b9d8f5be9a7e9fb9edb4f7cc9c642a26c3a7))
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "name": "ru.coon"
5
5
  },
6
6
  "description": "",
7
- "version": "2.5.51",
7
+ "version": "2.5.53",
8
8
  "repository": {
9
9
  "type": "git",
10
10
  "url": "git+http://gitlab-dbr.sigma-it.local/dbr/ru.coon"
@@ -101,7 +101,8 @@ Ext.define('Coon.report.plugin.configPanel.ExportReportDataToFilePluginConfigPan
101
101
  allowBlank: false,
102
102
  store: [
103
103
  {name: 'Excel', id: 'excel'},
104
- {name: 'PDF', id: 'pdf'}
104
+ {name: 'PDF', id: 'pdf'},
105
+ {name: 'CSV', id: 'csv'}
105
106
  ],
106
107
  displayField: 'name',
107
108
  valueField: 'id',
@@ -37,16 +37,29 @@ Ext.define('Coon.report.plugin.grid.ExportReportDataToFilePlugin', {
37
37
  }, this);
38
38
  this.printPdfCommand = Ext.create('command.GetPdfReportDataCommand', {useRawFilterParams: this.getConfig('addToSearchButton')});
39
39
  },
40
-
40
+ callExportByType() {
41
+ switch (this.config.exportFileFormat) {
42
+ case 'pdf':
43
+ this.printPdfCommand.execute(this.report, this.config);
44
+ break;
45
+ case 'excel':
46
+ this.printExcelFile();
47
+ break;
48
+ case 'csv':
49
+ this.printCsvFile();
50
+ break;
51
+ }
52
+ },
41
53
  handler: function() {
42
54
  if (this.config.allowUserSelectColumnsToUpload) {
43
55
  this.showPanel();
44
56
  } else {
45
57
  this.config.columns = this.config.columnList.map((record) => record.reportField);
46
58
  this.getRecordsToPrint();
47
- this.config.exportFileFormat === 'pdf' ?
59
+ this.callExportByType();
60
+ /* this.config.exportFileFormat === 'pdf' ?
48
61
  this.printPdfCommand.execute(this.report, this.config) :
49
- this.printExcelFile();
62
+ this.printExcelFile();*/
50
63
  }
51
64
  },
52
65
 
@@ -113,9 +126,10 @@ Ext.define('Coon.report.plugin.grid.ExportReportDataToFilePlugin', {
113
126
  });
114
127
  this.win.on('setColumns', function() {
115
128
  this.getRecordsToPrint();
116
- this.config.exportFileFormat === 'pdf' ?
129
+ /* this.config.exportFileFormat === 'pdf' ?
117
130
  this.printPdfCommand.execute(this.report, this.config) :
118
- this.printExcelFile();
131
+ this.printExcelFile();*/
132
+ this.callExportByType();
119
133
  this.win.close();
120
134
  }, this);
121
135
  this.win.show();
@@ -155,7 +169,55 @@ Ext.define('Coon.report.plugin.grid.ExportReportDataToFilePlugin', {
155
169
  this.config.cmp.timeout :
156
170
  this.defaultTimeout;
157
171
  },
172
+ printCsvFile: async function() {
173
+ this.grid.mask('подождите пожалуйста...');
174
+ const fileName = this.config.reportFileName || this.report.reportId || 'defaultReportName';
175
+ const currentParamList = this.getConfig('addToSearchButton') ? this.report.northPanel.collectParams() : this.report.currentParamList;
176
+
177
+ const parameterList = [];
158
178
 
179
+ for (const key in currentParamList) {
180
+ if (currentParamList.hasOwnProperty(key) && !Ext.isEmpty(currentParamList[key])) {
181
+ parameterList.push({type: key, value: currentParamList[key]});
182
+ }
183
+ }
184
+
185
+ /* const hasSelected = !!(this.getSelectedRecords() || []).length;
186
+ const url = hasSelected && !this.getConfig('addToSearchButton') ?
187
+ '/ReportFormData/getExcelFromRowsOrReport' :
188
+ '/ReportFormData/getCSVReport';*/
189
+ const url = '/ReportFormData/getCSVReport';
190
+ Ext.Ajax.request({
191
+ url,
192
+ method: 'POST',
193
+ // binary: true,
194
+ timeout: this.getTimeout(),
195
+ params: {
196
+ reportId: this.report.reportId,
197
+ fileName: fileName,
198
+ appendDateToFileName: Ext.isBoolean(this.config.appendDateToFileName) ? this.config.appendDateToFileName : true,
199
+ parameterList: JSON.stringify(parameterList),
200
+ columnList: JSON.stringify(this.config.columns),
201
+ toExcel: JSON.stringify(this.config.toExcel),
202
+ },
203
+ success(responce) {
204
+ this.grid.unmask();
205
+ const csvContent = 'data:text/csv;charset=utf-8,%EF%BB%BF' + encodeURI(responce.responseText);
206
+ const link = document.createElement('a');
207
+ link.setAttribute('href', csvContent);
208
+ link.setAttribute('download', `${fileName}.csv`);
209
+ document.body.appendChild(link); // Required for FF
210
+ link.click();
211
+ link.parentNode.removeChild(link);
212
+ },
213
+ failure(error) {
214
+ this.grid.unmask();
215
+ Coon.log.error('ExportReportDataToFilePlugin error: ', error);
216
+ Ext.Msg.alert('ошибка', 'ошибка загрузки файла');
217
+ },
218
+ scope: this,
219
+ });
220
+ },
159
221
  printExcelFile: async function() {
160
222
  this.grid.mask('подождите пожалуйста...');
161
223
  const fileName = this.config.reportFileName || this.report.reportId || 'defaultReportName';
@@ -27,11 +27,7 @@ Ext.define('Coon.uielement.plugin.UnifiedButtonToolbarPlugin', {
27
27
  }
28
28
  ],
29
29
  });
30
- if (this.dock === 'bottom') {
31
- view.dockedItems.add(this.controller.unifiedButtonToolbar);
32
- } else {
33
- view.dockedItems.insert(0, this.controller.unifiedButtonToolbar);
34
- }
30
+ view.addDocked(this.controller.unifiedButtonToolbar, this.dock === 'bottom' ? null : 0);
35
31
  },
36
32
  onBeforeCloseWindow() {
37
33
  this.save(true);
@@ -56,12 +52,7 @@ Ext.define('Coon.uielement.plugin.UnifiedButtonToolbarPlugin', {
56
52
  },
57
53
  save(windowClose) {
58
54
  this.windowClose = windowClose;
59
- if (this.prepareBeanHandlerName &&
60
- this.controller[this.prepareBeanHandlerName] &&
61
- typeof this.controller[this.prepareBeanHandlerName] === 'function') {
62
- this.compareCash = true;
63
- this.controller[this.prepareBeanHandlerName].call();
64
- }
55
+ this.callPrepareBeanHandler();
65
56
  },
66
57
  generateHash(params) {
67
58
  if (params && Ext.isObject(params)) {
@@ -80,6 +71,14 @@ Ext.define('Coon.uielement.plugin.UnifiedButtonToolbarPlugin', {
80
71
  }
81
72
  }
82
73
  },
74
+ callPrepareBeanHandler(compareCash = true) {
75
+ if (this.prepareBeanHandlerName &&
76
+ this.controller[this.prepareBeanHandlerName] &&
77
+ typeof this.controller[this.prepareBeanHandlerName] === 'function') {
78
+ this.compareCash = compareCash;
79
+ this.controller[this.prepareBeanHandlerName].call();
80
+ }
81
+ },
83
82
  async callSaveHandler(closeAfterSave) {
84
83
  if (
85
84
  this.saveHandlerName &&
@@ -87,9 +86,14 @@ Ext.define('Coon.uielement.plugin.UnifiedButtonToolbarPlugin', {
87
86
  typeof this.controller[this.saveHandlerName] === 'function'
88
87
  ) {
89
88
  if (this.controller[this.saveHandlerName] instanceof Promise) {
90
- await this.controller[this.saveHandlerName].call(this.controller);
89
+ const isError = await this.controller[this.saveHandlerName].call(this.controller).catch(() => 'error');
90
+ if (isError === 'error') {
91
+ closeAfterSave = false;
92
+ }
91
93
  } else {
92
- this.controller[this.saveHandlerName].call(this.controller);
94
+ if (this.controller[this.saveHandlerName].call(this.controller) !== true) {
95
+ closeAfterSave = false;
96
+ }
93
97
  }
94
98
  if (closeAfterSave) {
95
99
  this.closeWindow();
package/src/version.js CHANGED
@@ -1,4 +1,4 @@
1
1
  Ext.define('Coon.version', {
2
2
  singleton: true,
3
- number: '2.5.51',
3
+ number: '2.5.53',
4
4
  });
@@ -1,7 +0,0 @@
1
- **спецификация:**
2
-
3
- входные параметры:
4
-
5
- - exportFileFormat [xls/pdf]
6
- - allowUserSelectColumnsToUpload
7
- - addToSearchButton добавить в кнопку "поиск", в этом случае в качестве параметра отправляем текущие параметры из FilterPanel(useRawFilterParams: true)