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
|
||||
// if (current_for_type && current_for_id) {
|
||||
// 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])
|
||||
// .first();
|
||||
// }
|
||||
@@ -92,7 +92,7 @@
|
||||
// // 2. Account Lookup
|
||||
// if (!result && account_id) {
|
||||
// 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])
|
||||
// .first();
|
||||
// }
|
||||
@@ -100,7 +100,7 @@
|
||||
// // 3. Global Lookup
|
||||
// if (!result) {
|
||||
// result = await db_core.data_store
|
||||
// .where('[code+account_id_random+for_type]')
|
||||
// .where('[code+account_id+for_type]')
|
||||
// .equals([current_code, null, null])
|
||||
// .first();
|
||||
// }
|
||||
@@ -198,9 +198,9 @@
|
||||
...ds_results,
|
||||
id: ds_id,
|
||||
data_store_id: ds_results.data_store_id || ds_id,
|
||||
// data_store_id_random: ds_id,
|
||||
account_id: ds_results.account_id_random || ds_results.account_id,
|
||||
// account_id_random: ds_results.account_id_random || ds_results.account_id,
|
||||
// data_store_id: ds_id,
|
||||
account_id: ds_results.account_id || ds_results.account_id,
|
||||
// account_id: ds_results.account_id || ds_results.account_id,
|
||||
updated_on: ds_results.updated_on || new Date().toISOString(),
|
||||
text: text_val,
|
||||
html: text_val, // Default map text to html
|
||||
@@ -236,12 +236,12 @@
|
||||
name: data_store_di.ds_name ?? ds_name,
|
||||
type: data_store_di.ds_type ?? ds_type,
|
||||
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_write: data_store_di.ds_access_write,
|
||||
access_delete: data_store_di.ds_access_delete,
|
||||
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;
|
||||
@@ -316,9 +316,9 @@
|
||||
Code: {$lq__ds_obj.code}
|
||||
Name: {$lq__ds_obj.name}
|
||||
Type: {$lq__ds_obj.type}
|
||||
Account: {$lq__ds_obj.account_id || 'Global / NULL'}
|
||||
Created: {$lq__ds_obj.created_on}
|
||||
Updated: {$lq__ds_obj.updated_on}
|
||||
Account: {$lq__ds_obj.account_id_random || 'Global / NULL'}
|
||||
</pre>
|
||||
|
||||
<hr />
|
||||
@@ -358,7 +358,7 @@
|
||||
</select>
|
||||
</label>
|
||||
<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>
|
||||
</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>
|
||||
</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">
|
||||
<button type="button" class="btn variant-filled-error" onclick={handle_delete}>
|
||||
<span class="fas fa-trash mr-2"></span> Delete
|
||||
|
||||
Reference in New Issue
Block a user