backend-plus 2.0.0-beta.10 → 2.0.0-beta.11
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.
- package/for-client/my-tables.js +34 -11
- package/lib/backend-plus.d.ts +3 -1
- package/lib/backend-plus.js +3 -1
- package/lib/procedures-table.js +19 -0
- package/package.json +19 -19
package/for-client/my-tables.js
CHANGED
|
@@ -294,9 +294,13 @@ myOwn.TableConnector = function(context, opts){
|
|
|
294
294
|
connector.opts = opts||{};
|
|
295
295
|
connector.fixedFields = connector.opts.fixedFields || [];
|
|
296
296
|
connector.fixedField = {};
|
|
297
|
+
connector.hideBecauseRelated = {};
|
|
297
298
|
connector.fixedFields.forEach(function(pair){
|
|
298
299
|
if(!pair.range && pair.value != myOwn.skipInFixedFields){
|
|
299
300
|
connector.fixedField[pair.fieldName] = pair.value;
|
|
301
|
+
if (!pair.show) {
|
|
302
|
+
connector.hideBecauseRelated[pair.fieldName] = true;
|
|
303
|
+
}
|
|
300
304
|
}
|
|
301
305
|
});
|
|
302
306
|
connector.parameterFunctions=connector.opts.parameterFunctions||{};
|
|
@@ -443,9 +447,13 @@ myOwn.TableConnectorLocal = function(context, opts){
|
|
|
443
447
|
connector.opts = opts||{};
|
|
444
448
|
connector.fixedFields = connector.opts.fixedFields || [];
|
|
445
449
|
connector.fixedField = {};
|
|
450
|
+
connector.hideBecauseRelated = {};
|
|
446
451
|
connector.fixedFields.forEach(function(pair){
|
|
447
452
|
if(!pair.range && pair.value != myOwn.skipInFixedFields){
|
|
448
453
|
connector.fixedField[pair.fieldName] = pair.value;
|
|
454
|
+
if (!pair.show) {
|
|
455
|
+
connector.hideBecauseRelated[pair.fieldName] = true;
|
|
456
|
+
}
|
|
449
457
|
}
|
|
450
458
|
});
|
|
451
459
|
connector.parameterFunctions=connector.opts.parameterFunctions||{};
|
|
@@ -624,19 +632,27 @@ myOwn.tableGrid = function tableGrid(tableName, mainElement, opts){
|
|
|
624
632
|
var primaryKeyValuesForDepotRow = getPrimaryKeyValues(primaryKey, depot.row);
|
|
625
633
|
return sameValue(JSON.stringify(primaryKeyValuesForRow),JSON.stringify(primaryKeyValuesForDepotRow))
|
|
626
634
|
});
|
|
635
|
+
if (!depot) {
|
|
636
|
+
var depot = grid.createDepotFromRow(row);
|
|
637
|
+
var needToAddInGrid = true;
|
|
638
|
+
}
|
|
639
|
+
var needToDisplayDepot = !!grid.filterDepots([depot])[0];
|
|
640
|
+
if (!needToDisplayDepot) return;
|
|
627
641
|
//chequeo que exista depot por las dudas
|
|
628
642
|
if ((!depot || !depot.tr || !depot.tr.parentNode) && !thereIsANewRecord && !grid.vertical) {
|
|
629
|
-
|
|
643
|
+
var depotsToDisplay = grid.filterDepots(grid.depots);
|
|
644
|
+
if (needToAddInGrid) {
|
|
630
645
|
var depot = grid.createDepotFromRow(row);
|
|
631
646
|
grid.depots.push(depot);
|
|
632
|
-
grid.
|
|
647
|
+
var depotsToDisplay = grid.filterDepots(grid.depots);
|
|
648
|
+
grid.sortDepotsToDisplay(depotsToDisplay);
|
|
633
649
|
} else if (depot.tr && !depot.tr.parentNode) {
|
|
634
650
|
depot.tr = null
|
|
635
651
|
}
|
|
636
652
|
var iRow = -1;
|
|
637
653
|
var i = 0;
|
|
638
|
-
while (i <
|
|
639
|
-
var aDepot =
|
|
654
|
+
while (i < depotsToDisplay.length){
|
|
655
|
+
var aDepot = depotsToDisplay[i];
|
|
640
656
|
if (depot == aDepot) break;
|
|
641
657
|
if (aDepot && aDepot.tr && aDepot.tr.parentNode && aDepot.tr.rowIndex != null) {
|
|
642
658
|
iRow = aDepot.tr.sectionRowIndex
|
|
@@ -664,7 +680,8 @@ myOwn.tableGrid = function tableGrid(tableName, mainElement, opts){
|
|
|
664
680
|
})
|
|
665
681
|
if(!thereIsANewRecord){
|
|
666
682
|
var i = 0;
|
|
667
|
-
var
|
|
683
|
+
var depotsToDisplay = grid.filterDepots(grid.depots);
|
|
684
|
+
var depotsToDelete = depotsToDisplay.filter(depot => depot.tick != tick);
|
|
668
685
|
var depot;
|
|
669
686
|
if (myOwn.config.config['grid-row-retain-moved-or-deleted'] && !force) {
|
|
670
687
|
var depotsToRetain = grid.depots.filter(depot => depot.tick == tick);
|
|
@@ -921,11 +938,11 @@ myOwn.DataColumnGrid.prototype.cellAttributes = function cellAttributes(specific
|
|
|
921
938
|
attr["my-mandatory"]="normal";
|
|
922
939
|
}
|
|
923
940
|
}
|
|
924
|
-
if(grid.connector.
|
|
941
|
+
if(grid.connector.hideBecauseRelated[fieldDef.name] && !fieldDef.alwaysShow){
|
|
925
942
|
attr["inherited-pk-column"]="yes";
|
|
926
943
|
}
|
|
927
944
|
if(fieldDef.referencesField){
|
|
928
|
-
if(grid.connector.
|
|
945
|
+
if(grid.connector.hideBecauseRelated[fieldDef.referencesField] && !fieldDef.alwaysShow){
|
|
929
946
|
attr["inherited-pk-column"]="yes";
|
|
930
947
|
}
|
|
931
948
|
if(grid.def.field[fieldDef.referencesField].isPk){
|
|
@@ -2605,18 +2622,19 @@ myOwn.TableGrid.prototype.displayGrid = function displayGrid(){
|
|
|
2605
2622
|
}
|
|
2606
2623
|
return depot;
|
|
2607
2624
|
};
|
|
2608
|
-
grid.
|
|
2625
|
+
grid.filterDepots = function filterDepots(depotsToFilter){
|
|
2609
2626
|
var grid = this;
|
|
2610
|
-
var depotsToDisplay;
|
|
2611
2627
|
var filterRows = grid.view.filter;
|
|
2628
|
+
var depotsToDisplay;
|
|
2612
2629
|
if(filterRows && filterRows.length){
|
|
2613
|
-
depotsToDisplay =
|
|
2630
|
+
depotsToDisplay = depotsToFilter.filter(function(depot,i){
|
|
2614
2631
|
var iFilter=0;
|
|
2615
2632
|
while(iFilter<filterRows.length){
|
|
2616
2633
|
var filterData=filterRows[iFilter];
|
|
2617
2634
|
var partialOk=true;
|
|
2618
2635
|
var columnsCompared = 0;
|
|
2619
2636
|
for(var column in depot.row){
|
|
2637
|
+
// var compSymb = filterData.rowSymbols && filterData.rowSymbols[column] || filterData[column].operator;
|
|
2620
2638
|
var compSymb = filterData.rowSymbols[column];
|
|
2621
2639
|
if(compSymb && my.comparator[compSymb] && (my.comparatorParameterNull[compSymb] || filterData.row[column] != null)){
|
|
2622
2640
|
var isSatisfied=my.comparator[compSymb](depot.row[column],filterData.row[column]);
|
|
@@ -2634,8 +2652,13 @@ myOwn.TableGrid.prototype.displayGrid = function displayGrid(){
|
|
|
2634
2652
|
return false;
|
|
2635
2653
|
});
|
|
2636
2654
|
}else{
|
|
2637
|
-
depotsToDisplay =
|
|
2655
|
+
depotsToDisplay = depotsToFilter;
|
|
2638
2656
|
}
|
|
2657
|
+
return depotsToDisplay;
|
|
2658
|
+
}
|
|
2659
|
+
grid.displayBody=function displayBody(){
|
|
2660
|
+
var grid = this;
|
|
2661
|
+
var depotsToDisplay = grid.filterDepots(grid.depots);
|
|
2639
2662
|
grid.sortDepotsToDisplay = function sortDepotsToDisplay(depotsToDisplay){
|
|
2640
2663
|
if(grid.view.sortColumns.length>0){
|
|
2641
2664
|
return depotsToDisplay.sort(function(depot1, depot2){
|
package/lib/backend-plus.d.ts
CHANGED
|
@@ -120,7 +120,7 @@ export type MenuInfoMenu = {
|
|
|
120
120
|
export type MenuInfoTable = {
|
|
121
121
|
menuType:'table'
|
|
122
122
|
table?:string
|
|
123
|
-
ff?:{fieldName:string, value:any}[]
|
|
123
|
+
ff?:{fieldName:string, value:any, show?:boolean}[]
|
|
124
124
|
fc?:{fieldName:string, operator:string, value:any}[]
|
|
125
125
|
pf?:any
|
|
126
126
|
td?:TableDefinition
|
|
@@ -211,6 +211,7 @@ export type FieldDefinition = EditableDbDefinition & {
|
|
|
211
211
|
table?:string
|
|
212
212
|
inherited?:boolean
|
|
213
213
|
nameForUpsert?:string
|
|
214
|
+
alwaysShow?:boolean /* show when appears in fixed fields */
|
|
214
215
|
} & ({} | {
|
|
215
216
|
sequence:SequenceDefinition
|
|
216
217
|
nullable:true
|
|
@@ -419,6 +420,7 @@ export class AppBackend{
|
|
|
419
420
|
messages:Record<LangId,Record<string, string>>
|
|
420
421
|
}
|
|
421
422
|
shootDownBackend():Promise<void>
|
|
423
|
+
setLog(opts:{until:string, results?:boolean})
|
|
422
424
|
}
|
|
423
425
|
|
|
424
426
|
}
|
package/lib/backend-plus.js
CHANGED
|
@@ -235,7 +235,8 @@ AppBackend.prototype.i18n.messages.en={
|
|
|
235
235
|
fileUploaded:'file uploaded',
|
|
236
236
|
unkownExt:'unkown file extension'
|
|
237
237
|
},
|
|
238
|
-
server:{
|
|
238
|
+
server:{
|
|
239
|
+
backupNotAvailable: 'Backup not available',
|
|
239
240
|
cantDelete_TLDR:'Can\'t delete. May be rights problems, locked records or internal problems',
|
|
240
241
|
cantInsert_TLDR:'Can\'t insert. May be rights problems, locked records or internal problems',
|
|
241
242
|
cantUpdate_TLDR:'Can\'t update. May be rights problems, locked records or internal problems',
|
|
@@ -314,6 +315,7 @@ AppBackend.prototype.i18n.messages.es={
|
|
|
314
315
|
unkownExt:'extensión de archivo desconocida'
|
|
315
316
|
},
|
|
316
317
|
server:{
|
|
318
|
+
backupNotAvailable: 'Backup no disponible',
|
|
317
319
|
cantDelete_TLDR:'no se pudo eliminar el registro. Podrían haber problemas de persmisos, bloqueo de registros o problemas internos en la definición de la PK',
|
|
318
320
|
cantInsert_TLDR:'no se pudo insertar el registro. Podrían haber problemas de persmisos, bloqueo de registros o problemas internos en la definición de la PK',
|
|
319
321
|
cantUpdate_TLDR:'no se pudo modificar el registro. Podrían haber problemas de persmisos, bloqueo de registros o problemas internos en la definición de la PK',
|
package/lib/procedures-table.js
CHANGED
|
@@ -1205,6 +1205,25 @@ ProcedureTables = [
|
|
|
1205
1205
|
and cha_new_pk = ${context.be.db.quoteLiteral(JSON.stringify(pk))}
|
|
1206
1206
|
order by cha_when desc
|
|
1207
1207
|
`,[parameters.tableName, parameters.fieldName]).fetchAll();
|
|
1208
|
+
return result.rows;
|
|
1209
|
+
}
|
|
1210
|
+
},
|
|
1211
|
+
{
|
|
1212
|
+
action:'download_dump',
|
|
1213
|
+
parameters:[
|
|
1214
|
+
{name:'password' , typeName:'text' },
|
|
1215
|
+
],
|
|
1216
|
+
bitacora:{always: true, error: true},
|
|
1217
|
+
progress:true,
|
|
1218
|
+
coreFunction:async function(context,parameters){
|
|
1219
|
+
var {be,client} = context;
|
|
1220
|
+
if(context.user[be.config.login.rolFieldName] != 'admin'){
|
|
1221
|
+
throw new Error('Forbiden history')
|
|
1222
|
+
}
|
|
1223
|
+
if (!be.config.db['downloadable-backup-path']) {
|
|
1224
|
+
throw new Error(be.messages.server.backupNotAvailable)
|
|
1225
|
+
}
|
|
1226
|
+
|
|
1208
1227
|
return result.rows;
|
|
1209
1228
|
}
|
|
1210
1229
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "backend-plus",
|
|
3
3
|
"description": "Backend for the anti Pareto rule",
|
|
4
|
-
"version": "2.0.0-beta.
|
|
4
|
+
"version": "2.0.0-beta.11",
|
|
5
5
|
"author": "Codenautas <codenautas@googlegroups.com>",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": "codenautas/backend-plus",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"mini-tools": "^1.12.1",
|
|
55
55
|
"moment": "^2.29.4",
|
|
56
56
|
"multiparty": "^4.2.3",
|
|
57
|
-
"nodemailer": "^6.9.
|
|
57
|
+
"nodemailer": "^6.9.5",
|
|
58
58
|
"numeral": "^2.0.6",
|
|
59
59
|
"pg-promise-strict": "^1.3.3",
|
|
60
60
|
"pikaday": "^1.8.2",
|
|
@@ -67,26 +67,26 @@
|
|
|
67
67
|
"session-file-store": "^1.5.0",
|
|
68
68
|
"sql-tools": "^0.1.2",
|
|
69
69
|
"stack-trace": "^0.0.10",
|
|
70
|
-
"stylus": "0.
|
|
70
|
+
"stylus": "0.60.0",
|
|
71
71
|
"type-store": "^0.4.0",
|
|
72
72
|
"typed-controls": "^0.12.0",
|
|
73
73
|
"xlsx": "https://cdn.sheetjs.com/xlsx-0.19.3/xlsx-0.19.3.tgz"
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|
|
76
76
|
"@types/big.js": "^6.2.0",
|
|
77
|
-
"@types/expect.js": "~0.3.
|
|
78
|
-
"@types/express": "^4.17.
|
|
79
|
-
"@types/express-useragent": "^1.0.
|
|
80
|
-
"@types/fs-extra": "^11.0.
|
|
81
|
-
"@types/js-yaml": "^4.0.
|
|
82
|
-
"@types/mocha": "^10.0.
|
|
83
|
-
"@types/multiparty": "~0.0.
|
|
84
|
-
"@types/node": "^20.
|
|
85
|
-
"@types/nodemailer": "^6.4.
|
|
86
|
-
"@types/numeral": "~2.0.
|
|
87
|
-
"@types/session-file-store": "^1.2.
|
|
88
|
-
"@types/stack-trace": "~0.0.
|
|
89
|
-
"@types/websql": "~0.0.
|
|
77
|
+
"@types/expect.js": "~0.3.30",
|
|
78
|
+
"@types/express": "^4.17.18",
|
|
79
|
+
"@types/express-useragent": "^1.0.3",
|
|
80
|
+
"@types/fs-extra": "^11.0.2",
|
|
81
|
+
"@types/js-yaml": "^4.0.6",
|
|
82
|
+
"@types/mocha": "^10.0.2",
|
|
83
|
+
"@types/multiparty": "~0.0.34",
|
|
84
|
+
"@types/node": "^20.8.0",
|
|
85
|
+
"@types/nodemailer": "^6.4.11",
|
|
86
|
+
"@types/numeral": "~2.0.3",
|
|
87
|
+
"@types/session-file-store": "^1.2.3",
|
|
88
|
+
"@types/stack-trace": "~0.0.31",
|
|
89
|
+
"@types/websql": "~0.0.28",
|
|
90
90
|
"esprima": "^4.0.1",
|
|
91
91
|
"expect.js": "~0.3.1",
|
|
92
92
|
"karma": "6.4.2",
|
|
@@ -98,11 +98,11 @@
|
|
|
98
98
|
"kill-9": "~0.4.3",
|
|
99
99
|
"mocha": "^10.2.0",
|
|
100
100
|
"nyc": "^15.1.0",
|
|
101
|
-
"puppeteer": "^21.
|
|
102
|
-
"sinon": "^
|
|
101
|
+
"puppeteer": "^21.3.6",
|
|
102
|
+
"sinon": "^16.0.0",
|
|
103
103
|
"supertest": "^6.3.3",
|
|
104
104
|
"types.d.ts": "~0.6.18",
|
|
105
|
-
"typescript": "^5.
|
|
105
|
+
"typescript": "^5.2.2",
|
|
106
106
|
"why-is-node-running": "^2.2.2"
|
|
107
107
|
},
|
|
108
108
|
"engines": {
|