From e7331efcbe29b921773696294ccda84414854983 Mon Sep 17 00:00:00 2001 From: Yuri Kuznetsov Date: Thu, 8 Aug 2024 19:59:49 +0300 Subject: [PATCH] ref --- .../views/group-email-folder/record/list.js | 71 ++++++++++--------- .../record/row-actions/default.js | 51 ++++++------- .../views/import-error/fields/line-number.js | 49 +++++++------ 3 files changed, 85 insertions(+), 86 deletions(-) diff --git a/client/src/views/group-email-folder/record/list.js b/client/src/views/group-email-folder/record/list.js index 8b95ef1fb4..792c8896eb 100644 --- a/client/src/views/group-email-folder/record/list.js +++ b/client/src/views/group-email-folder/record/list.js @@ -26,48 +26,53 @@ * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. ************************************************************************/ -define('views/group-email-folder/record/list', ['views/record/list'], function (Dep) { +import ListRecordView from 'views/record/list'; - return Dep.extend({ +export default class extends ListRecordView { - rowActionsView: 'views/email-folder/record/row-actions/default', + rowActionsView = 'views/email-folder/record/row-actions/default' - actionMoveUp: function (data) { - let model = this.collection.get(data.id); + // noinspection JSUnusedGlobalSymbols + async actionMoveUp(data) { + const model = this.collection.get(data.id); - if (!model) { - return; - } + if (!model) { + return; + } - let index = this.collection.indexOf(model); + const index = this.collection.indexOf(model); - if (index === 0) { - return; - } + if (index === 0) { + return; + } - Espo.Ajax.postRequest('GroupEmailFolder/action/moveUp', {id: model.id}) - .then(() => { - this.collection.fetch(); - }); - }, + Espo.Ui.notify(' ... '); - actionMoveDown: function (data) { - let model = this.collection.get(data.id); + await Espo.Ajax.postRequest('GroupEmailFolder/action/moveUp', {id: model.id}); + await this.collection.fetch(); - if (!model) { - return; - } + Espo.Ui.notify(false); + } - let index = this.collection.indexOf(model); + // noinspection JSUnusedGlobalSymbols + async actionMoveDown(data) { + const model = this.collection.get(data.id); - if ((index === this.collection.length - 1) && (this.collection.length === this.collection.total)) { - return; - } + if (!model) { + return; + } - Espo.Ajax.postRequest('GroupEmailFolder/action/moveDown', {id: model.id}) - .then(() => { - this.collection.fetch(); - }); - }, - }); -}); + const index = this.collection.indexOf(model); + + if ((index === this.collection.length - 1) && (this.collection.length === this.collection.total)) { + return; + } + + Espo.Ui.notify(' ... '); + + await Espo.Ajax.postRequest('GroupEmailFolder/action/moveDown', {id: model.id}); + await this.collection.fetch(); + + Espo.Ui.notify(false); + } +} diff --git a/client/src/views/group-email-folder/record/row-actions/default.js b/client/src/views/group-email-folder/record/row-actions/default.js index 1bd3d417e8..69c88a2036 100644 --- a/client/src/views/group-email-folder/record/row-actions/default.js +++ b/client/src/views/group-email-folder/record/row-actions/default.js @@ -26,36 +26,31 @@ * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. ************************************************************************/ -define('views/email-folder/record/row-actions/default', ['views/record/row-actions/default'], function (Dep) { +import DefaultRowActionsView from 'views/record/row-actions/default'; - return Dep.extend({ +export default class extends DefaultRowActionsView { - setup: function () { - Dep.prototype.setup.call(this); - }, + getActionList() { + const list = super.getActionList(); - getActionList: function () { - var list = Dep.prototype.getActionList.call(this); + if (this.options.acl.edit) { + list.unshift({ + action: 'moveDown', + label: 'Move Down', + data: { + id: this.model.id, + }, + }); - if (this.options.acl.edit) { - list.unshift({ - action: 'moveDown', - label: 'Move Down', - data: { - id: this.model.id, - }, - }); + list.unshift({ + action: 'moveUp', + label: 'Move Up', + data: { + id: this.model.id, + }, + }); + } - list.unshift({ - action: 'moveUp', - label: 'Move Up', - data: { - id: this.model.id, - }, - }); - } - - return list; - }, - }); -}); + return list; + } +} diff --git a/client/src/views/import-error/fields/line-number.js b/client/src/views/import-error/fields/line-number.js index 52bbb2bf3b..98a8aa1f5a 100644 --- a/client/src/views/import-error/fields/line-number.js +++ b/client/src/views/import-error/fields/line-number.js @@ -26,39 +26,38 @@ * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. ************************************************************************/ -define('views/import-error/fields/line-number', ['views/fields/int'], (Dep) => { +import IntFieldView from 'views/fields/int'; - return Dep.extend({ +export default class extends IntFieldView { - disableFormatting: true, + disableFormatting = true - data: function () { - let data = Dep.prototype.data.call(this); + data() { + const data = super.data(); - data.valueIsSet = this.model.has(this.sourceName); - data.isNotEmpty = this.model.has(this.sourceName); + data.valueIsSet = this.model.has(this.sourceName); + data.isNotEmpty = this.model.has(this.sourceName); - return data; - }, + return data; + } - setup: function () { - Dep.prototype.setup.call(this); + setup() { + super.setup(); - this.sourceName = this.name === 'exportLineNumber' ? - 'exportRowIndex' : - 'rowIndex'; - }, + this.sourceName = this.name === 'exportLineNumber' ? + 'exportRowIndex' : + 'rowIndex'; + } - getAttributeList: function () { - return [this.sourceName]; - }, + getAttributeList() { + return [this.sourceName]; + } - getValueForDisplay: function () { - let value = this.model.get(this.sourceName); + getValueForDisplay() { + let value = this.model.get(this.sourceName); - value++; + value++; - return this.formatNumber(value); - }, - }); -}); + return this.formatNumber(value); + } +}