Skip to content

Commit

Permalink
Merge branch 'master' of github.com:cloudera/hue into feat/storage-br…
Browse files Browse the repository at this point in the history
…owser-12
  • Loading branch information
ramprasadagarwal committed Jan 14, 2025
2 parents d3e823b + d2c8ce0 commit 918be1a
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 8 deletions.
3 changes: 1 addition & 2 deletions apps/filebrowser/src/filebrowser/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ def display(request):
return HttpResponse(f'Cannot request chunks greater than {MAX_CHUNK_SIZE_BYTES} bytes.', status=400)

# Read out based on meta.
compression, offset, length, contents = read_contents(compression, path, request.fs, offset, length)
_, offset, length, contents = read_contents(compression, path, request.fs, offset, length)

# Get contents as string for text mode, or at least try
file_contents = None
Expand All @@ -372,7 +372,6 @@ def display(request):
'length': length,
'end': offset + len(contents),
'mode': mode,
'compression': compression,
}

return JsonResponse(data)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ $icon-margin: 5px;
height: $cell-height;
@include mixins.nowrap-ellipsis;
}

td.ant-table-cell:first-child {
text-overflow: initial;
}
}

.hue-storage-browser__table-cell-name {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@ import formatBytes from '../../../utils/formatBytes';
import './StorageDirectoryPage.scss';
import { formatTimestamp } from '../../../utils/dateTimeUtils';
import useLoadData from '../../../utils/hooks/useLoadData';
import { DEFAULT_PAGE_SIZE, FileUploadStatus } from '../../../utils/constants/storageBrowser';
import {
DEFAULT_PAGE_SIZE,
DEFAULT_POLLING_TIME,
FileUploadStatus
} from '../../../utils/constants/storageBrowser';
import CreateAndUploadAction from './CreateAndUploadAction/CreateAndUploadAction';
import DragAndDrop from '../../../reactComponents/DragAndDrop/DragAndDrop';
import UUID from '../../../utils/string/UUID';
Expand Down Expand Up @@ -77,6 +81,7 @@ const StorageDirectoryPage = ({
const [tableHeight, setTableHeight] = useState<number>(100);
const [selectedFiles, setSelectedFiles] = useState<StorageDirectoryTableData[]>([]);
const [filesToUpload, setFilesToUpload] = useState<UploadItem[]>([]);
const [polling, setPolling] = useState<boolean>(false);

const [pageSize, setPageSize] = useState<number>(DEFAULT_PAGE_SIZE);
const [pageNumber, setPageNumber] = useState<number>(1);
Expand Down Expand Up @@ -106,7 +111,8 @@ const StorageDirectoryPage = ({
fileStats.type !== BrowserViewType.dir,
onSuccess: () => {
setSelectedFiles([]);
}
},
pollInterval: polling ? DEFAULT_POLLING_TIME : undefined
});

const tableData: StorageDirectoryTableData[] = useMemo(() => {
Expand Down Expand Up @@ -223,6 +229,7 @@ const StorageDirectoryPage = ({
status: FileUploadStatus.Pending
};
});
setPolling(true);
setFilesToUpload(prevFiles => [...prevFiles, ...newUploadItems]);
};

Expand Down Expand Up @@ -292,7 +299,10 @@ const StorageDirectoryPage = ({
</div>

<DragAndDrop onDrop={onFilesDrop}>
<LoadingErrorWrapper loading={loadingFiles || listDirectoryLoading} errors={errorConfig}>
<LoadingErrorWrapper
loading={(loadingFiles || listDirectoryLoading) && !polling}
errors={errorConfig}
>
<Table
className={className}
columns={getColumns(tableData[0] ?? {})}
Expand All @@ -302,11 +312,13 @@ const StorageDirectoryPage = ({
rowClassName={rowClassName}
rowKey={r => `${r.path}_${r.type}_${r.mtime}`}
rowSelection={{
hideSelectAll: !tableData.length,
columnWidth: 36,
type: 'checkbox',
...rowSelection
}}
scroll={{ y: tableHeight }}
data-testid={`${testId}`}
data-testid={testId}
locale={locale}
{...restProps}
/>
Expand All @@ -325,7 +337,10 @@ const StorageDirectoryPage = ({
<FileUploadQueue
filesQueue={filesToUpload}
onClose={() => setFilesToUpload([])}
onComplete={reloadData}
onComplete={() => {
reloadData();
setPolling(false);
}}
/>
)}
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export const DEFAULT_CHUNK_SIZE = 5 * 1024 * 1024; // 5 MiB
export const DEFAULT_CONCURRENT_MAX_CONNECTIONS = 3;
export const DEFAULT_ENABLE_CHUNK_UPLOAD = false;
export const DEFAULT_PREVIEW_PAGE_SIZE = 1024 * 512; // 0.5 MiB
export const DEFAULT_POLLING_TIME = 10 * 1000; // 10 seconds

export enum SupportedFileTypes {
IMAGE = 'image',
Expand Down
2 changes: 1 addition & 1 deletion desktop/core/src/desktop/templates/job_browser_common.mako
Original file line number Diff line number Diff line change
Expand Up @@ -2401,7 +2401,7 @@
<tbody data-bind="foreach: properties['actions']">
<tr>
<td>
<a data-bind="hueLink: '/jobbrowser/jobs/' + ko.unwrap(externalId), clickBubble: false">
<a data-bind="hueLink: '/jobbrowser/jobs/#!id=' + ko.unwrap(externalId), clickBubble: false">
<i class="fa fa-tasks"></i>
</a>
</td>
Expand Down

0 comments on commit 918be1a

Please sign in to comment.