1
0

UIWindowUploadProgress.js 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. import UIWindow from './UIWindow.js'
  2. // todo do this using uid rather than item_path, since item_path is way mroe expensive on the DB
  3. async function UIWindowUploadProgress(options){
  4. let h = '';
  5. h += `<div data-upload-operation-id="${options.operation_id}">`;
  6. h += `<div>`;
  7. // spinner
  8. h +=`<svg style="float:left; margin-right: 7px;" xmlns="http://www.w3.org/2000/svg" height="24" width="24" viewBox="0 0 24 24"><title>circle anim</title><g fill="#212121" class="nc-icon-wrapper"><g class="nc-loop-circle-24-icon-f"><path d="M12 24a12 12 0 1 1 12-12 12.013 12.013 0 0 1-12 12zm0-22a10 10 0 1 0 10 10A10.011 10.011 0 0 0 12 2z" fill="#212121" opacity=".4"></path><path d="M24 12h-2A10.011 10.011 0 0 0 12 2V0a12.013 12.013 0 0 1 12 12z" data-color="color-2"></path></g><style>.nc-loop-circle-24-icon-f{--animation-duration:0.5s;transform-origin:12px 12px;animation:nc-loop-circle-anim var(--animation-duration) infinite linear}@keyframes nc-loop-circle-anim{0%{transform:rotate(0)}100%{transform:rotate(360deg)}}</style></g></svg>`;
  9. // Progress report
  10. h +=`<div style="margin-bottom:20px; float:left; padding-top:3px; font-size:15px; overflow: hidden; width: calc(100% - 40px); text-overflow: ellipsis; white-space: nowrap;">`;
  11. // msg
  12. h += `<span class="upload-progress-msg">Preparing for upload...</span>`;
  13. h += `</div>`;
  14. // progress
  15. h += `<div class="upload-progress-bar-container" style="clear:both; margin-top:20px; border-radius:3px;">`;
  16. h += `<div class="upload-progress-bar"></div>`;
  17. h += `</div>`;
  18. // cancel
  19. h += `<button style="float:right; margin-top: 15px; margin-right: -2px;" class="button button-small upload-cancel-btn">Cancel</button>`;
  20. h +=`</div>`;
  21. h += `</div>`;
  22. const el_window = await UIWindow({
  23. title: `Upload`,
  24. icon: window.icons[`app-icon-uploader.svg`],
  25. uid: null,
  26. is_dir: false,
  27. body_content: h,
  28. draggable_body: false,
  29. has_head: false,
  30. selectable_body: false,
  31. draggable_body: true,
  32. allow_context_menu: false,
  33. is_resizable: false,
  34. is_droppable: false,
  35. init_center: true,
  36. allow_native_ctxmenu: false,
  37. allow_user_select: false,
  38. window_class: 'window-upload-progress',
  39. width: 450,
  40. dominant: true,
  41. window_css:{
  42. height: 'initial',
  43. },
  44. body_css: {
  45. padding: '22px',
  46. width: 'initial',
  47. 'background-color': 'rgba(231, 238, 245, .95)',
  48. 'backdrop-filter': 'blur(3px)',
  49. }
  50. });
  51. return el_window;
  52. }
  53. export default UIWindowUploadProgress