From be6297de405f1e1a229b732c799f078f5a79f53b Mon Sep 17 00:00:00 2001 From: "ayush.goyal" Date: Tue, 7 Mar 2023 20:53:49 +0530 Subject: [PATCH] [ozone] adding UI warning if file size is greater then upload_chunk_size --- .../src/filebrowser/templates/listdir_components.mako | 4 ++++ desktop/core/src/desktop/js/ext/fileuploader.custom.js | 3 +++ desktop/core/src/desktop/templates/global_js_constants.mako | 2 ++ 3 files changed, 9 insertions(+) diff --git a/apps/filebrowser/src/filebrowser/templates/listdir_components.mako b/apps/filebrowser/src/filebrowser/templates/listdir_components.mako index 22a823ca64a..29784497c06 100644 --- a/apps/filebrowser/src/filebrowser/templates/listdir_components.mako +++ b/apps/filebrowser/src/filebrowser/templates/listdir_components.mako @@ -2012,6 +2012,10 @@ else: }); $("#fileUploader").on('fb:updatePath', function (e, options) { + const uploadingToOzone = self.currentPath().startsWith("ofs://"); + if (uploadingToOzone && UPLOAD_CHUNK_SIZE) { + uploader.setOption('sizeLimit', UPLOAD_CHUNK_SIZE); + } uploader.setParams({ dest: options.dest, fileFieldLabel: "hdfs_file" diff --git a/desktop/core/src/desktop/js/ext/fileuploader.custom.js b/desktop/core/src/desktop/js/ext/fileuploader.custom.js index d9758c7a891..dc27568b967 100644 --- a/desktop/core/src/desktop/js/ext/fileuploader.custom.js +++ b/desktop/core/src/desktop/js/ext/fileuploader.custom.js @@ -315,6 +315,9 @@ qq.FileUploaderBasic.prototype = { setParams: function(params){ this._options.params = params; }, + setOption: function(key, val){ + this._options[key] = val; + }, getInProgress: function(){ return this._filesInProgress; }, diff --git a/desktop/core/src/desktop/templates/global_js_constants.mako b/desktop/core/src/desktop/templates/global_js_constants.mako index ece9493b63e..ee79cf4ec7e 100644 --- a/desktop/core/src/desktop/templates/global_js_constants.mako +++ b/desktop/core/src/desktop/templates/global_js_constants.mako @@ -26,6 +26,7 @@ from beeswax.conf import DOWNLOAD_BYTES_LIMIT, DOWNLOAD_ROW_LIMIT, LIST_PARTITIONS_LIMIT, CLOSE_SESSIONS from dashboard.conf import HAS_SQL_ENABLED + from hadoop.conf import UPLOAD_CHUNK_SIZE from jobbrowser.conf import ENABLE_HISTORY_V2 from filebrowser.conf import SHOW_UPLOAD_BUTTON, REMOTE_STORAGE_HOME from indexer.conf import ENABLE_NEW_INDEXER @@ -135,6 +136,7 @@ window.SHOW_NOTEBOOKS = '${ SHOW_NOTEBOOKS.get() }' === 'True' window.SHOW_UPLOAD_BUTTON = '${ hasattr(SHOW_UPLOAD_BUTTON, 'get') and SHOW_UPLOAD_BUTTON.get() }' === 'True' + window.UPLOAD_CHUNK_SIZE = '${ UPLOAD_CHUNK_SIZE.get() }'; window.IS_MULTICLUSTER_ONLY = '${ IS_MULTICLUSTER_ONLY.get() }' === 'True'; window.IS_K8S_ONLY = '${ IS_K8S_ONLY.get() }' === 'True';