mirror of
https://github.com/documize/community.git
synced 2025-07-24 15:49:44 +02:00
Replaced underscore.js & is.js with lodash.js
This commit is contained in:
parent
df8e843bf5
commit
566807bc14
93 changed files with 17379 additions and 2056 deletions
|
@ -43,19 +43,19 @@ export default Component.extend(ModalMixin, Notifier, {
|
|||
|
||||
ldapErrorServerHost: empty('ldapConfig.serverHost'),
|
||||
ldapErrorServerPort: computed('ldapConfig.serverPort', function() {
|
||||
return is.empty(this.get('ldapConfig.serverPort')) || is.not.number(parseInt(this.get('ldapConfig.serverPort')));
|
||||
return _.isEmpty(this.get('ldapConfig.serverPort')) || !_.isNumber(parseInt(this.get('ldapConfig.serverPort')));
|
||||
}),
|
||||
ldapErrorBindDN: empty('ldapConfig.bindDN'),
|
||||
ldapErrorBindPassword: empty('ldapConfig.bindPassword'),
|
||||
ldapErrorNoFilter: computed('ldapConfig.{userFilter,groupFilter}', function() {
|
||||
return is.empty(this.get('ldapConfig.userFilter')) && is.empty(this.get('ldapConfig.groupFilter'));
|
||||
return _.isEmpty(this.get('ldapConfig.userFilter')) && _.isEmpty(this.get('ldapConfig.groupFilter'));
|
||||
}),
|
||||
ldapErrorAttributeUserRDN: empty('ldapConfig.attributeUserRDN'),
|
||||
ldapErrorAttributeUserFirstname: empty('ldapConfig.attributeUserFirstname'),
|
||||
ldapErrorAttributeUserLastname: empty('ldapConfig.attributeUserLastname'),
|
||||
ldapErrorAttributeUserEmail: empty('ldapConfig.attributeUserEmail'),
|
||||
ldapErrorAttributeGroupMember: computed('ldapConfig.{groupFilter,attributeGroupMember}', function() {
|
||||
return is.not.empty(this.get('ldapConfig.groupFilter')) && is.empty(this.get('ldapConfig.attributeGroupMember'));
|
||||
return !_.isEmpty(this.get('ldapConfig.groupFilter')) && _.isEmpty(this.get('ldapConfig.attributeGroupMember'));
|
||||
}),
|
||||
ldapPreview: null,
|
||||
ldapConfig: null,
|
||||
|
@ -92,7 +92,7 @@ export default Component.extend(ModalMixin, Notifier, {
|
|||
case constants.AuthProvider.Keycloak: // eslint-disable-line no-case-declarations
|
||||
let config = this.get('authConfig');
|
||||
|
||||
if (is.undefined(config) || is.null(config) || is.empty(config) ) {
|
||||
if (_.isUndefined(config) || _.isNull(config) || _.isEmpty(config) ) {
|
||||
config = {};
|
||||
} else {
|
||||
config = JSON.parse(config);
|
||||
|
@ -107,7 +107,7 @@ export default Component.extend(ModalMixin, Notifier, {
|
|||
case constants.AuthProvider.LDAP: // eslint-disable-line no-case-declarations
|
||||
let ldapConfig = this.get('authConfig');
|
||||
|
||||
if (is.undefined(ldapConfig) || is.null(ldapConfig) || is.empty(ldapConfig) ) {
|
||||
if (_.isUndefined(ldapConfig) || _.isNull(ldapConfig) || _.isEmpty(ldapConfig) ) {
|
||||
ldapConfig = {};
|
||||
} else {
|
||||
ldapConfig = JSON.parse(ldapConfig);
|
||||
|
@ -194,13 +194,13 @@ export default Component.extend(ModalMixin, Notifier, {
|
|||
config.realm = config.realm.trim();
|
||||
config.clientId = config.clientId.trim();
|
||||
config.publicKey = config.publicKey.trim();
|
||||
config.group = is.undefined(config.group) ? '' : config.group.trim();
|
||||
config.group = _.isUndefined(config.group) ? '' : config.group.trim();
|
||||
config.adminUser = config.adminUser.trim();
|
||||
config.adminPassword = config.adminPassword.trim();
|
||||
config.defaultPermissionAddSpace = config.hasOwnProperty('defaultPermissionAddSpace') ? config.defaultPermissionAddSpace : true;
|
||||
config.disableLogout = config.hasOwnProperty('disableLogout') ? config.disableLogout : true;
|
||||
|
||||
if (is.endWith(config.url, '/')) {
|
||||
if (_.endsWith(config.url, '/')) {
|
||||
config.url = config.url.substring(0, config.url.length-1);
|
||||
}
|
||||
|
||||
|
@ -221,7 +221,7 @@ export default Component.extend(ModalMixin, Notifier, {
|
|||
config.serverHost = config.serverHost.trim();
|
||||
config.serverPort = parseInt(this.get('ldapConfig.serverPort'));
|
||||
|
||||
if (is.not.empty(config.groupFilter) && is.empty(config.attributeGroupMember)) {
|
||||
if (!_.isEmpty(config.groupFilter) && _.isEmpty(config.attributeGroupMember)) {
|
||||
this.$('#ldap-attributeGroupMember').focus();
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -118,17 +118,17 @@ export default Component.extend(Notifier, Modal, {
|
|||
|
||||
// do we have upload file?
|
||||
// let files = document.getElementById("restore-file").files;
|
||||
// if (is.undefined(files) || is.null(files)) {
|
||||
// if (_.isUndefined(files) || _.isNull(files)) {
|
||||
// return;
|
||||
// }
|
||||
|
||||
// let file = document.getElementById("restore-file").files[0];
|
||||
// if (is.undefined(file) || is.null(file)) {
|
||||
// if (_.isUndefined(file) || _.isNull(file)) {
|
||||
// return;
|
||||
// }
|
||||
|
||||
let filedata = this.get('restoreFile');
|
||||
if (is.null(filedata)) {
|
||||
if (_.isNull(filedata)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -107,7 +107,7 @@ export default Component.extend(Notifier, {
|
|||
}
|
||||
|
||||
let e = this.get('model.general.conversionEndpoint');
|
||||
if (is.endWith(e, '/')) {
|
||||
if (_.endsWith(e, '/')) {
|
||||
this.set('model.general.conversionEndpoint', e.substring(0, e.length-1));
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ export default Component.extend(Notifier, {
|
|||
// Jira specific.
|
||||
let jira = this.get('jira');
|
||||
|
||||
if (is.empty(jira) || is.not.object(jira)) {
|
||||
if (_.isEmpty(jira) || !_.isObject(jira)) {
|
||||
jira = {
|
||||
url: '',
|
||||
username: '',
|
||||
|
@ -37,7 +37,7 @@ export default Component.extend(Notifier, {
|
|||
// Trello specific.
|
||||
let trello = this.get('trello');
|
||||
|
||||
if (is.not.object(trello)) {
|
||||
if (!_.isObject(trello)) {
|
||||
trello = {
|
||||
appKey: ''
|
||||
};
|
||||
|
@ -52,7 +52,7 @@ export default Component.extend(Notifier, {
|
|||
let orgId = this.get("appMeta.orgId");
|
||||
let url = this.get('jiraCreds.url');
|
||||
|
||||
if (is.endWith(url, '/')) {
|
||||
if (_.endsWith(url, '/')) {
|
||||
this.set('jiraCreds.url', url.substring(0, url.length-1));
|
||||
}
|
||||
|
||||
|
|
|
@ -82,7 +82,7 @@ export default Component.extend(Notifier, Modals, {
|
|||
onExport() {
|
||||
let spec = {
|
||||
spaceId: '',
|
||||
data: _.pluck(this.get('folders'), 'id'),
|
||||
data: _.map(this.get('folders'), 'id'),
|
||||
filterType: 'space',
|
||||
};
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ export default Component.extend(Modals, {
|
|||
label.color = '#263238';
|
||||
}
|
||||
|
||||
if (is.empty(label.name)) {
|
||||
if (_.isEmpty(label.name)) {
|
||||
$('#add-label-name').addClass('is-invalid').focus();
|
||||
return;
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ export default Component.extend(Modals, {
|
|||
let color = this.get('labelColor').trim();
|
||||
let label = this.get('editLabel');
|
||||
|
||||
if (is.empty(name)) {
|
||||
if (_.isEmpty(name)) {
|
||||
$('#edit-label-name').addClass('is-invalid').focus();
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ import $ from 'jquery';
|
|||
import AuthProvider from '../../mixins/auth';
|
||||
import ModalMixin from '../../mixins/modal';
|
||||
import Notifier from '../../mixins/notifier';
|
||||
import stringUtil from '../../utils/string';
|
||||
import Component from '@ember/component';
|
||||
|
||||
export default Component.extend(AuthProvider, ModalMixin, Notifier, {
|
||||
|
@ -30,19 +31,19 @@ export default Component.extend(AuthProvider, ModalMixin, Notifier, {
|
|||
},
|
||||
|
||||
onAddUser() {
|
||||
if (is.empty(this.get('newUser.firstname'))) {
|
||||
if (_.isEmpty(this.get('newUser.firstname'))) {
|
||||
$("#newUserFirstname").addClass('is-invalid').focus();
|
||||
return;
|
||||
}
|
||||
$("#newUserFirstname").removeClass('is-invalid');
|
||||
|
||||
if (is.empty(this.get('newUser.lastname'))) {
|
||||
if (_.isEmpty(this.get('newUser.lastname'))) {
|
||||
$("#newUserLastname").addClass('is-invalid').focus();
|
||||
return;
|
||||
}
|
||||
$("#newUserLastname").removeClass('is-invalid');
|
||||
|
||||
if (is.empty(this.get('newUser.email')) || is.not.email(this.get('newUser.email'))) {
|
||||
if (_.isEmpty(this.get('newUser.email')) || !stringUtil.isEmail(this.get('newUser.email'))) {
|
||||
$("#newUserEmail").addClass('is-invalid').focus();
|
||||
return;
|
||||
}
|
||||
|
@ -59,7 +60,7 @@ export default Component.extend(AuthProvider, ModalMixin, Notifier, {
|
|||
},
|
||||
|
||||
onAddUsers() {
|
||||
if (is.empty(this.get('bulkUsers'))) {
|
||||
if (_.isEmpty(this.get('bulkUsers'))) {
|
||||
$("#bulkUsers").addClass('is-invalid').focus();
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ export default Component.extend(AuthProvider, ModalMixin, {
|
|||
let filteredUsers = A([]);
|
||||
users.forEach(user => {
|
||||
let m = members.findBy('userId', user.get('id'));
|
||||
if (is.undefined(m)) filteredUsers.pushObject(user);
|
||||
if (_.isUndefined(m)) filteredUsers.pushObject(user);
|
||||
});
|
||||
|
||||
this.set('users', filteredUsers);
|
||||
|
@ -75,7 +75,7 @@ export default Component.extend(AuthProvider, ModalMixin, {
|
|||
|
||||
let newGroup = this.get('newGroup');
|
||||
|
||||
if (is.empty(newGroup.name)) {
|
||||
if (_.isEmpty(newGroup.name)) {
|
||||
$('#new-group-name')
|
||||
.addClass('is-invalid')
|
||||
.focus();
|
||||
|
@ -108,7 +108,7 @@ export default Component.extend(AuthProvider, ModalMixin, {
|
|||
let group = this.get('groups').findBy('id', deleteGroup.id);
|
||||
|
||||
if (
|
||||
is.empty(deleteGroup.name) ||
|
||||
_.isEmpty(deleteGroup.name) ||
|
||||
group.get('name') !== deleteGroup.name
|
||||
) {
|
||||
$('#delete-group-name')
|
||||
|
@ -141,7 +141,7 @@ export default Component.extend(AuthProvider, ModalMixin, {
|
|||
|
||||
let group = this.get('editGroup');
|
||||
|
||||
if (is.empty(group.get('name'))) {
|
||||
if (_.isEmpty(group.get('name'))) {
|
||||
$('#edit-group-name')
|
||||
.addClass('is-invalid')
|
||||
.focus();
|
||||
|
|
|
@ -16,6 +16,7 @@ import { schedule, debounce } from '@ember/runloop';
|
|||
import AuthProvider from '../../mixins/auth';
|
||||
import ModalMixin from '../../mixins/modal';
|
||||
import Notifier from '../../mixins/notifier';
|
||||
import stringUtil from '../../utils/string';
|
||||
import Component from '@ember/component';
|
||||
|
||||
export default Component.extend(AuthProvider, ModalMixin, Notifier, {
|
||||
|
@ -142,15 +143,15 @@ export default Component.extend(AuthProvider, ModalMixin, Notifier, {
|
|||
let user = this.get('editUser');
|
||||
let password = this.get('password');
|
||||
|
||||
if (is.empty(user.firstname)) {
|
||||
if (_.isEmpty(user.firstname)) {
|
||||
$("#edit-firstname").addClass("is-invalid").focus();
|
||||
return;
|
||||
}
|
||||
if (is.empty(user.lastname)) {
|
||||
if (_.isEmpty(user.lastname)) {
|
||||
$("#edit-lastname").addClass("is-invalid").focus();
|
||||
return;
|
||||
}
|
||||
if (is.empty(user.email) || is.not.email(user.email)) {
|
||||
if (_.isEmpty(user.email) || !stringUtil.isEmail(user.email)) {
|
||||
$("#edit-email").addClass("is-invalid").focus();
|
||||
return;
|
||||
}
|
||||
|
@ -161,7 +162,7 @@ export default Component.extend(AuthProvider, ModalMixin, Notifier, {
|
|||
let cb = this.get('onSave');
|
||||
cb(user);
|
||||
|
||||
if (is.not.empty(password.password) && is.not.empty(password.confirmation) &&
|
||||
if (!_.isEmpty(password.password) && !_.isEmpty(password.confirmation) &&
|
||||
password.password === password.confirmation) {
|
||||
|
||||
let pw = this.get('onPassword');
|
||||
|
@ -218,7 +219,7 @@ export default Component.extend(AuthProvider, ModalMixin, Notifier, {
|
|||
let groups = this.get('groups');
|
||||
groups.forEach((g) => {
|
||||
let hasGroup = userGroups.findBy('groupId', g.get('id'));
|
||||
g.set('isMember', is.not.undefined(hasGroup));
|
||||
g.set('isMember', !_.isUndefined(hasGroup));
|
||||
})
|
||||
this.set('groups', groups);
|
||||
|
||||
|
@ -230,7 +231,7 @@ export default Component.extend(AuthProvider, ModalMixin, Notifier, {
|
|||
let group = this.get('groups').findBy('id', groupId);
|
||||
group.set('isMember', false);
|
||||
|
||||
if (is.undefined(groupId) || is.undefined(userId)) {
|
||||
if (_.isUndefined(groupId) || _.isUndefined(userId)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -244,7 +245,7 @@ export default Component.extend(AuthProvider, ModalMixin, Notifier, {
|
|||
let group = this.get('groups').findBy('id', groupId);
|
||||
group.set('isMember', true);
|
||||
|
||||
if (is.undefined(groupId) || is.undefined(userId)) {
|
||||
if (_.isUndefined(groupId) || _.isUndefined(userId)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue