+
Drag and drop files to upload.
@@ -99,14 +145,12 @@ export default ({ className }: WithClassname) => {
-
{
if (!e.currentTarget.files) return;
-
onFileSubmission(e.currentTarget.files);
if (fileUploadInput.current) {
fileUploadInput.current.files = null;
@@ -115,11 +159,7 @@ export default ({ className }: WithClassname) => {
/>
diff --git a/resources/scripts/state/server/files.ts b/resources/scripts/state/server/files.ts
index 04098572..34abbb7b 100644
--- a/resources/scripts/state/server/files.ts
+++ b/resources/scripts/state/server/files.ts
@@ -1,35 +1,50 @@
import { action, Action } from 'easy-peasy';
import { cleanDirectoryPath } from '@/helpers';
+export interface FileUpload {
+ name: string;
+ loaded: number;
+ readonly total: number;
+}
+
export interface ServerFileStore {
directory: string;
selectedFiles: string[];
+ uploads: FileUpload[];
setDirectory: Action
;
setSelectedFiles: Action;
appendSelectedFile: Action;
removeSelectedFile: Action;
+
+ appendFileUpload: Action;
+ removeFileUpload: Action;
}
const files: ServerFileStore = {
directory: '/',
selectedFiles: [],
+ uploads: [],
setDirectory: action((state, payload) => {
state.directory = cleanDirectoryPath(payload);
}),
-
setSelectedFiles: action((state, payload) => {
state.selectedFiles = payload;
}),
-
appendSelectedFile: action((state, payload) => {
state.selectedFiles = state.selectedFiles.filter(f => f !== payload).concat(payload);
}),
-
removeSelectedFile: action((state, payload) => {
state.selectedFiles = state.selectedFiles.filter(f => f !== payload);
}),
+
+ appendFileUpload: action((state, payload) => {
+ state.uploads = state.uploads.filter(f => f.name !== payload.name).concat(payload);
+ }),
+ removeFileUpload: action((state, payload) => {
+ state.uploads = state.uploads.filter(f => f.name !== payload);
+ }),
};
export default files;
diff --git a/routes/api-client.php b/routes/api-client.php
index 755cabde..72b6729f 100644
--- a/routes/api-client.php
+++ b/routes/api-client.php
@@ -77,7 +77,7 @@ Route::group(['prefix' => '/servers/{server}', 'middleware' => [AuthenticateServ
Route::post('/create-folder', [Client\Servers\FileController::class, 'create']);
Route::post('/chmod', [Client\Servers\FileController::class, 'chmod']);
Route::post('/pull', [Client\Servers\FileController::class, 'pull'])->middleware(['throttle:pull']);
- Route::get('/upload', [Client\Servers\FileUploadController::class]);
+ Route::get('/upload', [Client\Servers\FileUploadController::class, '__invoke']);
});
Route::group(['prefix' => '/schedules'], function () {