Standardizing how things are reloaded. Triggers again!
This commit is contained in:
@@ -108,6 +108,10 @@ export async function load_ae_obj_li__event(
|
|||||||
inc_presentation_li = false,
|
inc_presentation_li = false,
|
||||||
inc_presenter_li = false,
|
inc_presenter_li = false,
|
||||||
inc_session_li = false,
|
inc_session_li = false,
|
||||||
|
enabled = 'enabled',
|
||||||
|
hidden = 'not_hidden',
|
||||||
|
limit = 99,
|
||||||
|
offset = 0,
|
||||||
order_by_li = {'start_datetime': 'DESC', 'name': 'ASC', 'updated_on': 'DESC', 'created_on': 'DESC'},
|
order_by_li = {'start_datetime': 'DESC', 'name': 'ASC', 'updated_on': 'DESC', 'created_on': 'DESC'},
|
||||||
params_json = null,
|
params_json = null,
|
||||||
params = {},
|
params = {},
|
||||||
@@ -124,6 +128,10 @@ export async function load_ae_obj_li__event(
|
|||||||
inc_presentation_li?: boolean,
|
inc_presentation_li?: boolean,
|
||||||
inc_presenter_li?: boolean,
|
inc_presenter_li?: boolean,
|
||||||
inc_session_li?: boolean,
|
inc_session_li?: boolean,
|
||||||
|
enabled?: string,
|
||||||
|
hidden?: string,
|
||||||
|
limit?: number,
|
||||||
|
offset?: number,
|
||||||
order_by_li?: key_val,
|
order_by_li?: key_val,
|
||||||
params_json?: null|key_val,
|
params_json?: null|key_val,
|
||||||
params?: key_val,
|
params?: key_val,
|
||||||
@@ -133,11 +141,6 @@ export async function load_ae_obj_li__event(
|
|||||||
) {
|
) {
|
||||||
console.log(`*** load_ae_obj_li__event() *** for_obj_id=${for_obj_id}`);
|
console.log(`*** load_ae_obj_li__event() *** for_obj_id=${for_obj_id}`);
|
||||||
|
|
||||||
let enabled: string = (params.qry__enabled ?? 'enabled'); // all, disabled, enabled
|
|
||||||
let hidden: string = (params.qry__hidden ?? 'not_hidden'); // all, hidden, not_hidden
|
|
||||||
let limit: number = (params.qry__limit ?? 99); // 99
|
|
||||||
let offset: number = (params.qry__offset ?? 0); // 0
|
|
||||||
|
|
||||||
// There is probably a better way to handle this. I don't want to just start a new object if it is not passed. However, the qry_conference and qry_str are sort of a special case. -2024-10-01
|
// There is probably a better way to handle this. I don't want to just start a new object if it is not passed. However, the qry_conference and qry_str are sort of a special case. -2024-10-01
|
||||||
if (!params_json) {
|
if (!params_json) {
|
||||||
params_json = {};
|
params_json = {};
|
||||||
|
|||||||
@@ -32,9 +32,8 @@ export async function load({ params, parent }) { // route
|
|||||||
inc_comment_li: true,
|
inc_comment_li: true,
|
||||||
enabled: 'enabled',
|
enabled: 'enabled',
|
||||||
hidden: 'not_hidden',
|
hidden: 'not_hidden',
|
||||||
limit: 200,
|
limit: 10,
|
||||||
order_by_li: {'priority': 'DESC', 'sort': 'DESC', 'updated_on': 'DESC', 'created_on': 'DESC', 'title': 'ASC'},
|
order_by_li: {'priority': 'DESC', 'sort': 'DESC', 'updated_on': 'DESC', 'created_on': 'DESC', 'title': 'ASC'},
|
||||||
// params: {qry__enabled: 'enabled', qry__hidden: 'not_hidden', qry__limit: 200},
|
|
||||||
try_cache: true,
|
try_cache: true,
|
||||||
log_lvl: log_lvl
|
log_lvl: log_lvl
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import { liveQuery } from "dexie";
|
|||||||
import { core_func } from '$lib/ae_core/ae_core_functions';
|
import { core_func } from '$lib/ae_core/ae_core_functions';
|
||||||
import { db_posts } from "$lib/ae_posts/db_posts";
|
import { db_posts } from "$lib/ae_posts/db_posts";
|
||||||
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 { idaa_loc, idaa_sess, idaa_slct, idaa_trig } from '$lib/ae_idaa_stores';
|
import { idaa_loc, idaa_sess, idaa_slct, idaa_trig, idaa_prom } from '$lib/ae_idaa_stores';
|
||||||
import { posts_func } from '$lib/ae_posts/ae_posts_functions';
|
import { posts_func } from '$lib/ae_posts/ae_posts_functions';
|
||||||
|
|
||||||
import Comp__post_obj_li from './ae_idaa_comp__post_obj_li.svelte';
|
import Comp__post_obj_li from './ae_idaa_comp__post_obj_li.svelte';
|
||||||
@@ -63,6 +63,35 @@ $: lq__post_comment_obj = liveQuery(async () => {
|
|||||||
return results;
|
return results;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$: if ($idaa_trig.post_li) {
|
||||||
|
$idaa_trig.post_li = false;
|
||||||
|
|
||||||
|
if (log_lvl) {
|
||||||
|
console.log(`Triggered: $idaa_trig.post_li`);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($idaa_loc.bb.qry__enabled !== 'all' || $idaa_loc.bb.qry__hidden !== 'all') {
|
||||||
|
console.log(`Deleting disabled or hidden post.`);
|
||||||
|
let results = db_posts.post
|
||||||
|
.clear();
|
||||||
|
console.log(`Deleted ${results} disabled post.`);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$idaa_prom.load__post_obj_li = posts_func.load_ae_obj_li__post({
|
||||||
|
api_cfg: $ae_api,
|
||||||
|
for_obj_type: 'account',
|
||||||
|
for_obj_id: $idaa_slct.account_id,
|
||||||
|
enabled: $idaa_loc.bb.qry__enabled,
|
||||||
|
hidden: $idaa_loc.bb.qry__hidden,
|
||||||
|
limit: $idaa_loc.bb.qry__limit,
|
||||||
|
order_by_li: $idaa_loc.bb.qry__order_by_li,
|
||||||
|
try_cache: true,
|
||||||
|
log_lvl: log_lvl,
|
||||||
|
});
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
export let log_lvl = 1;
|
export let log_lvl = 1;
|
||||||
import type { key_val } from '$lib/ae_stores';
|
import type { key_val } from '$lib/ae_stores';
|
||||||
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 { idaa_loc, idaa_sess, idaa_slct } from '$lib/ae_idaa_stores';
|
import { idaa_loc, idaa_sess, idaa_slct, idaa_trig, idaa_prom } from '$lib/ae_idaa_stores';
|
||||||
import { posts_func } from '$lib/ae_posts/ae_posts_functions';
|
import { posts_func } from '$lib/ae_posts/ae_posts_functions';
|
||||||
|
|
||||||
let ae_promises: key_val = {};
|
let ae_promises: key_val = {};
|
||||||
@@ -53,24 +53,23 @@ let search_submit_results: any = null;
|
|||||||
type="button"
|
type="button"
|
||||||
on:click={() => {
|
on:click={() => {
|
||||||
$idaa_loc.bb.qry__hidden = 'all';
|
$idaa_loc.bb.qry__hidden = 'all';
|
||||||
$idaa_loc.bb.qry__limit = 200;
|
// $idaa_loc.bb.qry__limit = 200;
|
||||||
ae_trigger = 'load__post_obj_li';
|
$idaa_trig.post_li = true;
|
||||||
|
|
||||||
|
// let load_post_obj_li = posts_func.load_ae_obj_li__post({
|
||||||
let load_post_obj_li = posts_func.load_ae_obj_li__post({
|
// api_cfg: $ae_api,
|
||||||
api_cfg: $ae_api,
|
// for_obj_type: 'account',
|
||||||
for_obj_type: 'account',
|
// for_obj_id: $ae_loc.account_id,
|
||||||
for_obj_id: $ae_loc.account_id,
|
// inc_comment_li: true,
|
||||||
inc_comment_li: true,
|
// enabled: $idaa_loc.bb.qry__enabled,
|
||||||
enabled: $idaa_loc.bb.qry__enabled,
|
// hidden: $idaa_loc.bb.qry__hidden,
|
||||||
hidden: $idaa_loc.bb.qry__hidden,
|
// limit: $idaa_loc.bb.qry__limit,
|
||||||
limit: $idaa_loc.bb.qry__limit,
|
// order_by_li: $idaa_loc.bb.qry__order_by_li,
|
||||||
order_by_li: $idaa_loc.bb.qry__order_by_li,
|
// try_cache: true,
|
||||||
try_cache: true,
|
// log_lvl: log_lvl
|
||||||
log_lvl: log_lvl
|
// });
|
||||||
});
|
// console.log(`load_post_obj_li = `, load_post_obj_li);
|
||||||
console.log(`load_post_obj_li = `, load_post_obj_li);
|
// $idaa_slct.post_obj_li = load_post_obj_li;
|
||||||
$idaa_slct.post_obj_li = load_post_obj_li;
|
|
||||||
|
|
||||||
}}
|
}}
|
||||||
class="btn_show_bb_post ae_btn btn btn-info btn-sm variant-ghost-secondary"
|
class="btn_show_bb_post ae_btn btn btn-info btn-sm variant-ghost-secondary"
|
||||||
@@ -82,23 +81,23 @@ let search_submit_results: any = null;
|
|||||||
type="button"
|
type="button"
|
||||||
on:click={() => {
|
on:click={() => {
|
||||||
$idaa_loc.bb.qry__hidden = 'not_hidden';
|
$idaa_loc.bb.qry__hidden = 'not_hidden';
|
||||||
$idaa_loc.bb.qry__limit = 100;
|
// $idaa_loc.bb.qry__limit = 100;
|
||||||
ae_trigger = 'load__post_obj_li';
|
$idaa_trig.post_li = true;
|
||||||
|
|
||||||
let load_post_obj_li = posts_func.load_ae_obj_li__post({
|
// let load_post_obj_li = posts_func.load_ae_obj_li__post({
|
||||||
api_cfg: $ae_api,
|
// api_cfg: $ae_api,
|
||||||
for_obj_type: 'account',
|
// for_obj_type: 'account',
|
||||||
for_obj_id: $ae_loc.account_id,
|
// for_obj_id: $ae_loc.account_id,
|
||||||
inc_comment_li: true,
|
// inc_comment_li: true,
|
||||||
enabled: $idaa_loc.bb.qry__enabled,
|
// enabled: $idaa_loc.bb.qry__enabled,
|
||||||
hidden: $idaa_loc.bb.qry__hidden,
|
// hidden: $idaa_loc.bb.qry__hidden,
|
||||||
limit: $idaa_loc.bb.qry__limit,
|
// limit: $idaa_loc.bb.qry__limit,
|
||||||
order_by_li: $idaa_loc.bb.qry__order_by_li,
|
// order_by_li: $idaa_loc.bb.qry__order_by_li,
|
||||||
try_cache: true,
|
// try_cache: true,
|
||||||
log_lvl: log_lvl
|
// log_lvl: log_lvl
|
||||||
});
|
// });
|
||||||
console.log(`load_post_obj_li = `, load_post_obj_li);
|
// console.log(`load_post_obj_li = `, load_post_obj_li);
|
||||||
$idaa_slct.post_obj_li = load_post_obj_li;
|
// $idaa_slct.post_obj_li = load_post_obj_li;
|
||||||
}}
|
}}
|
||||||
class="btn_hide_bb_post ae_btn btn btn-info btn-sm variant-ghost-secondary"
|
class="btn_hide_bb_post ae_btn btn btn-info btn-sm variant-ghost-secondary"
|
||||||
>
|
>
|
||||||
@@ -113,22 +112,22 @@ let search_submit_results: any = null;
|
|||||||
$idaa_loc.bb.qry__hidden = 'all';
|
$idaa_loc.bb.qry__hidden = 'all';
|
||||||
$idaa_loc.bb.qry__enabled = 'all';
|
$idaa_loc.bb.qry__enabled = 'all';
|
||||||
$idaa_loc.bb.qry__limit = 500;
|
$idaa_loc.bb.qry__limit = 500;
|
||||||
ae_trigger = 'load__post_obj_li';
|
$idaa_trig.post_li = true;
|
||||||
|
|
||||||
let load_post_obj_li = posts_func.load_ae_obj_li__post({
|
// let load_post_obj_li = posts_func.load_ae_obj_li__post({
|
||||||
api_cfg: $ae_api,
|
// api_cfg: $ae_api,
|
||||||
for_obj_type: 'account',
|
// for_obj_type: 'account',
|
||||||
for_obj_id: $ae_loc.account_id,
|
// for_obj_id: $ae_loc.account_id,
|
||||||
inc_comment_li: true,
|
// inc_comment_li: true,
|
||||||
enabled: $idaa_loc.bb.qry__enabled,
|
// enabled: $idaa_loc.bb.qry__enabled,
|
||||||
hidden: $idaa_loc.bb.qry__hidden,
|
// hidden: $idaa_loc.bb.qry__hidden,
|
||||||
limit: $idaa_loc.bb.qry__limit,
|
// limit: $idaa_loc.bb.qry__limit,
|
||||||
order_by_li: $idaa_loc.bb.qry__order_by_li,
|
// order_by_li: $idaa_loc.bb.qry__order_by_li,
|
||||||
try_cache: true,
|
// try_cache: true,
|
||||||
log_lvl: log_lvl
|
// log_lvl: log_lvl
|
||||||
});
|
// });
|
||||||
console.log(`load_post_obj_li = `, load_post_obj_li);
|
// console.log(`load_post_obj_li = `, load_post_obj_li);
|
||||||
$idaa_slct.post_obj_li = load_post_obj_li;
|
// $idaa_slct.post_obj_li = load_post_obj_li;
|
||||||
}}
|
}}
|
||||||
class="btn_show_bb_post ae_btn btn btn-warning btn-sm variant-ghost-secondary"
|
class="btn_show_bb_post ae_btn btn btn-warning btn-sm variant-ghost-secondary"
|
||||||
>
|
>
|
||||||
@@ -139,22 +138,22 @@ let search_submit_results: any = null;
|
|||||||
type="button"
|
type="button"
|
||||||
on:click={() => {
|
on:click={() => {
|
||||||
$idaa_loc.bb.qry__enabled = 'enabled';
|
$idaa_loc.bb.qry__enabled = 'enabled';
|
||||||
ae_trigger = 'load__post_obj_li';
|
$idaa_trig.post_li = true;
|
||||||
|
|
||||||
let load_post_obj_li = posts_func.load_ae_obj_li__post({
|
// let load_post_obj_li = posts_func.load_ae_obj_li__post({
|
||||||
api_cfg: $ae_api,
|
// api_cfg: $ae_api,
|
||||||
for_obj_type: 'account',
|
// for_obj_type: 'account',
|
||||||
for_obj_id: $ae_loc.account_id,
|
// for_obj_id: $ae_loc.account_id,
|
||||||
inc_comment_li: true,
|
// inc_comment_li: true,
|
||||||
enabled: $idaa_loc.bb.qry__enabled,
|
// enabled: $idaa_loc.bb.qry__enabled,
|
||||||
hidden: $idaa_loc.bb.qry__hidden,
|
// hidden: $idaa_loc.bb.qry__hidden,
|
||||||
limit: $idaa_loc.bb.qry__limit,
|
// limit: $idaa_loc.bb.qry__limit,
|
||||||
order_by_li: $idaa_loc.bb.qry__order_by_li,
|
// order_by_li: $idaa_loc.bb.qry__order_by_li,
|
||||||
try_cache: true,
|
// try_cache: true,
|
||||||
log_lvl: log_lvl
|
// log_lvl: log_lvl
|
||||||
});
|
// });
|
||||||
console.log(`load_post_obj_li = `, load_post_obj_li);
|
// console.log(`load_post_obj_li = `, load_post_obj_li);
|
||||||
$idaa_slct.post_obj_li = load_post_obj_li;
|
// $idaa_slct.post_obj_li = load_post_obj_li;
|
||||||
}}
|
}}
|
||||||
class="btn_hide_bb_post ae_btn btn btn-warning btn-sm variant-ghost-secondary"
|
class="btn_hide_bb_post ae_btn btn btn-warning btn-sm variant-ghost-secondary"
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import { Modal } from 'flowbite-svelte';
|
|||||||
|
|
||||||
import type { key_val } from '$lib/ae_stores';
|
import type { key_val } from '$lib/ae_stores';
|
||||||
import { ae_util } from '$lib/ae_utils/ae_utils';
|
import { ae_util } from '$lib/ae_utils/ae_utils';
|
||||||
import { idaa_loc, idaa_sess, idaa_slct } from '$lib/ae_idaa_stores';
|
import { idaa_loc, idaa_sess, idaa_slct, idaa_trig, idaa_prom } from '$lib/ae_idaa_stores';
|
||||||
// import Element_data_store from '$lib/element_data_store_v2.svelte';
|
// import Element_data_store from '$lib/element_data_store_v2.svelte';
|
||||||
// import Comp_event_session_obj_li from '../../events_pres_mgmt/ae_comp__event_session_obj_li.svelte';
|
// import Comp_event_session_obj_li from '../../events_pres_mgmt/ae_comp__event_session_obj_li.svelte';
|
||||||
|
|
||||||
@@ -19,7 +19,7 @@ import { liveQuery } from "dexie";
|
|||||||
import { core_func } from '$lib/ae_core/ae_core_functions';
|
import { core_func } from '$lib/ae_core/ae_core_functions';
|
||||||
import { db_events } from "$lib/ae_events/db_events";
|
import { db_events } from "$lib/ae_events/db_events";
|
||||||
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_func } from '$lib/ae_events_functions';
|
import { events_func } from '$lib/ae_events_functions';
|
||||||
|
|
||||||
import Comp__event_obj_qry from './ae_idaa_comp__event_obj_qry.svelte';
|
import Comp__event_obj_qry from './ae_idaa_comp__event_obj_qry.svelte';
|
||||||
import Comp__event_obj_li from './ae_idaa_comp__event_obj_li.svelte';
|
import Comp__event_obj_li from './ae_idaa_comp__event_obj_li.svelte';
|
||||||
@@ -78,6 +78,34 @@ $: lq_new__event_obj_li = liveQuery(async () => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
$: if ($idaa_trig.event_li) {
|
||||||
|
$idaa_trig.event_li = false;
|
||||||
|
|
||||||
|
if (log_lvl) {
|
||||||
|
console.log(`Triggered: $idaa_trig.event_li`);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($idaa_loc.recovery_meetings.qry__enabled !== 'all' || $idaa_loc.recovery_meetings.qry__hidden !== 'all') {
|
||||||
|
console.log(`Deleting disabled or hidden event.`);
|
||||||
|
let results = db_events.events
|
||||||
|
.clear();
|
||||||
|
console.log(`Deleted ${results} disabled event.`);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
$idaa_prom.load__event_obj_li = events_func.load_ae_obj_li__event({
|
||||||
|
api_cfg: $ae_api,
|
||||||
|
for_obj_type: 'account',
|
||||||
|
for_obj_id: $idaa_slct.account_id,
|
||||||
|
enabled: $idaa_loc.recovery_meetings.qry__enabled,
|
||||||
|
hidden: $idaa_loc.recovery_meetings.qry__hidden,
|
||||||
|
limit: $idaa_loc.recovery_meetings.qry__limit,
|
||||||
|
order_by_li: $idaa_loc.recovery_meetings.qry__order_by_li,
|
||||||
|
try_cache: true,
|
||||||
|
log_lvl: log_lvl,
|
||||||
|
});
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<!-- ({$lq__event_obj?.event_id ?? ''}) -->
|
<!-- ({$lq__event_obj?.event_id ?? ''}) -->
|
||||||
|
|||||||
Reference in New Issue
Block a user