Staring work on getting Electron working from Svelte app. Wrapping up for the day.
This commit is contained in:
440
src/lib/api.ts
440
src/lib/api.ts
@@ -3,408 +3,19 @@
|
||||
// This needs to be cleaned up and ideally removed the need for Axios.
|
||||
|
||||
import type { key_val } from '$lib/ae_stores';
|
||||
|
||||
|
||||
import { delete_object } from './api_delete_object'; // Exported at the end of this file
|
||||
import { get_object } from './api_get_object'; // Exported at the end of this file
|
||||
import { patch_object } from './api_patch_object'; // Exported at the end of this file
|
||||
import { post_object } from './api_post_object'; // Exported at the end of this file
|
||||
|
||||
|
||||
import { get_ae_obj_id_crud } from '$lib/api_get__crud_obj_id';
|
||||
import { get_ae_obj_li_for_obj_id_crud } from '$lib/api_get__crud_obj_li_v1';
|
||||
import { get_ae_obj_li_for_obj_id_crud_v2 } from '$lib/api_get__crud_obj_li_v2';
|
||||
|
||||
|
||||
// Updated 2023-12-01
|
||||
export let get_ae_obj_id_crud = async function get_ae_obj_id_crud(
|
||||
{
|
||||
api_cfg,
|
||||
no_account_id=false,
|
||||
obj_type,
|
||||
obj_id,
|
||||
use_alt_table=false,
|
||||
use_alt_base=false,
|
||||
inc={},
|
||||
enabled='enabled',
|
||||
hidden='not_hidden',
|
||||
limit=999999,
|
||||
offset=0,
|
||||
data={},
|
||||
// key,
|
||||
// jwt=null,
|
||||
headers={},
|
||||
params={},
|
||||
timeout=25000,
|
||||
return_meta=false,
|
||||
log_lvl=0
|
||||
}: {
|
||||
api_cfg: any,
|
||||
no_account_id?: boolean,
|
||||
obj_type: string,
|
||||
obj_id: string,
|
||||
use_alt_table?: boolean,
|
||||
use_alt_base?: boolean,
|
||||
inc?: any,
|
||||
enabled?: string,
|
||||
hidden?: string,
|
||||
limit?: number,
|
||||
offset?: number,
|
||||
data?: any,
|
||||
// key: string,
|
||||
// jwt?: string,
|
||||
headers?: any,
|
||||
params?: any,
|
||||
timeout?: number,
|
||||
return_meta?: boolean,
|
||||
log_lvl?: number
|
||||
}
|
||||
) {
|
||||
if (log_lvl) {
|
||||
console.log('*** get_ae_obj_id_crud() ***');
|
||||
}
|
||||
|
||||
// data = {};
|
||||
// data['super_key'] = key;
|
||||
// data['jwt'] = jwt;
|
||||
// NOTE: The key and or JWT should be in the header of the DELETE, GET, PATCH, POST
|
||||
|
||||
let endpoint = '';
|
||||
if (obj_type == 'account') {
|
||||
endpoint = `/crud/account/${obj_id}`;
|
||||
} else if (obj_type == 'address') {
|
||||
endpoint = `/crud/address/${obj_id}`;
|
||||
} else if (obj_type == 'archive') {
|
||||
endpoint = `/crud/archive/${obj_id}`;
|
||||
} else if (obj_type == 'archive_content') {
|
||||
endpoint = `/crud/archive/content/${obj_id}`;
|
||||
} else if (obj_type == 'contact') {
|
||||
endpoint = `/crud/contact/${obj_id}`;
|
||||
} else if (obj_type == 'data_store') {
|
||||
endpoint = `/crud/data_store/${obj_id}`;
|
||||
} else if (obj_type == 'event') {
|
||||
endpoint = `/crud/event/${obj_id}`;
|
||||
} else if (obj_type == 'event_abstract') {
|
||||
endpoint = `/crud/event/abstract/${obj_id}`;
|
||||
} else if (obj_type == 'event_badge') {
|
||||
endpoint = `/crud/event/badge/${obj_id}`;
|
||||
} else if (obj_type == 'event_device') {
|
||||
endpoint = `/crud/event/device/${obj_id}`;
|
||||
} else if (obj_type == 'event_exhibit') {
|
||||
endpoint = `/crud/event/exhibit/${obj_id}`;
|
||||
} else if (obj_type == 'event_exhibit_tracking') {
|
||||
endpoint = `/crud/event/exhibit/tracking/${obj_id}`;
|
||||
} else if (obj_type == 'event_file') {
|
||||
endpoint = `/crud/event/file/${obj_id}`;
|
||||
} else if (obj_type == 'event_location') {
|
||||
endpoint = `/crud/event/location/${obj_id}`;
|
||||
} else if (obj_type == 'event_person') {
|
||||
endpoint = `/crud/event/person/${obj_id}`;
|
||||
} else if (obj_type == 'event_presentation') {
|
||||
endpoint = `/crud/event/presentation/${obj_id}`;
|
||||
} else if (obj_type == 'event_presenter') {
|
||||
endpoint = `/crud/event/presenter/${obj_id}`;
|
||||
} else if (obj_type == 'event_session') {
|
||||
endpoint = `/crud/event/session/${obj_id}`;
|
||||
} else if (obj_type == 'event_track') {
|
||||
endpoint = `/crud/event/track/${obj_id}`;
|
||||
} else if (obj_type == 'grant') {
|
||||
endpoint = `/crud/grant/${obj_id}`;
|
||||
} else if (obj_type == 'hosted_file') {
|
||||
endpoint = `/crud/hosted_file/${obj_id}`;
|
||||
} else if (obj_type == 'journal') {
|
||||
endpoint = `/crud/journal/${obj_id}`;
|
||||
} else if (obj_type == 'journal_entry') {
|
||||
endpoint = `/crud/journal/entry/${obj_id}`;
|
||||
} else if (obj_type == 'order') {
|
||||
endpoint = `/crud/order/${obj_id}`;
|
||||
} else if (obj_type == 'order_line') {
|
||||
endpoint = `/crud/order/line/${obj_id}`;
|
||||
} else if (obj_type == 'page') {
|
||||
endpoint = `/crud/page/${obj_id}`;
|
||||
} else if (obj_type == 'person') {
|
||||
endpoint = `/crud/person/${obj_id}`;
|
||||
} else if (obj_type == 'post') {
|
||||
endpoint = `/crud/post/${obj_id}`;
|
||||
} else if (obj_type == 'post_comment') {
|
||||
endpoint = `/crud/post/comment/${obj_id}`;
|
||||
} else if (obj_type == 'site') {
|
||||
endpoint = `/crud/site/${obj_id}`;
|
||||
} else if (obj_type == 'site_domain') {
|
||||
endpoint = `/crud/site/domain/${obj_id}`;
|
||||
} else if (obj_type == 'sponsorship_cfg') {
|
||||
endpoint = `/crud/sponsorship/cfg/${obj_id}`;
|
||||
} else if (obj_type == 'sponsorship') {
|
||||
endpoint = `/crud/sponsorship/${obj_id}`;
|
||||
// } else if (obj_type == 'user') {
|
||||
// endpoint = `/crud/user/${obj_id}`;
|
||||
} else {
|
||||
console.log(`Unknown object type: ${obj_type}`);
|
||||
return false;
|
||||
}
|
||||
if (log_lvl) {
|
||||
console.log('Endpoint:', endpoint);
|
||||
}
|
||||
|
||||
params['use_alt_table'] = use_alt_table;
|
||||
params['use_alt_base'] = use_alt_base;
|
||||
|
||||
if (log_lvl) {
|
||||
console.log('Params:', params);
|
||||
}
|
||||
|
||||
if (no_account_id) {
|
||||
headers['x-no-account-id'] = 'Nothing to See Here';
|
||||
delete headers['x-account-id'];
|
||||
delete api_cfg['headers']['x-account-id'];
|
||||
// headers['x-account-id'] = null;
|
||||
// headers['x-account-id'] = '_XY7DXtc9Mxx';
|
||||
// params['x_no_account_id_token'] = 'Nothing to See Here';
|
||||
|
||||
// Remove the x-account-id header
|
||||
// if (headers['x-account-id']) {
|
||||
// delete headers['x-account-id'];
|
||||
// }
|
||||
|
||||
// headers['x-account-id'] = null;
|
||||
// headers['x-no-account-id-token'] = 'Nothing to See Here'; // get_object() will fix the underscores to dashes
|
||||
}
|
||||
|
||||
let object_obj_get_promise = await get_object({
|
||||
api_cfg: api_cfg,
|
||||
endpoint: endpoint,
|
||||
headers: headers,
|
||||
params: params,
|
||||
timeout: timeout,
|
||||
log_lvl: log_lvl
|
||||
});
|
||||
|
||||
if (log_lvl > 1) {
|
||||
console.log(object_obj_get_promise);
|
||||
}
|
||||
|
||||
return object_obj_get_promise;
|
||||
}
|
||||
|
||||
|
||||
// The lookup "obj_type" should broken out into a separate function. - 2024-08-07
|
||||
// Updated 2023-11-15
|
||||
export let get_ae_obj_li_for_obj_id_crud = async function get_ae_obj_li_for_obj_id_crud(
|
||||
{
|
||||
api_cfg,
|
||||
obj_type,
|
||||
for_obj_type,
|
||||
for_obj_id, // NOTE: Changed 2023-12-06 to no longer required
|
||||
use_alt_table=false,
|
||||
use_alt_base=false,
|
||||
inc={},
|
||||
enabled='enabled',
|
||||
hidden='not_hidden',
|
||||
order_by_li=null,
|
||||
limit=999999,
|
||||
offset=0,
|
||||
// key,
|
||||
// jwt=null,
|
||||
headers={},
|
||||
params_json=null, // NOTE: This is a JSON object that needs to be safely converted to a string for the params. This is used for the API endpoint. Example: { "fulltext_search": { "default_qry_str": "Search string for default", "address_default_qry_str": "Search string for address", "contact_1_default_qry_str": "Search string for contact_1" } }
|
||||
// json_obj=null, // NOTE: This is a JSON object that needs to be safely converted to a string for the params. This is used for the search endpoint.
|
||||
params={},
|
||||
return_meta=false,
|
||||
log_lvl=1
|
||||
}: {
|
||||
api_cfg: any,
|
||||
obj_type: string,
|
||||
for_obj_type: string,
|
||||
for_obj_id?: string,
|
||||
use_alt_table?: boolean,
|
||||
use_alt_base?: boolean,
|
||||
inc?: key_val
|
||||
enabled?: string,
|
||||
hidden?: string,
|
||||
order_by_li?: any,
|
||||
limit?: number,
|
||||
offset?: number,
|
||||
// key: string,
|
||||
// jwt?: string,
|
||||
headers?: any,
|
||||
params_json?: any,
|
||||
// json_obj?: any,
|
||||
params?: key_val,
|
||||
return_meta?: boolean,
|
||||
log_lvl?: number
|
||||
}
|
||||
) {
|
||||
if (log_lvl) {
|
||||
console.log('*** get_ae_obj_li_for_obj_id_crud() ***');
|
||||
}
|
||||
|
||||
// data = {};
|
||||
// data['super_key'] = key;
|
||||
// data['jwt'] = jwt;
|
||||
// NOTE: The key and or JWT should be in the header of the DELETE, GET, PATCH, POST
|
||||
|
||||
// const endpoint = `/crud/${obj_type}/list`;
|
||||
|
||||
let endpoint = '';
|
||||
if (obj_type == 'account') {
|
||||
endpoint = `/crud/account/list`;
|
||||
} else if (obj_type == 'address') {
|
||||
endpoint = `/crud/address/list`;
|
||||
} else if (obj_type == 'archive') {
|
||||
endpoint = `/crud/archive/list`;
|
||||
} else if (obj_type == 'archive_content') {
|
||||
endpoint = `/crud/archive/content/list`;
|
||||
} else if (obj_type == 'contact') {
|
||||
endpoint = `/crud/contact/list`;
|
||||
} else if (obj_type == 'data_store') {
|
||||
endpoint = `/crud/data_store/list`;
|
||||
} else if (obj_type == 'event') {
|
||||
endpoint = `/crud/event/list`;
|
||||
} else if (obj_type == 'event_abstract') {
|
||||
endpoint = `/crud/event/abstract/list`;
|
||||
} else if (obj_type == 'event_badge') {
|
||||
endpoint = `/crud/event/badge/list`;
|
||||
} else if (obj_type == 'event_device') {
|
||||
endpoint = `/crud/event/device/list`;
|
||||
} else if (obj_type == 'event_exhibit') {
|
||||
endpoint = `/crud/event/exhibit/list`;
|
||||
} else if (obj_type == 'event_exhibit_tracking') {
|
||||
endpoint = `/crud/event/exhibit/tracking/list`;
|
||||
} else if (obj_type == 'event_file') {
|
||||
endpoint = `/crud/event/file/list`;
|
||||
} else if (obj_type == 'event_location') {
|
||||
endpoint = `/crud/event/location/list`;
|
||||
} else if (obj_type == 'event_person') {
|
||||
endpoint = `/crud/event/person/list`;
|
||||
} else if (obj_type == 'event_presentation') {
|
||||
endpoint = `/crud/event/presentation/list`;
|
||||
} else if (obj_type == 'event_presenter') {
|
||||
endpoint = `/crud/event/presenter/list`;
|
||||
} else if (obj_type == 'event_session') {
|
||||
endpoint = `/crud/event/session/list`;
|
||||
} else if (obj_type == 'event_track') {
|
||||
endpoint = `/crud/event/track/list`;
|
||||
} else if (obj_type == 'grant') {
|
||||
endpoint = `/crud/grant/list`;
|
||||
} else if (obj_type == 'hosted_file') {
|
||||
endpoint = `/crud/hosted_file/list`;
|
||||
} else if (obj_type == 'journal') {
|
||||
endpoint = `/crud/journal/list`;
|
||||
} else if (obj_type == 'journal_entry') {
|
||||
endpoint = `/crud/journal/entry/list`;
|
||||
} else if (obj_type == 'order') {
|
||||
endpoint = `/crud/order/list`;
|
||||
} else if (obj_type == 'order_line') {
|
||||
endpoint = `/crud/order/line/list`;
|
||||
} else if (obj_type == 'page') {
|
||||
endpoint = `/crud/page/list`;
|
||||
} else if (obj_type == 'person') {
|
||||
endpoint = `/crud/person/list`;
|
||||
} else if (obj_type == 'post') {
|
||||
endpoint = `/crud/post/list`;
|
||||
} else if (obj_type == 'post_comment') {
|
||||
endpoint = `/crud/post/comment/list`;
|
||||
} else if (obj_type == 'site') {
|
||||
endpoint = `/crud/site/list`;
|
||||
} else if (obj_type == 'sponsorship_cfg') {
|
||||
endpoint = `/crud/sponsorship/cfg/list`;
|
||||
} else if (obj_type == 'sponsorship') {
|
||||
endpoint = `/crud/sponsorship/list`;
|
||||
// } else if (obj_type == 'user') {
|
||||
// endpoint = `/crud/user/list`;
|
||||
// } else if (obj_type == 'lu' && for_obj_type == 'country_subdivision') {
|
||||
// endpoint = `/crud/lu/country_subdivision/list`;
|
||||
// for_obj_type = null;
|
||||
// } else if (obj_type == 'lu' && for_obj_type == 'country') {
|
||||
// endpoint = `/crud/lu/country/list`;
|
||||
// for_obj_type = null;
|
||||
// } else if (obj_type == 'lu' && for_obj_type == 'time_zone') {
|
||||
// endpoint = `/crud/lu/time_zone/list`;
|
||||
// for_obj_type = null;
|
||||
} else {
|
||||
console.log(`Unknown object type: ${obj_type}`);
|
||||
return false;
|
||||
}
|
||||
if (log_lvl) {
|
||||
console.log('Endpoint:', endpoint);
|
||||
}
|
||||
|
||||
if (for_obj_type) {
|
||||
params['for_obj_type'] = for_obj_type;
|
||||
}
|
||||
if (for_obj_id) {
|
||||
params['for_obj_id'] = for_obj_id;
|
||||
}
|
||||
|
||||
params['use_alt_table'] = use_alt_table;
|
||||
params['use_alt_base'] = use_alt_base;
|
||||
|
||||
/* Need to deal with inc params here */
|
||||
|
||||
let allowed_enabled_list = ['all', 'enabled', 'not_enabled']
|
||||
if (allowed_enabled_list.includes(enabled) ) {
|
||||
params['enabled'] = enabled;
|
||||
}
|
||||
|
||||
let allowed_hidden_list = ['all', 'hidden', 'not_hidden'];
|
||||
if (allowed_hidden_list.includes(hidden) ) {
|
||||
params['hidden'] = hidden;
|
||||
}
|
||||
|
||||
// NOTE: The order_by_li variable is in the "headers" because if is a the URL GET params do not handle multiple values very well. Maybe base64 encore in the future or something? Reminder that GET requests should not have a body (no JSON).
|
||||
// NOTE: The order_by_li should be a key value pair of the property/DB field to sort and how to sort (ASC or DESC)
|
||||
if (order_by_li) {
|
||||
headers['order_by_li'] = order_by_li;
|
||||
}
|
||||
|
||||
if (limit >= 0) {
|
||||
params['limit'] = limit;
|
||||
}
|
||||
|
||||
if (offset >= 0) {
|
||||
params['offset'] = offset;
|
||||
}
|
||||
|
||||
if (params_json) {
|
||||
// NOTE: This is a JSON object that needs to be safely converted to a string for the params. This is used for the search endpoint.
|
||||
// Max characters for a GET request is 2083. This is a limitation of the browser (Microsoft IE and Edge).
|
||||
console.log('JSON Object:', params_json);
|
||||
console.log(JSON.stringify(params_json));
|
||||
// NOTE: "jp" stands for "JSON Params"
|
||||
params['jp'] = encodeURIComponent(JSON.stringify(params_json));
|
||||
if (params['jp'].length > 2083) {
|
||||
console.log(`The JSON object is too large to be used as a GET parameter. The overall max URL length is 2083 characters. Please use the POST endpoint instead. Length = ${params['jp'].length} [THIS DOES NOT EXIST YET]`);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// if (json_obj) {
|
||||
// // NOTE: This is a JSON object that needs to be safely converted to a string for the params. This is used for the search endpoint.
|
||||
// // Max characters for a GET request is 2083. This is a limitation of the browser (Microsoft IE and Edge).
|
||||
// console.log('JSON Object:', json_obj);
|
||||
// params['json_str'] = encodeURIComponent(JSON.stringify(json_obj));
|
||||
// if (params['json_str'].length > 2083) {
|
||||
// console.log(`The JSON object is too large to be used as a GET parameter. The overall max URL length is 2083 characters. Please use the POST endpoint instead. Length = ${params['json_str'].length} [THIS DOES NOT EXIST YET]`);
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
|
||||
if (log_lvl) {
|
||||
console.log('Params:', params);
|
||||
}
|
||||
|
||||
let object_li_get_promise = await api.get_object({
|
||||
api_cfg: api_cfg,
|
||||
endpoint: endpoint,
|
||||
headers: headers,
|
||||
params: params,
|
||||
return_meta: return_meta,
|
||||
log_lvl: log_lvl
|
||||
});
|
||||
|
||||
if (log_lvl > 1) {
|
||||
console.log(object_li_get_promise);
|
||||
}
|
||||
|
||||
return object_li_get_promise;
|
||||
}
|
||||
|
||||
|
||||
// This new function has not been tested yet!!!
|
||||
// Updated 2024-08-07
|
||||
export let get_ae_obj_li_for_lu = async function get_ae_obj_li_for_lu(
|
||||
@@ -1271,53 +882,15 @@ export let send_email = async function send_email(
|
||||
|
||||
/* END: Utility: Email Related */
|
||||
|
||||
// function resolved(result: any) {
|
||||
// console.log('Resolved');
|
||||
// }
|
||||
|
||||
// function rejected(result: any) {
|
||||
// console.error(result);
|
||||
// }
|
||||
|
||||
// const parse_params = (params) => {
|
||||
// const keys = Object.keys(params);
|
||||
// let options = '';
|
||||
|
||||
// keys.forEach((key) => {
|
||||
// const isParamTypeObject = typeof params[key] === 'object';
|
||||
// const isParamTypeArray = isParamTypeObject && (params[key].length >= 0);
|
||||
|
||||
// if (!isParamTypeObject) {
|
||||
// let encoded_value = encodeURIComponent(params[key]);
|
||||
// options += `${key}=${encoded_value}&`;
|
||||
// // options += `${key}=${params[key]}&`;
|
||||
// }
|
||||
|
||||
// if (isParamTypeObject && isParamTypeArray) {
|
||||
// params[key].forEach((element) => {
|
||||
// let encoded_value = encodeURIComponent(element);
|
||||
// options += `${key}=${encoded_value}&`;
|
||||
// // options += `${key}=${element}&`;
|
||||
// });
|
||||
// }
|
||||
// });
|
||||
|
||||
// return options ? options.slice(0, -1) : options;
|
||||
// };
|
||||
|
||||
|
||||
// export let test = async function test() {
|
||||
// console.log('Exported test function from API.');
|
||||
// }
|
||||
|
||||
let obj = {
|
||||
get_ae_obj_li_for_obj_id_crud_v2: get_ae_obj_li_for_obj_id_crud_v2,
|
||||
delete_object: delete_object,
|
||||
get_object: get_object,
|
||||
patch_object: patch_object,
|
||||
post_object: post_object,
|
||||
get_ae_obj_id_crud: get_ae_obj_id_crud,
|
||||
get_ae_obj_li_for_obj_id_crud: get_ae_obj_li_for_obj_id_crud,
|
||||
get_ae_obj_li_for_obj_id_crud_v2: get_ae_obj_li_for_obj_id_crud_v2,
|
||||
create_ae_obj_crud: create_ae_obj_crud,
|
||||
update_ae_obj_id_crud: update_ae_obj_id_crud,
|
||||
delete_ae_obj_id_crud: delete_ae_obj_id_crud,
|
||||
@@ -1325,7 +898,6 @@ let obj = {
|
||||
delete_hosted_file: delete_hosted_file,
|
||||
get_data_store_obj_w_code: get_data_store_obj_w_code,
|
||||
send_email: send_email,
|
||||
// test: test;
|
||||
}
|
||||
export let api = obj;
|
||||
// module.exports = api;
|
||||
172
src/lib/api_get__crud_obj_id.ts
Normal file
172
src/lib/api_get__crud_obj_id.ts
Normal file
@@ -0,0 +1,172 @@
|
||||
import type { key_val } from '$lib/ae_stores';
|
||||
import { get_object } from './api_get_object';
|
||||
|
||||
// Updated 2023-12-01
|
||||
export async function get_ae_obj_id_crud(
|
||||
{
|
||||
api_cfg,
|
||||
no_account_id=false,
|
||||
obj_type,
|
||||
obj_id,
|
||||
use_alt_table=false,
|
||||
use_alt_base=false,
|
||||
inc={},
|
||||
enabled='enabled',
|
||||
hidden='not_hidden',
|
||||
limit=999999,
|
||||
offset=0,
|
||||
data={},
|
||||
// key,
|
||||
// jwt=null,
|
||||
headers={},
|
||||
params={},
|
||||
timeout=25000,
|
||||
return_meta=false,
|
||||
log_lvl=0
|
||||
}: {
|
||||
api_cfg: any,
|
||||
no_account_id?: boolean,
|
||||
obj_type: string,
|
||||
obj_id: string,
|
||||
use_alt_table?: boolean,
|
||||
use_alt_base?: boolean,
|
||||
inc?: any,
|
||||
enabled?: string,
|
||||
hidden?: string,
|
||||
limit?: number,
|
||||
offset?: number,
|
||||
data?: any,
|
||||
// key: string,
|
||||
// jwt?: string,
|
||||
headers?: any,
|
||||
params?: key_val,
|
||||
timeout?: number,
|
||||
return_meta?: boolean,
|
||||
log_lvl?: number
|
||||
}
|
||||
) {
|
||||
if (log_lvl) {
|
||||
console.log('*** get_ae_obj_id_crud() ***');
|
||||
}
|
||||
|
||||
// data = {};
|
||||
// data['super_key'] = key;
|
||||
// data['jwt'] = jwt;
|
||||
// NOTE: The key and or JWT should be in the header of the DELETE, GET, PATCH, POST
|
||||
|
||||
let endpoint = '';
|
||||
if (obj_type == 'account') {
|
||||
endpoint = `/crud/account/${obj_id}`;
|
||||
} else if (obj_type == 'address') {
|
||||
endpoint = `/crud/address/${obj_id}`;
|
||||
} else if (obj_type == 'archive') {
|
||||
endpoint = `/crud/archive/${obj_id}`;
|
||||
} else if (obj_type == 'archive_content') {
|
||||
endpoint = `/crud/archive/content/${obj_id}`;
|
||||
} else if (obj_type == 'contact') {
|
||||
endpoint = `/crud/contact/${obj_id}`;
|
||||
} else if (obj_type == 'data_store') {
|
||||
endpoint = `/crud/data_store/${obj_id}`;
|
||||
} else if (obj_type == 'event') {
|
||||
endpoint = `/crud/event/${obj_id}`;
|
||||
} else if (obj_type == 'event_abstract') {
|
||||
endpoint = `/crud/event/abstract/${obj_id}`;
|
||||
} else if (obj_type == 'event_badge') {
|
||||
endpoint = `/crud/event/badge/${obj_id}`;
|
||||
} else if (obj_type == 'event_device') {
|
||||
endpoint = `/crud/event/device/${obj_id}`;
|
||||
} else if (obj_type == 'event_exhibit') {
|
||||
endpoint = `/crud/event/exhibit/${obj_id}`;
|
||||
} else if (obj_type == 'event_exhibit_tracking') {
|
||||
endpoint = `/crud/event/exhibit/tracking/${obj_id}`;
|
||||
} else if (obj_type == 'event_file') {
|
||||
endpoint = `/crud/event/file/${obj_id}`;
|
||||
} else if (obj_type == 'event_location') {
|
||||
endpoint = `/crud/event/location/${obj_id}`;
|
||||
} else if (obj_type == 'event_person') {
|
||||
endpoint = `/crud/event/person/${obj_id}`;
|
||||
} else if (obj_type == 'event_presentation') {
|
||||
endpoint = `/crud/event/presentation/${obj_id}`;
|
||||
} else if (obj_type == 'event_presenter') {
|
||||
endpoint = `/crud/event/presenter/${obj_id}`;
|
||||
} else if (obj_type == 'event_session') {
|
||||
endpoint = `/crud/event/session/${obj_id}`;
|
||||
} else if (obj_type == 'event_track') {
|
||||
endpoint = `/crud/event/track/${obj_id}`;
|
||||
} else if (obj_type == 'grant') {
|
||||
endpoint = `/crud/grant/${obj_id}`;
|
||||
} else if (obj_type == 'hosted_file') {
|
||||
endpoint = `/crud/hosted_file/${obj_id}`;
|
||||
} else if (obj_type == 'journal') {
|
||||
endpoint = `/crud/journal/${obj_id}`;
|
||||
} else if (obj_type == 'journal_entry') {
|
||||
endpoint = `/crud/journal/entry/${obj_id}`;
|
||||
} else if (obj_type == 'order') {
|
||||
endpoint = `/crud/order/${obj_id}`;
|
||||
} else if (obj_type == 'order_line') {
|
||||
endpoint = `/crud/order/line/${obj_id}`;
|
||||
} else if (obj_type == 'page') {
|
||||
endpoint = `/crud/page/${obj_id}`;
|
||||
} else if (obj_type == 'person') {
|
||||
endpoint = `/crud/person/${obj_id}`;
|
||||
} else if (obj_type == 'post') {
|
||||
endpoint = `/crud/post/${obj_id}`;
|
||||
} else if (obj_type == 'post_comment') {
|
||||
endpoint = `/crud/post/comment/${obj_id}`;
|
||||
} else if (obj_type == 'site') {
|
||||
endpoint = `/crud/site/${obj_id}`;
|
||||
} else if (obj_type == 'site_domain') {
|
||||
endpoint = `/crud/site/domain/${obj_id}`;
|
||||
} else if (obj_type == 'sponsorship_cfg') {
|
||||
endpoint = `/crud/sponsorship/cfg/${obj_id}`;
|
||||
} else if (obj_type == 'sponsorship') {
|
||||
endpoint = `/crud/sponsorship/${obj_id}`;
|
||||
// } else if (obj_type == 'user') {
|
||||
// endpoint = `/crud/user/${obj_id}`;
|
||||
} else {
|
||||
console.log(`Unknown object type: ${obj_type}`);
|
||||
return false;
|
||||
}
|
||||
if (log_lvl) {
|
||||
console.log('Endpoint:', endpoint);
|
||||
}
|
||||
|
||||
params['use_alt_table'] = use_alt_table;
|
||||
params['use_alt_base'] = use_alt_base;
|
||||
|
||||
if (log_lvl) {
|
||||
console.log('Params:', params);
|
||||
}
|
||||
|
||||
if (no_account_id) {
|
||||
headers['x-no-account-id'] = 'Nothing to See Here';
|
||||
delete headers['x-account-id'];
|
||||
delete api_cfg['headers']['x-account-id'];
|
||||
// headers['x-account-id'] = null;
|
||||
// headers['x-account-id'] = '_XY7DXtc9Mxx';
|
||||
// params['x_no_account_id_token'] = 'Nothing to See Here';
|
||||
|
||||
// Remove the x-account-id header
|
||||
// if (headers['x-account-id']) {
|
||||
// delete headers['x-account-id'];
|
||||
// }
|
||||
|
||||
// headers['x-account-id'] = null;
|
||||
// headers['x-no-account-id-token'] = 'Nothing to See Here'; // get_object() will fix the underscores to dashes
|
||||
}
|
||||
|
||||
let object_obj_get_promise = await get_object({
|
||||
api_cfg: api_cfg,
|
||||
endpoint: endpoint,
|
||||
headers: headers,
|
||||
params: params,
|
||||
timeout: timeout,
|
||||
log_lvl: log_lvl
|
||||
});
|
||||
|
||||
if (log_lvl > 1) {
|
||||
console.log(object_obj_get_promise);
|
||||
}
|
||||
|
||||
return object_obj_get_promise;
|
||||
}
|
||||
226
src/lib/api_get__crud_obj_li_v1.ts
Normal file
226
src/lib/api_get__crud_obj_li_v1.ts
Normal file
@@ -0,0 +1,226 @@
|
||||
import type { key_val } from '$lib/ae_stores';
|
||||
import { get_object } from './api_get_object';
|
||||
|
||||
// The lookup "obj_type" should broken out into a separate function. - 2024-08-07
|
||||
// Updated 2023-11-15
|
||||
export async function get_ae_obj_li_for_obj_id_crud(
|
||||
{
|
||||
api_cfg,
|
||||
obj_type,
|
||||
for_obj_type,
|
||||
for_obj_id, // NOTE: Changed 2023-12-06 to no longer required
|
||||
use_alt_table=false,
|
||||
use_alt_base=false,
|
||||
inc={},
|
||||
enabled='enabled',
|
||||
hidden='not_hidden',
|
||||
order_by_li=null,
|
||||
limit=999999,
|
||||
offset=0,
|
||||
// key,
|
||||
// jwt=null,
|
||||
headers={},
|
||||
params_json=null, // NOTE: This is a JSON object that needs to be safely converted to a string for the params. This is used for the API endpoint. Example: { "fulltext_search": { "default_qry_str": "Search string for default", "address_default_qry_str": "Search string for address", "contact_1_default_qry_str": "Search string for contact_1" } }
|
||||
// json_obj=null, // NOTE: This is a JSON object that needs to be safely converted to a string for the params. This is used for the search endpoint.
|
||||
params={},
|
||||
return_meta=false,
|
||||
log_lvl=1
|
||||
}: {
|
||||
api_cfg: any,
|
||||
obj_type: string,
|
||||
for_obj_type: string,
|
||||
for_obj_id?: string,
|
||||
use_alt_table?: boolean,
|
||||
use_alt_base?: boolean,
|
||||
inc?: key_val
|
||||
enabled?: string,
|
||||
hidden?: string,
|
||||
order_by_li?: any,
|
||||
limit?: number,
|
||||
offset?: number,
|
||||
// key: string,
|
||||
// jwt?: string,
|
||||
headers?: any,
|
||||
params_json?: any,
|
||||
// json_obj?: any,
|
||||
params?: key_val,
|
||||
return_meta?: boolean,
|
||||
log_lvl?: number
|
||||
}
|
||||
) {
|
||||
if (log_lvl) {
|
||||
console.log('*** get_ae_obj_li_for_obj_id_crud() ***');
|
||||
}
|
||||
|
||||
// data = {};
|
||||
// data['super_key'] = key;
|
||||
// data['jwt'] = jwt;
|
||||
// NOTE: The key and or JWT should be in the header of the DELETE, GET, PATCH, POST
|
||||
|
||||
// const endpoint = `/crud/${obj_type}/list`;
|
||||
|
||||
let endpoint = '';
|
||||
if (obj_type == 'account') {
|
||||
endpoint = `/crud/account/list`;
|
||||
} else if (obj_type == 'address') {
|
||||
endpoint = `/crud/address/list`;
|
||||
} else if (obj_type == 'archive') {
|
||||
endpoint = `/crud/archive/list`;
|
||||
} else if (obj_type == 'archive_content') {
|
||||
endpoint = `/crud/archive/content/list`;
|
||||
} else if (obj_type == 'contact') {
|
||||
endpoint = `/crud/contact/list`;
|
||||
} else if (obj_type == 'data_store') {
|
||||
endpoint = `/crud/data_store/list`;
|
||||
} else if (obj_type == 'event') {
|
||||
endpoint = `/crud/event/list`;
|
||||
} else if (obj_type == 'event_abstract') {
|
||||
endpoint = `/crud/event/abstract/list`;
|
||||
} else if (obj_type == 'event_badge') {
|
||||
endpoint = `/crud/event/badge/list`;
|
||||
} else if (obj_type == 'event_device') {
|
||||
endpoint = `/crud/event/device/list`;
|
||||
} else if (obj_type == 'event_exhibit') {
|
||||
endpoint = `/crud/event/exhibit/list`;
|
||||
} else if (obj_type == 'event_exhibit_tracking') {
|
||||
endpoint = `/crud/event/exhibit/tracking/list`;
|
||||
} else if (obj_type == 'event_file') {
|
||||
endpoint = `/crud/event/file/list`;
|
||||
} else if (obj_type == 'event_location') {
|
||||
endpoint = `/crud/event/location/list`;
|
||||
} else if (obj_type == 'event_person') {
|
||||
endpoint = `/crud/event/person/list`;
|
||||
} else if (obj_type == 'event_presentation') {
|
||||
endpoint = `/crud/event/presentation/list`;
|
||||
} else if (obj_type == 'event_presenter') {
|
||||
endpoint = `/crud/event/presenter/list`;
|
||||
} else if (obj_type == 'event_session') {
|
||||
endpoint = `/crud/event/session/list`;
|
||||
} else if (obj_type == 'event_track') {
|
||||
endpoint = `/crud/event/track/list`;
|
||||
} else if (obj_type == 'grant') {
|
||||
endpoint = `/crud/grant/list`;
|
||||
} else if (obj_type == 'hosted_file') {
|
||||
endpoint = `/crud/hosted_file/list`;
|
||||
} else if (obj_type == 'journal') {
|
||||
endpoint = `/crud/journal/list`;
|
||||
} else if (obj_type == 'journal_entry') {
|
||||
endpoint = `/crud/journal/entry/list`;
|
||||
} else if (obj_type == 'order') {
|
||||
endpoint = `/crud/order/list`;
|
||||
} else if (obj_type == 'order_line') {
|
||||
endpoint = `/crud/order/line/list`;
|
||||
} else if (obj_type == 'page') {
|
||||
endpoint = `/crud/page/list`;
|
||||
} else if (obj_type == 'person') {
|
||||
endpoint = `/crud/person/list`;
|
||||
} else if (obj_type == 'post') {
|
||||
endpoint = `/crud/post/list`;
|
||||
} else if (obj_type == 'post_comment') {
|
||||
endpoint = `/crud/post/comment/list`;
|
||||
} else if (obj_type == 'site') {
|
||||
endpoint = `/crud/site/list`;
|
||||
} else if (obj_type == 'sponsorship_cfg') {
|
||||
endpoint = `/crud/sponsorship/cfg/list`;
|
||||
} else if (obj_type == 'sponsorship') {
|
||||
endpoint = `/crud/sponsorship/list`;
|
||||
// } else if (obj_type == 'user') {
|
||||
// endpoint = `/crud/user/list`;
|
||||
// } else if (obj_type == 'lu' && for_obj_type == 'country_subdivision') {
|
||||
// endpoint = `/crud/lu/country_subdivision/list`;
|
||||
// for_obj_type = null;
|
||||
// } else if (obj_type == 'lu' && for_obj_type == 'country') {
|
||||
// endpoint = `/crud/lu/country/list`;
|
||||
// for_obj_type = null;
|
||||
// } else if (obj_type == 'lu' && for_obj_type == 'time_zone') {
|
||||
// endpoint = `/crud/lu/time_zone/list`;
|
||||
// for_obj_type = null;
|
||||
} else {
|
||||
console.log(`Unknown object type: ${obj_type}`);
|
||||
return false;
|
||||
}
|
||||
if (log_lvl) {
|
||||
console.log('Endpoint:', endpoint);
|
||||
}
|
||||
|
||||
if (for_obj_type) {
|
||||
params['for_obj_type'] = for_obj_type;
|
||||
}
|
||||
if (for_obj_id) {
|
||||
params['for_obj_id'] = for_obj_id;
|
||||
}
|
||||
|
||||
params['use_alt_table'] = use_alt_table;
|
||||
params['use_alt_base'] = use_alt_base;
|
||||
|
||||
/* Need to deal with inc params here */
|
||||
|
||||
let allowed_enabled_list = ['all', 'enabled', 'not_enabled']
|
||||
if (allowed_enabled_list.includes(enabled) ) {
|
||||
params['enabled'] = enabled;
|
||||
}
|
||||
|
||||
let allowed_hidden_list = ['all', 'hidden', 'not_hidden'];
|
||||
if (allowed_hidden_list.includes(hidden) ) {
|
||||
params['hidden'] = hidden;
|
||||
}
|
||||
|
||||
// NOTE: The order_by_li variable is in the "headers" because if is a the URL GET params do not handle multiple values very well. Maybe base64 encore in the future or something? Reminder that GET requests should not have a body (no JSON).
|
||||
// NOTE: The order_by_li should be a key value pair of the property/DB field to sort and how to sort (ASC or DESC)
|
||||
if (order_by_li) {
|
||||
headers['order_by_li'] = order_by_li;
|
||||
}
|
||||
|
||||
if (limit >= 0) {
|
||||
params['limit'] = limit;
|
||||
}
|
||||
|
||||
if (offset >= 0) {
|
||||
params['offset'] = offset;
|
||||
}
|
||||
|
||||
if (params_json) {
|
||||
// NOTE: This is a JSON object that needs to be safely converted to a string for the params. This is used for the search endpoint.
|
||||
// Max characters for a GET request is 2083. This is a limitation of the browser (Microsoft IE and Edge).
|
||||
if (log_lvl) {
|
||||
console.log('JSON Object:', params_json);
|
||||
console.log(JSON.stringify(params_json));
|
||||
}
|
||||
// NOTE: "jp" stands for "JSON Params"
|
||||
params['jp'] = encodeURIComponent(JSON.stringify(params_json));
|
||||
if (params['jp'].length > 2083) {
|
||||
console.log(`The JSON object is too large to be used as a GET parameter. The overall max URL length is 2083 characters. Please use the POST endpoint instead. Length = ${params['jp'].length} [THIS DOES NOT EXIST YET]`);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// if (json_obj) {
|
||||
// // NOTE: This is a JSON object that needs to be safely converted to a string for the params. This is used for the search endpoint.
|
||||
// // Max characters for a GET request is 2083. This is a limitation of the browser (Microsoft IE and Edge).
|
||||
// console.log('JSON Object:', json_obj);
|
||||
// params['json_str'] = encodeURIComponent(JSON.stringify(json_obj));
|
||||
// if (params['json_str'].length > 2083) {
|
||||
// console.log(`The JSON object is too large to be used as a GET parameter. The overall max URL length is 2083 characters. Please use the POST endpoint instead. Length = ${params['json_str'].length} [THIS DOES NOT EXIST YET]`);
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
|
||||
if (log_lvl) {
|
||||
console.log('Params:', params);
|
||||
}
|
||||
|
||||
let object_li_get_promise = await get_object({
|
||||
api_cfg: api_cfg,
|
||||
endpoint: endpoint,
|
||||
headers: headers,
|
||||
params: params,
|
||||
return_meta: return_meta,
|
||||
log_lvl: log_lvl
|
||||
});
|
||||
|
||||
if (log_lvl > 1) {
|
||||
console.log(object_li_get_promise);
|
||||
}
|
||||
|
||||
return object_li_get_promise;
|
||||
}
|
||||
@@ -1,54 +1,54 @@
|
||||
import type { key_val } from '$lib/ae_stores';
|
||||
import { get_object } from './api_get_object'; // Exported at the end of this file
|
||||
import { get_object } from './api_get_object';
|
||||
|
||||
// The lookup "obj_type" should broken out into a separate function. - 2024-08-07
|
||||
// Updated 2023-11-15
|
||||
export async function get_ae_obj_li_for_obj_id_crud_v2(
|
||||
{
|
||||
api_cfg,
|
||||
obj_type,
|
||||
for_obj_type,
|
||||
for_obj_id, // NOTE: Changed 2023-12-06 to no longer required
|
||||
use_alt_tbl=false,
|
||||
use_alt_mdl=false,
|
||||
use_alt_exp=false,
|
||||
inc={},
|
||||
enabled='enabled',
|
||||
hidden='not_hidden',
|
||||
order_by_li=null,
|
||||
limit=999999,
|
||||
offset=0,
|
||||
// key,
|
||||
// jwt=null,
|
||||
headers={},
|
||||
params_json=null, // NOTE: This is a JSON object that needs to be safely converted to a string for the params. This is used for the API endpoint. Example: { "fulltext_search": { "default_qry_str": "Search string for default", "address_default_qry_str": "Search string for address", "contact_1_default_qry_str": "Search string for contact_1" } }
|
||||
// json_obj=null, // NOTE: This is a JSON object that needs to be safely converted to a string for the params. This is used for the search endpoint.
|
||||
params={},
|
||||
return_meta=false,
|
||||
log_lvl=1
|
||||
}: {
|
||||
api_cfg: any,
|
||||
obj_type: string,
|
||||
for_obj_type: string,
|
||||
for_obj_id?: string,
|
||||
use_alt_tbl?: boolean|string,
|
||||
use_alt_mdl?: boolean|string,
|
||||
use_alt_exp?: boolean|string,
|
||||
inc?: key_val
|
||||
enabled?: string,
|
||||
hidden?: string,
|
||||
order_by_li?: any,
|
||||
limit?: number,
|
||||
offset?: number,
|
||||
// key: string,
|
||||
// jwt?: string,
|
||||
headers?: any,
|
||||
params_json?: any,
|
||||
// json_obj?: any,
|
||||
params?: key_val,
|
||||
return_meta?: boolean,
|
||||
log_lvl?: number
|
||||
}
|
||||
{
|
||||
api_cfg,
|
||||
obj_type,
|
||||
for_obj_type,
|
||||
for_obj_id, // NOTE: Changed 2023-12-06 to no longer required
|
||||
use_alt_tbl=false,
|
||||
use_alt_mdl=false,
|
||||
use_alt_exp=false,
|
||||
inc={},
|
||||
enabled='enabled',
|
||||
hidden='not_hidden',
|
||||
order_by_li=null,
|
||||
limit=999999,
|
||||
offset=0,
|
||||
// key,
|
||||
// jwt=null,
|
||||
headers={},
|
||||
params_json=null, // NOTE: This is a JSON object that needs to be safely converted to a string for the params. This is used for the API endpoint. Example: { "fulltext_search": { "default_qry_str": "Search string for default", "address_default_qry_str": "Search string for address", "contact_1_default_qry_str": "Search string for contact_1" } }
|
||||
// json_obj=null, // NOTE: This is a JSON object that needs to be safely converted to a string for the params. This is used for the search endpoint.
|
||||
params={},
|
||||
return_meta=false,
|
||||
log_lvl=1
|
||||
}: {
|
||||
api_cfg: any,
|
||||
obj_type: string,
|
||||
for_obj_type: string,
|
||||
for_obj_id?: string,
|
||||
use_alt_tbl?: boolean|string,
|
||||
use_alt_mdl?: boolean|string,
|
||||
use_alt_exp?: boolean|string,
|
||||
inc?: key_val
|
||||
enabled?: string,
|
||||
hidden?: string,
|
||||
order_by_li?: any,
|
||||
limit?: number,
|
||||
offset?: number,
|
||||
// key: string,
|
||||
// jwt?: string,
|
||||
headers?: any,
|
||||
params_json?: any,
|
||||
// json_obj?: any,
|
||||
params?: key_val,
|
||||
return_meta?: boolean,
|
||||
log_lvl?: number
|
||||
}
|
||||
) {
|
||||
if (log_lvl) {
|
||||
console.log('*** get_ae_obj_li_for_obj_id_crud() ***');
|
||||
@@ -192,8 +192,10 @@ export async function get_ae_obj_li_for_obj_id_crud_v2(
|
||||
if (params_json) {
|
||||
// NOTE: This is a JSON object that needs to be safely converted to a string for the params. This is used for the search endpoint.
|
||||
// Max characters for a GET request is 2083. This is a limitation of the browser (Microsoft IE and Edge).
|
||||
console.log('JSON Object:', params_json);
|
||||
console.log(JSON.stringify(params_json));
|
||||
if (log_lvl) {
|
||||
console.log('JSON Object:', params_json);
|
||||
console.log(JSON.stringify(params_json));
|
||||
}
|
||||
// NOTE: "jp" stands for "JSON Params"
|
||||
params['jp'] = encodeURIComponent(JSON.stringify(params_json));
|
||||
if (params['jp'].length > 2083) {
|
||||
|
||||
1391
src/lib/electron_native.js
Normal file
1391
src/lib/electron_native.js
Normal file
File diff suppressed because it is too large
Load Diff
@@ -21,10 +21,12 @@ import { events_loc, events_sess, events_slct, events_trigger, events_trig } fro
|
||||
import { events_func } from '$lib/ae_events_functions';
|
||||
|
||||
|
||||
import { kill_processes, open_local_file_v2, run_cmd, run_cmd_sync, run_osascript, get_device_info } from './electron.js';
|
||||
import { kill_processes, open_local_file_v2, run_cmd, run_cmd_sync, run_osascript, get_device_info } from '$lib/electron_relay.js';
|
||||
import Event_launcher_menu from './launcher_menu.svelte';
|
||||
import Event_launcher_session_view from './launcher_session_view.svelte';
|
||||
|
||||
// import native_app from '$lib/electron_native.js';
|
||||
|
||||
// Exports
|
||||
|
||||
|
||||
@@ -247,8 +249,92 @@ if (browser) {
|
||||
|
||||
onMount(() => {
|
||||
console.log('Pres Mgmt Launcher [slug]: +page@(launcher).svelte');
|
||||
|
||||
// if ($ae_event_launcher.app_mode == 'native') {
|
||||
// handle_get_device_info($slct.event_device_id);
|
||||
// }
|
||||
|
||||
// const native_app = require('$lib./script');
|
||||
|
||||
// let native_app_config = native_app.load_init_config();
|
||||
// console.log('Native App Initial Config:', native_app_config);
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
async function handle_get_device_info(event_device_id) {
|
||||
console.log('*** handle_get_device_info() ***');
|
||||
// console.log(event_device_id);
|
||||
|
||||
// console.log('GET DEVICE INFO!!! GET DEVICE INFO!!! GET DEVICE INFO!!!');
|
||||
|
||||
let get_device_info_promise = get_device_info({event_device_id: event_device_id});
|
||||
get_device_info_promise.then(function (result) {
|
||||
// console.log('GOT DEVICE INFO!!! GOT DEVICE INFO!!! GOT DEVICE INFO!!!');
|
||||
console.log(get_device_info_promise);
|
||||
let event_device_data = {};
|
||||
event_device_data['other_json'] = JSON.stringify(result);
|
||||
|
||||
event_device_data['info_hostname'] = result.hostname;
|
||||
|
||||
// console.log(event_device_data['other_json']);
|
||||
|
||||
// console.log(result.networkInterfaces);
|
||||
|
||||
let ni_data_li = [];
|
||||
let ip_address_li = [];
|
||||
|
||||
for (let network_interface in result.networkInterfaces) {
|
||||
// console.log(network_interface);
|
||||
let ni_data = {};
|
||||
|
||||
if (network_interface.startsWith('en')) {
|
||||
console.log('Wired or wireless network interface found');
|
||||
|
||||
ni_data['name'] = network_interface;
|
||||
|
||||
let ni_details = result.networkInterfaces[network_interface];
|
||||
// console.log(ni_details);
|
||||
|
||||
for (let i=0; i < ni_details.length; i++) {
|
||||
ni_data['address'] = ni_details[i].address;
|
||||
ni_data['mac'] = ni_details[i].mac;
|
||||
|
||||
ip_address_li.push(ni_details[i].address);
|
||||
}
|
||||
|
||||
ni_data_li.push(ni_data);
|
||||
}
|
||||
}
|
||||
|
||||
event_device_data['meta_json'] = JSON.stringify(ni_data_li);
|
||||
console.log(event_device_data['meta_json']);
|
||||
|
||||
event_device_data['info_ip_list'] = ip_address_li.join('; ');
|
||||
console.log(event_device_data['info_ip_list']);
|
||||
|
||||
event_device_obj_up_promise = update_event_device_obj({event_device_id: event_device_id, data: event_device_data, log_lvl: 0})
|
||||
.then(function (up_event_device_result) {
|
||||
// console.log('UPDATED DEVICE INFO!!! UPDATED DEVICE INFO!!! UPDATED DEVICE INFO!!!');
|
||||
if (up_event_device_result) {
|
||||
console.log(up_event_device_result);
|
||||
}
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log('No results returned or failed.');
|
||||
console.log(error);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
return get_device_info_promise;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ let hover_timer: any = null;
|
||||
$events_slct.event_session_id = event_session_obj?.id;
|
||||
$events_slct.event_session_obj = event_session_obj;
|
||||
|
||||
ae_promises.slct_event_session_id = ({
|
||||
ae_promises.slct_event_session_id = events_func.load_ae_obj_id__event_session({
|
||||
api_cfg: $ae_api,
|
||||
event_session_id: event_session_obj?.id,
|
||||
inc_file_li: true,
|
||||
@@ -96,7 +96,7 @@ let hover_timer: any = null;
|
||||
$events_slct.event_session_id = event_session_obj?.id;
|
||||
$events_slct.event_session_obj = event_session_obj;
|
||||
|
||||
ae_promises.slct_event_session_id = ({
|
||||
ae_promises.slct_event_session_id = events_func.load_ae_obj_id__event_session({
|
||||
api_cfg: $ae_api,
|
||||
event_session_id: event_session_obj?.id,
|
||||
inc_file_li: true,
|
||||
|
||||
@@ -194,9 +194,7 @@ function process_search_string(search_str: string) {
|
||||
// params['qry__limit'] = 35;
|
||||
// }
|
||||
|
||||
search__event_session({
|
||||
api_cfg: $ae_api,
|
||||
event_id: $events_slct.event_id,
|
||||
handle_search__event_session({
|
||||
ft_search_str: ft_search_str_new,
|
||||
lk_search_str: lk_search_str_new,
|
||||
// fulltext_search_qry_str: ft_search_str_new,
|
||||
@@ -213,8 +211,6 @@ function process_search_string(search_str: string) {
|
||||
|
||||
async function handle_search__event_session(
|
||||
{
|
||||
api_cfg,
|
||||
event_id,
|
||||
ft_search_str = '',
|
||||
lk_search_str = '',
|
||||
search_delay = 0,
|
||||
@@ -227,8 +223,6 @@ async function handle_search__event_session(
|
||||
try_cache=false,
|
||||
log_lvl=1,
|
||||
}: {
|
||||
api_cfg: any,
|
||||
event_id: string,
|
||||
ft_search_str?: string,
|
||||
lk_search_str?: string,
|
||||
search_delay?: number, // In milliseconds
|
||||
@@ -269,7 +263,7 @@ async function handle_search__event_session(
|
||||
|
||||
$events_sess.pres_mgmt.status_qry__search = 'loading';
|
||||
|
||||
search_submit_results = events_func.handle_search__event_session({
|
||||
search_submit_results = events_func.search__event_session({
|
||||
api_cfg: $ae_api,
|
||||
event_id: $events_slct.event_id,
|
||||
// type_code: type_code,
|
||||
|
||||
@@ -228,14 +228,16 @@ async function handle_qry__event_session(
|
||||
enabled = $events_loc.pres_mgmt.qry_enabled ?? 'enabled',
|
||||
hidden = $events_loc.pres_mgmt.qry_hidden ?? 'not_hidden',
|
||||
limit = $events_loc.pres_mgmt.qry_limit__session ?? 150,
|
||||
log_lvl=2,
|
||||
log_lvl=0,
|
||||
}: {
|
||||
qry_files?: boolean,
|
||||
// file_count?: boolean,
|
||||
// file_count_all?: null|number,
|
||||
// ft_search_str?: string,
|
||||
// lk_search_str?: string,
|
||||
params?: key_val,
|
||||
enabled?: string,
|
||||
hidden?: string,
|
||||
limit?: number,
|
||||
log_lvl?: number,
|
||||
}
|
||||
) {
|
||||
@@ -263,12 +265,14 @@ async function handle_qry__event_session(
|
||||
$events_sess.pres_mgmt.status_qry__search = 'processing';
|
||||
$events_sess.pres_mgmt.status_rpt[$events_sess.pres_mgmt.show_report] = 'processing';
|
||||
$events_slct.event_session_obj_li = search_results;
|
||||
console.log(search_results);
|
||||
if (log_lvl) {
|
||||
console.log(`Search results:`, search_results);
|
||||
}
|
||||
// $events_sess.pres_mgmt.status_qry__search = 'done';
|
||||
})
|
||||
.finally(() => {
|
||||
if (log_lvl) {
|
||||
console.log('TEST SEARCH - Search done. Pulling out the event_session_id_randoms.');
|
||||
console.log('API query done. Pulling out the event_session_id_random values.');
|
||||
}
|
||||
// console.log(`TEST search: ${$lq_kv__event_session_obj_li}`);
|
||||
|
||||
|
||||
@@ -150,7 +150,7 @@ let ae_triggers: key_val = {};
|
||||
on:ae_crud_updated={e => {
|
||||
console.log(`ae_crud_updated:`, e.detail);
|
||||
|
||||
({
|
||||
events_func.load_ae_obj_id__event_session({
|
||||
api_cfg: $ae_api,
|
||||
event_session_id: $lq__event_session_obj?.event_session_id_random,
|
||||
log_lvl: log_lvl
|
||||
@@ -204,7 +204,7 @@ let ae_triggers: key_val = {};
|
||||
on:ae_crud_updated={e => {
|
||||
console.log(`ae_crud_updated:`, e.detail);
|
||||
|
||||
({
|
||||
events_func.load_ae_obj_id__event_session({
|
||||
api_cfg: $ae_api,
|
||||
event_session_id: $lq__event_session_obj?.event_session_id_random,
|
||||
log_lvl: log_lvl
|
||||
@@ -257,7 +257,7 @@ let ae_triggers: key_val = {};
|
||||
on:ae_crud_updated={e => {
|
||||
console.log(`ae_crud_updated:`, e.detail);
|
||||
|
||||
({
|
||||
events_func.load_ae_obj_id__event_session({
|
||||
api_cfg: $ae_api,
|
||||
event_session_id: $lq__event_session_obj?.event_session_id_random,
|
||||
log_lvl: log_lvl
|
||||
|
||||
@@ -148,7 +148,7 @@ $: if ($lq__event_session_obj) {
|
||||
on:ae_crud_updated={e => {
|
||||
console.log(`ae_crud_updated:`, e.detail);
|
||||
|
||||
({
|
||||
events_func.load_ae_obj_id__event_session({
|
||||
api_cfg: $ae_api,
|
||||
event_session_id: $lq__event_session_obj?.event_session_id_random,
|
||||
log_lvl: 1
|
||||
@@ -177,7 +177,7 @@ $: if ($lq__event_session_obj) {
|
||||
on:ae_crud_updated={e => {
|
||||
console.log(`ae_crud_updated:`, e.detail);
|
||||
|
||||
({
|
||||
events_func.load_ae_obj_id__event_session({
|
||||
api_cfg: $ae_api,
|
||||
event_session_id: $lq__event_session_obj?.event_session_id_random,
|
||||
log_lvl: 1
|
||||
@@ -213,7 +213,7 @@ $: if ($lq__event_session_obj) {
|
||||
on:ae_crud_updated={e => {
|
||||
console.log(`ae_crud_updated:`, e.detail);
|
||||
|
||||
({
|
||||
events_func.load_ae_obj_id__event_session({
|
||||
api_cfg: $ae_api,
|
||||
event_session_id: $lq__event_session_obj?.event_session_id_random
|
||||
});
|
||||
@@ -241,7 +241,7 @@ $: if ($lq__event_session_obj) {
|
||||
on:ae_crud_updated={e => {
|
||||
console.log(`ae_crud_updated:`, e.detail);
|
||||
|
||||
({
|
||||
events_func.load_ae_obj_id__event_session({
|
||||
api_cfg: $ae_api,
|
||||
event_session_id: $lq__event_session_obj?.event_session_id_random
|
||||
});
|
||||
@@ -287,7 +287,7 @@ $: if ($lq__event_session_obj) {
|
||||
on:ae_crud_updated={e => {
|
||||
console.log(`ae_crud_updated:`, e.detail);
|
||||
|
||||
({
|
||||
events_func.load_ae_obj_id__event_session({
|
||||
api_cfg: $ae_api,
|
||||
event_session_id: $lq__event_session_obj?.event_session_id_random,
|
||||
log_lvl: 1
|
||||
@@ -421,7 +421,7 @@ $: if ($lq__event_session_obj) {
|
||||
on:ae_crud_updated={e => {
|
||||
console.log(`ae_crud_updated:`, e.detail);
|
||||
|
||||
({
|
||||
events_func.load_ae_obj_id__event_session({
|
||||
api_cfg: $ae_api,
|
||||
event_session_id: $lq__event_session_obj?.event_session_id_random,
|
||||
log_lvl: 1
|
||||
@@ -625,7 +625,7 @@ $: if ($lq__event_session_obj) {
|
||||
on:ae_crud_updated={e => {
|
||||
console.log(`ae_crud_updated:`, e.detail);
|
||||
|
||||
({
|
||||
events_func.load_ae_obj_id__event_session({
|
||||
api_cfg: $ae_api,
|
||||
event_session_id: $lq__event_session_obj?.event_session_id_random,
|
||||
log_lvl: 1
|
||||
@@ -875,7 +875,9 @@ $: if ($lq__event_session_obj) {
|
||||
on:ae_crud_updated={e => {
|
||||
console.log(`ae_crud_updated:`, e.detail);
|
||||
|
||||
events_func.load_ae_obj_id__event_presentation({api_cfg: $ae_api, event_presentation_id: event_presentation_obj.event_presentation_id_random, log_lvl: 1})
|
||||
events_func.load_ae_obj_id__event_presentation({
|
||||
api_cfg: $ae_api, event_presentation_id: event_presentation_obj.event_presentation_id_random, log_lvl: 1
|
||||
})
|
||||
.then(function (load_results) {
|
||||
})
|
||||
.then(function (load_results) {
|
||||
|
||||
Reference in New Issue
Block a user