Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/NFDI4Chem/nmrxiv into prod-…
Browse files Browse the repository at this point in the history
…helm-deploy
  • Loading branch information
CS76 committed Jan 15, 2024
2 parents 9d4cb78 + 3c72756 commit e0f341c
Show file tree
Hide file tree
Showing 19 changed files with 437 additions and 127 deletions.
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,28 @@
# Changelog

## [1.1.0-rc.21](https://github.com/NFDI4Chem/nmrxiv/compare/v1.0.0-rc.21...v1.1.0-rc.21) (2024-01-15)


### Features

* updated OA schema to include enum values ([8534f88](https://github.com/NFDI4Chem/nmrxiv/commit/8534f882205559ab8e224b5b677bcd59d17c8be2))


### Bug Fixes

* added is_null check to request photo to avoid 500 error ([be04a3e](https://github.com/NFDI4Chem/nmrxiv/commit/be04a3e993ada4c210d0fbc97e9f6934df119584))
* enabled file select ([e1680fa](https://github.com/NFDI4Chem/nmrxiv/commit/e1680fa5e0fafeb83547da8fa24b245c4cf0d3b8))
* enabled select files on click ([16397a3](https://github.com/NFDI4Chem/nmrxiv/commit/16397a3193e3cf89aea3d82ea9450f7e477a34f7))
* Issues with default sort (disabled for now) ([574b4f3](https://github.com/NFDI4Chem/nmrxiv/commit/574b4f374df7439ed9a57112d88bdf0e5278d988))
* published project policy issues fix ([f03801f](https://github.com/NFDI4Chem/nmrxiv/commit/f03801f6085e4ff88dc7d32e43fe1f83718a5743))
* removed deleted word concatenation to project name upon deletion ([0776172](https://github.com/NFDI4Chem/nmrxiv/commit/0776172eb084b8539e7d402dda443819af4448b2))
* resolve cooloff period value. ([201f6ff](https://github.com/NFDI4Chem/nmrxiv/commit/201f6ff017ac57b83aba20e02e75aceef83931e3)), closes [#1014](https://github.com/NFDI4Chem/nmrxiv/issues/1014)
* resolved [#1018](https://github.com/NFDI4Chem/nmrxiv/issues/1018) ([677eb54](https://github.com/NFDI4Chem/nmrxiv/commit/677eb54f9ac48f0692b2b55f0f7424c4084387a8))
* resolved permanent loading screen while navigation forward and backward between steps ([1447070](https://github.com/NFDI4Chem/nmrxiv/commit/14470702ecc728dc6062028d5eb67fdf14d7f804))
* resolves [#1010](https://github.com/NFDI4Chem/nmrxiv/issues/1010) ([12a1363](https://github.com/NFDI4Chem/nmrxiv/commit/12a13630f5cbfd1587e204adc0ed2e10956f871d))
* resolves [#996](https://github.com/NFDI4Chem/nmrxiv/issues/996) ([4471c3b](https://github.com/NFDI4Chem/nmrxiv/commit/4471c3b87f99053b08975bc4b2a26aaec1d1089a))
* side bar layout changes ([a4b80f2](https://github.com/NFDI4Chem/nmrxiv/commit/a4b80f2098ec5869932ac71d2f89f02f9dabf453))

## [1.0.1-rc.20](https://github.com/NFDI4Chem/nmrxiv/compare/v1.0.0-rc.20...v1.0.1-rc.20) (2024-01-10)


Expand Down
2 changes: 1 addition & 1 deletion app/Actions/Project/DeleteProject.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function delete($project)
if ($draft) {
$draft->update(['is_deleted' => true]);
}
$project->name = $project->name.'- deleted';
$project->name = $project->name;
$project->deleted_on = Carbon::now();
$project->is_deleted = true;
$project->sendNotification('deletion', $this->prepareSendList($project));
Expand Down
11 changes: 6 additions & 5 deletions app/Actions/Project/UpdateProject.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,12 @@ public function update(Project $project, array $input)

if (array_key_exists('photo', $input)) {
$image = $input['photo'];
$s3 = Storage::disk(env('FILESYSTEM_DRIVER_PUBLIC'));
$file_name =
uniqid().'.'.$image->getClientOriginalExtension();
$s3filePath = '/projects/'.$file_name;
$s3->put($s3filePath, file_get_contents($image), 'public');
if (! is_null($image)) {
$s3 = Storage::disk(env('FILESYSTEM_DRIVER_PUBLIC'));
$file_name = uniqid().'.'.$image->getClientOriginalExtension();
$s3filePath = '/projects/'.$file_name;
$s3->put($s3filePath, file_get_contents($image), 'public');
}
}

$is_public = array_key_exists('is_public', $input) ? $input['is_public'] : $project->is_public;
Expand Down
8 changes: 3 additions & 5 deletions app/Http/Controllers/API/DataController.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class DataController extends Controller
* @OA\Get(
* path="/api/v1/list/{model}",
* summary="Fetch all models",
* description="Fetch details for all publicly available models on nmrXiv.",
* description="Fetch details for all publicly available models (i.e. projects, samples, datasets) on nmrXiv.",
* operationId="publicModels",
* tags={"public"},
*
Expand All @@ -30,7 +30,8 @@ class DataController extends Controller
*
* @OA\Schema(
* type="string",
* )
* enum={"projects", "samples", "datasets"}
* )
* ),
*
* @OA\Response(
Expand All @@ -56,7 +57,6 @@ public function all(Request $request, $model)
->where('is_public', true)
->allowedSorts($allowedSorts)
->allowedFilters($allowedFilters)
->defaultSort($defaultSort)
->paginate($per_page)
->appends(request()->query())
);
Expand All @@ -66,7 +66,6 @@ public function all(Request $request, $model)
->where('is_public', true)
->allowedSorts($allowedSorts)
->allowedFilters($allowedFilters)
->defaultSort($defaultSort)
->paginate($per_page)
->appends(request()->query())
);
Expand All @@ -76,7 +75,6 @@ public function all(Request $request, $model)
->where('is_public', true)
->allowedSorts($allowedSorts)
->allowedFilters($allowedFilters)
->defaultSort($defaultSort)
->paginate($per_page)
->appends(request()->query())
);
Expand Down
7 changes: 7 additions & 0 deletions app/Http/Controllers/DashboardController.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,30 @@ public function dashboard(Request $request)
$user = $request->user();
$team = $user->currentTeam;
$projects = [];
$samples = [];

if ($team) {
$team->users = $team->allUsers();
if (! $team->personal_team) {
$projects = Project::with('users', 'owner')->where([['team_id', $team->id], ['is_deleted', false]])->orderBy('updated_at', 'DESC')->get();
$samples = Study::with('users', 'owner', 'sample.molecules')->where([['project_id', null], ['team_id', $team->id], ['is_deleted', false]])->orderBy('updated_at', 'DESC')->get();
} else {
$projects = Project::with('users', 'owner')->where([['owner_id', $user->id], ['is_deleted', false]])
->where('team_id', $team->id)
->orderBy('updated_at', 'DESC')
->get();

$samples = Study::with('users', 'owner')->where([['project_id', null], ['owner_id', $user->id], ['is_deleted', false]])
->where('team_id', $team->id)
->orderBy('updated_at', 'DESC')->get();
}
}

return Inertia::render('Dashboard', [
'filters' => $request->all('action', 'draft_id'),
'team' => $team,
'projects' => $projects->load('tags'),
'samples' => $samples->load('sample.molecules'),
'teamRole' => $user->teamRole($team),
]);
}
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/ProjectController.php
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ public function destroy(Request $request, StatefulGuard $guard, Project $project
]);
}

if ($project->status = 'processing' || $project->status = 'queued') {
if ($project->status == 'processing' || $project->status == 'queued') {
return redirect()->route('dashboard')->with('error', 'It is not possible to delete a project that is currently being processed or queued.');
} else {
$creator->delete($project);
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Middleware/HandleInertiaRequests.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public function share(Request $request)
'SCOUT_PREFIX' => (env('SCOUT_PREFIX')),
'europemcWSApi' => (env('EUROPEMC_WS_API')),
'dataciteURL' => env('DATACITE_ENDPOINT'),
'collOffPeriod' => env('COOL_OFF_PERIOD'),
'coolOffPeriod' => env('COOL_OFF_PERIOD'),
'mailFromAddress' => env('MAIL_FROM_ADDRESS'),
'orcidSearchApi' => env('ORCID_ID_SEARCH_API'),
'orcidPersonApi' => env('ORCID_ID_PERSON_API'),
Expand Down
2 changes: 1 addition & 1 deletion app/Policies/ProjectPolicy.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public function createProject(User $user)
*/
public function updateProject(User $user, Project $project)
{
if ($project->is_public || $project->is_archived || $project->is_deleted || $project->is_published) {
if ($project->is_public || $project->is_archived || $project->is_deleted || $project->is_published || (! $project->is_published && $project->doi)) {
return false;
}

Expand Down
158 changes: 105 additions & 53 deletions resources/js/Layouts/AppLayout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -131,25 +131,59 @@
aria-label="Sidebar"
class="flex flex-col items-center py-4 px-0"
>
<Link
v-for="item in filteredNavigation"
:key="item.name"
:href="item.href"
:class="[
$page.url === item.href
? ' border-r-4 bg-gray-200 border-r-black'
: '',
'w-full px-7 hover:bg-gray-700 hover:text-white group flex items-center py-3 text-sm font-medium ' +
item.bg,
]"
>
<component
:is="item.icon"
class="h-6 w-6"
aria-hidden="true"
/>
<span class="sr-only"> {{ item.name }} </span>
</Link>
<div v-for="item in filteredNavigation">
<div
v-if="!$page.props.user.first_name"
class="border-t"
>
&nbsp;
</div>
<Link
:key="item.name"
:href="item.href"
v-if="item.name"
:class="[
$page.url === item.href
? 'bg-gray-900 border-y text-white'
: 'bg-gray-200 border-y',
'w-full px-10 hover:bg-gray-700 hover:text-white group flex items-center py-4 text-md font-small ' +
item.bg,
]"
>
<component
:is="item.icon"
class="h-6 w-6"
aria-hidden="true"
/>
<span class="sr-only">
{{ item.name }}
</span>
</Link>
<Link
v-for="child in item.children"
:id="child.id"
:key="child.name"
:href="child.href"
:class="[
$page.url === child.href
? 'bg-gray-900 text-white'
: '',
'w-full px-10 hover:bg-gray-700 hover:text-white group flex items-center py-3 text-md font-small ' +
child.bg,
]"
>
<component
:is="child.icon"
class="h-6 w-6"
aria-hidden="true"
/>
<span class="flex-1 sr-only">
{{ child.name }}
</span>
</Link>
<div class="border-b">&nbsp;</div>
<div>&nbsp;</div>
</div>
</nav>
</div>
<div class="flex-shrink-0 flex pb-5"></div>
Expand Down Expand Up @@ -195,22 +229,23 @@
<div
v-for="item in filteredNavigation"
:key="item.name"
:class="[item.auth ? 'border-t' : '']"
:class="[item.auth ? 'border-t pb-4' : '']"
>
<div
v-if="item.prefix"
class="p-2 bg-gray-100 text-gray-500 text-sm border-b"
class="p-2 bg-gray-100 text-gray-500 text-sm border-y"
>
{{ item.prefix }}
</div>
<Link
:id="item.id"
:href="item.href"
v-if="item.name"
:class="[
$page.url === item.href
? ' border-r-4 bg-gray-200 border-r-black'
: '',
'w-full px-7 hover:bg-gray-700 hover:text-white group flex items-center py-3 text-sm font-medium ' +
'w-full px-7 hover:bg-gray-700 hover:text-white group flex items-center py-3 text-md font-medium ' +
item.bg,
]"
>
Expand All @@ -230,13 +265,13 @@
$page.url === child.href
? ' border-r-4 bg-gray-200 border-r-black'
: '',
'w-full px-10 hover:bg-gray-700 hover:text-white group flex items-center py-1.5 text-sm font-small ' +
'w-full px-10 hover:bg-gray-700 hover:text-white group flex items-center py-1.5 text-md font-small ' +
child.bg,
]"
>
<component
:is="child.icon"
class="mr-3 ml-2 h-4 w-4"
class="mr-3 ml-2 h-5 w-5"
aria-hidden="true"
/>
<span class="flex-1"> {{ child.name }} </span>
Expand Down Expand Up @@ -489,26 +524,37 @@
"
>
<div
v-if="
!$page.props.user.current_team
.personal_team
"
class="block px-4 pt-2 text-xs text-gray-400"
>
Personal Account
</div>
<form
v-if="
!$page.props.user.current_team
.personal_team
"
@submit.prevent="
switchToTeam(personalTeam)
"
>
<jet-dropdown-link as="button">
<div class="flex items-center">
<svg
v-if="
$page.props.user
.current_team
.personal_team
"
class="mr-2 h-5 w-5 text-green-400"
fill="none"
stroke-linecap="round"
stroke-linejoin="round"
stroke-width="2"
stroke="currentColor"
viewBox="0 0 24 24"
>
<path
d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"
></path>
</svg>
<svg
v-else
class="mr-2 h-5 w-5 text-gray-400"
fill="none"
stroke-linecap="round"
Expand All @@ -521,6 +567,7 @@
d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"
></path>
</svg>

<div>
{{
$page.props.user
Expand Down Expand Up @@ -739,27 +786,6 @@ const secondaryNavigation = [
];
const navigation = [
{
auth: false,
name: "Projects",
href: "/projects",
icon: FolderIcon,
bg: "bg-white",
},
{
auth: false,
name: "Spectra",
href: "/spectra",
icon: Squares2X2Icon,
bg: "bg-white",
},
{
auth: false,
name: "Compounds",
href: "/compounds",
icon: SwatchIcon,
bg: "bg-white",
},
{
auth: true,
name: "Dashboard",
Expand Down Expand Up @@ -803,6 +829,32 @@ const navigation = [
},
],
},
{
prefix: "Public",
children: [
{
auth: false,
name: "Projects",
href: "/projects",
icon: FolderIcon,
bg: "bg-white",
},
{
auth: false,
name: "Spectra",
href: "/spectra",
icon: Squares2X2Icon,
bg: "bg-white",
},
{
auth: false,
name: "Compounds",
href: "/compounds",
icon: SwatchIcon,
bg: "bg-white",
},
],
},
];
export default {
Expand Down
Loading

0 comments on commit e0f341c

Please sign in to comment.