From 54ae69b7b76016307c3b92437ca06dc2aa1eddb9 Mon Sep 17 00:00:00 2001 From: jelveh Date: Sun, 27 Oct 2024 21:32:39 -0700 Subject: [PATCH] feat: add an 'Upload' button at the bottom of `OpenFilePicker` --- src/gui/src/UI/UIWindow.js | 20 ++++++++++++++++---- src/gui/src/css/style.css | 13 ++++++++++++- src/gui/src/helpers/launch_app.js | 1 - 3 files changed, 28 insertions(+), 6 deletions(-) diff --git a/src/gui/src/UI/UIWindow.js b/src/gui/src/UI/UIWindow.js index 203b3789..22ac1baa 100644 --- a/src/gui/src/UI/UIWindow.js +++ b/src/gui/src/UI/UIWindow.js @@ -374,8 +374,8 @@ async function UIWindow(options) { // is_saveFileDialog if(options.is_saveFileDialog){ h += `
`; - h += `
`; - h += ``; + h += `
`; + h += ``; h += ``; h += ``; h += ``; h += `
`; @@ -398,7 +404,7 @@ async function UIWindow(options) { // is_directoryPicker else if(options.is_directoryPicker){ h += `
`; - h += `
`; + h += `
`; h += ``; h += ``; h += `
`; @@ -492,7 +498,13 @@ async function UIWindow(options) { const el_filedialog_cancel_btn = document.querySelector(`#window-${win_id} .filedialog-cancel-btn`); const el_openfiledialog_open_btn = document.querySelector(`#window-${win_id} .openfiledialog-open-btn`); const el_directorypicker_select_btn = document.querySelector(`#window-${win_id} .directorypicker-select-btn`); + const el_window_filedialog_upload_here = document.querySelector(`#window-${win_id} .window-filedialog-upload-here`); + if(el_window_filedialog_upload_here){ + el_window_filedialog_upload_here.addEventListener('click', function(){ + window.init_upload_using_dialog(el_window_body, $(el_window).attr('data-path') + '/'); + }); + } // attach optional event listeners el_window.on_before_exit = options.on_before_exit; diff --git a/src/gui/src/css/style.css b/src/gui/src/css/style.css index 152a956f..105bee0f 100644 --- a/src/gui/src/css/style.css +++ b/src/gui/src/css/style.css @@ -1324,8 +1324,9 @@ span.header-sort-icon img { background-color: #f3f5f9; padding: 0 15px; display: flex; - flex-direction: column; + flex-direction: row; justify-content: center; + align-items: center; } .savefiledialog-filename { @@ -1337,6 +1338,16 @@ span.header-sort-icon img { flex-grow: 1; } +.window-filedialog-upload-here{ + -webkit-font-smoothing: antialiased; + opacity: 0.7; + font-size: 14px; +} + +.window-filedialog-upload-here:hover{ + cursor: pointer; + opacity: 1; +} .savefiledialog-save-btn, .openfiledialog-open-btn { margin-left: 10px; } diff --git a/src/gui/src/helpers/launch_app.js b/src/gui/src/helpers/launch_app.js index a260f15a..b1435232 100644 --- a/src/gui/src/helpers/launch_app.js +++ b/src/gui/src/helpers/launch_app.js @@ -306,7 +306,6 @@ const launch_app = async (options)=>{ if(app_info.metadata?.credentialless !== undefined && typeof app_info.metadata.credentialless === 'boolean') credentialless = app_info.metadata.credentialless; - console.log('credentialless', credentialless); // open window el_win = UIWindow({ element_uuid: uuid,