@websy/websy-designs 1.11.12 → 1.11.14

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.
@@ -121,13 +121,13 @@ class AuthHelper {
121
121
  })
122
122
  }
123
123
  isLoggedIn (req, res, next) {
124
- // console.log(req.session)
124
+ console.log(req.session)
125
125
  if (req.session && req.session.user && req.session.user.isAnonymous !== true) {
126
- // console.log('in condition D')
126
+ console.log('in condition D')
127
127
  next()
128
128
  }
129
129
  else {
130
- // console.log('in condition E')
130
+ console.log('in condition E')
131
131
  res.redirect('/login')
132
132
  }
133
133
  }
@@ -294,7 +294,6 @@ class PGHelper {
294
294
  return sql
295
295
  }
296
296
  buildWhere (input, entity) {
297
- console.log('input is', input)
298
297
  if (typeof input === 'undefined' || input.trim() === '') {
299
298
  return '1=1'
300
299
  }
@@ -308,7 +307,7 @@ class PGHelper {
308
307
  // console.log('where input', input)
309
308
  // console.log('splitter is', this.options.fieldValueSeparator)
310
309
  let list = input.split(';').map(d => {
311
- let parts = d.split(this.options.fieldValueSeparator)
310
+ let parts = d.split(this.options.fieldValueSeparator)
312
311
  if (parts.length === 2) {
313
312
  let partValues = parts[1]
314
313
  partValues = partValues.split('|')
@@ -322,12 +321,11 @@ class PGHelper {
322
321
  else if (parts[1].indexOf('%') !== -1) {
323
322
  return `LOWER(${entity ? entity + '.' : ''}${parts[0]}) LIKE '${parts[1]}'`
324
323
  }
325
- else {
324
+ else {
326
325
  return `${entity ? entity + '.' : ''}${parts[0]} = '${parts[1]}'`
327
326
  }
328
327
  }
329
- else {
330
- console.log(`${entity ? entity + '.' : ''}${parts[0]} IN ('${partValues.join('\',\'')}')`)
328
+ else {
331
329
  return `${entity ? entity + '.' : ''}${parts[0]} IN ('${partValues.join('\',\'')}')`
332
330
  }
333
331
  }
@@ -337,9 +335,7 @@ class PGHelper {
337
335
  return `${entity ? entity + '.' : ''}${parts[0]} <> '${parts[1]}'`
338
336
  }
339
337
  }
340
- })
341
- console.log('list is')
342
- console.log(list)
338
+ })
343
339
  return `
344
340
  ${list.length > 0 ? list.join(' AND ') : ''}
345
341
  `
@@ -67,7 +67,9 @@ module.exports = function (options) {
67
67
  app.use('/pdf', require(`./routes/${version}/pdf`))
68
68
  if (options.useDB === true) {
69
69
  const dbHelper = require(`./helpers/${version}/${options.dbEngine}Helper`)
70
- dbHelper.init(options.dbOnError || {}).then(() => {
70
+ let dbOptions = options.dbEngine === 'pg' ? options.dbOptions : options.dbOnError || {}
71
+
72
+ dbHelper.init(dbOptions).then(() => {
71
73
  app.set('trust proxy', 1)
72
74
  app.use(cookieParser(process.env.SESSION_SECRET))
73
75
  let cookieConfig = {
@@ -149,23 +151,23 @@ module.exports = function (options) {
149
151
  }
150
152
  else {
151
153
  let excludedRoutes = process.env.EXCLUDED_ROUTES.split(',')
152
- // console.log('secure routes', secureRoutes)
153
- // console.log('excluded routes', excludedRoutes)
154
- // console.log('path', req.path)
155
- // console.log('index of', excludedRoutes.indexOf(req.path))
154
+ console.log('secure routes', secureRoutes)
155
+ console.log('excluded routes', excludedRoutes)
156
+ console.log('path', req.path)
157
+ console.log('index of', excludedRoutes.indexOf(req.path))
156
158
  if (secureRoutes === true) {
157
159
  excludedRoutes.push('/resources', '/scripts', '/styles', '/external', '/templates', '/fonts')
158
160
  }
159
161
  if (secureRoutes === false && excludedRoutes.indexOf('/' + req.path.split('/')[1]) !== -1) {
160
- // console.log('in condition A')
162
+ console.log('in condition A')
161
163
  app.authHelper.isLoggedIn(req, res, next)
162
164
  }
163
165
  else if (secureRoutes === true && excludedRoutes.indexOf('/' + req.path.split('/')[1]) === -1) {
164
- // console.log('in condition B')
166
+ console.log('in condition B')
165
167
  app.authHelper.isLoggedIn(req, res, next)
166
168
  }
167
169
  else {
168
- // console.log('in condition C')
170
+ console.log('in condition C')
169
171
  next()
170
172
  }
171
173
  // secureRoutes === false && excludedRoutes.indexOf(req.path) !== -1 && app.authHelper.isLoggedIn(req, res, next)
@@ -4197,8 +4197,11 @@ class WebsyResultList {
4197
4197
  const html = this.buildHTML(d, startIndex)
4198
4198
  const el = document.getElementById(this.elementId)
4199
4199
  el.innerHTML += html.replace(/\n/g, '')
4200
+ if (this.options.onAppend) {
4201
+ this.options.onAppend()
4202
+ }
4200
4203
  }
4201
- buildHTML (d, startIndex = 0, inputTemplate, locator = []) {
4204
+ buildHTML (d = [], startIndex = 0, inputTemplate, locator = []) {
4202
4205
  let html = ``
4203
4206
  if (this.options.template) {
4204
4207
  if (d.length > 0) {
@@ -4435,7 +4438,10 @@ class WebsyResultList {
4435
4438
  resize () {
4436
4439
  const html = this.buildHTML(this.rows)
4437
4440
  const el = document.getElementById(this.elementId)
4438
- el.innerHTML = html.replace(/\n/g, '')
4441
+ el.innerHTML = html.replace(/\n/g, '')
4442
+ if (this.options.onResize) {
4443
+ this.options.onResize()
4444
+ }
4439
4445
  }
4440
4446
  }
4441
4447
 
@@ -5906,7 +5912,7 @@ class WebsyTable {
5906
5912
  }
5907
5913
  }
5908
5914
  hideLoading () {
5909
- this.loadingDialog.hide()
5915
+ this.loadingDialog && this.loadingDialog.hide()
5910
5916
  }
5911
5917
  internalSort (column, colIndex) {
5912
5918
  this.options.columns.forEach((c, i) => {
@@ -6052,7 +6058,7 @@ class WebsyTable {
6052
6058
  this._isRendered = true
6053
6059
  }
6054
6060
  showLoading (options) {
6055
- this.loadingDialog.show(options)
6061
+ this.loadingDialog && this.loadingDialog.show(options)
6056
6062
  }
6057
6063
  }
6058
6064
 
@@ -3962,11 +3962,15 @@ var WebsyResultList = /*#__PURE__*/function () {
3962
3962
  var html = this.buildHTML(d, startIndex);
3963
3963
  var el = document.getElementById(this.elementId);
3964
3964
  el.innerHTML += html.replace(/\n/g, '');
3965
+ if (this.options.onAppend) {
3966
+ this.options.onAppend();
3967
+ }
3965
3968
  }
3966
3969
  }, {
3967
3970
  key: "buildHTML",
3968
- value: function buildHTML(d) {
3971
+ value: function buildHTML() {
3969
3972
  var _this28 = this;
3973
+ var d = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
3970
3974
  var startIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
3971
3975
  var inputTemplate = arguments.length > 2 ? arguments[2] : undefined;
3972
3976
  var locator = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
@@ -4216,6 +4220,9 @@ var WebsyResultList = /*#__PURE__*/function () {
4216
4220
  var html = this.buildHTML(this.rows);
4217
4221
  var el = document.getElementById(this.elementId);
4218
4222
  el.innerHTML = html.replace(/\n/g, '');
4223
+ if (this.options.onResize) {
4224
+ this.options.onResize();
4225
+ }
4219
4226
  }
4220
4227
  }]);
4221
4228
  return WebsyResultList;
@@ -5742,7 +5749,7 @@ var WebsyTable = /*#__PURE__*/function () {
5742
5749
  }, {
5743
5750
  key: "hideLoading",
5744
5751
  value: function hideLoading() {
5745
- this.loadingDialog.hide();
5752
+ this.loadingDialog && this.loadingDialog.hide();
5746
5753
  }
5747
5754
  }, {
5748
5755
  key: "internalSort",
@@ -5876,7 +5883,7 @@ var WebsyTable = /*#__PURE__*/function () {
5876
5883
  }, {
5877
5884
  key: "showLoading",
5878
5885
  value: function showLoading(options) {
5879
- this.loadingDialog.show(options);
5886
+ this.loadingDialog && this.loadingDialog.show(options);
5880
5887
  }
5881
5888
  }]);
5882
5889
  return WebsyTable;