Working on ability to change the presentation name and session name... Making progress. Need to figure out why the file list does not reload correctly right after saving.

This commit is contained in:
Scott Idem
2024-06-20 17:45:00 -04:00
parent d49f73583c
commit 991cb1e9da
5 changed files with 247 additions and 80 deletions

View File

@@ -196,6 +196,7 @@ async function handle_load_ae_obj_li__event_file(
handle_db_save_ae_obj_li__event_file({obj_type: 'event_file', obj_li: event_file_obj_li_get_result});
return event_file_obj_li_get_result;
} else {
console.log('No results returned.');
return [];
}
})
@@ -269,7 +270,7 @@ async function handle_load_ae_obj_id__event_session(
use_alt_table: false, // NOTE: This will use the table_name_alt value instead of the table_name value in the API config.
use_alt_base: false, // NOTE: This will use the base_name_alt value instead of the base_name value in the API config.
params: params,
log_lvl: 0
log_lvl: log_lvl
})
.then(function (event_session_obj_get_result) {
if (event_session_obj_get_result) {
@@ -436,6 +437,51 @@ async function handle_search__event_session(
}
// Updated 2024-06-20
async function handle_load_ae_obj_id__event_presentation(
{
api_cfg,
event_presentation_id,
try_cache=false,
log_lvl=0
} : {
api_cfg: any,
event_presentation_id: string,
try_cache?: boolean,
log_lvl?: number
}
) {
console.log(`*** handle_load_ae_obj_id__event_presentation() *** event_presentation_id=${event_presentation_id}`);
let params = {};
ae_promises.load__event_presentation_obj = await api.get_ae_obj_id_crud({
api_cfg: api_cfg,
obj_type: 'event_presentation',
obj_id: event_presentation_id, // NOTE: This is the FQDN, not normally the ID.
use_alt_table: false, // NOTE: This will use the table_name_alt value instead of the table_name value in the API config.
use_alt_base: false, // NOTE: This will use the base_name_alt value instead of the base_name value
params: params,
log_lvl: log_lvl
})
.then(function (event_presentation_obj_get_result) {
if (event_presentation_obj_get_result) {
// This is expecting a list
handle_db_save_ae_obj_li__event_presentation({obj_type: 'event_presentation', obj_li: [event_presentation_obj_get_result]});
return event_presentation_obj_get_result;
} else {
console.log('No results returned.');
return null;
}
})
.catch(function (error) {
console.log('No results returned or failed.', error);
});
return ae_promises.load__event_presentation_obj;
}
// Updated 2024-06-10
async function handle_load_ae_obj_li__event_presentation(
{
@@ -1900,6 +1946,7 @@ let export_obj = {
handle_load_ae_obj_li__event_session: handle_load_ae_obj_li__event_session,
handle_search__event_session: handle_search__event_session,
handle_load_ae_obj_id__event_presentation: handle_load_ae_obj_id__event_presentation,
handle_load_ae_obj_li__event_presentation: handle_load_ae_obj_li__event_presentation,
handle_load_ae_obj_id__event_presenter: handle_load_ae_obj_id__event_presenter,

View File

@@ -483,7 +483,7 @@ export class MySubClassedDexie extends Dexie {
event_id_random, event_session_id_random, event_presentation_id_random, event_presenter_id_random, event_location_id_random,
filename, extension,
lu_file_purpose_id, lu_event_file_purpose_name, file_purpose,
enable, hide, priority, sort, group, notes, created_on, updated_on`,
enable, hide, priority, sort, group, created_on, updated_on`,
presentations: `
id, event_presentation_id, event_presentation_id_random,
@@ -493,7 +493,7 @@ export class MySubClassedDexie extends Dexie {
event_id_random, event_session_id_random, event_abstract_id_random,
abstract_code, name, description, start_datetime, end_datetime,
hide_event_launcher,
enable, hide, priority, sort, group, notes, created_on, updated_on`,
enable, hide, priority, sort, group, created_on, updated_on`,
presenters: `
id, event_presenter_id, event_presenter_id_random,
@@ -506,7 +506,7 @@ export class MySubClassedDexie extends Dexie {
full_name, affiliations, email,
agree,
hide_event_launcher,
enable, hide, priority, sort, group, notes, created_on, updated_on`,
enable, hide, priority, sort, group, created_on, updated_on`,
});
}
}

View File

@@ -89,7 +89,7 @@ async function handle_obj_field_patch(new_field_value: any) {
// let params = {};
ae_promises.api_update__ae_obj = core_func.handle_update_ae_obj_id_crud({
ae_promises.api_update__ae_obj = await core_func.handle_update_ae_obj_id_crud({
api_cfg: api_cfg,
object_type: object_type,
object_id: object_id,
@@ -100,7 +100,7 @@ async function handle_obj_field_patch(new_field_value: any) {
log_lvl: 0
})
.then(function (results) {
console.log('PATCH Promise', results);
console.log('Field 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}`);
@@ -110,7 +110,16 @@ async function handle_obj_field_patch(new_field_value: any) {
patch_result = 'PATCH failed';
return false;
}
return true;
})
.catch(function (error) {
console.log('Something went wrong patching the record.');
console.log(error);
return false;
})
.finally(function () {
console.log('Field PATCH Promise finally');
// This dispatch() must be under "finally".
dispatch(
'ae_crud_updated',
{
@@ -121,73 +130,8 @@ async function handle_obj_field_patch(new_field_value: any) {
'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');
});
// 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>