FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

support custom girder upload chunk size by Justineantoine · Pull Request #1498 · Kitware/dive · GitHub

/ dive Public
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .production  (1) .ts  (1) .vue  (1) All 3 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
1 change: 1 addition & 0 deletions client/.env.production
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
VUE_APP_STATIC_PATH=./static/viame/
VUE_APP_GTAG=UA-6042509-43
VUE_APP_SENTRY_DSN=https://0ec02775cc734df98134cecf5c91f782@o267860.ingest.sentry.io/5436001
VUE_APP_UPLOAD_CHUNK_SIZE=67108864
23 changes: 23 additions & 0 deletions client/platform/web-girder/utils.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { UploadManager, Location } from '@girder/components/src';
import {
calibrationFileTypes, inputAnnotationFileTypes, inputAnnotationTypes,
otherImageTypes, otherVideoTypes, websafeImageTypes, websafeVideoTypes, zipFileTypes,
} from 'dive-common/constants';
import { DatasetType } from 'dive-common/apispec';
import type { LocationType, RootlessLocationType } from 'platform/web-girder/store/types';
import { Route } from 'vue-router';
import { AxiosInstance } from 'axios';

/**
* If the current route is representable by a LocationType, return it.
Expand Down Expand Up @@ -83,8 +85,29 @@ Promise<{ canceled: boolean; filePaths: string[]; fileList?: File[]}> {
}));
}

interface UploadOptions {
$rest: AxiosInstance;
parent: Location;
progress?: () => null;
params?: Record<string, unknown>;
chunkLen?: number;
}

class GirderUploadManager extends UploadManager {
constructor(file: File, options: UploadOptions = {} as UploadOptions) {
const envChunkSize = parseInt(process.env.VUE_APP_UPLOAD_CHUNK_SIZE || '', 10);
const chunkSize = Number.isFinite(envChunkSize) ? envChunkSize : 64 * 1024 * 1024;
const finalOptions: UploadOptions = {
...options,
chunkLen: options.chunkLen ?? chunkSize,
};
super(file, finalOptions);
}
}

export {
getLocationFromRoute,
getRouteFromLocation,
openFromDisk,
GirderUploadManager,
};
2 changes: 2 additions & 0 deletions client/platform/web-girder/views/UploadGirder.vue
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
} from 'platform/web-girder/constants';

import { makeViameFolder, postProcess } from 'platform/web-girder/api';
import { GirderUploadManager } from 'platform/web-girder/utils';

export default Vue.extend({
name: 'GirderUpload',
Expand Down Expand Up @@ -161,6 +162,7 @@ export default Vue.extend({
await this.start({
dest: folder,
postUpload,
uploadCls: GirderUploadManager,
});
},
},
Expand Down

Back | FazBrowse Home | New Git URL