@xuda.io/xuda-worker-bundle-min 1.3.828 → 1.3.830
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/index.js +13 -956
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1933,7 +1933,9 @@ func.datasource.prepare = async function (
|
|
|
1933
1933
|
SESSION_OBJ[SESSION_ID].dataSourceSessionGlobal++;
|
|
1934
1934
|
}
|
|
1935
1935
|
dataSourceSession = SESSION_OBJ[SESSION_ID].dataSourceSessionGlobal;
|
|
1936
|
-
SESSION_OBJ[SESSION_ID].DS_GLB[dataSourceSession] = {
|
|
1936
|
+
SESSION_OBJ[SESSION_ID].DS_GLB[dataSourceSession] = {
|
|
1937
|
+
data_feed: { rows: [] },
|
|
1938
|
+
};
|
|
1937
1939
|
};
|
|
1938
1940
|
const init_existing_dataSource = function () {
|
|
1939
1941
|
let _ds = SESSION_OBJ[SESSION_ID].DS_GLB[dataSourceNoP];
|
|
@@ -2354,23 +2356,6 @@ func.datasource.execute = async function (
|
|
|
2354
2356
|
filterModel
|
|
2355
2357
|
);
|
|
2356
2358
|
|
|
2357
|
-
// _ds.v.raw_data = await func.db.get_query(
|
|
2358
|
-
// SESSION_ID,
|
|
2359
|
-
// _ds._dataSourceTableId,
|
|
2360
|
-
// _ds.v.couchView,
|
|
2361
|
-
// dataSourceSession,
|
|
2362
|
-
// _ds.viewSourceDesc,
|
|
2363
|
-
// "datasource table",
|
|
2364
|
-
// prog_obj.progDataSource.dataSourceReduce,
|
|
2365
|
-
// await get_skip(),
|
|
2366
|
-
// (await get_limit()) || 99999999,
|
|
2367
|
-
// null,
|
|
2368
|
-
// null,
|
|
2369
|
-
// _ds?.progDataSource?.sortModel,
|
|
2370
|
-
// null,
|
|
2371
|
-
// filterModel
|
|
2372
|
-
// );
|
|
2373
|
-
|
|
2374
2359
|
const ret_rows_found = await func.db.get_query(
|
|
2375
2360
|
SESSION_ID,
|
|
2376
2361
|
_ds._dataSourceTableId,
|
|
@@ -2701,9 +2686,6 @@ func.datasource.execute = async function (
|
|
|
2701
2686
|
break;
|
|
2702
2687
|
|
|
2703
2688
|
case "component":
|
|
2704
|
-
// _ds.data_feed = { groupBy: {}, rows: [] };
|
|
2705
|
-
|
|
2706
|
-
// _ds.rows_found = 0;
|
|
2707
2689
|
_ds.rows_processed = 0;
|
|
2708
2690
|
_ds.viewRangeExp_rows_deleted = 0;
|
|
2709
2691
|
|
|
@@ -2768,35 +2750,12 @@ func.datasource.execute = async function (
|
|
|
2768
2750
|
}
|
|
2769
2751
|
}
|
|
2770
2752
|
|
|
2771
|
-
// if (
|
|
2772
|
-
// _ds.locatedRecordId &&
|
|
2773
|
-
// typeof _ds.data_feed.rows[row_idx] === "undefined"
|
|
2774
|
-
// ) {
|
|
2775
|
-
// delete _ds.locatedRecordId;
|
|
2776
|
-
// }
|
|
2777
|
-
|
|
2778
|
-
// db_adapter_module.sort_data(SESSION_ID, dataSourceSession, "form");
|
|
2779
|
-
|
|
2780
2753
|
_ds.finalRecordId = func.datasource.get_currentRecordId(
|
|
2781
2754
|
SESSION_ID,
|
|
2782
2755
|
dataSourceSession,
|
|
2783
2756
|
true
|
|
2784
2757
|
);
|
|
2785
2758
|
_ds.currentRecordId = _ds.finalRecordId;
|
|
2786
|
-
|
|
2787
|
-
// clear db_raw_data to avoid refresh bug when rendering to locate index 0
|
|
2788
|
-
|
|
2789
|
-
if (_ds.v.viewRangeExp_deleted) {
|
|
2790
|
-
for (let [key, val] of Object.entries(
|
|
2791
|
-
_ds.v.viewRangeExp_deleted.reverse()
|
|
2792
|
-
)) {
|
|
2793
|
-
SESSION_OBJ[SESSION_ID].DS_GLB[
|
|
2794
|
-
dataSourceSession
|
|
2795
|
-
].db_raw_data.rows.splice(val, 1);
|
|
2796
|
-
}
|
|
2797
|
-
}
|
|
2798
|
-
|
|
2799
|
-
// return await callback_datasource();
|
|
2800
2759
|
};
|
|
2801
2760
|
|
|
2802
2761
|
for await (const [key, val] of Object.entries(_ds.data_feed.rows)) {
|
|
@@ -2840,361 +2799,7 @@ func.datasource.execute = async function (
|
|
|
2840
2799
|
"E"
|
|
2841
2800
|
);
|
|
2842
2801
|
}
|
|
2843
|
-
// switch (tree_obj.menuType) {
|
|
2844
|
-
// case "api": {
|
|
2845
|
-
// _ds.api_rendered_output = "";
|
|
2846
|
-
// let has_datasource = await calc_batch_loops();
|
|
2847
|
-
|
|
2848
|
-
// data_arr = _ds.v?.raw_data?.rows || [];
|
|
2849
|
-
// if (!has_datasource) {
|
|
2850
|
-
// for (n = 0; n < _ds.v.batch_loops; n++) {
|
|
2851
|
-
// data_arr.push({});
|
|
2852
|
-
// }
|
|
2853
|
-
// }
|
|
2854
|
-
// _ds.currentRecordId = "dataset";
|
|
2855
|
-
// for await (let [key, val] of Object.entries(data_arr)) {
|
|
2856
|
-
// if (has_datasource && Number(key) >= _ds.v.batch_loops) break;
|
|
2857
|
-
|
|
2858
|
-
// if (!has_datasource) {
|
|
2859
|
-
// val.value = _ds?.data_feed?.rows?.[_ds.currentRecordId] || {
|
|
2860
|
-
// value: {},
|
|
2861
|
-
// };
|
|
2862
|
-
// }
|
|
2863
|
-
|
|
2864
|
-
// if (await get_before_record_count()) {
|
|
2865
|
-
// await func.datasource.execute_view_events(
|
|
2866
|
-
// SESSION_ID,
|
|
2867
|
-
// dataSourceSession,
|
|
2868
|
-
// "before_record"
|
|
2869
|
-
// );
|
|
2870
|
-
// }
|
|
2871
|
-
|
|
2872
|
-
// await func.datasource.render_fields_dataset(
|
|
2873
|
-
// SESSION_ID,
|
|
2874
|
-
// dataSourceSession,
|
|
2875
|
-
// val
|
|
2876
|
-
// );
|
|
2877
|
-
|
|
2878
|
-
// if (await get_after_record_count()) {
|
|
2879
|
-
// await func.datasource.execute_view_events(
|
|
2880
|
-
// SESSION_ID,
|
|
2881
|
-
// dataSourceSession,
|
|
2882
|
-
// "after_record"
|
|
2883
|
-
// );
|
|
2884
|
-
// }
|
|
2885
|
-
|
|
2886
|
-
// await render_api_output();
|
|
2887
|
-
// }
|
|
2888
2802
|
|
|
2889
|
-
// if (tree_obj.apiOutput === "json") {
|
|
2890
|
-
// var str = _ds.api_rendered_output.substring(
|
|
2891
|
-
// 0,
|
|
2892
|
-
// _ds.api_rendered_output.length - 1
|
|
2893
|
-
// );
|
|
2894
|
-
// if (Number(_ds.progDataSource?.dataSourceLimit) === 1) {
|
|
2895
|
-
// _ds.api_rendered_output = str;
|
|
2896
|
-
// } else {
|
|
2897
|
-
// _ds.api_rendered_output = "[" + str + "]";
|
|
2898
|
-
// }
|
|
2899
|
-
// }
|
|
2900
|
-
|
|
2901
|
-
// break;
|
|
2902
|
-
// }
|
|
2903
|
-
|
|
2904
|
-
// case "batch": {
|
|
2905
|
-
// let has_datasource = await calc_batch_loops();
|
|
2906
|
-
|
|
2907
|
-
// data_arr = _ds.v?.raw_data?.rows || [];
|
|
2908
|
-
// if (!has_datasource) {
|
|
2909
|
-
// for (n = 0; n < _ds.v.batch_loops; n++) {
|
|
2910
|
-
// data_arr.push({});
|
|
2911
|
-
// }
|
|
2912
|
-
// }
|
|
2913
|
-
// _ds.currentRecordId = "dataset";
|
|
2914
|
-
// for await (let [key, val] of Object.entries(data_arr)) {
|
|
2915
|
-
// if (has_datasource && Number(key) >= _ds.v.batch_loops) break;
|
|
2916
|
-
|
|
2917
|
-
// if (!has_datasource) {
|
|
2918
|
-
// val.value = _ds?.data_feed?.rows?.[_ds.currentRecordId] || {
|
|
2919
|
-
// value: {},
|
|
2920
|
-
// };
|
|
2921
|
-
// }
|
|
2922
|
-
|
|
2923
|
-
// if (await get_before_record_count()) {
|
|
2924
|
-
// await func.datasource.execute_view_events(
|
|
2925
|
-
// SESSION_ID,
|
|
2926
|
-
// dataSourceSession,
|
|
2927
|
-
// "before_record"
|
|
2928
|
-
// );
|
|
2929
|
-
// }
|
|
2930
|
-
|
|
2931
|
-
// await func.datasource.render_fields_dataset(
|
|
2932
|
-
// SESSION_ID,
|
|
2933
|
-
// dataSourceSession,
|
|
2934
|
-
// val
|
|
2935
|
-
// );
|
|
2936
|
-
|
|
2937
|
-
// if (await get_after_record_count()) {
|
|
2938
|
-
// await func.datasource.execute_view_events(
|
|
2939
|
-
// SESSION_ID,
|
|
2940
|
-
// dataSourceSession,
|
|
2941
|
-
// "after_record"
|
|
2942
|
-
// );
|
|
2943
|
-
// }
|
|
2944
|
-
// }
|
|
2945
|
-
|
|
2946
|
-
// break;
|
|
2947
|
-
// }
|
|
2948
|
-
|
|
2949
|
-
// case "get_data":
|
|
2950
|
-
// if (await get_before_record_count()) {
|
|
2951
|
-
// await func.datasource.execute_view_events(
|
|
2952
|
-
// SESSION_ID,
|
|
2953
|
-
// dataSourceSession,
|
|
2954
|
-
// "before_record"
|
|
2955
|
-
// );
|
|
2956
|
-
// }
|
|
2957
|
-
|
|
2958
|
-
// ret = await db_adapter_module.process_view_dataset(
|
|
2959
|
-
// SESSION_ID,
|
|
2960
|
-
// dataSourceSession,
|
|
2961
|
-
// _ds.v,
|
|
2962
|
-
// _ds
|
|
2963
|
-
// // json1
|
|
2964
|
-
// );
|
|
2965
|
-
|
|
2966
|
-
// if (await get_after_record_count()) {
|
|
2967
|
-
// await func.datasource.execute_view_events(
|
|
2968
|
-
// SESSION_ID,
|
|
2969
|
-
// dataSourceSession,
|
|
2970
|
-
// "after_record"
|
|
2971
|
-
// );
|
|
2972
|
-
// }
|
|
2973
|
-
|
|
2974
|
-
// break;
|
|
2975
|
-
|
|
2976
|
-
// case "set_data":
|
|
2977
|
-
// if (
|
|
2978
|
-
// !prog_obj.progDataSource?.dataSourceType ||
|
|
2979
|
-
// _ds.progDataSource.dataSourceType !== "table" ||
|
|
2980
|
-
// !_ds._dataSourceTableId
|
|
2981
|
-
// ) {
|
|
2982
|
-
// return func.utils.debug_report(
|
|
2983
|
-
// SESSION_ID,
|
|
2984
|
-
// "Data source",
|
|
2985
|
-
// "Datasource DB Table must be defined for Set Data operation",
|
|
2986
|
-
// "E"
|
|
2987
|
-
// );
|
|
2988
|
-
// }
|
|
2989
|
-
|
|
2990
|
-
// if (tree_obj.crudMode === "U") {
|
|
2991
|
-
// _ds.set_mode = "U";
|
|
2992
|
-
// data_arr = _ds.v?.raw_data?.rows || [];
|
|
2993
|
-
// }
|
|
2994
|
-
|
|
2995
|
-
// if (tree_obj.crudMode === "D") {
|
|
2996
|
-
// _ds.set_mode = "D";
|
|
2997
|
-
// data_arr = _ds.v?.raw_data?.rows || [];
|
|
2998
|
-
// }
|
|
2999
|
-
|
|
3000
|
-
// // initiated with Update but no rows found
|
|
3001
|
-
// if (
|
|
3002
|
-
// tree_obj.crudMode === "U" &&
|
|
3003
|
-
// tree_obj.allowCreate &&
|
|
3004
|
-
// !_ds.v?.raw_data?.rows?.length
|
|
3005
|
-
// ) {
|
|
3006
|
-
// _ds.set_mode = "C";
|
|
3007
|
-
// data_arr = [{ id: "newRecord", value: {} }];
|
|
3008
|
-
// }
|
|
3009
|
-
|
|
3010
|
-
// if (tree_obj.crudMode === "C") {
|
|
3011
|
-
// _ds.set_mode = "C";
|
|
3012
|
-
// data_arr = [{ id: "newRecord", value: {} }];
|
|
3013
|
-
// }
|
|
3014
|
-
|
|
3015
|
-
// for await (let val of data_arr) {
|
|
3016
|
-
// _ds.currentRecordId = val.id;
|
|
3017
|
-
// if (await get_before_record_count()) {
|
|
3018
|
-
// await func.datasource.execute_view_events(
|
|
3019
|
-
// SESSION_ID,
|
|
3020
|
-
// dataSourceSession,
|
|
3021
|
-
// "before_record"
|
|
3022
|
-
// );
|
|
3023
|
-
// }
|
|
3024
|
-
|
|
3025
|
-
// await func.datasource.render_fields_dataset(
|
|
3026
|
-
// SESSION_ID,
|
|
3027
|
-
// dataSourceSession,
|
|
3028
|
-
// val
|
|
3029
|
-
// );
|
|
3030
|
-
// let data_feed_str = JSON.stringify(_ds.data_feed);
|
|
3031
|
-
|
|
3032
|
-
// if (await get_after_record_count()) {
|
|
3033
|
-
// await func.datasource.execute_view_events(
|
|
3034
|
-
// SESSION_ID,
|
|
3035
|
-
// dataSourceSession,
|
|
3036
|
-
// "after_record"
|
|
3037
|
-
// );
|
|
3038
|
-
// }
|
|
3039
|
-
|
|
3040
|
-
// if (
|
|
3041
|
-
// _ds.set_mode === "C" ||
|
|
3042
|
-
// JSON.stringify(_ds.data_feed) !== data_feed_str
|
|
3043
|
-
// ) {
|
|
3044
|
-
// const dbMsgP = await func.db.save_data(SESSION_ID, dataSourceSession);
|
|
3045
|
-
// if (dbMsgP) _ds.currentRecordId = dbMsgP.id;
|
|
3046
|
-
// _ds.set_mode = "M";
|
|
3047
|
-
// }
|
|
3048
|
-
|
|
3049
|
-
// if (_ds.set_mode === "D") {
|
|
3050
|
-
// const dbMsgP = await func.db.save_data(SESSION_ID, dataSourceSession);
|
|
3051
|
-
// if (dbMsgP) _ds.currentRecordId = dbMsgP.id;
|
|
3052
|
-
// }
|
|
3053
|
-
// }
|
|
3054
|
-
// // ret = await callback_datasource();
|
|
3055
|
-
|
|
3056
|
-
// break;
|
|
3057
|
-
|
|
3058
|
-
// case "component":
|
|
3059
|
-
// _ds.data_feed = { sort: {}, groupBy: {}, rows: {} };
|
|
3060
|
-
|
|
3061
|
-
// // _ds.rows_found = 0;
|
|
3062
|
-
// _ds.rows_processed = 0;
|
|
3063
|
-
// _ds.viewRangeExp_rows_deleted = 0;
|
|
3064
|
-
|
|
3065
|
-
// let rows = _ds.v.raw_data?.rows?.length;
|
|
3066
|
-
|
|
3067
|
-
// _ds.data_feed.rows_changed = [];
|
|
3068
|
-
// _ds.data_feed.rows_deleted = [];
|
|
3069
|
-
// _ds.data_feed.rows_added = [];
|
|
3070
|
-
|
|
3071
|
-
// const row_not_found = async function () {
|
|
3072
|
-
// _ds.currentRecordId = "newRecord";
|
|
3073
|
-
// _ds.set_mode = "C";
|
|
3074
|
-
// _ds.record_not_found = true;
|
|
3075
|
-
|
|
3076
|
-
// const newRecord = 999999;
|
|
3077
|
-
|
|
3078
|
-
// if (_.isEmpty(_ds.data_feed.rows[newRecord])) {
|
|
3079
|
-
// await func.datasource.render_fields_form(
|
|
3080
|
-
// SESSION_ID,
|
|
3081
|
-
// dataSourceSession,
|
|
3082
|
-
// { id: "newRecord", value: {} },
|
|
3083
|
-
// null,
|
|
3084
|
-
// false,
|
|
3085
|
-
// "newRecord"
|
|
3086
|
-
// );
|
|
3087
|
-
// }
|
|
3088
|
-
// var count = await func.datasource.get_field_init_count(
|
|
3089
|
-
// SESSION_ID,
|
|
3090
|
-
// dataSourceSession,
|
|
3091
|
-
// "newRecord",
|
|
3092
|
-
// false
|
|
3093
|
-
// );
|
|
3094
|
-
// if (
|
|
3095
|
-
// count > 0 // was: && !args.dataSourceNoP
|
|
3096
|
-
// ) {
|
|
3097
|
-
// await func.datasource.execute_field_init_events(
|
|
3098
|
-
// SESSION_ID,
|
|
3099
|
-
// dataSourceSession,
|
|
3100
|
-
// "form",
|
|
3101
|
-
// "newRecord"
|
|
3102
|
-
// );
|
|
3103
|
-
// }
|
|
3104
|
-
// // return await callback_datasource();
|
|
3105
|
-
// };
|
|
3106
|
-
// if (!rows) {
|
|
3107
|
-
// await row_not_found();
|
|
3108
|
-
// break;
|
|
3109
|
-
// }
|
|
3110
|
-
|
|
3111
|
-
// _ds.firstRecordId = _ds.v.raw_data.rows[0].id;
|
|
3112
|
-
|
|
3113
|
-
// const finish_form = async function () {
|
|
3114
|
-
// // check if locatedRecordId exist in SESSION_OBJ[SESSION_ID].DS_GLB
|
|
3115
|
-
// if (_ds.locatedRecordId) {
|
|
3116
|
-
// try {
|
|
3117
|
-
// const row_idx = func.common.find_ROWID_idx(
|
|
3118
|
-
// _ds,
|
|
3119
|
-
// _ds.locatedRecordId
|
|
3120
|
-
// );
|
|
3121
|
-
// } catch (error) {
|
|
3122
|
-
// delete _ds.locatedRecordId;
|
|
3123
|
-
// }
|
|
3124
|
-
// }
|
|
3125
|
-
|
|
3126
|
-
// // if (
|
|
3127
|
-
// // _ds.locatedRecordId &&
|
|
3128
|
-
// // typeof _ds.data_feed.rows[row_idx] === "undefined"
|
|
3129
|
-
// // ) {
|
|
3130
|
-
// // delete _ds.locatedRecordId;
|
|
3131
|
-
// // }
|
|
3132
|
-
|
|
3133
|
-
// db_adapter_module.sort_data(SESSION_ID, dataSourceSession, "form");
|
|
3134
|
-
|
|
3135
|
-
// _ds.finalRecordId = func.datasource.get_currentRecordId(
|
|
3136
|
-
// SESSION_ID,
|
|
3137
|
-
// dataSourceSession,
|
|
3138
|
-
// true
|
|
3139
|
-
// );
|
|
3140
|
-
// _ds.currentRecordId = _ds.finalRecordId;
|
|
3141
|
-
|
|
3142
|
-
// // clear db_raw_data to avoid refresh bug when rendering to locate index 0
|
|
3143
|
-
|
|
3144
|
-
// if (_ds.v.viewRangeExp_deleted) {
|
|
3145
|
-
// for (let [key, val] of Object.entries(
|
|
3146
|
-
// _ds.v.viewRangeExp_deleted.reverse()
|
|
3147
|
-
// )) {
|
|
3148
|
-
// SESSION_OBJ[SESSION_ID].DS_GLB[
|
|
3149
|
-
// dataSourceSession
|
|
3150
|
-
// ].db_raw_data.rows.splice(val, 1);
|
|
3151
|
-
// }
|
|
3152
|
-
// }
|
|
3153
|
-
|
|
3154
|
-
// // return await callback_datasource();
|
|
3155
|
-
// };
|
|
3156
|
-
|
|
3157
|
-
// for await (const [key, val] of Object.entries(_ds.v.raw_data.rows)) {
|
|
3158
|
-
// if (await get_before_record_count()) {
|
|
3159
|
-
// await func.datasource.execute_view_events(
|
|
3160
|
-
// SESSION_ID,
|
|
3161
|
-
// dataSourceSession,
|
|
3162
|
-
// "before_record"
|
|
3163
|
-
// );
|
|
3164
|
-
// }
|
|
3165
|
-
|
|
3166
|
-
// await func.datasource.run_rows_form(
|
|
3167
|
-
// SESSION_ID,
|
|
3168
|
-
// dataSourceSession,
|
|
3169
|
-
// key,
|
|
3170
|
-
// null,
|
|
3171
|
-
// null,
|
|
3172
|
-
// null,
|
|
3173
|
-
// _ds.pre_init_fields,
|
|
3174
|
-
// val,
|
|
3175
|
-
// db_adapter_module
|
|
3176
|
-
// );
|
|
3177
|
-
|
|
3178
|
-
// if (await get_after_record_count()) {
|
|
3179
|
-
// await func.datasource.execute_view_events(
|
|
3180
|
-
// SESSION_ID,
|
|
3181
|
-
// dataSourceSession,
|
|
3182
|
-
// "after_record"
|
|
3183
|
-
// );
|
|
3184
|
-
// }
|
|
3185
|
-
// }
|
|
3186
|
-
// await finish_form();
|
|
3187
|
-
|
|
3188
|
-
// break;
|
|
3189
|
-
|
|
3190
|
-
// default:
|
|
3191
|
-
// return func.utils.debug_report(
|
|
3192
|
-
// SESSION_ID,
|
|
3193
|
-
// "Data source",
|
|
3194
|
-
// "Program type not defined",
|
|
3195
|
-
// "E"
|
|
3196
|
-
// );
|
|
3197
|
-
// }
|
|
3198
2803
|
ret = await callback_datasource();
|
|
3199
2804
|
return ret;
|
|
3200
2805
|
};
|
|
@@ -3418,9 +3023,6 @@ func.datasource.render_fields_form = async function (
|
|
|
3418
3023
|
);
|
|
3419
3024
|
};
|
|
3420
3025
|
|
|
3421
|
-
// if (!_ds.data_feed.rows[row_idx])
|
|
3422
|
-
// _ds.data_feed.rows[row_idx] = { _ROWID: data.id };
|
|
3423
|
-
|
|
3424
3026
|
let row_idx;
|
|
3425
3027
|
try {
|
|
3426
3028
|
row_idx = func.common.find_ROWID_idx(_ds, data._ROWID);
|
|
@@ -3439,16 +3041,10 @@ func.datasource.render_fields_form = async function (
|
|
|
3439
3041
|
if (glb.PROTECTED_VARS.includes(fieldId)) {
|
|
3440
3042
|
switch (fieldId) {
|
|
3441
3043
|
case "_ROWNO": {
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
// row_no
|
|
3447
|
-
// );
|
|
3448
|
-
(_ds.data_feed.rows[row_idx][fieldId] = await get_value(
|
|
3449
|
-
fieldId,
|
|
3450
|
-
row_idx
|
|
3451
|
-
));
|
|
3044
|
+
_ds.data_feed.rows[row_idx][fieldId] = await get_value(
|
|
3045
|
+
fieldId,
|
|
3046
|
+
row_idx
|
|
3047
|
+
);
|
|
3452
3048
|
continue;
|
|
3453
3049
|
}
|
|
3454
3050
|
case "_ROWID": {
|
|
@@ -3456,10 +3052,7 @@ func.datasource.render_fields_form = async function (
|
|
|
3456
3052
|
fieldId,
|
|
3457
3053
|
data.id
|
|
3458
3054
|
);
|
|
3459
|
-
|
|
3460
|
-
// fieldId,
|
|
3461
|
-
// data.id
|
|
3462
|
-
// );
|
|
3055
|
+
|
|
3463
3056
|
continue;
|
|
3464
3057
|
}
|
|
3465
3058
|
case "_ROWDOC": {
|
|
@@ -3467,10 +3060,7 @@ func.datasource.render_fields_form = async function (
|
|
|
3467
3060
|
fieldId,
|
|
3468
3061
|
data
|
|
3469
3062
|
);
|
|
3470
|
-
|
|
3471
|
-
// fieldId,
|
|
3472
|
-
// data
|
|
3473
|
-
// );
|
|
3063
|
+
|
|
3474
3064
|
continue;
|
|
3475
3065
|
}
|
|
3476
3066
|
}
|
|
@@ -3489,10 +3079,6 @@ func.datasource.render_fields_form = async function (
|
|
|
3489
3079
|
fieldId,
|
|
3490
3080
|
ret.result
|
|
3491
3081
|
);
|
|
3492
|
-
// _ds.data_feed.rows[data.id][fieldId] = await get_value(
|
|
3493
|
-
// fieldId,
|
|
3494
|
-
// ret.result
|
|
3495
|
-
// );
|
|
3496
3082
|
|
|
3497
3083
|
continue;
|
|
3498
3084
|
}
|
|
@@ -3501,10 +3087,7 @@ func.datasource.render_fields_form = async function (
|
|
|
3501
3087
|
fieldId,
|
|
3502
3088
|
val.props?.fieldValue
|
|
3503
3089
|
);
|
|
3504
|
-
|
|
3505
|
-
// fieldId,
|
|
3506
|
-
// val.props?.fieldValue
|
|
3507
|
-
// );
|
|
3090
|
+
|
|
3508
3091
|
continue;
|
|
3509
3092
|
}
|
|
3510
3093
|
if (val.data.type === "table" || val.data.type === "datasource") {
|
|
@@ -3515,10 +3098,6 @@ func.datasource.render_fields_form = async function (
|
|
|
3515
3098
|
fieldId,
|
|
3516
3099
|
data[fieldId]
|
|
3517
3100
|
);
|
|
3518
|
-
// _ds.data_feed.rows[data.id][fieldId] = await get_value(
|
|
3519
|
-
// fieldId,
|
|
3520
|
-
// data.value[fieldId]
|
|
3521
|
-
// );
|
|
3522
3101
|
}
|
|
3523
3102
|
} catch (err) {
|
|
3524
3103
|
func.utils.debug_report(SESSION_ID, "Datasource", err, "E", null, _ds);
|
|
@@ -3526,143 +3105,6 @@ func.datasource.render_fields_form = async function (
|
|
|
3526
3105
|
}
|
|
3527
3106
|
};
|
|
3528
3107
|
|
|
3529
|
-
// func.datasource.run_rows_form = async function (
|
|
3530
|
-
// SESSION_ID,
|
|
3531
|
-
// dataSourceSession,
|
|
3532
|
-
// rowIdxP,
|
|
3533
|
-
// NA_onDemandP,
|
|
3534
|
-
// NA_callbackP,
|
|
3535
|
-
// NA_oninit_triggers_to_runP,
|
|
3536
|
-
// pre_init_fieldsP,
|
|
3537
|
-
// data,
|
|
3538
|
-
// db_adapter_module
|
|
3539
|
-
// ) {
|
|
3540
|
-
// var _ds = SESSION_OBJ[SESSION_ID].DS_GLB[dataSourceSession];
|
|
3541
|
-
// if (!_ds) return;
|
|
3542
|
-
// // var v = _ds.v;
|
|
3543
|
-
|
|
3544
|
-
// var val = _ds.data_feed.rows[rowIdxP];
|
|
3545
|
-
|
|
3546
|
-
// var idx;
|
|
3547
|
-
|
|
3548
|
-
// try {
|
|
3549
|
-
// if (typeof val !== "undefined") {
|
|
3550
|
-
// if (val.id) idx = val.id;
|
|
3551
|
-
// else if (val.value) idx = val.value._id;
|
|
3552
|
-
// else idx = val;
|
|
3553
|
-
// } else {
|
|
3554
|
-
// idx = "newRecord";
|
|
3555
|
-
// }
|
|
3556
|
-
// } catch (e) {
|
|
3557
|
-
// console.error(e);
|
|
3558
|
-
// }
|
|
3559
|
-
// // var sort_index = rowIdxP - _ds.viewRangeExp_rows_deleted;
|
|
3560
|
-
// //
|
|
3561
|
-
// const add_row = async function () {
|
|
3562
|
-
// var old_row_data;
|
|
3563
|
-
|
|
3564
|
-
// _ds.data_feed.rows[idx] = {};
|
|
3565
|
-
// // _ds.data_feed.rows[idx].arrIndex = sort_index; // removed 022623 needs other solution
|
|
3566
|
-
|
|
3567
|
-
// const form_continue = async function (render_fields) {
|
|
3568
|
-
// _ds.rows_processed++;
|
|
3569
|
-
// // const sort_form = async function () {
|
|
3570
|
-
// // await db_adapter_module.add_sort(
|
|
3571
|
-
// // SESSION_ID,
|
|
3572
|
-
// // dataSourceSession,
|
|
3573
|
-
// // "form",
|
|
3574
|
-
// // _ds.progDataSource.dataSourceSortScript,
|
|
3575
|
-
// // idx,
|
|
3576
|
-
// // sort_index
|
|
3577
|
-
// // );
|
|
3578
|
-
// // await db_adapter_module.add_GroupBy(
|
|
3579
|
-
// // SESSION_ID,
|
|
3580
|
-
// // dataSourceSession,
|
|
3581
|
-
// // "form",
|
|
3582
|
-
// // _ds.progDataSource.dataSourceGroupByScript,
|
|
3583
|
-
// // idx,
|
|
3584
|
-
// // sort_index
|
|
3585
|
-
// // );
|
|
3586
|
-
// // // _ds.rows_found++;
|
|
3587
|
-
// // };
|
|
3588
|
-
// const delete_row = async function () {
|
|
3589
|
-
// if (_ds) {
|
|
3590
|
-
// delete _ds.data_feed.rows[idx];
|
|
3591
|
-
|
|
3592
|
-
// if (!_ds.v.viewRangeExp_deleted) _ds.v.viewRangeExp_deleted = [];
|
|
3593
|
-
// _ds.v.viewRangeExp_deleted.push(rowIdxP);
|
|
3594
|
-
// }
|
|
3595
|
-
// // _ds.rows_found--;
|
|
3596
|
-
// _ds.viewRangeExp_rows_deleted++;
|
|
3597
|
-
// };
|
|
3598
|
-
// if (_ds.progDataSource?.dataSourceFiltersScript) {
|
|
3599
|
-
// var res = await func.datasource.validate_viewRange(
|
|
3600
|
-
// SESSION_ID,
|
|
3601
|
-
// _ds.progDataSource.dataSourceFiltersScript,
|
|
3602
|
-
// dataSourceSession,
|
|
3603
|
-
// idx,
|
|
3604
|
-
// "form"
|
|
3605
|
-
// );
|
|
3606
|
-
// if (
|
|
3607
|
-
// res === false ||
|
|
3608
|
-
// res === 0 ||
|
|
3609
|
-
// typeof res === "undefined" ||
|
|
3610
|
-
// res === null
|
|
3611
|
-
// ) {
|
|
3612
|
-
// await delete_row();
|
|
3613
|
-
// }
|
|
3614
|
-
// }
|
|
3615
|
-
// // await sort_form();
|
|
3616
|
-
|
|
3617
|
-
// if (_ds.progDataSource?.dataSourceLocateScript) {
|
|
3618
|
-
// var res = func.datasource.validate_viewLocate(
|
|
3619
|
-
// SESSION_ID,
|
|
3620
|
-
// _ds.progDataSource.dataSourceLocateScript,
|
|
3621
|
-
// dataSourceSession,
|
|
3622
|
-
// idx,
|
|
3623
|
-
// "form"
|
|
3624
|
-
// );
|
|
3625
|
-
// if (res) {
|
|
3626
|
-
// _ds.locatedRecordId = idx;
|
|
3627
|
-
// }
|
|
3628
|
-
// }
|
|
3629
|
-
// if (_ds.progDataSource?.dataSourceFiltersScript) {
|
|
3630
|
-
// return;
|
|
3631
|
-
// }
|
|
3632
|
-
// };
|
|
3633
|
-
// _ds.currentRecordId = idx; // set temporary to allow expression decoder work
|
|
3634
|
-
|
|
3635
|
-
// await func.datasource.render_fields_form(
|
|
3636
|
-
// SESSION_ID,
|
|
3637
|
-
// dataSourceSession,
|
|
3638
|
-
// data,
|
|
3639
|
-
// null,
|
|
3640
|
-
// true,
|
|
3641
|
-
// idx,
|
|
3642
|
-
// true,
|
|
3643
|
-
// pre_init_fieldsP
|
|
3644
|
-
// );
|
|
3645
|
-
// const init_count = await func.datasource.get_field_init_count(
|
|
3646
|
-
// SESSION_ID,
|
|
3647
|
-
// dataSourceSession,
|
|
3648
|
-
// idx,
|
|
3649
|
-
// false,
|
|
3650
|
-
// _ds.oninit_triggers_to_run
|
|
3651
|
-
// );
|
|
3652
|
-
// if (init_count > 0) {
|
|
3653
|
-
// await func.datasource.execute_field_init_events(
|
|
3654
|
-
// SESSION_ID,
|
|
3655
|
-
// dataSourceSession,
|
|
3656
|
-
// "form",
|
|
3657
|
-
// idx
|
|
3658
|
-
// );
|
|
3659
|
-
// }
|
|
3660
|
-
// await form_continue();
|
|
3661
|
-
// };
|
|
3662
|
-
|
|
3663
|
-
// await add_row();
|
|
3664
|
-
// };
|
|
3665
|
-
|
|
3666
3108
|
func.datasource.run_rows_form = async function (
|
|
3667
3109
|
SESSION_ID,
|
|
3668
3110
|
dataSourceSession,
|
|
@@ -3693,78 +3135,7 @@ func.datasource.run_rows_form = async function (
|
|
|
3693
3135
|
} catch (e) {
|
|
3694
3136
|
console.error(e);
|
|
3695
3137
|
}
|
|
3696
|
-
|
|
3697
|
-
//
|
|
3698
|
-
|
|
3699
|
-
// _ds.data_feed.rows[idx] = { _ROWID: val._ROWID };
|
|
3700
|
-
// _ds.data_feed.rows[idx].arrIndex = sort_index; // removed 022623 needs other solution
|
|
3701
|
-
|
|
3702
|
-
// const form_continue = async function (render_fields) {
|
|
3703
|
-
// _ds.rows_processed++;
|
|
3704
|
-
// // const sort_form = async function () {
|
|
3705
|
-
// // await db_adapter_module.add_sort(
|
|
3706
|
-
// // SESSION_ID,
|
|
3707
|
-
// // dataSourceSession,
|
|
3708
|
-
// // "form",
|
|
3709
|
-
// // _ds.progDataSource.dataSourceSortScript,
|
|
3710
|
-
// // idx,
|
|
3711
|
-
// // sort_index
|
|
3712
|
-
// // );
|
|
3713
|
-
// // await db_adapter_module.add_GroupBy(
|
|
3714
|
-
// // SESSION_ID,
|
|
3715
|
-
// // dataSourceSession,
|
|
3716
|
-
// // "form",
|
|
3717
|
-
// // _ds.progDataSource.dataSourceGroupByScript,
|
|
3718
|
-
// // idx,
|
|
3719
|
-
// // sort_index
|
|
3720
|
-
// // );
|
|
3721
|
-
// // // _ds.rows_found++;
|
|
3722
|
-
// // };
|
|
3723
|
-
// const delete_row = async function () {
|
|
3724
|
-
// if (_ds) {
|
|
3725
|
-
// delete _ds.data_feed.rows[idx];
|
|
3726
|
-
|
|
3727
|
-
// if (!_ds.v.viewRangeExp_deleted) _ds.v.viewRangeExp_deleted = [];
|
|
3728
|
-
// _ds.v.viewRangeExp_deleted.push(rowIdxP);
|
|
3729
|
-
// }
|
|
3730
|
-
// // _ds.rows_found--;
|
|
3731
|
-
// _ds.viewRangeExp_rows_deleted++;
|
|
3732
|
-
// };
|
|
3733
|
-
// if (_ds.progDataSource?.dataSourceFiltersScript) {
|
|
3734
|
-
// var res = await func.datasource.validate_viewRange(
|
|
3735
|
-
// SESSION_ID,
|
|
3736
|
-
// _ds.progDataSource.dataSourceFiltersScript,
|
|
3737
|
-
// dataSourceSession,
|
|
3738
|
-
// idx,
|
|
3739
|
-
// "form"
|
|
3740
|
-
// );
|
|
3741
|
-
// if (
|
|
3742
|
-
// res === false ||
|
|
3743
|
-
// res === 0 ||
|
|
3744
|
-
// typeof res === "undefined" ||
|
|
3745
|
-
// res === null
|
|
3746
|
-
// ) {
|
|
3747
|
-
// await delete_row();
|
|
3748
|
-
// }
|
|
3749
|
-
// }
|
|
3750
|
-
// // await sort_form();
|
|
3751
|
-
|
|
3752
|
-
// if (_ds.progDataSource?.dataSourceLocateScript) {
|
|
3753
|
-
// var res = func.datasource.validate_viewLocate(
|
|
3754
|
-
// SESSION_ID,
|
|
3755
|
-
// _ds.progDataSource.dataSourceLocateScript,
|
|
3756
|
-
// dataSourceSession,
|
|
3757
|
-
// idx,
|
|
3758
|
-
// "form"
|
|
3759
|
-
// );
|
|
3760
|
-
// if (res) {
|
|
3761
|
-
// _ds.locatedRecordId = idx;
|
|
3762
|
-
// }
|
|
3763
|
-
// }
|
|
3764
|
-
// if (_ds.progDataSource?.dataSourceFiltersScript) {
|
|
3765
|
-
// return;
|
|
3766
|
-
// }
|
|
3767
|
-
// };
|
|
3138
|
+
|
|
3768
3139
|
_ds.currentRecordId = val._ROWID; // set temporary to allow expression decoder work
|
|
3769
3140
|
|
|
3770
3141
|
await func.datasource.render_fields_form(
|
|
@@ -5004,7 +4375,7 @@ func.datasource.get_value = async function (
|
|
|
5004
4375
|
_ds.data_feed.rows[row_idx][_field_id]
|
|
5005
4376
|
);
|
|
5006
4377
|
}
|
|
5007
|
-
|
|
4378
|
+
|
|
5008
4379
|
if (Object.keys(_ds?.dynamic_fields || {})?.includes(_field_id)) {
|
|
5009
4380
|
return await return_dynamic_value(
|
|
5010
4381
|
_field_id,
|
|
@@ -5480,54 +4851,11 @@ func.datasource.add_dynamic_field_to_ds = function (
|
|
|
5480
4851
|
value: val,
|
|
5481
4852
|
};
|
|
5482
4853
|
};
|
|
5483
|
-
|
|
5484
|
-
// SESSION_ID,
|
|
5485
|
-
// dsSessionP,
|
|
5486
|
-
// key,
|
|
5487
|
-
// val
|
|
5488
|
-
// ) {
|
|
5489
|
-
// var _ds = SESSION_OBJ[SESSION_ID].DS_GLB[dsSessionP];
|
|
5490
|
-
// if (!_ds.dynamic_fields) {
|
|
5491
|
-
// _ds.dynamic_fields = [];
|
|
5492
|
-
// }
|
|
5493
|
-
// _ds.data_feed.rows[_ds.currentRecordId][key] = val;
|
|
5494
|
-
|
|
5495
|
-
// // todo: check duplicates
|
|
5496
|
-
// if (_ds.dynamic_fields.some((e) => e.data.field_id === key)) return;
|
|
5497
|
-
|
|
5498
|
-
// const toType = function (obj) {
|
|
5499
|
-
// return {}.toString
|
|
5500
|
-
// .call(obj)
|
|
5501
|
-
// .match(/\s([a-zA-Z]+)/)[1]
|
|
5502
|
-
// .toLowerCase();
|
|
5503
|
-
// };
|
|
5504
|
-
|
|
5505
|
-
// _ds.dynamic_fields.push({
|
|
5506
|
-
// id: crypto.randomUUID(),
|
|
5507
|
-
// data: {
|
|
5508
|
-
// type: "virtual",
|
|
5509
|
-
// field_id: key,
|
|
5510
|
-
// },
|
|
5511
|
-
// props: {
|
|
5512
|
-
// fieldType: val ? toType(val) : "string",
|
|
5513
|
-
// },
|
|
5514
|
-
// });
|
|
5515
|
-
// };
|
|
4854
|
+
|
|
5516
4855
|
func.datasource.get_progFields = async function (SESSION_ID, dsSessionP) {
|
|
5517
4856
|
var _ds = SESSION_OBJ[SESSION_ID].DS_GLB[dsSessionP];
|
|
5518
4857
|
const _view_obj = await func.utils.VIEWS_OBJ.get(SESSION_ID, _ds.prog_id);
|
|
5519
4858
|
return _view_obj.progFields;
|
|
5520
|
-
// var ret_arr = _view_obj.progFields;
|
|
5521
|
-
|
|
5522
|
-
// _ds?.dynamic_fields?.forEach((field) => {
|
|
5523
|
-
// if (ret_arr.some((e) => e.data.field_id === field.data.field_id)) {
|
|
5524
|
-
// return;
|
|
5525
|
-
// }
|
|
5526
|
-
|
|
5527
|
-
// ret_arr.push(field);
|
|
5528
|
-
// });
|
|
5529
|
-
|
|
5530
|
-
// return ret_arr;
|
|
5531
4859
|
};
|
|
5532
4860
|
func.utils = {};
|
|
5533
4861
|
|
|
@@ -6304,278 +5632,7 @@ func.utils.ws_worker.functions = {
|
|
|
6304
5632
|
service: params.service,
|
|
6305
5633
|
});
|
|
6306
5634
|
},
|
|
6307
|
-
// datasource_get_grid_data: async function (params, promise_queue_id) {
|
|
6308
|
-
// var SESSION_ID = params.session_id;
|
|
6309
|
-
// var _session = SESSION_OBJ[SESSION_ID];
|
|
6310
|
-
// if (!_session.DS_GLB) {
|
|
6311
|
-
// if (typeof show_log !== "undefined" && show_log)
|
|
6312
|
-
// console.log(
|
|
6313
|
-
// "DATASOURCE GET SESSION_ID: " + SESSION_ID,
|
|
6314
|
-
// params.dssession + " NOT EXIST!"
|
|
6315
|
-
// );
|
|
6316
|
-
// return;
|
|
6317
|
-
// }
|
|
6318
|
-
|
|
6319
|
-
// const get_count = async function () {
|
|
6320
|
-
// const json = await func.db.get_query(
|
|
6321
|
-
// SESSION_ID,
|
|
6322
|
-
// _ds._dataSourceTableId,
|
|
6323
|
-
// v.couchView,
|
|
6324
|
-
// params.dssession,
|
|
6325
|
-
// v.viewSourceDesc,
|
|
6326
|
-
// "read grid",
|
|
6327
|
-
|
|
6328
|
-
// // null,
|
|
6329
|
-
// null,
|
|
6330
|
-
// null,
|
|
6331
|
-
// null,
|
|
6332
|
-
// true,
|
|
6333
|
-
// null,
|
|
6334
|
-
// sort_fields,
|
|
6335
|
-
// sort_dir,
|
|
6336
|
-
// grid_filter_info,
|
|
6337
|
-
// null
|
|
6338
|
-
// );
|
|
6339
|
-
|
|
6340
|
-
// if (json.error) {
|
|
6341
|
-
// return worker_post_message({
|
|
6342
|
-
// promise_queue_id,
|
|
6343
|
-
// params: { error: true },
|
|
6344
|
-
// worker_id: ws_worker_id,
|
|
6345
|
-
// session_id: SESSION_ID,
|
|
6346
|
-
// process_pid: params.process_pid,
|
|
6347
|
-
// service: params.service,
|
|
6348
|
-
// });
|
|
6349
|
-
// }
|
|
6350
|
-
// var rows = json.rows.length ? json.rows[0].value : 0;
|
|
6351
|
-
// _ds.rows_found = rows;
|
|
6352
|
-
// return json;
|
|
6353
|
-
// };
|
|
6354
|
-
|
|
6355
|
-
// const get_query = async function () {
|
|
6356
|
-
// const json = await func.db.get_query(
|
|
6357
|
-
// SESSION_ID,
|
|
6358
|
-
// _ds._dataSourceTableId,
|
|
6359
|
-
// v.couchView,
|
|
6360
|
-
// params.dssession,
|
|
6361
|
-
// v.viewSourceDesc,
|
|
6362
|
-
// "read grid",
|
|
6363
|
-
// null,
|
|
6364
|
-
// v.progDataSource.dataSourceReduce,
|
|
6365
|
-
// from,
|
|
6366
|
-
// to - from,
|
|
6367
|
-
// false,
|
|
6368
|
-
// null,
|
|
6369
|
-
// sort_fields,
|
|
6370
|
-
// sort_dir,
|
|
6371
|
-
// grid_filter_info
|
|
6372
|
-
// );
|
|
6373
|
-
|
|
6374
|
-
// if (json.error) {
|
|
6375
|
-
// if (db_driver === "pouchdb") {
|
|
6376
|
-
// return callback({ error: true });
|
|
6377
|
-
// } else {
|
|
6378
|
-
// return worker_post_message({
|
|
6379
|
-
// promise_queue_id,
|
|
6380
|
-
// params: { error: true },
|
|
6381
|
-
// worker_id: ws_worker_id,
|
|
6382
|
-
// session_id: SESSION_ID,
|
|
6383
|
-
// process_pid: params.process_pid,
|
|
6384
|
-
// service: params.service,
|
|
6385
|
-
// });
|
|
6386
|
-
// }
|
|
6387
|
-
// }
|
|
6388
|
-
|
|
6389
|
-
// var rows = json.rows.length;
|
|
6390
|
-
// if (!params.req_from_grid) {
|
|
6391
|
-
// _ds.rows_found = rows;
|
|
6392
|
-
// } else {
|
|
6393
|
-
// rows = _ds.rows_found;
|
|
6394
|
-
// }
|
|
6395
|
-
|
|
6396
|
-
// _ds.data_feed = {};
|
|
6397
|
-
// _ds.data_feed.rows = {};
|
|
6398
|
-
// _ds.data_feed.sort = {};
|
|
6399
|
-
// _ds.data_feed.groupBy = {};
|
|
6400
|
-
|
|
6401
|
-
// await func.datasource.process_view_grid(
|
|
6402
|
-
// SESSION_ID,
|
|
6403
|
-
// params.dssession,
|
|
6404
|
-
// json,
|
|
6405
|
-
// rows
|
|
6406
|
-
// );
|
|
6407
|
-
|
|
6408
|
-
// obj.meta.rows_found = _ds.rows_found;
|
|
6409
|
-
// obj.data = _ds.data_feed;
|
|
6410
|
-
|
|
6411
|
-
// if (db_driver === "pouchdb") {
|
|
6412
|
-
// callback(obj);
|
|
6413
|
-
// } else {
|
|
6414
|
-
// worker_post_message({
|
|
6415
|
-
// promise_queue_id,
|
|
6416
|
-
// params: obj,
|
|
6417
|
-
// worker_id: ws_worker_id,
|
|
6418
|
-
// session_id: SESSION_ID,
|
|
6419
|
-
// process_pid: params.process_pid,
|
|
6420
|
-
// service: params.service,
|
|
6421
|
-
// });
|
|
6422
|
-
|
|
6423
|
-
// // console.log(json);
|
|
6424
|
-
// }
|
|
6425
|
-
// };
|
|
6426
|
-
// var from = Number(params.from);
|
|
6427
|
-
// var to = Number(params.to);
|
|
6428
|
-
// var obj = {
|
|
6429
|
-
// meta: {},
|
|
6430
|
-
// data: {
|
|
6431
|
-
// sort: {},
|
|
6432
|
-
// rows: {},
|
|
6433
|
-
// },
|
|
6434
|
-
// };
|
|
6435
|
-
// var sort_fields = [],
|
|
6436
|
-
// sort_dir,
|
|
6437
|
-
// grid_filter_info = [];
|
|
6438
|
-
|
|
6439
|
-
// if (params.sort_fields) {
|
|
6440
|
-
// sort_fields = params.sort_fields;
|
|
6441
|
-
// sort_dir = params.sort_dir;
|
|
6442
|
-
// }
|
|
6443
|
-
|
|
6444
|
-
// if (params.grid_filter_info) {
|
|
6445
|
-
// grid_filter_info = params.grid_filter_info;
|
|
6446
|
-
// }
|
|
6447
|
-
|
|
6448
|
-
// var _ds = SESSION_OBJ[SESSION_ID].DS_GLB[params.dssession];
|
|
6449
|
-
// var v = _ds.v;
|
|
6450
|
-
|
|
6451
|
-
// let db_driver;
|
|
6452
|
-
// if (_ds._dataSourceTableId) {
|
|
6453
|
-
// let file_ret = await func.utils.FILES_OBJ.get(
|
|
6454
|
-
// SESSION_ID,
|
|
6455
|
-
// _ds._dataSourceTableId
|
|
6456
|
-
// );
|
|
6457
|
-
// db_driver = file_ret.properties.db_driver || "xuda";
|
|
6458
|
-
// }
|
|
6459
|
-
// if (params.req_from_grid) {
|
|
6460
|
-
// const count_ret = await get_count();
|
|
6461
|
-
// }
|
|
6462
|
-
// return await get_query();
|
|
6463
|
-
// },
|
|
6464
|
-
// datasource_get_grid_totals: async function (params, promise_queue_id) {
|
|
6465
|
-
// var SESSION_ID = params.session_id;
|
|
6466
|
-
// var _session = SESSION_OBJ[SESSION_ID];
|
|
6467
|
-
// if (_session.DS_GLB) {
|
|
6468
|
-
// if (typeof show_log !== "undefined" && show_log)
|
|
6469
|
-
// console.log(
|
|
6470
|
-
// "DATASOURCE GET GRID TOTALS SESSION_ID: " + SESSION_ID,
|
|
6471
|
-
// APP_OBJ[_session.app_id].app_name,
|
|
6472
|
-
// params.dssession
|
|
6473
|
-
// );
|
|
6474
|
-
|
|
6475
|
-
// var grid_filter_info = [],
|
|
6476
|
-
// total_fields_info = [];
|
|
6477
|
-
|
|
6478
|
-
// if (params.total_fields_info) {
|
|
6479
|
-
// total_fields_info = params.total_fields_info;
|
|
6480
|
-
// }
|
|
6481
|
-
|
|
6482
|
-
// if (params.grid_filter_info) {
|
|
6483
|
-
// grid_filter_info = params.grid_filter_info;
|
|
6484
|
-
// }
|
|
6485
|
-
|
|
6486
|
-
// const _ds = _session.DS_GLB[params.dssession];
|
|
6487
|
-
// const v = _ds.v;
|
|
6488
|
-
|
|
6489
|
-
// let db_driver;
|
|
6490
|
-
// if (_ds._dataSourceTableId) {
|
|
6491
|
-
// let file_ret = await func.utils.FILES_OBJ.get(
|
|
6492
|
-
// SESSION_ID,
|
|
6493
|
-
// _ds._dataSourceTableId
|
|
6494
|
-
// );
|
|
6495
|
-
// db_driver = file_ret.properties.db_driver || "xuda";
|
|
6496
|
-
// }
|
|
6497
5635
|
|
|
6498
|
-
// // count
|
|
6499
|
-
// const json = await func.db.get_query(
|
|
6500
|
-
// SESSION_ID,
|
|
6501
|
-
// _ds._dataSourceTableId,
|
|
6502
|
-
// v.couchView,
|
|
6503
|
-
// params.dssession,
|
|
6504
|
-
// v.viewSourceDesc,
|
|
6505
|
-
// "read grid",
|
|
6506
|
-
// null,
|
|
6507
|
-
// null,
|
|
6508
|
-
// null,
|
|
6509
|
-
// null,
|
|
6510
|
-
// false,
|
|
6511
|
-
// null,
|
|
6512
|
-
// null,
|
|
6513
|
-
// null,
|
|
6514
|
-
// grid_filter_info,
|
|
6515
|
-
// total_fields_info
|
|
6516
|
-
// );
|
|
6517
|
-
|
|
6518
|
-
// if (json.error) {
|
|
6519
|
-
// if (db_driver === "pouchdb") {
|
|
6520
|
-
// return { error: true };
|
|
6521
|
-
// } else {
|
|
6522
|
-
// return worker_post_message({
|
|
6523
|
-
// promise_queue_id,
|
|
6524
|
-
// params: { error: true },
|
|
6525
|
-
// worker_id: ws_worker_id,
|
|
6526
|
-
// session_id: SESSION_ID,
|
|
6527
|
-
// process_pid: params.process_pid,
|
|
6528
|
-
// service: params.service,
|
|
6529
|
-
// });
|
|
6530
|
-
// }
|
|
6531
|
-
// }
|
|
6532
|
-
// if (db_driver === "pouchdb") {
|
|
6533
|
-
// return json;
|
|
6534
|
-
// } else {
|
|
6535
|
-
// worker_post_message({
|
|
6536
|
-
// // fx_to_execute: callback,
|
|
6537
|
-
// params: json,
|
|
6538
|
-
// worker_id: ws_worker_id,
|
|
6539
|
-
// session_id: SESSION_ID,
|
|
6540
|
-
// process_pid: params.process_pid,
|
|
6541
|
-
// service: params.service,
|
|
6542
|
-
// });
|
|
6543
|
-
// }
|
|
6544
|
-
// } else {
|
|
6545
|
-
// if (typeof show_log !== "undefined" && show_log)
|
|
6546
|
-
// console.log(
|
|
6547
|
-
// "DATASOURCE GET SESSION_ID: " + SESSION_ID,
|
|
6548
|
-
// params.dssession + " NOT EXIST!"
|
|
6549
|
-
// );
|
|
6550
|
-
// }
|
|
6551
|
-
// },
|
|
6552
|
-
// datasource_get_value: async function (params, promise_queue_id) {
|
|
6553
|
-
// var SESSION_ID = params.session_id;
|
|
6554
|
-
// var _session = SESSION_OBJ[SESSION_ID];
|
|
6555
|
-
// if (show_log)
|
|
6556
|
-
// console.log(
|
|
6557
|
-
// "DATASOURCE GET VALUE SESSION_ID: " + SESSION_ID,
|
|
6558
|
-
// APP_OBJ[_session.app_id].app_name,
|
|
6559
|
-
// params.dssession
|
|
6560
|
-
// );
|
|
6561
|
-
// const ret = await func.datasource.get_value(
|
|
6562
|
-
// SESSION_ID,
|
|
6563
|
-
// params.fieldIdP,
|
|
6564
|
-
// params.dsSessionP,
|
|
6565
|
-
|
|
6566
|
-
// params.rowIdP
|
|
6567
|
-
// );
|
|
6568
|
-
// // debugger;
|
|
6569
|
-
// worker_post_message({
|
|
6570
|
-
// promise_queue_id,
|
|
6571
|
-
// worker_id: ws_worker_id,
|
|
6572
|
-
// params: ret,
|
|
6573
|
-
|
|
6574
|
-
// session_id: SESSION_ID,
|
|
6575
|
-
// process_pid: params.process_pid,
|
|
6576
|
-
// service: params.service,
|
|
6577
|
-
// });
|
|
6578
|
-
// },
|
|
6579
5636
|
return_to_data_source: function (params, promise_queue_id) {
|
|
6580
5637
|
var SESSION_ID = params.session_id;
|
|
6581
5638
|
var _session = SESSION_OBJ[SESSION_ID];
|