Now with upload and download percent! Also better editing for session POC.

This commit is contained in:
Scott Idem
2024-06-21 12:25:36 -04:00
parent fd114bce22
commit 2552e1a839
11 changed files with 433 additions and 64 deletions

View File

@@ -191,8 +191,14 @@ async function handle_input_upload_files(input_upload_files) {
// Uncomment and the post_promise is not seen by the "await" below
// post_promise = await api.post_object({api_cfg: $cfg.api, endpoint: endpoint, params: params, data:form_data});
// Uncomment so that the post_promise is not seen by the "await" below
ae_promises.upload__hosted_file_obj = await api.post_object({api_cfg: $ae_api, endpoint: endpoint, params: params, form_data: form_data})
ae_promises.upload__hosted_file_obj = api.post_object({
api_cfg: $ae_api,
endpoint: endpoint,
params: params,
form_data: form_data,
task_id: link_to_id,
log_lvl: 1
})
.then(async function (result) {
// NOTE: The /hosted_file/upload_files endpoint will always return a list of successful files uploaded. In this case we are only uploading one file and expecting a list of one item.
let x = 0;
@@ -442,8 +448,28 @@ WARNING: The file upload and management is a work in progress. You can upload an
// handle_submit_form;
}}
>
<span class="fas fa-save mx-1"></span>
{#await ae_promises.upload__hosted_file_obj}
<span class="fas fa-spinner fa-spin mx-1"></span>
<span class="">
Uploading
{#if $ae_sess.api_upload_kv[$events_slct.event_presenter_id]}
{$ae_sess.api_upload_kv[$events_slct.event_presenter_id].percent_completed}%
{/if}
</span>
{:then}
<span class="fas fa-upload mx-1"></span>
<span class="text-sm">
Upload:
</span>
<!-- <span class="fas fa-save mx-1"></span> -->
<span class="grow">
File
</span>
{/await}
<!-- <span class="fas fa-save mx-1"></span>
<span class="grow">
Upload File
</span> -->
</button>
</form>
@@ -482,8 +508,8 @@ WARNING: The file upload and management is a work in progress. You can upload an
<span class="fas fa-spinner fa-spin mx-1"></span>
<span class="">
Downloading
{#if $ae_sess.download[`/hosted_file/${event_file_obj.hosted_file_id_random}/download`]}
{$ae_sess.download[`/hosted_file/${event_file_obj.hosted_file_id_random}/download`].percent_completed}%
{#if $ae_sess.api_download_kv[event_file_obj.hosted_file_id_random]}
{$ae_sess.api_download_kv[event_file_obj.hosted_file_id_random].percent_completed}%
{/if}
:
</span>