Skip to content

Commit

Permalink
Merge pull request #409 from pepkit/dev
Browse files Browse the repository at this point in the history
Release 0.14.3
  • Loading branch information
khoroshevskyi authored Dec 5, 2024
2 parents 1cd0071 + 533be4c commit 57ca04b
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 14 deletions.
5 changes: 5 additions & 0 deletions pephub/dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ def get_organizations_from_session_info(
organizations = []
if session_info:
organizations = session_info.get("orgs")
if organizations:
organizations = [x.lower() for x in organizations]
return organizations


Expand All @@ -171,6 +173,8 @@ def get_user_from_session_info(
user = None
if session_info:
user = session_info.get("login")
if user:
user = user.lower()
return user


Expand All @@ -186,6 +190,7 @@ def get_namespace_access_list(
if user:
access_rights.append(user)
access_rights.extend(orgs)
access_rights = [x.lower() for x in access_rights]
return access_rights
else:
return []
Expand Down
2 changes: 1 addition & 1 deletion pephub/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def zip_pep(project: Dict[str, Any]) -> Response:
project_name = config[NAME_KEY]

if project[SAMPLE_RAW_DICT_KEY] is not None:
config[CFG_SAMPLE_TABLE_KEY] = ["sample_table.csv"]
config[CFG_SAMPLE_TABLE_KEY] = "sample_table.csv"
content_to_zip["sample_table.csv"] = pd.DataFrame(
project[SAMPLE_RAW_DICT_KEY]
).to_csv(index=False)
Expand Down
4 changes: 4 additions & 0 deletions pephub/routers/auth/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,11 +165,15 @@ def callback(
"https://api.github.com/user",
headers={"Authorization": f"Bearer {x['access_token']}"},
).json()
if "login" in u:
u["login"] = u["login"].lower()

organizations = requests.get(
u["organizations_url"],
headers={"Authorization": f"Bearer {x['access_token']}"},
).json()
for org in organizations:
org["login"] = org["login"].lower()

# encode the token
token = CLIAuthSystem.jwt_encode_user_data(
Expand Down
27 changes: 14 additions & 13 deletions web/src/components/forms/project-upload-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import { useSession } from '../../contexts/session-context';
import { useUploadMutation } from '../../hooks/mutations/useUploadMutation';
import { popFileFromFileList } from '../../utils/dragndrop';
import { GitHubAvatar } from '../badges/github-avatar';
import { CombinedErrorMessage } from './components/combined-error-message';
import { FileDropZone } from './components/file-dropzone';
import { SchemaDropdown } from './components/schemas-databio-dropdown';
import { CombinedErrorMessage } from './components/combined-error-message'

interface FromFileInputs {
is_private: boolean;
Expand Down Expand Up @@ -106,29 +106,29 @@ export const ProjectUploadForm = ({ onHide, defaultNamespace }: Props) => {
{...register('name', {
required: {
value: true,
message: "empty",
message: 'empty',
},
pattern: {
value: /^[a-zA-Z0-9_-]+$/,
message: "invalid",
message: 'invalid',
},
})}
/>
<span className="mx-1 mb-1">:</span>
</div>
<div className="d-flex flex-row align-items-center justify-content-between w-full ">
<input
<input
{...register('tag', {
required: false,
required: false,
pattern: {
value: /^[a-zA-Z0-9_-]+$/,
message: "invalid",
message: 'invalid',
},
})}
id="tag"
type="text"
className="form-control"
placeholder="default"
id="tag"
type="text"
className="form-control"
placeholder="default"
/>
</div>
</div>
Expand Down Expand Up @@ -185,8 +185,9 @@ export const ProjectUploadForm = ({ onHide, defaultNamespace }: Props) => {
) : (
<FileDropZone name="files" control={control} multiple={true} innerRef={fileDialogRef} />
)}
<p className='text-xs mt-1'>
* Namespace and Project Name are required. A tag value of "default" will be supplied if the Tag input is left empty.
<p className="text-xs mt-1">
* Namespace and Project Name are required. A tag value of "default" will be supplied if the Tag input is left
empty.
</p>
<div className="mt-3">
<button
Expand All @@ -202,7 +203,7 @@ export const ProjectUploadForm = ({ onHide, defaultNamespace }: Props) => {
isPrivate,
description,
files: uploadFiles,
pepSchema,
pepSchema: pepSchema || 'databio/pep-2.1.0',
},
{
onSuccess: () => {
Expand Down

0 comments on commit 57ca04b

Please sign in to comment.