@xuda.io/runtime-bundle 1.0.518 → 1.0.520
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/js/xuda-runtime-bundle.js +227 -213
- package/js/xuda-runtime-bundle.min.js +1 -1
- package/js/xuda-runtime-slim.js +231 -217
- package/js/xuda-runtime-slim.min.es.js +231 -217
- package/js/xuda-runtime-slim.min.js +1 -1
- package/js/xuda-server-bundle.min.mjs +1 -1
- package/js/xuda-server-bundle.mjs +208 -203
- package/js/xuda-worker-bundle.js +208 -203
- package/js/xuda-worker-bundle.min.js +1 -1
- package/package.json +1 -1
|
@@ -28244,6 +28244,7 @@ func.UI.refs_garbage_collector = function (SESSION_ID = Object.keys(SESSION_OBJ)
|
|
|
28244
28244
|
};
|
|
28245
28245
|
|
|
28246
28246
|
func.UI.update_xu_ref = function (SESSION_ID, dsSessionP, ref_field_id, $elm) {
|
|
28247
|
+
let ret;
|
|
28247
28248
|
const _session = SESSION_OBJ[SESSION_ID];
|
|
28248
28249
|
let _ds_0 = _session.DS_GLB[0];
|
|
28249
28250
|
|
|
@@ -28253,27 +28254,35 @@ func.UI.update_xu_ref = function (SESSION_ID, dsSessionP, ref_field_id, $elm) {
|
|
|
28253
28254
|
|
|
28254
28255
|
let SYS_GLOBAL_OBJ_REFS = _ds_0.data_system['SYS_GLOBAL_OBJ_REFS'];
|
|
28255
28256
|
|
|
28256
|
-
if (!SYS_GLOBAL_OBJ_REFS[ref_field_id]) {
|
|
28257
|
-
|
|
28258
|
-
}
|
|
28259
|
-
SYS_GLOBAL_OBJ_REFS[ref_field_id].ds = _ds;
|
|
28260
|
-
SYS_GLOBAL_OBJ_REFS[ref_field_id].data = _ds?.data_feed?.rows?.[row_idx] || {};
|
|
28261
|
-
SYS_GLOBAL_OBJ_REFS[ref_field_id].props = _ds.in_parameters || {};
|
|
28262
|
-
|
|
28263
|
-
if ($elm) {
|
|
28264
|
-
const attributes = $elm?.data()?.xuData?.xuPanelProps || $elm?.data()?.xuData?.debug_info?.attribute_stat || {};
|
|
28265
|
-
SYS_GLOBAL_OBJ_REFS[ref_field_id].attributes = attributes;
|
|
28266
|
-
SYS_GLOBAL_OBJ_REFS[ref_field_id].xu_ui_id = $elm.attr('xu-ui-id');
|
|
28267
|
-
}
|
|
28268
|
-
|
|
28269
|
-
// let obj = { ds: _ds, data: _ds?.data_feed?.rows?.[row_idx] || {}, props: _ds.in_parameters || {} };
|
|
28257
|
+
// if (!SYS_GLOBAL_OBJ_REFS[ref_field_id]) {
|
|
28258
|
+
// SYS_GLOBAL_OBJ_REFS[ref_field_id] = {};
|
|
28259
|
+
// }
|
|
28260
|
+
// SYS_GLOBAL_OBJ_REFS[ref_field_id].ds = _ds;
|
|
28261
|
+
// SYS_GLOBAL_OBJ_REFS[ref_field_id].data = _ds?.data_feed?.rows?.[row_idx] || {};
|
|
28262
|
+
// SYS_GLOBAL_OBJ_REFS[ref_field_id].props = _ds.in_parameters || {};
|
|
28270
28263
|
|
|
28271
28264
|
// if ($elm) {
|
|
28272
28265
|
// const attributes = $elm?.data()?.xuData?.xuPanelProps || $elm?.data()?.xuData?.debug_info?.attribute_stat || {};
|
|
28273
|
-
//
|
|
28274
|
-
//
|
|
28266
|
+
// SYS_GLOBAL_OBJ_REFS[ref_field_id].attributes = attributes;
|
|
28267
|
+
// SYS_GLOBAL_OBJ_REFS[ref_field_id].xu_ui_id = $elm.attr('xu-ui-id');
|
|
28275
28268
|
// }
|
|
28276
28269
|
|
|
28270
|
+
let obj = { ds: _ds, data: _ds?.data_feed?.rows?.[row_idx] || {}, props: _ds.in_parameters || {} };
|
|
28271
|
+
|
|
28272
|
+
if ($elm) {
|
|
28273
|
+
const attributes = $elm?.data()?.xuData?.xuPanelProps || $elm?.data()?.xuData?.debug_info?.attribute_stat || {};
|
|
28274
|
+
obj.attributes = attributes;
|
|
28275
|
+
obj.xu_ui_id = $elm.attr('xu-ui-id');
|
|
28276
|
+
}
|
|
28277
|
+
|
|
28278
|
+
if (!_.isEqual(SYS_GLOBAL_OBJ_REFS?.[ref_field_id] || {}, obj)) {
|
|
28279
|
+
if (!SYS_GLOBAL_OBJ_REFS[ref_field_id]) {
|
|
28280
|
+
SYS_GLOBAL_OBJ_REFS[ref_field_id] = {};
|
|
28281
|
+
}
|
|
28282
|
+
SYS_GLOBAL_OBJ_REFS[ref_field_id] = obj;
|
|
28283
|
+
ret = true;
|
|
28284
|
+
}
|
|
28285
|
+
return ret;
|
|
28277
28286
|
// func.datasource.update(SESSION_ID, {
|
|
28278
28287
|
// [0]: {
|
|
28279
28288
|
// ['datasource_main']: {
|
|
@@ -30161,201 +30170,201 @@ func.datasource.del = function (SESSION_ID, dsP) {
|
|
|
30161
30170
|
}
|
|
30162
30171
|
perform_delete();
|
|
30163
30172
|
};
|
|
30164
|
-
func.datasource.update_old = async function (SESSION_ID, datasource_changes, update_local_scope_only, avoid_refresh) {
|
|
30165
|
-
|
|
30166
|
-
|
|
30167
|
-
|
|
30168
|
-
if (_session.IS_API || typeof IS_MASTER_WEBSOCKET !== 'undefined' || typeof IS_PROCESS_SERVER !== 'undefined') {
|
|
30169
|
-
update_local_scope_only = true;
|
|
30170
|
-
}
|
|
30171
|
-
|
|
30172
|
-
if (typeof glb.GLOBAL_VARS === 'undefined') {
|
|
30173
|
-
glb.GLOBAL_VARS = (await func.common.get_module(SESSION_ID, 'xuda-system-globals-module.mjs')).system_globals;
|
|
30174
|
-
}
|
|
30175
|
-
|
|
30176
|
-
const set_fieldComputed_dependencies = async function (dsNo, field_id, parent_ds) {
|
|
30177
|
-
// iterate child ds
|
|
30178
|
-
for (const [dsSession, _ds] of Object.entries(_session.DS_GLB)) {
|
|
30179
|
-
if (parent_ds !== null) {
|
|
30180
|
-
if (_ds.parentDataSourceNo != parent_ds) continue;
|
|
30181
|
-
} else {
|
|
30182
|
-
if (dsSession != dsNo) continue;
|
|
30183
|
-
}
|
|
30184
|
-
let tree_ret = await func.utils.TREE_OBJ.get(SESSION_ID, _ds.prog_id);
|
|
30185
|
-
if (tree_ret.menuType === 'component' || tree_ret.menuType === 'globals') {
|
|
30186
|
-
// check if field has fieldComputed property
|
|
30187
|
-
const _progFields = await func.datasource.get_progFields(SESSION_ID, dsSession);
|
|
30188
|
-
// find if field is computed
|
|
30189
|
-
let fieldComputed_propExpressions, fieldComputed_id;
|
|
30190
|
-
for await (const val of _progFields) {
|
|
30191
|
-
const fieldId = val.data.field_id;
|
|
30192
|
-
|
|
30193
|
-
// if (fieldId !== field_id) continue
|
|
30194
|
-
if (val.data.type !== 'virtual' || !val.props.fieldComputed) continue;
|
|
30195
|
-
|
|
30196
|
-
const _propExpressions = val.props?.propExpressions?.fieldValue;
|
|
30197
|
-
if (_propExpressions && JSON.stringify(_propExpressions).includes(field_id)) {
|
|
30198
|
-
fieldComputed_propExpressions = _propExpressions;
|
|
30199
|
-
fieldComputed_id = fieldId;
|
|
30200
|
-
}
|
|
30201
|
-
}
|
|
30202
|
-
|
|
30203
|
-
if (!fieldComputed_id) return;
|
|
30204
|
-
|
|
30205
|
-
// iterate ds rows
|
|
30206
|
-
for (const row of _ds.data_feed?.rows || []) {
|
|
30207
|
-
// iterate row fields
|
|
30208
|
-
for (const [key, val] of Object.entries(row)) {
|
|
30209
|
-
if (key !== fieldComputed_id) continue;
|
|
30210
|
-
try {
|
|
30211
|
-
let ret = await func.expression.get(SESSION_ID, fieldComputed_propExpressions, dsNo, 'update', row._ROWID);
|
|
30173
|
+
// func.datasource.update_old = async function (SESSION_ID, datasource_changes, update_local_scope_only, avoid_refresh) {
|
|
30174
|
+
// return new Promise(async (resolve, reject) => {
|
|
30175
|
+
// var _session = SESSION_OBJ[SESSION_ID];
|
|
30212
30176
|
|
|
30213
|
-
|
|
30214
|
-
|
|
30215
|
-
|
|
30216
|
-
if (!fields_changed.includes(fieldComputed_id)) {
|
|
30217
|
-
fields_changed.push(fieldComputed_id);
|
|
30218
|
-
}
|
|
30219
|
-
if (!datasource_changed.includes(dsSession)) {
|
|
30220
|
-
datasource_changed.push(dsSession);
|
|
30221
|
-
}
|
|
30222
|
-
}
|
|
30223
|
-
} catch (err) {
|
|
30224
|
-
console.error(err);
|
|
30225
|
-
}
|
|
30226
|
-
}
|
|
30227
|
-
}
|
|
30228
|
-
}
|
|
30229
|
-
await set_fieldComputed_dependencies(dsNo, field_id, dsSession);
|
|
30230
|
-
}
|
|
30231
|
-
};
|
|
30177
|
+
// if (_session.IS_API || typeof IS_MASTER_WEBSOCKET !== 'undefined' || typeof IS_PROCESS_SERVER !== 'undefined') {
|
|
30178
|
+
// update_local_scope_only = true;
|
|
30179
|
+
// }
|
|
30232
30180
|
|
|
30233
|
-
|
|
30234
|
-
|
|
30235
|
-
|
|
30236
|
-
let server_datasource_changes = {};
|
|
30237
|
-
// iterate changes datasource
|
|
30238
|
-
for await (const [dataSource, row_data] of Object.entries(datasource_changes)) {
|
|
30239
|
-
var _ds = _session.DS_GLB[dataSource];
|
|
30240
|
-
if (!_ds) {
|
|
30241
|
-
continue;
|
|
30242
|
-
}
|
|
30181
|
+
// if (typeof glb.GLOBAL_VARS === 'undefined') {
|
|
30182
|
+
// glb.GLOBAL_VARS = (await func.common.get_module(SESSION_ID, 'xuda-system-globals-module.mjs')).system_globals;
|
|
30183
|
+
// }
|
|
30243
30184
|
|
|
30244
|
-
|
|
30245
|
-
|
|
30246
|
-
|
|
30247
|
-
|
|
30248
|
-
|
|
30249
|
-
|
|
30250
|
-
|
|
30251
|
-
|
|
30185
|
+
// const set_fieldComputed_dependencies = async function (dsNo, field_id, parent_ds) {
|
|
30186
|
+
// // iterate child ds
|
|
30187
|
+
// for (const [dsSession, _ds] of Object.entries(_session.DS_GLB)) {
|
|
30188
|
+
// if (parent_ds !== null) {
|
|
30189
|
+
// if (_ds.parentDataSourceNo != parent_ds) continue;
|
|
30190
|
+
// } else {
|
|
30191
|
+
// if (dsSession != dsNo) continue;
|
|
30192
|
+
// }
|
|
30193
|
+
// let tree_ret = await func.utils.TREE_OBJ.get(SESSION_ID, _ds.prog_id);
|
|
30194
|
+
// if (tree_ret.menuType === 'component' || tree_ret.menuType === 'globals') {
|
|
30195
|
+
// // check if field has fieldComputed property
|
|
30196
|
+
// const _progFields = await func.datasource.get_progFields(SESSION_ID, dsSession);
|
|
30197
|
+
// // find if field is computed
|
|
30198
|
+
// let fieldComputed_propExpressions, fieldComputed_id;
|
|
30199
|
+
// for await (const val of _progFields) {
|
|
30200
|
+
// const fieldId = val.data.field_id;
|
|
30201
|
+
|
|
30202
|
+
// // if (fieldId !== field_id) continue
|
|
30203
|
+
// if (val.data.type !== 'virtual' || !val.props.fieldComputed) continue;
|
|
30204
|
+
|
|
30205
|
+
// const _propExpressions = val.props?.propExpressions?.fieldValue;
|
|
30206
|
+
// if (_propExpressions && JSON.stringify(_propExpressions).includes(field_id)) {
|
|
30207
|
+
// fieldComputed_propExpressions = _propExpressions;
|
|
30208
|
+
// fieldComputed_id = fieldId;
|
|
30209
|
+
// }
|
|
30210
|
+
// }
|
|
30252
30211
|
|
|
30253
|
-
|
|
30254
|
-
|
|
30255
|
-
|
|
30256
|
-
|
|
30257
|
-
|
|
30258
|
-
|
|
30259
|
-
|
|
30260
|
-
|
|
30261
|
-
|
|
30262
|
-
|
|
30212
|
+
// if (!fieldComputed_id) return;
|
|
30213
|
+
|
|
30214
|
+
// // iterate ds rows
|
|
30215
|
+
// for (const row of _ds.data_feed?.rows || []) {
|
|
30216
|
+
// // iterate row fields
|
|
30217
|
+
// for (const [key, val] of Object.entries(row)) {
|
|
30218
|
+
// if (key !== fieldComputed_id) continue;
|
|
30219
|
+
// try {
|
|
30220
|
+
// let ret = await func.expression.get(SESSION_ID, fieldComputed_propExpressions, dsNo, 'update', row._ROWID);
|
|
30221
|
+
|
|
30222
|
+
// const row_idx = func.common.find_ROWID_idx(_ds, row._ROWID);
|
|
30223
|
+
// if (_ds.data_feed.rows[row_idx][fieldComputed_id] !== ret.result) {
|
|
30224
|
+
// _ds.data_feed.rows[row_idx][fieldComputed_id] = ret.result;
|
|
30225
|
+
// if (!fields_changed.includes(fieldComputed_id)) {
|
|
30226
|
+
// fields_changed.push(fieldComputed_id);
|
|
30227
|
+
// }
|
|
30228
|
+
// if (!datasource_changed.includes(dsSession)) {
|
|
30229
|
+
// datasource_changed.push(dsSession);
|
|
30230
|
+
// }
|
|
30231
|
+
// }
|
|
30232
|
+
// } catch (err) {
|
|
30233
|
+
// console.error(err);
|
|
30234
|
+
// }
|
|
30235
|
+
// }
|
|
30236
|
+
// }
|
|
30237
|
+
// }
|
|
30238
|
+
// await set_fieldComputed_dependencies(dsNo, field_id, dsSession);
|
|
30239
|
+
// }
|
|
30240
|
+
// };
|
|
30241
|
+
|
|
30242
|
+
// var fields_changed = [];
|
|
30243
|
+
// var datasource_changed = [];
|
|
30244
|
+
// let client_datasource_changes = {};
|
|
30245
|
+
// let server_datasource_changes = {};
|
|
30246
|
+
// // iterate changes datasource
|
|
30247
|
+
// for await (const [dataSource, row_data] of Object.entries(datasource_changes)) {
|
|
30248
|
+
// var _ds = _session.DS_GLB[dataSource];
|
|
30249
|
+
// if (!_ds) {
|
|
30250
|
+
// continue;
|
|
30251
|
+
// }
|
|
30263
30252
|
|
|
30264
|
-
|
|
30265
|
-
|
|
30266
|
-
|
|
30267
|
-
|
|
30268
|
-
|
|
30253
|
+
// const update_xu_ref = async function () {
|
|
30254
|
+
// let _ds_0 = _session.DS_GLB[0];
|
|
30255
|
+
// for ([ref_name, val] of Object.entries(_ds_0.data_system['SYS_GLOBAL_OBJ_REFS'])) {
|
|
30256
|
+
// if (val.ds.dsSession == dataSource) {
|
|
30257
|
+
// func.UI.update_xu_ref(SESSION_ID, dataSource, ref_name);
|
|
30258
|
+
// }
|
|
30259
|
+
// }
|
|
30260
|
+
// };
|
|
30269
30261
|
|
|
30270
|
-
|
|
30271
|
-
|
|
30272
|
-
|
|
30273
|
-
|
|
30274
|
-
|
|
30262
|
+
// // iterate changes records
|
|
30263
|
+
// for (const [record_id, fields_data] of Object.entries(row_data)) {
|
|
30264
|
+
// // iterate changes fields
|
|
30265
|
+
// for (const [field_id, value] of Object.entries(fields_data)) {
|
|
30266
|
+
// // mechanism to make update directly on the datasource object
|
|
30267
|
+
// if (record_id === 'datasource_main') {
|
|
30268
|
+
// _.set(_ds, field_id, value);
|
|
30269
|
+
// update_xu_ref();
|
|
30270
|
+
// continue;
|
|
30271
|
+
// }
|
|
30275
30272
|
|
|
30276
|
-
|
|
30277
|
-
|
|
30273
|
+
// if (typeof fields_data === 'object') {
|
|
30274
|
+
// if (glb.GLOBAL_VARS[field_id]) {
|
|
30275
|
+
// _ds.data_system[field_id] = value;
|
|
30276
|
+
// continue;
|
|
30277
|
+
// }
|
|
30278
30278
|
|
|
30279
|
-
|
|
30280
|
-
|
|
30281
|
-
|
|
30282
|
-
|
|
30283
|
-
|
|
30284
|
-
|
|
30285
|
-
|
|
30286
|
-
|
|
30287
|
-
|
|
30288
|
-
|
|
30289
|
-
|
|
30290
|
-
|
|
30291
|
-
|
|
30292
|
-
|
|
30293
|
-
|
|
30294
|
-
|
|
30295
|
-
|
|
30296
|
-
|
|
30297
|
-
|
|
30298
|
-
|
|
30299
|
-
|
|
30300
|
-
|
|
30301
|
-
|
|
30302
|
-
|
|
30303
|
-
|
|
30304
|
-
|
|
30305
|
-
|
|
30306
|
-
|
|
30307
|
-
|
|
30308
|
-
|
|
30279
|
+
// // try {
|
|
30280
|
+
// const row_idx = func.common.find_ROWID_idx(_ds, record_id);
|
|
30281
|
+
// if (_ds.data_feed.rows[row_idx][field_id] !== value) {
|
|
30282
|
+
// _ds.data_feed.rows[row_idx][field_id] = value;
|
|
30283
|
+
// await set_fieldComputed_dependencies(dataSource, field_id, null);
|
|
30284
|
+
|
|
30285
|
+
// // search the field in refs
|
|
30286
|
+
// update_xu_ref();
|
|
30287
|
+
|
|
30288
|
+
// if (!update_local_scope_only) {
|
|
30289
|
+
// let tree_ret = await func.utils.TREE_OBJ.get(SESSION_ID, _ds.prog_id);
|
|
30290
|
+
// if (glb.IS_WORKER) {
|
|
30291
|
+
// // RUN AT SERVER
|
|
30292
|
+
// if (tree_ret.menuType === 'globals' || tree_ret.menuType === 'component') {
|
|
30293
|
+
// const _progFields = await func.datasource.get_progFields(SESSION_ID, dataSource);
|
|
30294
|
+
// let view_field_obj = func.common.find_item_by_key(_progFields, 'field_id', field_id);
|
|
30295
|
+
// if (!view_field_obj?.data?.serverField && record_id !== 'data_system') {
|
|
30296
|
+
// if (!client_datasource_changes[dataSource]) {
|
|
30297
|
+
// client_datasource_changes[dataSource] = {};
|
|
30298
|
+
// }
|
|
30299
|
+
// if (!client_datasource_changes[dataSource][record_id]) {
|
|
30300
|
+
// client_datasource_changes[dataSource][record_id] = {};
|
|
30301
|
+
// }
|
|
30302
|
+
// client_datasource_changes[dataSource][record_id][field_id] = value;
|
|
30303
|
+
// }
|
|
30304
|
+
// }
|
|
30305
|
+
// } else {
|
|
30306
|
+
// // RUN AT CLIENT
|
|
30307
|
+
// if ((tree_ret.menuType === 'component' && _ds._run_at !== 'client') || tree_ret.menuType === 'globals') {
|
|
30308
|
+
// if (!server_datasource_changes[dataSource]) {
|
|
30309
|
+
// server_datasource_changes[dataSource] = {};
|
|
30310
|
+
// }
|
|
30311
|
+
// if (!server_datasource_changes[dataSource][record_id]) {
|
|
30312
|
+
// server_datasource_changes[dataSource][record_id] = {};
|
|
30313
|
+
// }
|
|
30314
|
+
// server_datasource_changes[dataSource][record_id][field_id] = value;
|
|
30315
|
+
// }
|
|
30316
|
+
// }
|
|
30317
|
+
// }
|
|
30309
30318
|
|
|
30310
|
-
|
|
30311
|
-
|
|
30312
|
-
|
|
30313
|
-
|
|
30314
|
-
|
|
30315
|
-
|
|
30319
|
+
// if (!fields_changed.includes(field_id)) {
|
|
30320
|
+
// fields_changed.push(field_id);
|
|
30321
|
+
// }
|
|
30322
|
+
// if (!datasource_changed.includes(dataSource)) {
|
|
30323
|
+
// datasource_changed.push(dataSource);
|
|
30324
|
+
// }
|
|
30316
30325
|
|
|
30317
|
-
|
|
30318
|
-
|
|
30319
|
-
|
|
30320
|
-
|
|
30321
|
-
|
|
30322
|
-
|
|
30323
|
-
|
|
30324
|
-
|
|
30325
|
-
|
|
30326
|
-
|
|
30327
|
-
|
|
30326
|
+
// if (!_ds.data_feed.rows_changed) {
|
|
30327
|
+
// _ds.data_feed.rows_changed = [];
|
|
30328
|
+
// }
|
|
30329
|
+
// if (!_ds.data_feed.rows_changed.includes(record_id)) _ds.data_feed.rows_changed.push(record_id);
|
|
30330
|
+
// }
|
|
30331
|
+
// } else if (fields_data === 'set') {
|
|
30332
|
+
// _ds.currentRecordId = record_id;
|
|
30333
|
+
// }
|
|
30334
|
+
// }
|
|
30335
|
+
// }
|
|
30336
|
+
// }
|
|
30328
30337
|
|
|
30329
|
-
|
|
30330
|
-
|
|
30331
|
-
|
|
30332
|
-
|
|
30333
|
-
|
|
30334
|
-
|
|
30335
|
-
|
|
30336
|
-
|
|
30337
|
-
|
|
30338
|
-
|
|
30339
|
-
|
|
30340
|
-
|
|
30341
|
-
|
|
30342
|
-
|
|
30343
|
-
|
|
30344
|
-
|
|
30345
|
-
|
|
30346
|
-
|
|
30347
|
-
|
|
30348
|
-
|
|
30349
|
-
|
|
30350
|
-
|
|
30351
|
-
|
|
30352
|
-
|
|
30353
|
-
|
|
30354
|
-
|
|
30355
|
-
|
|
30356
|
-
|
|
30357
|
-
|
|
30358
|
-
};
|
|
30338
|
+
// if (glb.IS_WORKER) {
|
|
30339
|
+
// if (!update_local_scope_only && !_.isEmpty(client_datasource_changes)) {
|
|
30340
|
+
// func.utils.post_back_to_client(SESSION_ID, 'update_client_eventChangesResults_from_worker', _session.worker_id, client_datasource_changes);
|
|
30341
|
+
// }
|
|
30342
|
+
// } else {
|
|
30343
|
+
// if (!update_local_scope_only && !_.isEmpty(server_datasource_changes)) {
|
|
30344
|
+
// const ret = await func.index.call_worker(SESSION_ID, {
|
|
30345
|
+
// service: 'update_datasource_changes_from_client',
|
|
30346
|
+
// data: {
|
|
30347
|
+
// session_id: SESSION_ID,
|
|
30348
|
+
// datasource_changes: server_datasource_changes,
|
|
30349
|
+
// },
|
|
30350
|
+
// id: _ds.worker_id,
|
|
30351
|
+
// });
|
|
30352
|
+
// }
|
|
30353
|
+
// ///// REFRESH SCREEN
|
|
30354
|
+
// if (!avoid_refresh && fields_changed.length) {
|
|
30355
|
+
// await func.UI.screen.refresh_xu_attributes(SESSION_ID, fields_changed);
|
|
30356
|
+
// // await removed from the below function cause to dead lock Mar 3 25
|
|
30357
|
+
// func.UI.screen.refresh_screen(
|
|
30358
|
+
// SESSION_ID,
|
|
30359
|
+
// fields_changed,
|
|
30360
|
+
// null,
|
|
30361
|
+
// datasource_changed[0], // refresh the current datasource only
|
|
30362
|
+
// );
|
|
30363
|
+
// }
|
|
30364
|
+
// }
|
|
30365
|
+
// resolve();
|
|
30366
|
+
// });
|
|
30367
|
+
// };
|
|
30359
30368
|
|
|
30360
30369
|
func.datasource.update = async function (SESSION_ID, datasource_changes, update_local_scope_only, avoid_refresh) {
|
|
30361
30370
|
return new Promise(async (resolve, reject) => {
|
|
@@ -30430,6 +30439,18 @@ func.datasource.update = async function (SESSION_ID, datasource_changes, update_
|
|
|
30430
30439
|
var datasource_changed = [];
|
|
30431
30440
|
let client_datasource_changes = {};
|
|
30432
30441
|
let server_datasource_changes = {};
|
|
30442
|
+
|
|
30443
|
+
const update_xu_ref = async function (dataSource, field_id) {
|
|
30444
|
+
let ret;
|
|
30445
|
+
let _ds_0 = _session.DS_GLB[0];
|
|
30446
|
+
for ([ref_name, val] of Object.entries(_ds_0.data_system['SYS_GLOBAL_OBJ_REFS'])) {
|
|
30447
|
+
if (val.ds.dsSession == dataSource) {
|
|
30448
|
+
ret = func.UI.update_xu_ref(SESSION_ID, dataSource, ref_name);
|
|
30449
|
+
}
|
|
30450
|
+
}
|
|
30451
|
+
return ret;
|
|
30452
|
+
};
|
|
30453
|
+
|
|
30433
30454
|
// iterate changes datasource
|
|
30434
30455
|
for await (const [dataSource, row_data] of Object.entries(datasource_changes)) {
|
|
30435
30456
|
var _ds = _session.DS_GLB[dataSource];
|
|
@@ -30437,15 +30458,6 @@ func.datasource.update = async function (SESSION_ID, datasource_changes, update_
|
|
|
30437
30458
|
continue;
|
|
30438
30459
|
}
|
|
30439
30460
|
|
|
30440
|
-
const update_xu_ref = async function () {
|
|
30441
|
-
let _ds_0 = _session.DS_GLB[0];
|
|
30442
|
-
for ([ref_name, val] of Object.entries(_ds_0.data_system['SYS_GLOBAL_OBJ_REFS'])) {
|
|
30443
|
-
if (val.ds.dsSession == dataSource) {
|
|
30444
|
-
func.UI.update_xu_ref(SESSION_ID, dataSource, ref_name);
|
|
30445
|
-
}
|
|
30446
|
-
}
|
|
30447
|
-
};
|
|
30448
|
-
|
|
30449
30461
|
// iterate changes records
|
|
30450
30462
|
for (const [record_id, fields_data] of Object.entries(row_data)) {
|
|
30451
30463
|
// iterate changes fields
|
|
@@ -30453,9 +30465,11 @@ func.datasource.update = async function (SESSION_ID, datasource_changes, update_
|
|
|
30453
30465
|
// mechanism to make update directly on the datasource object
|
|
30454
30466
|
if (record_id === 'datasource_main') {
|
|
30455
30467
|
_.set(_ds, field_id, value);
|
|
30456
|
-
update_xu_ref();
|
|
30457
|
-
|
|
30458
|
-
|
|
30468
|
+
const ret = update_xu_ref(dataSource, field_id);
|
|
30469
|
+
if (ret) {
|
|
30470
|
+
fields_changed.push(field_id);
|
|
30471
|
+
datasource_changed.push(dataSource);
|
|
30472
|
+
}
|
|
30459
30473
|
continue;
|
|
30460
30474
|
}
|
|
30461
30475
|
|
|
@@ -30472,7 +30486,7 @@ func.datasource.update = async function (SESSION_ID, datasource_changes, update_
|
|
|
30472
30486
|
await set_fieldComputed_dependencies(dataSource, field_id, null);
|
|
30473
30487
|
|
|
30474
30488
|
// search the field in refs
|
|
30475
|
-
update_xu_ref();
|
|
30489
|
+
update_xu_ref(dataSource, field_id);
|
|
30476
30490
|
|
|
30477
30491
|
if (!update_local_scope_only) {
|
|
30478
30492
|
let tree_ret = await func.utils.TREE_OBJ.get(SESSION_ID, _ds.prog_id);
|