ref
This commit is contained in:
@@ -26,26 +26,21 @@
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
define('views/admin/auth-log-record/list', ['views/list'], function (Dep) {
|
||||
import ListView from 'views/list';
|
||||
|
||||
return Dep.extend({
|
||||
export default class extends ListView {
|
||||
|
||||
setup: function () {
|
||||
Dep.prototype.setup.call(this);
|
||||
},
|
||||
getHeader() {
|
||||
return this.buildHeaderHtml([
|
||||
$('<a>')
|
||||
.attr('href', '#Admin')
|
||||
.text(this.translate('Administration')),
|
||||
$('<span>')
|
||||
.text(this.getLanguage().translate('Auth Log', 'labels', 'Admin')),
|
||||
]);
|
||||
}
|
||||
|
||||
getHeader: function () {
|
||||
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'));
|
||||
},
|
||||
});
|
||||
});
|
||||
updatePageTitle() {
|
||||
this.setPageTitle(this.getLanguage().translate('Auth Log', 'labels', 'Admin'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,12 +26,10 @@
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
define('views/admin/auth-log-record/modals/detail', ['views/modals/detail'], function (Dep) {
|
||||
import DetailModalView from 'views/modals/detail';
|
||||
|
||||
return Dep.extend({
|
||||
export default class extends DetailModalView {
|
||||
|
||||
sideDisabled: true,
|
||||
|
||||
editDisabled: true,
|
||||
});
|
||||
});
|
||||
sideDisabled = true
|
||||
editDisabled = true
|
||||
}
|
||||
|
||||
@@ -26,14 +26,11 @@
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
define('views/admin/auth-log-record/record/detail-small', ['views/record/detail-small'], function (Dep) {
|
||||
import DetailSmallRecordView from 'views/record/detail-small';
|
||||
|
||||
return Dep.extend({
|
||||
export default class extends DetailSmallRecordView {
|
||||
|
||||
sideDisabled: true,
|
||||
|
||||
isWide: true,
|
||||
|
||||
bottomView: 'views/record/detail-bottom',
|
||||
});
|
||||
});
|
||||
sideDisabled = true
|
||||
isWide = true
|
||||
bottomView = 'views/record/detail-bottom'
|
||||
}
|
||||
|
||||
@@ -26,12 +26,11 @@
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
define('views/admin/auth-log-record/record/detail', ['views/record/detail'], function (Dep) {
|
||||
import DetailRecordView from 'views/record/detail';
|
||||
|
||||
return Dep.extend({
|
||||
export default class extends DetailRecordView {
|
||||
|
||||
sideDisabled: true,
|
||||
sideDisabled = true
|
||||
readOnly = true
|
||||
}
|
||||
|
||||
readOnly: true,
|
||||
});
|
||||
});
|
||||
|
||||
@@ -26,14 +26,13 @@
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
define('views/admin/auth-log-record/record/list', ['views/record/list'], function (Dep) {
|
||||
import ListRecordView from 'views/record/list';
|
||||
|
||||
return Dep.extend({
|
||||
export default class extends ListRecordView {
|
||||
|
||||
rowActionsView: 'views/record/row-actions/view-and-remove',
|
||||
rowActionsView = 'views/record/row-actions/view-and-remove'
|
||||
|
||||
massActionList: ['remove'],
|
||||
checkAllResultMassActionList: ['remove'],
|
||||
forceSettings: true,
|
||||
});
|
||||
});
|
||||
massActionList = ['remove']
|
||||
checkAllResultMassActionList = ['remove']
|
||||
forceSettings = true
|
||||
}
|
||||
|
||||
@@ -26,25 +26,24 @@
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
define('views/admin/auth-token/list', ['views/list'], function (Dep) {
|
||||
import ListView from 'views/list';
|
||||
|
||||
return Dep.extend({
|
||||
export default class extends ListView {
|
||||
|
||||
setup: function () {
|
||||
Dep.prototype.setup.call(this);
|
||||
createButton = false
|
||||
|
||||
this.menu.buttons = [];
|
||||
},
|
||||
getHeader() {
|
||||
const a = document.createElement('a');
|
||||
a.href = '#Admin';
|
||||
a.innerText = this.translate('Administration');
|
||||
|
||||
getHeader: function () {
|
||||
return '<a href="#Admin">' + this.translate('Administration') + '</a>' +
|
||||
' <span class="chevron-right"></span> ' +
|
||||
this.getLanguage().translate('Auth Tokens', 'labels', 'Admin');
|
||||
},
|
||||
const text = document.createElement('span');
|
||||
text.innerText = this.getLanguage().translate('Auth Tokens', 'labels', 'Admin');
|
||||
|
||||
updatePageTitle: function () {
|
||||
this.setPageTitle(this.getLanguage().translate('Auth Tokens', 'labels', 'Admin'));
|
||||
},
|
||||
});
|
||||
});
|
||||
return this.buildHeaderHtml([a, text]);
|
||||
}
|
||||
|
||||
updatePageTitle() {
|
||||
this.setPageTitle(this.getLanguage().translate('Auth Tokens', 'labels', 'Admin'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,12 +26,10 @@
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
define('views/admin/auth-token/modals/detail', ['views/modals/detail'], function (Dep) {
|
||||
import DetailModalView from 'views/modals/detail';
|
||||
|
||||
return Dep.extend({
|
||||
export default class extends DetailModalView {
|
||||
|
||||
sideDisabled: true,
|
||||
|
||||
editDisabled: true,
|
||||
});
|
||||
});
|
||||
sideDisabled = true
|
||||
editDisabled = true
|
||||
}
|
||||
|
||||
@@ -26,14 +26,12 @@
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
define('views/admin/auth-token/record/detail-small', ['views/record/detail-small'], function (Dep) {
|
||||
import DetailSmallRecordView from 'views/record/detail-small';
|
||||
|
||||
return Dep.extend({
|
||||
export default class extends DetailSmallRecordView {
|
||||
|
||||
sideDisabled: true,
|
||||
sideDisabled = true
|
||||
isWide = true
|
||||
bottomView = 'views/record/detail-bottom'
|
||||
}
|
||||
|
||||
isWide: true,
|
||||
|
||||
bottomView: 'views/record/detail-bottom',
|
||||
});
|
||||
});
|
||||
|
||||
@@ -26,12 +26,10 @@
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
define('views/admin/auth-token/record/detail', ['views/record/detail'], function (Dep) {
|
||||
import DetailRecordView from 'views/record/detail';
|
||||
|
||||
return Dep.extend({
|
||||
export default class extends DetailRecordView {
|
||||
|
||||
sideDisabled: true,
|
||||
|
||||
readOnly: true,
|
||||
});
|
||||
});
|
||||
sideDisabled = true
|
||||
readOnly = true
|
||||
}
|
||||
|
||||
@@ -26,72 +26,74 @@
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
define('views/admin/auth-token/record/list', ['views/record/list'], function (Dep) {
|
||||
import ListRecordView from 'views/record/list';
|
||||
|
||||
return Dep.extend({
|
||||
export default class extends ListRecordView {
|
||||
|
||||
rowActionsView: 'views/admin/auth-token/record/row-actions/default',
|
||||
rowActionsView = 'views/admin/auth-token/record/row-actions/default'
|
||||
massActionList = ['remove', 'setInactive']
|
||||
checkAllResultMassActionList = ['remove', 'setInactive']
|
||||
|
||||
massActionList: ['remove', 'setInactive'],
|
||||
// noinspection JSUnusedGlobalSymbols
|
||||
massActionSetInactive() {
|
||||
let ids = null;
|
||||
const allResultIsChecked = this.allResultIsChecked;
|
||||
|
||||
checkAllResultMassActionList: ['remove', 'setInactive'],
|
||||
if (!allResultIsChecked) {
|
||||
ids = this.checkedList;
|
||||
}
|
||||
|
||||
massActionSetInactive: function () {
|
||||
let ids = null;
|
||||
let allResultIsChecked = this.allResultIsChecked;
|
||||
const attributes = {
|
||||
isActive: false,
|
||||
};
|
||||
|
||||
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(() => {
|
||||
this.collection
|
||||
.fetch()
|
||||
.then(() => {
|
||||
Espo.Ui.success(this.translate('Done'));
|
||||
|
||||
let attributes = {
|
||||
isActive: false,
|
||||
};
|
||||
if (ids) {
|
||||
ids.forEach(id => {
|
||||
this.checkRecord(id);
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
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'));
|
||||
// noinspection JSUnusedGlobalSymbols
|
||||
/**
|
||||
* @param {Record} data
|
||||
*/
|
||||
actionSetInactive(data) {
|
||||
if (!data.id) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (ids) {
|
||||
ids.forEach(id => {
|
||||
this.checkRecord(id);
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
const model = this.collection.get(data.id);
|
||||
|
||||
actionSetInactive: function (data) {
|
||||
if (!data.id) {
|
||||
return;
|
||||
}
|
||||
if (!model) {
|
||||
return;
|
||||
}
|
||||
|
||||
var model = this.collection.get(data.id);
|
||||
Espo.Ui.notify(this.translate('pleaseWait', 'messages'));
|
||||
|
||||
if (!model) {
|
||||
return;
|
||||
}
|
||||
|
||||
Espo.Ui.notify(this.translate('pleaseWait', 'messages'));
|
||||
|
||||
model
|
||||
.save({'isActive': false}, {patch: true})
|
||||
.then(() => {
|
||||
Espo.Ui.notify(false);
|
||||
});
|
||||
},
|
||||
});
|
||||
});
|
||||
model
|
||||
.save({'isActive': false}, {patch: true})
|
||||
.then(() => {
|
||||
Espo.Ui.notify(false);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,50 +26,41 @@
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
define('views/admin/auth-token/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);
|
||||
setup() {
|
||||
super.setup();
|
||||
|
||||
this.listenTo(this.model, 'change:isActive', () => {
|
||||
setTimeout(() => {
|
||||
this.reRender();
|
||||
}, 10);
|
||||
});
|
||||
},
|
||||
this.listenTo(this.model, 'change:isActive', () => {
|
||||
setTimeout(() => this.reRender(), 10);
|
||||
});
|
||||
}
|
||||
|
||||
getActionList: function () {
|
||||
var list = [];
|
||||
getActionList() {
|
||||
const list = [];
|
||||
|
||||
list.push({
|
||||
action: 'quickView',
|
||||
label: 'View',
|
||||
data: {id: this.model.id},
|
||||
});
|
||||
|
||||
if (this.model.get('isActive')) {
|
||||
list.push({
|
||||
action: 'quickView',
|
||||
label: 'View',
|
||||
data: {
|
||||
id: this.model.id
|
||||
}
|
||||
action: 'setInactive',
|
||||
label: 'Set Inactive',
|
||||
data: {id: this.model.id},
|
||||
});
|
||||
}
|
||||
|
||||
if (this.model.get('isActive')) {
|
||||
list.push({
|
||||
action: 'setInactive',
|
||||
label: 'Set Inactive',
|
||||
data: {
|
||||
id: this.model.id
|
||||
}
|
||||
});
|
||||
}
|
||||
list.push({
|
||||
action: 'quickRemove',
|
||||
label: 'Remove',
|
||||
data: {id: this.model.id},
|
||||
});
|
||||
|
||||
list.push({
|
||||
action: 'quickRemove',
|
||||
label: 'Remove',
|
||||
data: {
|
||||
id: this.model.id
|
||||
}
|
||||
});
|
||||
|
||||
return list;
|
||||
},
|
||||
});
|
||||
});
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,75 +26,75 @@
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
define('views/admin/authentication/fields/test-connection', ['views/fields/base'], function (Dep) {
|
||||
import BaseFieldView from 'views/fields/base';
|
||||
|
||||
return Dep.extend({
|
||||
export default class extends BaseFieldView {
|
||||
|
||||
templateContent: `
|
||||
<button
|
||||
class="btn btn-default"
|
||||
data-action="testConnection"
|
||||
>{{translate \'Test Connection\' scope=\'Settings\'}}</button>
|
||||
`,
|
||||
// language=Handlebars
|
||||
templateContent = `
|
||||
<button
|
||||
class="btn btn-default"
|
||||
data-action="testConnection"
|
||||
>{{translate \'Test Connection\' scope=\'Settings\'}}</button>
|
||||
`
|
||||
|
||||
events: {
|
||||
'click [data-action="testConnection"]': function () {
|
||||
this.testConnection();
|
||||
},
|
||||
},
|
||||
fetch() {
|
||||
return {};
|
||||
}
|
||||
|
||||
fetch: function () {
|
||||
return {};
|
||||
},
|
||||
setup() {
|
||||
super.setup();
|
||||
|
||||
getConnectionData: function () {
|
||||
return {
|
||||
'host': this.model.get('ldapHost'),
|
||||
'port': this.model.get('ldapPort'),
|
||||
'useSsl': this.model.get('ldapSecurity'),
|
||||
'useStartTls': this.model.get('ldapSecurity'),
|
||||
'username': this.model.get('ldapUsername'),
|
||||
'password': this.model.get('ldapPassword'),
|
||||
'bindRequiresDn': this.model.get('ldapBindRequiresDn'),
|
||||
'accountDomainName': this.model.get('ldapAccountDomainName'),
|
||||
'accountDomainNameShort': this.model.get('ldapAccountDomainNameShort'),
|
||||
'accountCanonicalForm': this.model.get('ldapAccountCanonicalForm'),
|
||||
};
|
||||
},
|
||||
this.addActionHandler('testConnection', () => this.testConnection());
|
||||
}
|
||||
|
||||
testConnection: function () {
|
||||
let data = this.getConnectionData();
|
||||
|
||||
this.$el.find('button').prop('disabled', true);
|
||||
getConnectionData() {
|
||||
return {
|
||||
'host': this.model.get('ldapHost'),
|
||||
'port': this.model.get('ldapPort'),
|
||||
'useSsl': this.model.get('ldapSecurity'),
|
||||
'useStartTls': this.model.get('ldapSecurity'),
|
||||
'username': this.model.get('ldapUsername'),
|
||||
'password': this.model.get('ldapPassword'),
|
||||
'bindRequiresDn': this.model.get('ldapBindRequiresDn'),
|
||||
'accountDomainName': this.model.get('ldapAccountDomainName'),
|
||||
'accountDomainNameShort': this.model.get('ldapAccountDomainNameShort'),
|
||||
'accountCanonicalForm': this.model.get('ldapAccountCanonicalForm'),
|
||||
};
|
||||
}
|
||||
|
||||
this.notify('Connecting', null, null, 'Settings');
|
||||
testConnection() {
|
||||
const data = this.getConnectionData();
|
||||
|
||||
Espo.Ajax
|
||||
.postRequest('Ldap/action/testConnection', data)
|
||||
.then(() => {
|
||||
this.$el.find('button').prop('disabled', false);
|
||||
this.$el.find('button').prop('disabled', true);
|
||||
|
||||
Espo.Ui.success(this.translate('ldapTestConnection', 'messages', 'Settings'));
|
||||
})
|
||||
.catch(xhr => {
|
||||
let statusReason = xhr.getResponseHeader('X-Status-Reason') || '';
|
||||
statusReason = statusReason.replace(/ $/, '');
|
||||
statusReason = statusReason.replace(/,$/, '');
|
||||
Espo.Ui.notify(this.translate('Connecting', 'labels', 'Settings'));
|
||||
|
||||
let msg = this.translate('Error') + ' ' + xhr.status;
|
||||
Espo.Ajax.postRequest('Ldap/action/testConnection', data)
|
||||
.then(() => {
|
||||
this.$el.find('button').prop('disabled', false);
|
||||
|
||||
if (statusReason) {
|
||||
msg += ': ' + statusReason;
|
||||
}
|
||||
Espo.Ui.success(this.translate('ldapTestConnection', 'messages', 'Settings'));
|
||||
})
|
||||
.catch(xhr => {
|
||||
let statusReason = xhr.getResponseHeader('X-Status-Reason') || '';
|
||||
statusReason = statusReason.replace(/ $/, '');
|
||||
statusReason = statusReason.replace(/,$/, '');
|
||||
|
||||
Espo.Ui.error(msg, true);
|
||||
let msg = this.translate('Error') + ' ' + xhr.status;
|
||||
|
||||
console.error(msg);
|
||||
if (statusReason) {
|
||||
msg += ': ' + statusReason;
|
||||
}
|
||||
|
||||
xhr.errorIsHandled = true;
|
||||
Espo.Ui.error(msg, true);
|
||||
|
||||
this.$el.find('button').prop('disabled', false);
|
||||
});
|
||||
},
|
||||
});
|
||||
});
|
||||
console.error(msg);
|
||||
|
||||
xhr.errorIsHandled = true;
|
||||
|
||||
this.$el.find('button').prop('disabled', false);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user