More work on making the locations and devices more useful.
This commit is contained in:
@@ -3,14 +3,17 @@ import { api } from '$lib/api';
|
|||||||
|
|
||||||
import { db_events } from "$lib/db_events";
|
import { db_events } from "$lib/db_events";
|
||||||
|
|
||||||
|
import { load_ae_obj_li__event_device } from './ae_events__event_device';
|
||||||
|
|
||||||
let ae_promises: key_val = {};
|
let ae_promises: key_val = {};
|
||||||
|
|
||||||
|
|
||||||
// Updated 2024-09-25
|
// Updated 2024-10-16
|
||||||
export async function load_ae_obj_id__event(
|
export async function load_ae_obj_id__event(
|
||||||
{
|
{
|
||||||
api_cfg,
|
api_cfg,
|
||||||
event_id,
|
event_id,
|
||||||
|
inc_device_li = false,
|
||||||
inc_file_li = false,
|
inc_file_li = false,
|
||||||
inc_location_li = false,
|
inc_location_li = false,
|
||||||
inc_presentation_li = false,
|
inc_presentation_li = false,
|
||||||
@@ -21,6 +24,7 @@ export async function load_ae_obj_id__event(
|
|||||||
}: {
|
}: {
|
||||||
api_cfg: any,
|
api_cfg: any,
|
||||||
event_id: string,
|
event_id: string,
|
||||||
|
inc_device_li?: boolean,
|
||||||
inc_file_li?: boolean,
|
inc_file_li?: boolean,
|
||||||
inc_location_li?: boolean,
|
inc_location_li?: boolean,
|
||||||
inc_presentation_li?: boolean,
|
inc_presentation_li?: boolean,
|
||||||
@@ -63,6 +67,30 @@ export async function load_ae_obj_id__event(
|
|||||||
console.log('No results returned or failed.', error);
|
console.log('No results returned or failed.', error);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (log_lvl) {
|
||||||
|
console.log('ae_promises.load__event_obj:', ae_promises.load__event_obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (inc_device_li) {
|
||||||
|
// Load the devices for the
|
||||||
|
if (log_lvl) {
|
||||||
|
console.log(`Need to load the device list for the now`);
|
||||||
|
}
|
||||||
|
let load_event_device_obj_li = load_ae_obj_li__event_device({
|
||||||
|
api_cfg: api_cfg,
|
||||||
|
for_obj_type: 'event',
|
||||||
|
for_obj_id: event_id,
|
||||||
|
params: {qry__enabled: 'all', qry__limit: 15},
|
||||||
|
try_cache: try_cache,
|
||||||
|
log_lvl: log_lvl
|
||||||
|
});
|
||||||
|
|
||||||
|
if (log_lvl) {
|
||||||
|
console.log(`load_event_device_obj_li = `, load_event_device_obj_li);
|
||||||
|
}
|
||||||
|
ae_promises.load__event_obj.event_device_li = load_event_device_obj_li;
|
||||||
|
}
|
||||||
|
|
||||||
return ae_promises.load__event_obj;
|
return ae_promises.load__event_obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import { load_ae_obj_id__event_location } from './ae_events__event_location';
|
|||||||
let ae_promises: key_val = {};
|
let ae_promises: key_val = {};
|
||||||
|
|
||||||
|
|
||||||
// Updated 2024-06-10
|
// Updated 2024-10-16
|
||||||
export async function load_ae_obj_id__event_device(
|
export async function load_ae_obj_id__event_device(
|
||||||
{
|
{
|
||||||
api_cfg,
|
api_cfg,
|
||||||
@@ -84,14 +84,13 @@ export async function load_ae_obj_id__event_device(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Updated 2024-09-24
|
// Updated 2024-10-16
|
||||||
export async function load_ae_obj_li__event_device(
|
export async function load_ae_obj_li__event_device(
|
||||||
{
|
{
|
||||||
api_cfg,
|
api_cfg,
|
||||||
for_obj_type,
|
for_obj_type,
|
||||||
for_obj_id,
|
for_obj_id,
|
||||||
inc_file_li = false,
|
inc_location_id = false,
|
||||||
inc_session_li = false,
|
|
||||||
order_by_li = {'priority': 'DESC', 'sort': 'DESC', 'name': 'ASC', 'code': 'ASC', 'updated_on': 'DESC', 'created_on': 'DESC'},
|
order_by_li = {'priority': 'DESC', 'sort': 'DESC', 'name': 'ASC', 'code': 'ASC', 'updated_on': 'DESC', 'created_on': 'DESC'},
|
||||||
params = {},
|
params = {},
|
||||||
try_cache = true,
|
try_cache = true,
|
||||||
@@ -100,8 +99,7 @@ export async function load_ae_obj_li__event_device(
|
|||||||
api_cfg: any,
|
api_cfg: any,
|
||||||
for_obj_type: string,
|
for_obj_type: string,
|
||||||
for_obj_id: string,
|
for_obj_id: string,
|
||||||
inc_file_li?: boolean,
|
inc_location_id?: boolean,
|
||||||
inc_session_li?: boolean,
|
|
||||||
order_by_li?: key_val,
|
order_by_li?: key_val,
|
||||||
params?: key_val,
|
params?: key_val,
|
||||||
try_cache?: boolean,
|
try_cache?: boolean,
|
||||||
@@ -119,13 +117,14 @@ export async function load_ae_obj_li__event_device(
|
|||||||
|
|
||||||
// console.log('params_json:', params_json);
|
// console.log('params_json:', params_json);
|
||||||
|
|
||||||
ae_promises.load__event_device_obj_li = await api.get_ae_obj_li_for_obj_id_crud({
|
ae_promises.load__event_device_obj_li = await api.get_ae_obj_li_for_obj_id_crud_v2({
|
||||||
api_cfg: api_cfg,
|
api_cfg: api_cfg,
|
||||||
obj_type: 'event_device',
|
obj_type: 'event_device',
|
||||||
for_obj_type: for_obj_type,
|
for_obj_type: for_obj_type,
|
||||||
for_obj_id: for_obj_id,
|
for_obj_id: for_obj_id,
|
||||||
use_alt_table: true, // NOTE: This will use the table_name_alt value instead of the table_name value in the API config.
|
use_alt_tbl: true,
|
||||||
use_alt_base: false, // NOTE: This will use the base_name_alt value instead of the base_name value
|
use_alt_mdl: false,
|
||||||
|
use_alt_exp: false,
|
||||||
enabled: enabled,
|
enabled: enabled,
|
||||||
hidden: hidden,
|
hidden: hidden,
|
||||||
order_by_li: order_by_li,
|
order_by_li: order_by_li,
|
||||||
@@ -156,62 +155,29 @@ export async function load_ae_obj_li__event_device(
|
|||||||
console.log('ae_promises.load__event_device_obj_li:', ae_promises.load__event_device_obj_li);
|
console.log('ae_promises.load__event_device_obj_li:', ae_promises.load__event_device_obj_li);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (inc_file_li) {
|
if (inc_location_id) {
|
||||||
// Load the files for the devices
|
// Load the location for the devices
|
||||||
if (log_lvl) {
|
if (log_lvl) {
|
||||||
console.log(`Need to load the file list for each device now`);
|
console.log(`Need to load the location list for each device now`);
|
||||||
}
|
}
|
||||||
for (let i = 0; i < ae_promises.load__event_device_obj_li.length; i++) {
|
for (let i = 0; i < ae_promises.load__event_device_obj_li.length; i++) {
|
||||||
let event_device_obj = ae_promises.load__event_device_obj_li[i];
|
let event_device_obj = ae_promises.load__event_device_obj_li[i];
|
||||||
let event_device_id = event_device_obj.event_device_id_random;
|
|
||||||
|
|
||||||
let load_event_file_obj_li = load_ae_obj_li__event_file({
|
let load_event_location_obj_li = load_ae_obj_id__event_location({
|
||||||
api_cfg: api_cfg,
|
api_cfg: api_cfg,
|
||||||
for_obj_type: 'event_device',
|
event_location_id: event_device_obj.event_location_id,
|
||||||
for_obj_id: event_device_id,
|
|
||||||
params: {qry__enabled: enabled, qry__limit: limit},
|
|
||||||
try_cache: try_cache,
|
try_cache: try_cache,
|
||||||
log_lvl: log_lvl
|
log_lvl: log_lvl
|
||||||
})
|
})
|
||||||
.then((event_file_obj_li) => {
|
.then((event_location_obj_li) => {
|
||||||
if (log_lvl) {
|
if (log_lvl) {
|
||||||
console.log(`event_file_obj_li = `, event_file_obj_li);
|
console.log(`event_location_obj_li = `, event_location_obj_li);
|
||||||
}
|
}
|
||||||
return event_file_obj_li;
|
return event_location_obj_li;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (log_lvl) {
|
if (log_lvl) {
|
||||||
console.log(`load_event_file_obj_li = `, load_event_file_obj_li);
|
console.log(`load_event_location_obj_li = `, load_event_location_obj_li);
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (inc_session_li) {
|
|
||||||
// Load the sessions for the devices
|
|
||||||
if (log_lvl) {
|
|
||||||
console.log(`Need to load the session list for each device now`);
|
|
||||||
}
|
|
||||||
for (let i = 0; i < ae_promises.load__event_device_obj_li.length; i++) {
|
|
||||||
let event_device_obj = ae_promises.load__event_device_obj_li[i];
|
|
||||||
let event_device_id = event_device_obj.event_device_id_random;
|
|
||||||
|
|
||||||
let load_event_session_obj_li = load_ae_obj_li__event_session({
|
|
||||||
api_cfg: api_cfg,
|
|
||||||
for_obj_type: 'event_device',
|
|
||||||
for_obj_id: event_device_id,
|
|
||||||
params: {qry__enabled: enabled, qry__limit: limit},
|
|
||||||
try_cache: try_cache,
|
|
||||||
log_lvl: log_lvl
|
|
||||||
})
|
|
||||||
.then((event_session_obj_li) => {
|
|
||||||
if (log_lvl) {
|
|
||||||
console.log(`event_session_obj_li = `, event_session_obj_li);
|
|
||||||
}
|
|
||||||
return event_session_obj_li;
|
|
||||||
});
|
|
||||||
|
|
||||||
if (log_lvl) {
|
|
||||||
console.log(`load_event_session_obj_li = `, load_event_session_obj_li);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -220,7 +186,7 @@ export async function load_ae_obj_li__event_device(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Updated 2024-06-25
|
// Updated 2024-10-16
|
||||||
export async function create_ae_obj__event_device(
|
export async function create_ae_obj__event_device(
|
||||||
{
|
{
|
||||||
api_cfg,
|
api_cfg,
|
||||||
@@ -275,7 +241,7 @@ export async function create_ae_obj__event_device(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Updated 2024-09-25
|
// Updated 2024-10-16
|
||||||
export async function update_ae_obj__event_device(
|
export async function update_ae_obj__event_device(
|
||||||
{
|
{
|
||||||
api_cfg,
|
api_cfg,
|
||||||
@@ -331,6 +297,7 @@ export async function update_ae_obj__event_device(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Updated 2024-10-16
|
||||||
export async function search__event_device(
|
export async function search__event_device(
|
||||||
{
|
{
|
||||||
api_cfg,
|
api_cfg,
|
||||||
@@ -452,7 +419,7 @@ export async function search__event_device(
|
|||||||
|
|
||||||
|
|
||||||
// This function will loop through the event_device_obj_li and save each one to the DB.
|
// This function will loop through the event_device_obj_li and save each one to the DB.
|
||||||
// Updated 2024-06-25
|
// Updated 2024-10-16
|
||||||
export function db_save_ae_obj_li__event_device(
|
export function db_save_ae_obj_li__event_device(
|
||||||
{
|
{
|
||||||
obj_type,
|
obj_type,
|
||||||
@@ -478,27 +445,42 @@ export function db_save_ae_obj_li__event_device(
|
|||||||
const id_random = await db_events.devices.put({
|
const id_random = await db_events.devices.put({
|
||||||
id: obj.event_device_id_random,
|
id: obj.event_device_id_random,
|
||||||
event_device_id: obj.event_device_id_random,
|
event_device_id: obj.event_device_id_random,
|
||||||
event_device_id_random: obj.event_device_id_random,
|
// event_device_id_random: obj.event_device_id_random,
|
||||||
|
|
||||||
external_id: obj.external_id,
|
|
||||||
code: obj.code,
|
|
||||||
|
|
||||||
type_code: obj.type_code,
|
|
||||||
|
|
||||||
event_id: obj.event_id_random,
|
event_id: obj.event_id_random,
|
||||||
event_id_random: obj.event_id_random,
|
// event_id_random: obj.event_id_random,
|
||||||
|
event_location_id: obj.event_location_id_random,
|
||||||
|
// event_location_id_random: obj.event_location_id_random,
|
||||||
|
|
||||||
|
code: obj.code,
|
||||||
name: obj.name,
|
name: obj.name,
|
||||||
description: obj.description,
|
description: obj.description,
|
||||||
|
|
||||||
passcode: obj.passcode,
|
passcode: obj.passcode,
|
||||||
|
|
||||||
hide_event_launcher: obj.hide_event_launcher,
|
local_file_cache_path: obj.local_file_cache_path,
|
||||||
|
host_file_temp_path: obj.host_file_temp_path,
|
||||||
|
recording_path: obj.recording_path,
|
||||||
|
|
||||||
|
record_audio: obj.record_audio,
|
||||||
|
record_video: obj.record_video,
|
||||||
|
|
||||||
|
trigger_open_file_id: obj.trigger_open_file_id,
|
||||||
|
trigger_open_session_id: obj.trigger_open_session_id,
|
||||||
|
trigger_recording_start: obj.trigger_recording_start,
|
||||||
|
trigger_recording_stop: obj.trigger_recording_stop,
|
||||||
|
trigger_reset: obj.trigger_reset,
|
||||||
|
trigger_show_admin: obj.trigger_show_admin,
|
||||||
|
trigger_show_hidden: obj.trigger_show_hidden,
|
||||||
|
|
||||||
alert: obj.alert,
|
alert: obj.alert,
|
||||||
alert_msg: obj.alert_msg,
|
alert_msg: obj.alert_msg,
|
||||||
|
|
||||||
data_json: obj.data_json,
|
info_hostname: obj.info_hostname,
|
||||||
|
info_ip_list: obj.info_ip_list,
|
||||||
|
|
||||||
|
meta_json: obj.meta_json,
|
||||||
|
other_json: obj.other_json,
|
||||||
|
|
||||||
enable: obj.enable,
|
enable: obj.enable,
|
||||||
hide: obj.hide,
|
hide: obj.hide,
|
||||||
@@ -510,19 +492,9 @@ export function db_save_ae_obj_li__event_device(
|
|||||||
updated_on: obj.updated_on,
|
updated_on: obj.updated_on,
|
||||||
|
|
||||||
// From SQL view
|
// From SQL view
|
||||||
file_count: obj.file_count,
|
|
||||||
file_count_all: obj.file_count_all,
|
|
||||||
internal_use_count: obj.internal_use_count,
|
|
||||||
event_file_id_li_json: obj.event_file_id_li_json,
|
|
||||||
|
|
||||||
// poc_person_given_name: obj.poc_person_given_name,
|
|
||||||
// poc_person_family_name: obj.poc_person_family_name,
|
|
||||||
// poc_person_full_name: obj.poc_person_full_name,
|
|
||||||
// poc_person_primary_email: obj.poc_person_primary_email,
|
|
||||||
// poc_person_passcode: obj.poc_person_passcode,
|
|
||||||
// poc_kv_json: obj.poc_kv_json,
|
|
||||||
|
|
||||||
event_name: obj.event_name,
|
event_name: obj.event_name,
|
||||||
|
event_location_code: obj.event_location_code,
|
||||||
|
event_location_name: obj.event_location_name,
|
||||||
});
|
});
|
||||||
// console.log(`Put obj with ID: ${obj.event_device_id_random} or ${id_random}`);
|
// console.log(`Put obj with ID: ${obj.event_device_id_random} or ${id_random}`);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
@@ -552,10 +552,12 @@ export async function qry__event_session(
|
|||||||
})
|
})
|
||||||
.then(function (event_session_obj_li_get_result) {
|
.then(function (event_session_obj_li_get_result) {
|
||||||
if (event_session_obj_li_get_result) {
|
if (event_session_obj_li_get_result) {
|
||||||
db_save_ae_obj_li__event_session({
|
if (try_cache) {
|
||||||
obj_type: 'event_session',
|
db_save_ae_obj_li__event_session({
|
||||||
obj_li: event_session_obj_li_get_result
|
obj_type: 'event_session',
|
||||||
});
|
obj_li: event_session_obj_li_get_result
|
||||||
|
});
|
||||||
|
}
|
||||||
return event_session_obj_li_get_result;
|
return event_session_obj_li_get_result;
|
||||||
} else {
|
} else {
|
||||||
return [];
|
return [];
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ export let iso_datetime_formatter = function iso_datetime_formatter(
|
|||||||
// datetime_iso 'YYYY-MM-DD HH:mm:ss'
|
// datetime_iso 'YYYY-MM-DD HH:mm:ss'
|
||||||
// datetime_iso_12 'YYYY-MM-DD hh:mm:ss A'
|
// datetime_iso_12 'YYYY-MM-DD hh:mm:ss A'
|
||||||
// datetime_iso_12_short 'YY-MM-DD hh:mm A'
|
// datetime_iso_12_short 'YY-MM-DD hh:mm A'
|
||||||
// datetime_iso_tz 'YYYY-MM-DD HH:mm:ss'
|
// datetime_iso_tz 'YYYY-MM-DD HH:mm:ss Z'
|
||||||
|
|
||||||
// datetime_12_no_seconds 'YYYY-MM-DD hh:mm A'
|
// datetime_12_no_seconds 'YYYY-MM-DD hh:mm A'
|
||||||
|
|
||||||
@@ -37,6 +37,8 @@ export let iso_datetime_formatter = function iso_datetime_formatter(
|
|||||||
|
|
||||||
// time_iso 'HH:mm:ss'
|
// time_iso 'HH:mm:ss'
|
||||||
// time_iso_12 'hh:mm:ss A'
|
// time_iso_12 'hh:mm:ss A'
|
||||||
|
// time_iso_tz 'HH:mm:ss Z'
|
||||||
|
// time_iso_12_tz 'hh:mm:ss A Z'
|
||||||
|
|
||||||
// time_long 'hh:mm:ss A'
|
// time_long 'hh:mm:ss A'
|
||||||
// time_medium 'h:m:s A'
|
// time_medium 'h:m:s A'
|
||||||
@@ -63,6 +65,9 @@ export let iso_datetime_formatter = function iso_datetime_formatter(
|
|||||||
case 'datetime_iso_12_short_month':
|
case 'datetime_iso_12_short_month':
|
||||||
datetime_string = dayjs(raw_datetime).format('MM-DD hh:mm A');
|
datetime_string = dayjs(raw_datetime).format('MM-DD hh:mm A');
|
||||||
break;
|
break;
|
||||||
|
case 'datetime_iso_tz':
|
||||||
|
datetime_string = dayjs(raw_datetime).format('YYYY-MM-DD HH:mm:ss Z');
|
||||||
|
break;
|
||||||
case 'datetime_12_no_seconds':
|
case 'datetime_12_no_seconds':
|
||||||
datetime_string = dayjs(raw_datetime).format('YYYY-MM-DD hh:mm A');
|
datetime_string = dayjs(raw_datetime).format('YYYY-MM-DD hh:mm A');
|
||||||
break;
|
break;
|
||||||
@@ -117,6 +122,9 @@ export let iso_datetime_formatter = function iso_datetime_formatter(
|
|||||||
case 'time_iso':
|
case 'time_iso':
|
||||||
datetime_string = dayjs(raw_datetime).format('HH:mm:ss');
|
datetime_string = dayjs(raw_datetime).format('HH:mm:ss');
|
||||||
break;
|
break;
|
||||||
|
case 'time_iso_12_tz':
|
||||||
|
datetime_string = dayjs(raw_datetime).format('hh:mm:ss A Z');
|
||||||
|
break;
|
||||||
case 'time_long':
|
case 'time_long':
|
||||||
datetime_string = dayjs(raw_datetime).format('HH:mm:ss A');
|
datetime_string = dayjs(raw_datetime).format('HH:mm:ss A');
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -35,13 +35,13 @@ export interface Event {
|
|||||||
cfg_json?: null|key_val;
|
cfg_json?: null|key_val;
|
||||||
|
|
||||||
enable: null|boolean;
|
enable: null|boolean;
|
||||||
hide: null|boolean;
|
hide?: null|boolean;
|
||||||
priority: null|boolean
|
priority?: null|boolean
|
||||||
sort: null|number;
|
sort?: null|number;
|
||||||
group: null|string;
|
group?: null|string;
|
||||||
notes: null|string;
|
notes?: null|string;
|
||||||
created_on: Date;
|
created_on: Date;
|
||||||
updated_on: null|Date;
|
updated_on?: null|Date;
|
||||||
|
|
||||||
// IDAA Recovery Meetings
|
// IDAA Recovery Meetings
|
||||||
contact_li_json?: null|string[]; // full_name, email, phone_mobile, phone_home, phone_office, other_text
|
contact_li_json?: null|string[]; // full_name, email, phone_mobile, phone_home, phone_office, other_text
|
||||||
@@ -122,46 +122,71 @@ export interface Badge {
|
|||||||
external_person_id: string;
|
external_person_id: string;
|
||||||
|
|
||||||
enable: null|boolean;
|
enable: null|boolean;
|
||||||
hide: null|boolean;
|
hide?: null|boolean;
|
||||||
priority: null|boolean
|
priority?: null|boolean
|
||||||
sort: null|number;
|
sort?: null|number;
|
||||||
group: null|string;
|
group?: null|string;
|
||||||
notes: null|string;
|
notes?: null|string;
|
||||||
created_on: Date;
|
created_on: Date;
|
||||||
updated_on: null|Date;
|
updated_on?: null|Date;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Updated 2024-10-16
|
// Updated 2024-10-16
|
||||||
export interface Device {
|
export interface Device {
|
||||||
// id?: number;
|
id: number;
|
||||||
id_random: string;
|
// id_random: string;
|
||||||
event_device_id_random: string;
|
event_device_id: string;
|
||||||
|
// event_device_id_random: string;
|
||||||
|
|
||||||
event_id_random: string;
|
event_id: string;
|
||||||
event_location_id_random: string;
|
// event_id_random: string;
|
||||||
|
event_location_id?: string;
|
||||||
|
// event_location_id_random?: string;
|
||||||
|
|
||||||
code: string;
|
code?: string;
|
||||||
name: string;
|
name: string;
|
||||||
|
description?: null|string;
|
||||||
|
|
||||||
for_type: null|string;
|
passcode?: null|string;
|
||||||
for_id: null|string;
|
|
||||||
for_id_random: null|string;
|
|
||||||
|
|
||||||
alert: null|boolean;
|
local_file_cache_path?: null|string;
|
||||||
|
host_file_temp_path?: null|string;
|
||||||
|
recording_path?: null|string;
|
||||||
|
|
||||||
|
record_audio?: null|boolean;
|
||||||
|
record_video?: null|boolean;
|
||||||
|
|
||||||
|
trigger_open_file_id?: null|string;
|
||||||
|
trigger_open_session_id?: null|string;
|
||||||
|
trigger_recording_start?: null|boolean;
|
||||||
|
trigger_recording_stop?: null|boolean;
|
||||||
|
trigger_reset?: null|boolean;
|
||||||
|
trigger_show_admin?: null|boolean;
|
||||||
|
trigger_show_hidden?: null|boolean;
|
||||||
|
|
||||||
|
alert?: null|boolean;
|
||||||
|
alert_msg?: null|string;
|
||||||
|
|
||||||
|
info_hostname?: null|string;
|
||||||
|
info_ip_list?: null|string; // Semi-colon separated list of IP addresses
|
||||||
|
|
||||||
|
meta_json?: null|string;
|
||||||
|
other_json?: null|string;
|
||||||
|
|
||||||
enable: null|boolean;
|
enable: null|boolean;
|
||||||
hide: null|boolean;
|
hide?: null|boolean;
|
||||||
priority: null|boolean
|
priority?: null|boolean
|
||||||
sort: null|number;
|
sort?: null|number;
|
||||||
group: null|string;
|
group?: null|string;
|
||||||
notes: null|string;
|
notes?: null|string;
|
||||||
created_on: Date;
|
created_on: Date;
|
||||||
updated_on: null|Date;
|
updated_on?: null|Date;
|
||||||
|
|
||||||
// Additional fields for convenience (database views)
|
// Additional fields for convenience (database views)
|
||||||
event_location_code: string;
|
event_name?: string;
|
||||||
event_location_name: string;
|
event_location_code?: string;
|
||||||
|
event_location_name?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -5,8 +5,9 @@ import { error } from '@sveltejs/kit';
|
|||||||
import { browser } from '$app/environment';
|
import { browser } from '$app/environment';
|
||||||
import { events_func } from '$lib/ae_events_functions';
|
import { events_func } from '$lib/ae_events_functions';
|
||||||
|
|
||||||
|
|
||||||
export async function load({ params, parent }) { // route
|
export async function load({ params, parent }) { // route
|
||||||
let log_lvl = 0;
|
let log_lvl = 1;
|
||||||
|
|
||||||
let data = await parent();
|
let data = await parent();
|
||||||
// console.log(`ae events_pres_mgmt event [event_id] +page.ts data:`, data);
|
// console.log(`ae events_pres_mgmt event [event_id] +page.ts data:`, data);
|
||||||
@@ -41,7 +42,11 @@ export async function load({ params, parent }) { // route
|
|||||||
|
|
||||||
if (browser) {
|
if (browser) {
|
||||||
let load_event_obj = events_func.load_ae_obj_id__event({
|
let load_event_obj = events_func.load_ae_obj_id__event({
|
||||||
api_cfg: ae_acct.api, event_id: event_id, try_cache: true
|
api_cfg: ae_acct.api,
|
||||||
|
event_id: event_id,
|
||||||
|
inc_device_li: true,
|
||||||
|
try_cache: true,
|
||||||
|
log_lvl: log_lvl
|
||||||
});
|
});
|
||||||
console.log(`load_event_obj = `, load_event_obj);
|
console.log(`load_event_obj = `, load_event_obj);
|
||||||
ae_acct.slct.event_obj = load_event_obj;
|
ae_acct.slct.event_obj = load_event_obj;
|
||||||
@@ -52,7 +57,7 @@ export async function load({ params, parent }) { // route
|
|||||||
for_obj_id: event_id,
|
for_obj_id: event_id,
|
||||||
params: {qry__enabled: 'enabled', qry__hidden: 'all', qry__limit: 200},
|
params: {qry__enabled: 'enabled', qry__hidden: 'all', qry__limit: 200},
|
||||||
try_cache: true,
|
try_cache: true,
|
||||||
log_lvl: 1
|
log_lvl: log_lvl
|
||||||
});
|
});
|
||||||
console.log(`load_event_session_obj_li = `, load_event_session_obj_li);
|
console.log(`load_event_session_obj_li = `, load_event_session_obj_li);
|
||||||
ae_acct.slct.event_session_obj_li = load_event_session_obj_li;
|
ae_acct.slct.event_session_obj_li = load_event_session_obj_li;
|
||||||
@@ -63,7 +68,7 @@ export async function load({ params, parent }) { // route
|
|||||||
for_obj_id: event_id,
|
for_obj_id: event_id,
|
||||||
params: {qry__enabled: 'enabled', qry__hidden: 'all', qry__limit: 200},
|
params: {qry__enabled: 'enabled', qry__hidden: 'all', qry__limit: 200},
|
||||||
try_cache: true,
|
try_cache: true,
|
||||||
log_lvl: 1
|
log_lvl: log_lvl
|
||||||
});
|
});
|
||||||
console.log(`load_event_location_obj_li = `, load_event_location_obj_li);
|
console.log(`load_event_location_obj_li = `, load_event_location_obj_li);
|
||||||
ae_acct.slct.event_location_obj_li = load_event_location_obj_li;
|
ae_acct.slct.event_location_obj_li = load_event_location_obj_li;
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
// Imports
|
// Imports
|
||||||
|
import { ae_util } from '$lib/ae_utils/ae_utils';
|
||||||
import { ae_snip, ae_loc, ae_sess, ae_api, ae_trig, slct, slct_trigger } from '$lib/ae_stores';
|
import { ae_snip, ae_loc, ae_sess, ae_api, ae_trig, slct, slct_trigger } from '$lib/ae_stores';
|
||||||
import { events_loc, events_sess, events_slct, events_trigger, events_trig_kv } from '$lib/ae_events_stores';
|
import { events_loc, events_sess, events_slct, events_trigger, events_trig_kv } from '$lib/ae_events_stores';
|
||||||
import { events_func } from '$lib/ae_events_functions';
|
import { events_func } from '$lib/ae_events_functions';
|
||||||
@@ -16,7 +17,7 @@ export let link_to_id: string;
|
|||||||
export let lq__event_device_obj_li: any;
|
export let lq__event_device_obj_li: any;
|
||||||
|
|
||||||
if (log_lvl) {
|
if (log_lvl) {
|
||||||
console.log(`link_to_type: ${link_to_type}; link_to_id: ${link_to_id}`);
|
console.log(`Event Device List: link_to_type: ${link_to_type}; link_to_id: ${link_to_id}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Variables
|
// Variables
|
||||||
@@ -28,40 +29,6 @@ if (log_lvl) {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
<div
|
|
||||||
class="float-right flex flex-row items-center"
|
|
||||||
>
|
|
||||||
{#if $ae_loc.trusted_access && $ae_loc.edit_mode}
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
on:click={() => {
|
|
||||||
console.log('Add Device');
|
|
||||||
if (!confirm('Add a new device to the event? You will be able to edit the details after the device is created.')) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let device_data = {
|
|
||||||
event_id_random: $events_slct.event_id,
|
|
||||||
name: 'TEMP Device Name',
|
|
||||||
enable: true,
|
|
||||||
}
|
|
||||||
|
|
||||||
events_func.create_ae_obj__event_device({
|
|
||||||
api_cfg: $ae_api,
|
|
||||||
event_id: $events_slct.event_id,
|
|
||||||
data_kv: device_data,
|
|
||||||
log_lvl: log_lvl,
|
|
||||||
})
|
|
||||||
}}
|
|
||||||
class="btn btn-sm variant-soft-warning hover:variant-filled-warning"
|
|
||||||
>
|
|
||||||
<span class="fas fa-plus mx-1"></span>
|
|
||||||
Add Device
|
|
||||||
</button>
|
|
||||||
{/if}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<section class="ae_comp event_device_obj_li {container_class_li}">
|
<section class="ae_comp event_device_obj_li {container_class_li}">
|
||||||
|
|
||||||
|
|
||||||
@@ -94,40 +61,6 @@ if (log_lvl) {
|
|||||||
class="space-y-2 border border-gray-200 p-2 rounded-md"
|
class="space-y-2 border border-gray-200 p-2 rounded-md"
|
||||||
>
|
>
|
||||||
|
|
||||||
<div class="float-right space-2 flex flex-row items-center">
|
|
||||||
{#if $ae_loc.trusted_access && $ae_loc.edit_mode}
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
on:click={() => {
|
|
||||||
console.log('Add Session');
|
|
||||||
if (!confirm('Add a new session to the device? You will be able to edit their details after the session record is created.')) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let session_data = {
|
|
||||||
event_id_random: $events_slct.event_id,
|
|
||||||
event_device_id_random: event_device_obj?.event_device_id_random,
|
|
||||||
name: 'TEMP Session Name',
|
|
||||||
enable: true,
|
|
||||||
}
|
|
||||||
|
|
||||||
events_func.create_ae_obj__event_session({
|
|
||||||
api_cfg: $ae_api,
|
|
||||||
event_id: $events_slct.event_id,
|
|
||||||
data_kv: session_data,
|
|
||||||
log_lvl: log_lvl,
|
|
||||||
})
|
|
||||||
}}
|
|
||||||
class="btn btn-sm variant-soft-warning hover:variant-filled-warning"
|
|
||||||
>
|
|
||||||
<span class="fas fa-plus mx-1"></span>
|
|
||||||
Add Session
|
|
||||||
</button>
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<h4 class="h5 rounded-md p-2 bg-gray-200">
|
<h4 class="h5 rounded-md p-2 bg-gray-200">
|
||||||
<Element_ae_crud
|
<Element_ae_crud
|
||||||
api_cfg={$ae_api}
|
api_cfg={$ae_api}
|
||||||
@@ -171,6 +104,52 @@ if (log_lvl) {
|
|||||||
{/if}
|
{/if}
|
||||||
</h4>
|
</h4>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<div
|
||||||
|
class="text-red-500 bg-red-200 p-1 rounded-md border border-red-200 text-center"
|
||||||
|
class:hidden={!event_device_obj?.alert && !event_device_obj?.alert_msg}
|
||||||
|
>
|
||||||
|
<span class="fas fa-exclamation-triangle mx-1" />
|
||||||
|
{event_device_obj?.alert ? 'Alert' : 'No Alert'}
|
||||||
|
<span class="fas fa-exclamation-triangle mx-1" />
|
||||||
|
<br>
|
||||||
|
{event_device_obj?.alert_msg ?? 'No Alert Message'}
|
||||||
|
</div>
|
||||||
|
<div class="flex flex-col gap-1">
|
||||||
|
<span>
|
||||||
|
<strong class="text-sm">hostname:</strong>
|
||||||
|
{event_device_obj?.info_hostname}
|
||||||
|
</span>
|
||||||
|
<span>
|
||||||
|
<strong class="text-sm">IPs:</strong>
|
||||||
|
{event_device_obj?.info_ip_list}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
class="text-sm text-gray-500 bg-gray-100"
|
||||||
|
>
|
||||||
|
Last updated:
|
||||||
|
<span>
|
||||||
|
<span>
|
||||||
|
{ae_util.iso_datetime_formatter(event_device_obj?.updated_on, 'dddd')},
|
||||||
|
</span>
|
||||||
|
<span>
|
||||||
|
{ae_util.iso_datetime_formatter(event_device_obj?.updated_on, 'date_long_month_day')}
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
@
|
||||||
|
<span
|
||||||
|
class="px-1"
|
||||||
|
class:bg-yellow-200={ae_util.is_datetime_recent({datetime: event_device_obj?.updated_on, minutes: 30})}
|
||||||
|
class:bg-green-200={ae_util.is_datetime_recent({datetime: event_device_obj?.updated_on, minutes: 240})}
|
||||||
|
class:bg-blue-200={ae_util.is_datetime_recent({datetime: event_device_obj?.updated_on, minutes: 2880})}
|
||||||
|
>
|
||||||
|
{ae_util.iso_datetime_formatter(event_device_obj?.updated_on, 'time_iso_12_tz')}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div
|
<div
|
||||||
class:hidden={!$events_loc.pres_mgmt.show_content__device_description}
|
class:hidden={!$events_loc.pres_mgmt.show_content__device_description}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ export let link_to_type: string;
|
|||||||
export let link_to_id: string;
|
export let link_to_id: string;
|
||||||
|
|
||||||
if (log_lvl) {
|
if (log_lvl) {
|
||||||
console.log(`link_to_type: ${link_to_type}; link_to_id: ${link_to_id}`);
|
console.log(`Event Device List Wrapper: link_to_type: ${link_to_type}; link_to_id: ${link_to_id}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Variables
|
// Variables
|
||||||
@@ -23,7 +23,7 @@ if (log_lvl) {
|
|||||||
// let ae_tmp: key_val = {};
|
// let ae_tmp: key_val = {};
|
||||||
// let ae_triggers: key_val = {};
|
// let ae_triggers: key_val = {};
|
||||||
|
|
||||||
let dq__where_type_id_val: string = `${link_to_type}_id_random`;
|
let dq__where_type_id_val: string = `${link_to_type}_id`;
|
||||||
let dq__where_eq_id_val: string = link_to_id;
|
let dq__where_eq_id_val: string = link_to_id;
|
||||||
|
|
||||||
// Functions and Logic
|
// Functions and Logic
|
||||||
|
|||||||
@@ -97,40 +97,6 @@ if (log_lvl) {
|
|||||||
class="space-y-2 border border-gray-200 p-2 rounded-md"
|
class="space-y-2 border border-gray-200 p-2 rounded-md"
|
||||||
>
|
>
|
||||||
|
|
||||||
<div class="float-right space-2 flex flex-row items-center">
|
|
||||||
{#if $ae_loc.trusted_access && $ae_loc.edit_mode}
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
on:click={() => {
|
|
||||||
console.log('Add Session');
|
|
||||||
if (!confirm('Add a new session to the location? You will be able to edit their details after the session record is created.')) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let session_data = {
|
|
||||||
event_id_random: $events_slct.event_id,
|
|
||||||
event_location_id_random: event_location_obj?.event_location_id_random,
|
|
||||||
name: 'TEMP Session Name',
|
|
||||||
enable: true,
|
|
||||||
}
|
|
||||||
|
|
||||||
events_func.create_ae_obj__event_session({
|
|
||||||
api_cfg: $ae_api,
|
|
||||||
event_id: $events_slct.event_id,
|
|
||||||
data_kv: session_data,
|
|
||||||
log_lvl: log_lvl,
|
|
||||||
})
|
|
||||||
}}
|
|
||||||
class="btn btn-sm variant-soft-warning hover:variant-filled-warning"
|
|
||||||
>
|
|
||||||
<span class="fas fa-plus mx-1"></span>
|
|
||||||
Add Session
|
|
||||||
</button>
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<h4 class="h5 rounded-md p-2 bg-gray-200">
|
<h4 class="h5 rounded-md p-2 bg-gray-200">
|
||||||
<Element_ae_crud
|
<Element_ae_crud
|
||||||
api_cfg={$ae_api}
|
api_cfg={$ae_api}
|
||||||
|
|||||||
@@ -181,13 +181,13 @@ let lq_kv__event_file_obj_li = liveQuery(
|
|||||||
|
|
||||||
>
|
>
|
||||||
<div>
|
<div>
|
||||||
<span>
|
<span>
|
||||||
{ae_util.iso_datetime_formatter(event_file_obj?.created_on, 'dddd')}
|
{ae_util.iso_datetime_formatter(event_file_obj?.created_on, 'dddd')}
|
||||||
</span>
|
</span>
|
||||||
<span>
|
<span>
|
||||||
{ae_util.iso_datetime_formatter(event_file_obj?.created_on, 'date_long_month_day')}
|
{ae_util.iso_datetime_formatter(event_file_obj?.created_on, 'date_long_month_day')}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<span
|
<span
|
||||||
class:bg-yellow-200={ae_util.is_datetime_recent({datetime: event_file_obj?.created_on, minutes: 30})}
|
class:bg-yellow-200={ae_util.is_datetime_recent({datetime: event_file_obj?.created_on, minutes: 30})}
|
||||||
class:bg-green-200={ae_util.is_datetime_recent({datetime: event_file_obj?.created_on, minutes: 240})}
|
class:bg-green-200={ae_util.is_datetime_recent({datetime: event_file_obj?.created_on, minutes: 240})}
|
||||||
|
|||||||
Reference in New Issue
Block a user