This commit is contained in:
Yuri Kuznetsov
2022-08-20 17:44:08 +03:00
parent 739e2b0ebc
commit ad4e7c0beb
25 changed files with 126 additions and 156 deletions
@@ -26,14 +26,13 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
Espo.define('views/action-history-record/fields/target-type', 'views/fields/enum', function (Dep) {
define('views/action-history-record/fields/target-type', ['views/fields/enum'], function (Dep) {
return Dep.extend({
setupOptions: function () {
Dep.prototype.setupOptions.call(this);
this.params.options = this.getMetadata().getScopeEntityList();
}
},
});
});
@@ -26,7 +26,7 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
Espo.define('views/action-history-record/fields/target', 'views/fields/link-parent', function (Dep) {
define('views/action-history-record/fields/target', ['views/fields/link-parent'], function (Dep) {
return Dep.extend({
@@ -37,23 +37,27 @@ Espo.define('views/action-history-record/fields/target', 'views/fields/link-pare
setup: function () {
Dep.prototype.setup.call(this);
var scopes = this.getMetadata().get('scopes') || {};
this.foreignScopeList = this.getMetadata().getScopeEntityList().filter(function (item) {
this.foreignScopeList = this.getMetadata().getScopeEntityList().filter(item => {
if (!this.getUser().isAdmin()) {
if (!this.getAcl().checkScopeHasAcl(item)) return;
if (!this.getAcl().checkScopeHasAcl(item)) {
return;
}
}
if (~this.ignoreScopeList.indexOf(item)) return;
if (!this.getAcl().checkScope(item)) return;
if (~this.ignoreScopeList.indexOf(item)) {
return;
}
if (!this.getAcl().checkScope(item)) {
return;
}
return true;
}, this);
});
this.getLanguage().sortEntityList(this.foreignScopeList);
this.foreignScope = this.model.get(this.typeName) || this.foreignScopeList[0];
}
},
});
});
@@ -26,7 +26,7 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
Espo.define('views/action-history-record/modals/detail', ['views/modals/detail'], function (Dep) {
define('views/action-history-record/modals/detail', ['views/modals/detail'], function (Dep) {
return Dep.extend({
@@ -34,8 +34,7 @@ Espo.define('views/action-history-record/modals/detail', ['views/modals/detail']
editDisabled: true,
sideDisabled: true
sideDisabled: true,
});
});
@@ -26,14 +26,12 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
Espo.define('views/action-history-record/record/list', 'views/record/list', function (Dep) {
define('views/action-history-record/record/list', ['views/record/list'], function (Dep) {
return Dep.extend({
rowActionsView: 'views/record/row-actions/view-and-remove',
massActionList: ['remove', 'export']
massActionList: ['remove', 'export'],
});
});
@@ -26,7 +26,7 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
Espo.define('views/admin/auth-log-record/list', 'views/list', function (Dep) {
define('views/admin/auth-log-record/list', ['views/list'], function (Dep) {
return Dep.extend({
@@ -35,14 +35,17 @@ Espo.define('views/admin/auth-log-record/list', 'views/list', function (Dep) {
},
getHeader: function () {
return '<a href="#Admin">' + this.translate('Administration') + '</a>' +
' <span class="chevron-right"></span> ' +
this.getLanguage().translate('Auth Log', 'labels', 'Admin');
return this.buildHeaderHtml([
$('<a>')
.attr('href', '#Admin')
.text(this.translate('Administration')),
$('<span>')
.text(this.getLanguage().translate('Auth Log', 'labels', 'Admin')),
]);
},
updatePageTitle: function () {
this.setPageTitle(this.getLanguage().translate('Auth Log', 'labels', 'Admin'));
}
},
});
});
@@ -26,13 +26,12 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
Espo.define('views/admin/auth-log-record/modals/detail', ['views/modals/detail'], function (Dep) {
define('views/admin/auth-log-record/modals/detail', ['views/modals/detail'], function (Dep) {
return Dep.extend({
sideDisabled: true,
editDisabled: true
editDisabled: true,
});
});
@@ -26,7 +26,7 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
Espo.define('views/admin/auth-log-record/record/detail-small', 'views/record/detail-small', function (Dep) {
define('views/admin/auth-log-record/record/detail-small', ['views/record/detail-small'], function (Dep) {
return Dep.extend({
@@ -34,7 +34,6 @@ Espo.define('views/admin/auth-log-record/record/detail-small', 'views/record/det
isWide: true,
bottomView: 'views/record/detail-bottom'
bottomView: 'views/record/detail-bottom',
});
});
@@ -26,13 +26,12 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
Espo.define('views/admin/auth-log-record/record/detail', 'views/record/detail', function (Dep) {
define('views/admin/auth-log-record/record/detail', ['views/record/detail'], function (Dep) {
return Dep.extend({
sideDisabled: true,
readOnly: true
readOnly: true,
});
});
@@ -26,7 +26,7 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
Espo.define('views/admin/auth-log-record/record/list', 'views/record/list', function (Dep) {
define('views/admin/auth-log-record/record/list', ['views/record/list'], function (Dep) {
return Dep.extend({
@@ -34,7 +34,6 @@ Espo.define('views/admin/auth-log-record/record/list', 'views/record/list', func
massActionList: ['remove'],
checkAllResultMassActionList: ['remove']
checkAllResultMassActionList: ['remove'],
});
});
@@ -26,13 +26,12 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
Espo.define('views/admin/auth-token/modals/detail', ['views/modals/detail'], function (Dep) {
define('views/admin/auth-token/modals/detail', ['views/modals/detail'], function (Dep) {
return Dep.extend({
sideDisabled: true,
editDisabled: true
editDisabled: true,
});
});
@@ -26,7 +26,7 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
Espo.define('views/admin/auth-token/record/detail-small', 'views/record/detail-small', function (Dep) {
define('views/admin/auth-token/record/detail-small', ['views/record/detail-small'], function (Dep) {
return Dep.extend({
@@ -34,8 +34,6 @@ Espo.define('views/admin/auth-token/record/detail-small', 'views/record/detail-s
isWide: true,
bottomView: 'views/record/detail-bottom'
bottomView: 'views/record/detail-bottom',
});
});
@@ -26,14 +26,12 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
Espo.define('views/admin/auth-token/record/detail', 'views/record/detail', function (Dep) {
define('views/admin/auth-token/record/detail', ['views/record/detail'], function (Dep) {
return Dep.extend({
sideDisabled: true,
readOnly: true
readOnly: true,
});
});
@@ -26,7 +26,7 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
define('views/admin/auth-token/record/list', 'views/record/list', function (Dep) {
define('views/admin/auth-token/record/list', ['views/record/list'], function (Dep) {
return Dep.extend({
@@ -37,45 +37,47 @@ define('views/admin/auth-token/record/list', 'views/record/list', function (Dep)
checkAllResultMassActionList: ['remove', 'setInactive'],
massActionSetInactive: function () {
var ids = false;
var allResultIsChecked = this.allResultIsChecked;
let ids = null;
let allResultIsChecked = this.allResultIsChecked;
if (!allResultIsChecked) {
ids = this.checkedList;
}
var attributes = {
isActive: false
let attributes = {
isActive: false,
};
var ids = false;
Espo.Ajax
.postRequest('MassAction', {
action: 'update',
entityType: this.entityType,
params: {
ids: ids || null,
where: (!ids || ids.length === 0) ? this.collection.getWhere() : null,
searchParams: (!ids || ids.length === 0) ? this.collection.data : null,
},
data: attributes,
})
.then(() => {
this.collection
.fetch()
.then(() => {
Espo.Ui.success(this.translate('Done'));
var allResultIsChecked = this.allResultIsChecked;
if (!allResultIsChecked) {
ids = this.checkedList;
}
Espo.Ajax.postRequest('MassAction', {
action: 'update',
entityType: this.entityType,
params: {
ids: ids || null,
where: (!ids || ids.length === 0) ? this.collection.getWhere() : null,
searchParams: (!ids || ids.length === 0) ? this.collection.data : null,
},
data: attributes,
}).then(() => {
var result = result || {};
this.collection.fetch();
});
if (ids) {
ids.forEach(id => {
this.checkRecord(id);
});
}
});
});
},
actionSetInactive: function (data) {
if (!data.id) {
return;
};
}
var model = this.collection.get(data.id);
@@ -86,14 +88,10 @@ define('views/admin/auth-token/record/list', 'views/record/list', function (Dep)
Espo.Ui.notify(this.translate('pleaseWait', 'messages'));
model
.save({
'isActive': false
}, {patch: true})
.save({'isActive': false}, {patch: true})
.then(() => {
Espo.Ui.notify(false);
});
}
},
});
});
@@ -26,29 +26,30 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
Espo.define('views/admin/auth-token/record/row-actions/default', 'views/record/row-actions/default', function (Dep) {
define('views/admin/auth-token/record/row-actions/default', ['views/record/row-actions/default'], function (Dep) {
return Dep.extend({
setup: function () {
Dep.prototype.setup.call(this);
this.listenTo(this.model, 'change:isActive', function () {
setTimeout(function () {
this.listenTo(this.model, 'change:isActive', () => {
setTimeout(() => {
this.reRender();
}.bind(this), 10);
}, this);
}, 10);
});
},
getActionList: function () {
var list = [];
list.push({
action: 'quickView',
label: 'View',
data: {
id: this.model.id
}
});
list.push({
action: 'quickView',
label: 'View',
data: {
id: this.model.id
}
});
if (this.model.get('isActive')) {
list.push({
@@ -59,6 +60,7 @@ Espo.define('views/admin/auth-token/record/row-actions/default', 'views/record/r
}
});
}
list.push({
action: 'quickRemove',
label: 'Remove',
@@ -66,10 +68,8 @@ Espo.define('views/admin/auth-token/record/row-actions/default', 'views/record/r
id: this.model.id
}
});
return list;
}
},
});
});
@@ -26,13 +26,10 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
Espo.define('views/admin/dynamic-logic/conditions/and', 'views/admin/dynamic-logic/conditions/group-base', function (Dep) {
define('views/admin/dynamic-logic/conditions/and', ['views/admin/dynamic-logic/conditions/group-base'], function (Dep) {
return Dep.extend({
operator: 'and'
operator: 'and',
});
});
@@ -26,7 +26,7 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
define('views/admin/dynamic-logic/conditions/field-types/base', 'view', function (Dep) {
define('views/admin/dynamic-logic/conditions/field-types/base', ['view'], function (Dep) {
return Dep.extend({
@@ -179,6 +179,5 @@ define('views/admin/dynamic-logic/conditions/field-types/base', 'view', function
return item;
},
});
});
@@ -26,12 +26,10 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
Espo.define('views/admin/dynamic-logic/conditions/field-types/date', 'views/admin/dynamic-logic/conditions/field-types/base', function (Dep) {
define('views/admin/dynamic-logic/conditions/field-types/date',
['views/admin/dynamic-logic/conditions/field-types/base'], function (Dep) {
return Dep.extend({
});
});
@@ -26,7 +26,8 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
Espo.define('views/admin/dynamic-logic/conditions/field-types/enum', 'views/admin/dynamic-logic/conditions/field-types/base', function (Dep) {
define('views/admin/dynamic-logic/conditions/field-types/enum',
['views/admin/dynamic-logic/conditions/field-types/base'], function (Dep) {
return Dep.extend({
@@ -35,7 +36,7 @@ Espo.define('views/admin/dynamic-logic/conditions/field-types/enum', 'views/admi
var item = {
type: this.type,
attribute: this.field
attribute: this.field,
};
if (valueView) {
@@ -55,8 +56,5 @@ Espo.define('views/admin/dynamic-logic/conditions/field-types/enum', 'views/admi
return viewName;
},
});
});
@@ -26,10 +26,8 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
define(
'views/admin/dynamic-logic/conditions/field-types/link-multiple',
'views/admin/dynamic-logic/conditions/field-types/base',
function (Dep) {
define('views/admin/dynamic-logic/conditions/field-types/link-multiple',
['views/admin/dynamic-logic/conditions/field-types/base'], function (Dep) {
return Dep.extend({
@@ -95,6 +93,5 @@ define(
return item;
},
});
});
@@ -26,7 +26,8 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
Espo.define('views/admin/dynamic-logic/conditions/field-types/link-parent', 'views/admin/dynamic-logic/conditions/field-types/base', function (Dep) {
define('views/admin/dynamic-logic/conditions/field-types/link-parent',
['views/admin/dynamic-logic/conditions/field-types/base'], function (Dep) {
return Dep.extend({
@@ -41,6 +42,7 @@ Espo.define('views/admin/dynamic-logic/conditions/field-types/link-parent', 'vie
if (this.type === 'equals' || this.type === 'notEquals') {
var values = {};
values[this.field + 'Id'] = valueView.model.get(this.field + 'Id');
values[this.field + 'Name'] = valueView.model.get(this.field + 'Name');
values[this.field + 'Type'] = valueView.model.get(this.field + 'Type');
@@ -99,9 +101,6 @@ Espo.define('views/admin/dynamic-logic/conditions/field-types/link-parent', 'vie
}
return item;
}
},
});
});
@@ -26,7 +26,8 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
Espo.define('views/admin/dynamic-logic/conditions/field-types/link', 'views/admin/dynamic-logic/conditions/field-types/base', function (Dep) {
define('views/admin/dynamic-logic/conditions/field-types/link',
['views/admin/dynamic-logic/conditions/field-types/base'], function (Dep) {
return Dep.extend({
@@ -51,9 +52,6 @@ Espo.define('views/admin/dynamic-logic/conditions/field-types/link', 'views/admi
}
return item;
}
},
});
});
@@ -26,7 +26,8 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
Espo.define('views/admin/dynamic-logic/conditions/field-types/multi-enum', 'views/admin/dynamic-logic/conditions/field-types/base', function (Dep) {
define('views/admin/dynamic-logic/conditions/field-types/multi-enum',
['views/admin/dynamic-logic/conditions/field-types/base'], function (Dep) {
return Dep.extend({
@@ -55,8 +56,5 @@ Espo.define('views/admin/dynamic-logic/conditions/field-types/multi-enum', 'view
return viewName;
},
});
});
@@ -26,7 +26,7 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
define('views/admin/dynamic-logic/conditions/group-base', 'view', function (Dep) {
define('views/admin/dynamic-logic/conditions/group-base', ['view'], function (Dep) {
return Dep.extend({
@@ -26,7 +26,7 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
Espo.define('views/admin/dynamic-logic/conditions/not', 'views/admin/dynamic-logic/conditions/group-base', function (Dep) {
define('views/admin/dynamic-logic/conditions/not', ['views/admin/dynamic-logic/conditions/group-base'], function (Dep) {
return Dep.extend({
@@ -40,7 +40,7 @@ Espo.define('views/admin/dynamic-logic/conditions/not', 'views/admin/dynamic-log
operator: this.operator,
hasItem: this.hasView(this.viewKey),
level: this.level,
groupOperator: this.getGroupOperator()
groupOperator: this.getGroupOperator(),
};
},
@@ -68,6 +68,7 @@ Espo.define('views/admin/dynamic-logic/conditions/not', 'views/admin/dynamic-log
getKey: function () {
var i = 0;
return 'view-' + this.level.toString() + '-' + this.number.toString() + '-' + i.toString();
},
@@ -75,26 +76,25 @@ Espo.define('views/admin/dynamic-logic/conditions/not', 'views/admin/dynamic-log
return 0;
},
addItemContainer: function () {
},
addItemContainer: function () {},
addViewDataListItem: function () {
},
addViewDataListItem: function () {},
fetch: function () {
var view = this.getView(this.viewKey);
if (!view) return {
type: 'and',
value: []
};
if (!view) {
return {
type: 'and',
value: [],
};
}
var value = view.fetch();
console.log(value);
return {
type: this.operator,
value: value
value: value,
};
},
@@ -104,9 +104,6 @@ Espo.define('views/admin/dynamic-logic/conditions/not', 'views/admin/dynamic-log
} else {
this.$el.find(' > .group-bottom').removeClass('hidden');
}
}
},
});
});
@@ -26,13 +26,10 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
Espo.define('views/admin/dynamic-logic/conditions/or', 'views/admin/dynamic-logic/conditions/group-base', function (Dep) {
define('views/admin/dynamic-logic/conditions/or', ['views/admin/dynamic-logic/conditions/group-base'], function (Dep) {
return Dep.extend({
operator: 'or'
operator: 'or',
});
});