load field values logic moved to backend

This commit is contained in:
Jan Prochazka
2022-03-17 08:40:09 +01:00
parent 074a75075d
commit 5c4794deae
7 changed files with 98 additions and 108 deletions

View File

@@ -151,34 +151,33 @@ module.exports = {
return res.result;
},
loadKeys_meta: true,
async loadKeys({ conid, database, root }) {
async loadDataCore(msgtype, {conid, database, ...args}) {
const opened = await this.ensureOpened(conid, database);
const res = await this.sendRequest(opened, { msgtype: 'loadKeys', root });
const res = await this.sendRequest(opened, { msgtype, ...args });
if (res.errorMessage) {
console.error(res.errorMessage);
}
return res.result || null;
},
loadKeys_meta: true,
async loadKeys({ conid, database, root }) {
return this.loadDataCore('loadKeys', { conid, database, root });
},
loadKeyInfo_meta: true,
async loadKeyInfo({ conid, database, key }) {
const opened = await this.ensureOpened(conid, database);
const res = await this.sendRequest(opened, { msgtype: 'loadKeyInfo', key });
if (res.errorMessage) {
console.error(res.errorMessage);
}
return res.result || null;
return this.loadDataCore('loadKeyInfo', { conid, database, key });
},
loadKeyTableRange_meta: true,
async loadKeyTableRange({ conid, database, key, cursor, count }) {
const opened = await this.ensureOpened(conid, database);
const res = await this.sendRequest(opened, { msgtype: 'loadKeyTableRange', key, cursor, count });
if (res.errorMessage) {
console.error(res.errorMessage);
}
return res.result || null;
return this.loadDataCore('loadKeyTableRange', { conid, database, key, cursor, count });
},
loadFieldValues_meta: true,
async loadFieldValues({ conid, database, schemaName, pureName, field, search }) {
return this.loadDataCore('loadFieldValues', { conid, database, schemaName, pureName, field, search });
},
callMethod_meta: true,