General work through out the day. Lots of interruptions from the dogs.

This commit is contained in:
Scott Idem
2024-03-25 19:26:49 -04:00
parent b0f2e2ccdf
commit 3ddef770c0
16 changed files with 497 additions and 491 deletions

View File

@@ -5,6 +5,7 @@ import { createEventDispatcher, onMount } from 'svelte';
// *** Import Aether core variables and functions
import type { key_val } from '$lib/ae_stores';
import { api } from '$lib/api';
import { core_func } from '$lib/ae_core_functions';
// import { ae_loc, ae_sess, ae_api, ae_trig, slct, slct_trigger } from '$lib/ae_stores';
// *** Import Aether core components
@@ -14,8 +15,8 @@ import { api } from '$lib/api';
// *** Export/Exposed variables and functions for component
export let log_lvl: number = 0;
export let trigger_patch: any = null;
export let api_cfg: object = {'api_crud_super_key': null};
export let api_crud_super_key: null|string = api_cfg.api_crud_super_key;
export let api_cfg: key_val = {'api_crud_super_key': null};
// export let api_crud_super_key: null|string = api_cfg.api_crud_super_key;
export let object_type: string;
export let object_id: string;
export let field_name: string;
@@ -42,7 +43,7 @@ export let class_li: string = '';
// *** Set initial variables
let ae_promises: key_val = {}; // Promise<any>;
let patch_result: Promise<any>|key_val;
let patch_result: null|Promise<any>|key_val|string;
let original_field_value = field_value;
@@ -87,18 +88,12 @@ async function handle_obj_field_patch(new_field_value: any) {
// let params = {};
ae_promises.api_update__ae_obj = api.update_ae_obj_id_crud({
ae_promises.api_update__ae_obj = core_func.handle_update_ae_obj_id_crud({
api_cfg: api_cfg,
obj_type: object_type,
obj_id: object_id,
object_type: object_type,
object_id: object_id,
field_name: field_name,
field_value: new_field_value,
// fields: data,
key: api_crud_super_key,
// jwt: null,
// params: params,
// data: patch_data,
log_lvl: 2
new_field_value: new_field_value,
})
.then(function (results) {
console.log('PATCH Promise', results);
@@ -133,6 +128,62 @@ async function handle_obj_field_patch(new_field_value: any) {
console.log('PATCH Promise finally');
});
// if (ae_promises.api_update__ae_obj) {
// console.log(`Patched - Field Name: ${field_name} with new Field Value: ${new_field_value}; Original Field Value: ${original_field_value}`);
// patch_result = 'PATCH complete';
// } else {
// console.log(`Not Patched - Field Name: ${field_name} with new Field Value: ${new_field_value}; Original Field Value: ${original_field_value}`);
// patch_result = 'PATCH failed';
// return false;
// }
// ae_promises.api_update__ae_obj = api.update_ae_obj_id_crud({
// api_cfg: api_cfg,
// obj_type: object_type,
// obj_id: object_id,
// field_name: field_name,
// field_value: new_field_value,
// // fields: data,
// key: api_crud_super_key,
// // jwt: null,
// // params: params,
// // data: patch_data,
// log_lvl: 2
// })
// .then(function (results) {
// console.log('PATCH Promise', results);
// if (results) {
// console.log(`Patched - Field Name: ${field_name} with new Field Value: ${new_field_value}; Original Field Value: ${original_field_value}`);
// patch_result = 'PATCH complete';
// } else {
// console.log(`Not Patched - Field Name: ${field_name} with new Field Value: ${new_field_value}; Original Field Value: ${original_field_value}`);
// patch_result = 'PATCH failed';
// return false;
// }
// dispatch(
// 'ae_crud_updated',
// {
// 'type': object_type,
// 'id': object_id,
// 'field_name': field_name,
// 'field_value': new_field_value,
// 'original_value': original_field_value,
// }
// );
// return true;
// })
// .catch(function (error) {
// console.log('Something went wrong patching the record.');
// console.log(error);
// return false;
// })
// .finally(function () {
// console.log('PATCH Promise finally');
// });
return ae_promises.api_update__ae_obj;
}
</script>
@@ -226,10 +277,10 @@ async function handle_obj_field_patch(new_field_value: any) {
/* BEGIN: Svelte CRUD (update) component */
.ae_crud {
/* margin: 0; */
/* padding: 0; */
}
/* .ae_crud {
margin: 0;
padding: 0;
} */
.ae_crud.display_inline {
/* outline: solid thin red; */