From 30cc6e19ead8fd78817a358b3c34e6cf869866d6 Mon Sep 17 00:00:00 2001 From: Venkata Chandra Sekhar Nainala Date: Fri, 10 Nov 2023 13:50:59 +0100 Subject: [PATCH] fix: upload screen updates and various bug fixes --- app/Console/Commands/ArchiveData.php | 3 +- app/Console/Commands/ExtractSpectra.php | 6 +- app/Console/Commands/SanitizeProjects.php | 20 +- app/Http/Controllers/DraftController.php | 20 +- app/Http/Resources/ProjectResource.php | 2 +- app/Providers/AppServiceProvider.php | 6 +- resources/js/Pages/Dashboard.vue | 6 +- resources/js/Pages/Upload.vue | 473 ++++++++++++---------- resources/js/Shared/FileSystemBrowser.vue | 14 +- 9 files changed, 300 insertions(+), 250 deletions(-) diff --git a/app/Console/Commands/ArchiveData.php b/app/Console/Commands/ArchiveData.php index 1c093235..7f6bf796 100644 --- a/app/Console/Commands/ArchiveData.php +++ b/app/Console/Commands/ArchiveData.php @@ -36,7 +36,8 @@ public function handle() ])->get(); foreach ($projects as $project) { - // echo($project->identifier); + echo($project->identifier); + echo("\r\n"); ArchiveProject::dispatch($project); ArchiveStudy::dispatch($project); } diff --git a/app/Console/Commands/ExtractSpectra.php b/app/Console/Commands/ExtractSpectra.php index 9baba458..d471e39c 100644 --- a/app/Console/Commands/ExtractSpectra.php +++ b/app/Console/Commands/ExtractSpectra.php @@ -88,7 +88,7 @@ public function handle() } catch (Exception $e) { echo 'Caught exception: ', $e->getMessage(), "\n"; } - + $study = $study->fresh(); foreach ($study->datasets as $dataset) { echo $dataset->identifier; echo "\r\n"; @@ -110,8 +110,8 @@ public function handle() $pathsMatch = true; if ($files) { foreach ($files as $file) { - echo $file; - echo "\r\n"; + // echo $file; + // echo "\r\n"; if (! str_contains($file, $path)) { $pathsMatch = false; } diff --git a/app/Console/Commands/SanitizeProjects.php b/app/Console/Commands/SanitizeProjects.php index cf1c6b6f..4750eddd 100644 --- a/app/Console/Commands/SanitizeProjects.php +++ b/app/Console/Commands/SanitizeProjects.php @@ -309,16 +309,16 @@ public function localise() public function updateFilesStatus() { - $drafts = Draft::where('is_deleted', true)->get(); - foreach ($drafts as $draft) { - echo $draft->id; - echo "\r\n"; - echo 'Deleting associated files'; - FileSystemObject::where('draft_id', $draft->id)->delete(); - echo 'Deleting draft'; - echo "\r\n"; - Draft::where('id', $draft->id)->delete(); - } + // $drafts = Draft::where('is_deleted', true)->get(); + // foreach ($drafts as $draft) { + // echo $draft->id; + // echo "\r\n"; + // echo 'Deleting associated files'; + // FileSystemObject::where('draft_id', $draft->id)->delete(); + // echo 'Deleting draft'; + // echo "\r\n"; + // Draft::where('id', $draft->id)->delete(); + // } $fsObjects = FileSystemObject::whereNull('status')->get(); foreach ($fsObjects as $fsObject) { diff --git a/app/Http/Controllers/DraftController.php b/app/Http/Controllers/DraftController.php index 674943c7..2f4bc894 100644 --- a/app/Http/Controllers/DraftController.php +++ b/app/Http/Controllers/DraftController.php @@ -155,16 +155,16 @@ public function process(Request $request, Draft $draft) $input = $request->all(); $project = Project::where('draft_id', $draft->id)->first(); - if ($project) { - $rule = Rule::unique('projects')->where('owner_id', $input['owner_id'])->ignore($project->id); - } else { - $rule = Rule::unique('projects')->where('owner_id', $input['owner_id']); - } - - $validation = $request->validate([ - 'name' => ['required', 'string', 'max:255', Rule::unique('drafts') - ->where('owner_id', $input['owner_id'])->ignore($draft->id), $rule, ], - ]); + // if ($project) { + // $rule = Rule::unique('projects')->where('owner_id', $input['owner_id'])->ignore($project->id); + // } else { + // $rule = Rule::unique('projects')->where('owner_id', $input['owner_id']); + // } + + // $validation = $request->validate([ + // 'name' => ['required', 'string', 'max:255', Rule::unique('drafts') + // ->where('owner_id', $input['owner_id'])->ignore($draft->id), $rule, ], + // ]); $draftFolders = FileSystemObject::with('children') ->where([ diff --git a/app/Http/Resources/ProjectResource.php b/app/Http/Resources/ProjectResource.php index 20be35f2..682cfd76 100644 --- a/app/Http/Resources/ProjectResource.php +++ b/app/Http/Resources/ProjectResource.php @@ -84,7 +84,7 @@ function () { 'children' => FileSystemObject::with( 'children' ) - ->where([['project_id', $this->id]]) + ->where([['project_id', $this->id], ['level', 0]]) ->orderBy('type') ->get(), ], diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index a83c403d..5eab1ffb 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -26,8 +26,8 @@ public function register() */ public function boot() { - if ($this->app->environment('production')) { - \URL::forceScheme('https'); - } + // if ($this->app->environment('production')) { + // \URL::forceScheme('https'); + // } } } diff --git a/resources/js/Pages/Dashboard.vue b/resources/js/Pages/Dashboard.vue index d7924134..17542974 100644 --- a/resources/js/Pages/Dashboard.vue +++ b/resources/js/Pages/Dashboard.vue @@ -70,14 +70,14 @@ d="M9 13h6m-3-3v6m-9 1V7a2 2 0 012-2h6l2 2h6a2 2 0 012 2v8a2 2 0 01-2 2H5a2 2 0 01-2-2z" /> -

- No Projects or Samples +

+ You have no projects or samples yet

Get started by uploading your data.

- + diff --git a/resources/js/Pages/Upload.vue b/resources/js/Pages/Upload.vue index c6625e92..e82b898a 100644 --- a/resources/js/Pages/Upload.vue +++ b/resources/js/Pages/Upload.vue @@ -350,6 +350,10 @@ >Draft ID: {{ currentDraft.key }} +
- Success + + Success + - Failed + + Incomplete + + + Meta + data + is + missing. + Please + check + the + validation + report + below. +
@@ -760,10 +790,11 @@ worries, though – - we've + We got your - back! + back + covered! Would you like @@ -786,7 +817,7 @@ >