Skip to content

Commit

Permalink
Merge pull request #216 from pepkit/dev
Browse files Browse the repository at this point in the history
Release `v0.9.7`
  • Loading branch information
nleroy917 authored Jul 24, 2023
2 parents 03c6fcb + 3abe123 commit e5445e0
Show file tree
Hide file tree
Showing 9 changed files with 153 additions and 19 deletions.
7 changes: 7 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html) and [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) format.

## [0.9.7] - 07-24-2023

### Fixed

- sample table would exhibit odd, erratic behavior if column names were left blank
- alnding page styling was not otpimal

## [0.9.6] - 07-20-2023

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion pephub/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.9.6"
__version__ = "0.9.7"
24 changes: 24 additions & 0 deletions pephub/routers/api/v1/namespace.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ async def get_namespace(
):
"""
Fetch namespace. Returns a JSON representation of the namespace.
Don't have a namespace?
Use the following:
namespace: databio
"""
nspace = nspace.dict()
nspace["projects_endpoint"] = f"{str(request.url)[:-1]}/projects"
Expand All @@ -60,6 +66,12 @@ async def get_namespace_projects(
):
"""
Fetch the projects for a particular namespace
Don't have a namespace?
Use the following:
namespace: databio
"""

# TODO, this API will change. Searching
Expand Down Expand Up @@ -118,6 +130,12 @@ async def create_pep(
),
agent: PEPDatabaseAgent = Depends(get_db),
):
"""
Create a PEP for a particular namespace you have write access to.
Don't know your namespace? Log in to see.
"""
if files is not None:
init_file = parse_user_file_upload(files)
init_file, other_files = split_upload_files_on_init_file(files, init_file)
Expand Down Expand Up @@ -226,6 +244,12 @@ async def upload_raw_pep(
project_from_json: ProjectJsonRequest,
agent: PEPDatabaseAgent = Depends(get_db),
):
"""
Upload a raw project for a particular namespace you have write access to.
Don't know your namespace? Log in to see.
"""
try:
is_private = project_from_json.is_private
tag = project_from_json.tag
Expand Down
82 changes: 81 additions & 1 deletion pephub/routers/api/v1/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,14 @@ async def get_a_pep(
):
"""
Fetch a PEP from a certain namespace
Don't have a namespace or project?
Use the following:
project: example
namespace: databio
"""
if not isinstance(proj, peppy.Project):
try:
Expand Down Expand Up @@ -93,6 +101,13 @@ async def update_a_pep(
):
"""
Update a PEP from a certain namespace
Don't have a namespace or project?
Use the following:
project: example
namespace: databio
"""
# if not logged in, they cant update
if namespace not in (list_of_admins or []):
Expand Down Expand Up @@ -255,6 +270,16 @@ async def get_pep_samples(
format: Optional[str] = None,
raw: Optional[bool] = False,
):
"""
Get samples from a certain project and namespace
Don't have a namespace or project?
Use the following:
project: example
namespace: databio
"""
if format is not None:
conversion_func: Callable = SAMPLE_CONVERSION_FUNCTIONS.get(format, None)
if conversion_func is not None:
Expand Down Expand Up @@ -288,6 +313,16 @@ async def get_pep_samples(
format: Optional[Literal["JSON", "String"]] = "JSON",
raw: Optional[bool] = False,
):
"""
Get project configuration file from a certain project and namespace
Don't have a namespace or project?
Use the following:
project: example
namespace: databio
"""
if raw:
proj_config = proj[CONFIG_KEY]
else:
Expand All @@ -303,6 +338,17 @@ async def get_pep_samples(

@project.get("/samples/{sample_name}")
async def get_sample(sample_name: str, proj: peppy.Project = Depends(get_project)):
"""
Get a particular sample from a certain project and namespace
Don't have a sample name, namespace, or project?
Use the following:
sample_name: 4-1_11102016
project: example
namespace: databio
"""
if sample_name not in get_project_sample_names(proj):
raise HTTPException(status_code=404, detail=f"sample '{sample_name}' not found")
sample = proj.get_sample(sample_name)
Expand All @@ -314,6 +360,16 @@ async def get_subsamples(
proj: peppy.Project = Depends(get_project),
download: bool = False,
):
"""
Get subsamples from a certain project and namespace
Don't have a namespace, or project?
Use the following:
project: example
namespace: databio
"""
subsamples = proj[SUBSAMPLE_RAW_LIST_KEY]
if subsamples is not None:
try:
Expand Down Expand Up @@ -353,6 +409,14 @@ async def convert_pep(
See, http://eido.databio.org/en/latest/filters/#convert-a-pep-into-an-alternative-format-with-a-filter
for more information.
Don't have a namespace, or project?
Use the following:
project: example
namespace: databio
"""
# default to basic
if filter is None:
Expand Down Expand Up @@ -381,7 +445,17 @@ async def convert_pep(

@project.get("/zip")
async def zip_pep_for_download(proj: peppy.Project = Depends(get_project)):
"""Zip a pep"""
"""
Zip a pep
Don't have a namespace, or project?
Use the following:
project: example
namespace: databio
"""
return zip_pep(proj)


Expand All @@ -396,6 +470,12 @@ async def fork_pep_to_namespace(
proj_annotation: AnnotationModel = Depends(get_project_annotation),
agent: PEPDatabaseAgent = Depends(get_db),
):
"""
Fork a project for a particular namespace you have write access to.
Don't know your namespace and/project? Log in to see.
"""
fork_to = fork_request.fork_to
fork_name = fork_request.fork_name
fork_tag = fork_request.fork_tag
Expand Down
6 changes: 3 additions & 3 deletions pephub/routers/eido/eido.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from starlette.requests import Request
from starlette.responses import JSONResponse
from typing import List, Tuple
from pepdbagent.utils import registry_path_converter

from ...helpers import parse_user_file_upload, split_upload_files_on_init_file
from ...dependencies import *
Expand Down Expand Up @@ -79,9 +80,8 @@ async def validate(
)

if pep_registry is not None:
# split into namespace, name, tag
namespace, name_tag = pep_registry.split("/")
name, tag = name_tag.split(":")
namespace, name, tag = registry_path_converter(pep_registry)
tag = tag or DEFAULT_TAG
p = agent.project.get(namespace, name, tag)
else:
init_file = parse_user_file_upload(pep_files)
Expand Down
14 changes: 5 additions & 9 deletions web/src/components/layout/landing-paths.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,7 @@ export const LandingPaths: FC = () => {
>
<a href={'/databio/example'}>
<motion.div
className="bottom-right-landing-icon fw-bold text-primary bg-gradient rounded shadow border bg-white border-primary cursor-pointer d-flex flex-row align-items-center justify-content-center"
// "sink in" on hover
className="bottom-right-landing-icon landing-icon-border fw-bold text-primary bg-gradient rounded shadow bg-white cursor-pointer d-flex flex-row align-items-center justify-content-center"
whileHover={{ scale: 1.05 }}
>
<i className="bi bi-eye-fill me-1"></i>
Expand All @@ -91,18 +90,16 @@ export const LandingPaths: FC = () => {
</a>
<a href="databio/example?fork=true">
<motion.div
className="top-right-landing-icon fw-bold text-primary bg-gradient rounded shadow border bg-white border-primary cursor-pointer d-flex flex-row align-items-center justify-content-center"
// "sink in" on hover
className="top-right-landing-icon landing-icon-border fw-bold text-primary bg-gradient rounded shadow bg-white cursor-pointer d-flex flex-row align-items-center justify-content-center"
whileHover={{ scale: 1.05 }}
>
<img src="/github-branch-primary.svg" height="20px" className="me-1" />
Fork PEP
</motion.div>
</a>
<a href={'/validate?pepRegistryPath=databio/example'}>
<a href={'/validate?pepRegistryPath=databio/example:default'}>
<motion.div
className="bottom-left-landing-icon fw-bold text-primary bg-gradient rounded shadow border bg-white border-primary cursor-pointer d-flex flex-row align-items-center justify-content-center"
// "sink in" on hover
className="bottom-left-landing-icon landing-icon-border fw-bold text-primary bg-gradient rounded shadow bg-white cursor-pointer d-flex flex-row align-items-center justify-content-center"
whileHover={{ scale: 1.05 }}
style={{}}
>
Expand All @@ -112,8 +109,7 @@ export const LandingPaths: FC = () => {
</a>
<a href={`${API_HOST}/api/v1/projects/databio/example`}>
<motion.div
className="top-left-landing-icon fw-bold text-primary bg-gradient rounded shadow border bg-white border-primary cursor-pointer d-flex flex-row align-items-center justify-content-center"
// "sink in" on hover
className="top-left-landing-icon landing-icon-border fw-bold text-primary bg-gradient rounded shadow bg-white cursor-pointer d-flex flex-row align-items-center justify-content-center"
whileHover={{ scale: 1.05 }}
>
<i className="bi bi-download me-1"></i>
Expand Down
22 changes: 22 additions & 0 deletions web/src/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,14 @@
box-shadow: 0 0 5px #ccc inset;
}

/* on mobile, remove all x-margins */
@media screen and (max-width: 990px) {
.landing-table-container {
margin-left: 0px !important;
margin-right: 0px !important;
}
}

/* subtle glow animation */
.landing-paths {
transform: translateY(-40%) translateX(-5%);
Expand All @@ -334,6 +342,20 @@
}
}

.landing-icon-border {
border: 1px solid;
animation: border-glow 1s ease-in-out infinite alternate;
}

@keyframes border-glow {
from {
border-color: #7ab9fd;
}
to {
border-color: #0d6efd;
}
}

.top-left-landing-icon {
position: absolute;
bottom: 332px;
Expand Down
4 changes: 2 additions & 2 deletions web/src/pages/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ function Home() {
</MotionButton>
)}
<a href="/validate">
<MotionButton className="mt-1 btn btn-outline-dark btn-lg me-3">
<MotionButton className="btn btn-outline-dark btn-lg me-3">
<i className="bi bi-check2-circle me-1"></i>Validation
</MotionButton>
</a>
Expand Down Expand Up @@ -98,7 +98,7 @@ function Home() {
</div>
</div>
<div className="col-lg-6 col-sm-12 align-items-center">
<div className="mt-5 ms-5">
<div className="mt-5 ms-5 landing-table-container">
<div className="position-relative">
<div className="mobile-gaurd">
<LandingPaths />
Expand Down
11 changes: 8 additions & 3 deletions web/src/utils/sample-table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,14 @@ export const arraysToSampleList = (arraysList: any[][]) => {
// first row is the header row
let headerRow = arraysList[0];

// look for null values, simply populate with the column name
headerRow = headerRow.map((cell, index) => {
if (!cell) {
return `column_${index + 1}`;
}
return cell;
});

if (headerRow.every((cell) => !cell)) {
toast.error('Header row cannot be empty! Please add at least one column name.');
return [];
Expand All @@ -80,9 +88,6 @@ export const arraysToSampleList = (arraysList: any[][]) => {
const theRest = arraysList.slice(1);
const sampleList: Sample[] = [];

// restrict header row to only contain non-null values
headerRow = headerRow.filter((key) => key !== null && key !== undefined);

// if there's only a header row, return a list with one sample where all the property values are null
if (arraysAreEmpty(theRest)) {
const sample: Sample = {};
Expand Down

0 comments on commit e5445e0

Please sign in to comment.