Slowly implementing the new Data Store element v3. It should be a drop in replacement for v2.
This commit is contained in:
@@ -84,7 +84,7 @@
|
|||||||
// // 1. Specific Lookup
|
// // 1. Specific Lookup
|
||||||
// if (current_for_type && current_for_id) {
|
// if (current_for_type && current_for_id) {
|
||||||
// result = await db_core.data_store
|
// result = await db_core.data_store
|
||||||
// .where('[code+for_type+for_id_random]')
|
// .where('[code+for_type+for_id]')
|
||||||
// .equals([current_code, current_for_type, current_for_id])
|
// .equals([current_code, current_for_type, current_for_id])
|
||||||
// .first();
|
// .first();
|
||||||
// }
|
// }
|
||||||
@@ -92,7 +92,7 @@
|
|||||||
// // 2. Account Lookup
|
// // 2. Account Lookup
|
||||||
// if (!result && account_id) {
|
// if (!result && account_id) {
|
||||||
// result = await db_core.data_store
|
// result = await db_core.data_store
|
||||||
// .where('[code+account_id_random+for_type]')
|
// .where('[code+account_id+for_type]')
|
||||||
// .equals([current_code, account_id, null])
|
// .equals([current_code, account_id, null])
|
||||||
// .first();
|
// .first();
|
||||||
// }
|
// }
|
||||||
@@ -100,7 +100,7 @@
|
|||||||
// // 3. Global Lookup
|
// // 3. Global Lookup
|
||||||
// if (!result) {
|
// if (!result) {
|
||||||
// result = await db_core.data_store
|
// result = await db_core.data_store
|
||||||
// .where('[code+account_id_random+for_type]')
|
// .where('[code+account_id+for_type]')
|
||||||
// .equals([current_code, null, null])
|
// .equals([current_code, null, null])
|
||||||
// .first();
|
// .first();
|
||||||
// }
|
// }
|
||||||
@@ -198,9 +198,9 @@
|
|||||||
...ds_results,
|
...ds_results,
|
||||||
id: ds_id,
|
id: ds_id,
|
||||||
data_store_id: ds_results.data_store_id || ds_id,
|
data_store_id: ds_results.data_store_id || ds_id,
|
||||||
// data_store_id_random: ds_id,
|
// data_store_id: ds_id,
|
||||||
account_id: ds_results.account_id_random || ds_results.account_id,
|
account_id: ds_results.account_id || ds_results.account_id,
|
||||||
// account_id_random: ds_results.account_id_random || ds_results.account_id,
|
// account_id: ds_results.account_id || ds_results.account_id,
|
||||||
updated_on: ds_results.updated_on || new Date().toISOString(),
|
updated_on: ds_results.updated_on || new Date().toISOString(),
|
||||||
text: text_val,
|
text: text_val,
|
||||||
html: text_val, // Default map text to html
|
html: text_val, // Default map text to html
|
||||||
@@ -236,12 +236,12 @@
|
|||||||
name: data_store_di.ds_name ?? ds_name,
|
name: data_store_di.ds_name ?? ds_name,
|
||||||
type: data_store_di.ds_type ?? ds_type,
|
type: data_store_di.ds_type ?? ds_type,
|
||||||
for_type: data_store_di.ds_for_type ?? null,
|
for_type: data_store_di.ds_for_type ?? null,
|
||||||
for_id_random: data_store_di.ds_for_id ?? null,
|
for_id: data_store_di.ds_for_id ?? null,
|
||||||
access_read: data_store_di.ds_access_read,
|
access_read: data_store_di.ds_access_read,
|
||||||
access_write: data_store_di.ds_access_write,
|
access_write: data_store_di.ds_access_write,
|
||||||
access_delete: data_store_di.ds_access_delete,
|
access_delete: data_store_di.ds_access_delete,
|
||||||
enable: data_store_di.ds_enable ?? true,
|
enable: data_store_di.ds_enable ?? true,
|
||||||
account_id_random: data_store_di.ds_use_account_id ? (data_store_di.ds_account_id ?? $slct.account_id) : null
|
account_id: data_store_di.ds_use_account_id ? (data_store_di.ds_account_id ?? $slct.account_id) : null
|
||||||
};
|
};
|
||||||
|
|
||||||
const content_val = data_store_di.ds_value;
|
const content_val = data_store_di.ds_value;
|
||||||
@@ -316,9 +316,9 @@
|
|||||||
Code: {$lq__ds_obj.code}
|
Code: {$lq__ds_obj.code}
|
||||||
Name: {$lq__ds_obj.name}
|
Name: {$lq__ds_obj.name}
|
||||||
Type: {$lq__ds_obj.type}
|
Type: {$lq__ds_obj.type}
|
||||||
|
Account: {$lq__ds_obj.account_id || 'Global / NULL'}
|
||||||
Created: {$lq__ds_obj.created_on}
|
Created: {$lq__ds_obj.created_on}
|
||||||
Updated: {$lq__ds_obj.updated_on}
|
Updated: {$lq__ds_obj.updated_on}
|
||||||
Account: {$lq__ds_obj.account_id_random || 'Global / NULL'}
|
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<hr />
|
<hr />
|
||||||
@@ -358,7 +358,7 @@
|
|||||||
</select>
|
</select>
|
||||||
</label>
|
</label>
|
||||||
<div class="flex items-center gap-2 pt-6">
|
<div class="flex items-center gap-2 pt-6">
|
||||||
<input type="checkbox" name="ds_use_account_id" class="checkbox" checked={!!$lq__ds_obj.account_id_random} />
|
<input type="checkbox" name="ds_use_account_id" class="checkbox" checked={!!$lq__ds_obj.account_id} />
|
||||||
<span class="text-xs">Account Specific</span>
|
<span class="text-xs">Account Specific</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -374,6 +374,11 @@
|
|||||||
>{$lq__ds_obj.type === 'json' ? (typeof $lq__ds_obj.json === 'string' ? $lq__ds_obj.json : JSON.stringify($lq__ds_obj.json, null, 2)) : ($lq__ds_obj.text || $lq__ds_obj.html || '')}</textarea>
|
>{$lq__ds_obj.type === 'json' ? (typeof $lq__ds_obj.json === 'string' ? $lq__ds_obj.json : JSON.stringify($lq__ds_obj.json, null, 2)) : ($lq__ds_obj.text || $lq__ds_obj.html || '')}</textarea>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="text-xs text-surface-500">
|
||||||
|
Created on: {$lq__ds_obj.created_on} | Last Updated: {$lq__ds_obj.updated_on}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="flex justify-between items-center pt-4">
|
<div class="flex justify-between items-center pt-4">
|
||||||
<button type="button" class="btn variant-filled-error" onclick={handle_delete}>
|
<button type="button" class="btn variant-filled-error" onclick={handle_delete}>
|
||||||
<span class="fas fa-trash mr-2"></span> Delete
|
<span class="fas fa-trash mr-2"></span> Delete
|
||||||
|
|||||||
@@ -53,11 +53,6 @@
|
|||||||
import MyClipboard from '$lib/app_components/e_app_clipboard.svelte';
|
import MyClipboard from '$lib/app_components/e_app_clipboard.svelte';
|
||||||
import E_app_debug_menu from '$lib/app_components/e_app_debug_menu.svelte';
|
import E_app_debug_menu from '$lib/app_components/e_app_debug_menu.svelte';
|
||||||
import E_app_sys_menu from '$lib/app_components/e_app_sys_menu.svelte';
|
import E_app_sys_menu from '$lib/app_components/e_app_sys_menu.svelte';
|
||||||
// import Element_access_type from '$lib/element_access_type.svelte';
|
|
||||||
// import Element_app_cfg from '$lib/element_app_cfg.svelte';
|
|
||||||
// import Element_sign_in_out from '$lib/element_sign_in_out.svelte';
|
|
||||||
|
|
||||||
// import Element_data_store from '$lib/element_data_store_v2.svelte';
|
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
data: any;
|
data: any;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
// import { PUBLIC_TESTING } from '$env/static/public';
|
// import { PUBLIC_TESTING } from '$env/static/public';
|
||||||
// console.log(`AE Config - +page.svelte PUBLIC_TESTING:`, PUBLIC_TESTING);
|
// console.log(`AE Config - +page.svelte PUBLIC_TESTING:`, PUBLIC_TESTING);
|
||||||
|
|
||||||
import Element_data_store from '$lib/elements/element_data_store_v2.svelte';
|
import Element_data_store from '$lib/elements/element_data_store_v3.svelte';
|
||||||
|
|
||||||
// import { api } from '$lib/api';
|
// import { api } from '$lib/api';
|
||||||
import { ae_loc, ae_sess, ae_api, slct, slct_trigger } from '$lib/stores/ae_stores';
|
import { ae_loc, ae_sess, ae_api, slct, slct_trigger } from '$lib/stores/ae_stores';
|
||||||
|
|||||||
@@ -9,16 +9,6 @@
|
|||||||
|
|
||||||
let log_lvl: number = 0;
|
let log_lvl: number = 0;
|
||||||
|
|
||||||
// import { browser } from '$app/environment';
|
|
||||||
// import { goto, invalidate, pushState, replaceState } from '$app/navigation';
|
|
||||||
|
|
||||||
// import type { key_val } from '$lib/ae_stores';
|
|
||||||
// import { ae_util } from '$lib/ae_utils/ae_utils';
|
|
||||||
// import Element_data_store from '$lib/element_data_store_v2.svelte';
|
|
||||||
|
|
||||||
// import { liveQuery } from "dexie";
|
|
||||||
// import { core_func } from '$lib/ae_core_functions';
|
|
||||||
// import { db_events } from "$lib/db_events";
|
|
||||||
import {
|
import {
|
||||||
ae_snip,
|
ae_snip,
|
||||||
ae_loc,
|
ae_loc,
|
||||||
@@ -35,10 +25,6 @@
|
|||||||
events_trigger
|
events_trigger
|
||||||
} from '$lib/stores/ae_events_stores';
|
} from '$lib/stores/ae_events_stores';
|
||||||
|
|
||||||
// import { events_func } from '$lib/ae_events_functions';
|
|
||||||
|
|
||||||
// import Event_page_menu from '../event_page_menu.svelte';
|
|
||||||
|
|
||||||
// Quickly save the data passed from the parent(s) to the Svelte stores, localStorage, and other.
|
// Quickly save the data passed from the parent(s) to the Svelte stores, localStorage, and other.
|
||||||
// $slct.account_id = data.account_id;
|
// $slct.account_id = data.account_id;
|
||||||
let ae_acct = data[$slct.account_id];
|
let ae_acct = data[$slct.account_id];
|
||||||
|
|||||||
@@ -88,6 +88,25 @@
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
<section class="card p-4 space-y-4 variant-soft-tertiary">
|
||||||
|
<h2 class="h3">Scenario 4: Change Props Passed</h2>
|
||||||
|
<p class="text-sm">Fetching code <code>{test_code_and_for}</code> linked to <code>for_type: event</code> and <code>for_id: {test_event_id}</code>.</p>
|
||||||
|
<div class="bg-surface-100-800-token p-4 rounded-lg border border-surface-500/20">
|
||||||
|
<AE_Element_Data_Store_V3
|
||||||
|
ds_code={test_code_and_for}
|
||||||
|
ds_name={'Specific Record Test'}
|
||||||
|
ds_type="html"
|
||||||
|
for_type="event"
|
||||||
|
for_id={test_event_id}
|
||||||
|
class_li="w-fit max-w-(--breakpoint-lg) text-xl text-red-500 font-bold text-center p-1 m-1 border border-red-200 rounded-md bg-red-100"
|
||||||
|
show_edit={false}
|
||||||
|
show_edit_btn={true}
|
||||||
|
{log_lvl}
|
||||||
|
debug={true}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
{/key}
|
{/key}
|
||||||
|
|
||||||
<section class="card p-4 space-y-4">
|
<section class="card p-4 space-y-4">
|
||||||
|
|||||||
Reference in New Issue
Block a user