Report viewer

This commit is contained in:
2023-05-08 22:55:20 -04:00
parent 38b13f9ad6
commit 71db3a6186
5 changed files with 239 additions and 1 deletions

View File

@@ -170,6 +170,22 @@ export const d_parse_notifications_fastuser = data => d_split(data, '^', 'info',
return row;
});
export const d_parse_multireport = data => {
if(data.length < 1) return [];
var brk, max = 0, grp;
for(var i = 0; i < data.length; ++i) {
brk = (grp = data[i]).indexOf('^');
if(brk >= 0) {
grp = +grp.substring(0, brk);
if(grp >= max) max = grp;
else break;
} else return [data];
}
var res = [], data = data.slice(), max = max + '^', grp = x => x.startsWith(max);
while(((brk = data.findIndex(grp)) >= 0) || (brk = data.length)) res.push(data.splice(0, brk + 1));
return res;
};
export function memoized(fn) {
var cache = {};
return async function(...args) {
@@ -268,6 +284,8 @@ export function Client(cid, secret) {
this.ORWLRR_INTERIM = aflow((...args) => this.call({ method: 'ORWLRR_INTERIM', context: ['OR CPRS GUI CHART'], ttl: 60, stale: false }, ...args), d_log, d_unwrap, lab_parse);
this.ORWLRR_INTERIM_RESULTS = async (...args) => lab_reparse_results(await this.ORWLRR_INTERIM(...args));
this.ORWRP_REPORT_TEXT = aflow((...args) => this.call({ method: 'ORWRP_REPORT_TEXT', context: ['OR CPRS GUI CHART'], ttl: 60, stale: false }, ...args), d_log, d_unwrap, d_parse_array, d_parse_multireport);
this.ORWORDG_ALLTREE = memoized(aflow(() => this.callctx(['OR CPRS GUI CHART'], 'ORWORDG_ALLTREE'), d_log, d_unwrap, f_split('^', 'ien', 'name', 'parent', 'has_children')));
this.ORWORDG_REVSTS = memoized(aflow(() => this.callctx(['OR CPRS GUI CHART'], 'ORWORDG_REVSTS'), d_log, d_unwrap, f_split('^', 'ien', 'name', 'parent', 'has_children')));
this.ORWORR_AGET = memoized(aflow((...args) => this.callctx(['OR CPRS GUI CHART'], 'ORWORR_AGET', ...args), d_log, d_unwrap, f_slice(1), f_split('^', 'ifn', 'dgrp', 'time')));