Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge UI fixes and metadata standardizer #365

Merged
merged 49 commits into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
db93de2
deleting view that is selected now unselects the view selector
sanghoonio Aug 5, 2024
057803a
rounded corner in schema select dropdown
sanghoonio Aug 5, 2024
7905ce6
added modal for no schema yellow button and prevented clearing schema…
sanghoonio Aug 5, 2024
15d7b14
missed closing div
sanghoonio Aug 6, 2024
25b6fe4
metadata standardizer modal
sanghoonio Aug 12, 2024
9ecb06e
standardizer ui kinda works
sanghoonio Aug 13, 2024
fe4bbc3
some changes to modal
sanghoonio Aug 13, 2024
84b4dd6
more standardizer ui progress
sanghoonio Aug 15, 2024
862f891
progress on standardizer api, trouble using hook to refetch it
sanghoonio Aug 16, 2024
a69d512
small tweaks
nleroy917 Aug 16, 2024
3030166
metadata standardizer api integration
sanghoonio Aug 16, 2024
eaca413
black
sanghoonio Aug 16, 2024
b0c4273
fix type errors
sanghoonio Aug 19, 2024
269f172
api updates
sanghoonio Aug 19, 2024
720709e
black
sanghoonio Aug 19, 2024
126ce7e
fixed bugs caused by trying to standardize columns multiple times bef…
sanghoonio Aug 19, 2024
5a7739c
address #368, #369, #370, #374
sanghoonio Aug 26, 2024
d11283c
fixed namespace bug and made ph_id read only #364
sanghoonio Aug 27, 2024
d1d57d4
add feedback and bug links
sanghoonio Aug 27, 2024
373e763
update some colors and shadows
sanghoonio Aug 27, 2024
4a40bee
more colors
sanghoonio Aug 27, 2024
e3967d6
address #376, #373, #372, #371, #366. undo changes made for #364 beca…
sanghoonio Aug 28, 2024
0257a94
update toast notifications for blank pep form
sanghoonio Aug 28, 2024
842a6b9
comment out standardizer endpoints for now. address #375
sanghoonio Aug 28, 2024
3fd7285
black
sanghoonio Aug 28, 2024
0812106
ui fixes
sanghoonio Aug 28, 2024
adab06a
fix type errors
sanghoonio Aug 29, 2024
c2a1b5b
view modal ui and some color changes
sanghoonio Aug 30, 2024
476b0c8
modal ui update
sanghoonio Aug 30, 2024
b985284
standardizer api debug
sanghoonio Sep 3, 2024
b713d21
push api
sanghoonio Sep 3, 2024
637e2db
Fixed prj object in standardizer
khoroshevskyi Sep 3, 2024
4acb645
reset standardizer modal on save and fix namespace colors
sanghoonio Sep 3, 2024
44a537f
remove printlines
sanghoonio Sep 3, 2024
0283627
rearrange fork modal helper text
sanghoonio Sep 3, 2024
baee6da
namespace ui updates
sanghoonio Sep 3, 2024
c47e93f
namespace consistency
sanghoonio Sep 3, 2024
b009019
add pep modal ui update
sanghoonio Sep 4, 2024
df45f4a
update fork pep modal ui
sanghoonio Sep 4, 2024
1e1f8e6
ui polish
sanghoonio Sep 4, 2024
2e612ed
css trickery
sanghoonio Sep 4, 2024
dee5419
missed button alignment in add pep modal
sanghoonio Sep 4, 2024
c23d532
border radius
sanghoonio Sep 4, 2024
1a351da
logo resize
sanghoonio Sep 4, 2024
04f61b9
class changes
sanghoonio Sep 4, 2024
fcadcc4
edit metadata modal update
sanghoonio Sep 4, 2024
36573cb
fixed namespace, name, and tag input checks not working in modals
sanghoonio Sep 4, 2024
de41801
fix sampletable whitespace causing issues
sanghoonio Sep 4, 2024
cdd444b
address pr comments
sanghoonio Sep 5, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions pephub/routers/api/v1/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
ConfigResponseModel,
)
from .helpers import verify_updated_project
from attribute_standardizer.attr_standardizer_class import AttrStandardizer
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know this isnt pephub but I still wanna say I don't like the ergonomics of this import 🙃

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed a little bit bedbs, so now you can do: from attribute_standardizer import AttrStandardizer

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you push to bedms?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is already there, I added it with input changes


_LOGGER = logging.getLogger(__name__)

Expand Down Expand Up @@ -1138,3 +1139,33 @@ def delete_full_history(
status_code=400,
detail="Could not delete history. Server error.",
)


@project.get(
nleroy917 marked this conversation as resolved.
Show resolved Hide resolved
"/standardize",
summary="Standardize PEP metadata column headers",
nleroy917 marked this conversation as resolved.
Show resolved Hide resolved
)
async def get_standardized_cols(
namespace: str, project: str, tag: Optional[str] = DEFAULT_TAG, schema: str = ""
):
"""
Standardize PEP metadata column headers using BEDmess.

Args:
- pep (str): PEP string to be standardized
- schema (str): Schema for AttrStandardizer
nleroy917 marked this conversation as resolved.
Show resolved Hide resolved

Returns:
- dict: Standardized results
"""

if schema == "":
nleroy917 marked this conversation as resolved.
Show resolved Hide resolved
return {}

path = namespace + "/" + project + ":" + tag
print(path)
nleroy917 marked this conversation as resolved.
Show resolved Hide resolved

model = AttrStandardizer(schema)

results = model.standardize(pep=path)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems a little inefficient, no? We are already on PEPhub, but it seems like the attribute standardized is getting it... from PEPhub? But we are already there so its making a request to itself.

This is probably an implementation detail in AttrStandardizer... so we should raise an issue there, but I really feel like we should be able to just pass a peppy.Project object to it directly

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch

return {"results": results}
21 changes: 21 additions & 0 deletions web/src/api/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,14 @@ export type RestoreProjectFromHistoryResponse = {
registry: string;
};

export type StandardizeColsResponse = {
results: {
[key: string]: {
[key: string]: number;
};
};
};

export const getProject = (
namespace: string,
projectName: string,
Expand Down Expand Up @@ -404,3 +412,16 @@ export const restoreProjectFromHistory = (
const url = `${API_BASE}/projects/${namespace}/${name}/history/${historyId}/restore?tag=${tag}`;
return axios.post<RestoreProjectFromHistoryResponse>(url, {}, { headers: { Authorization: `Bearer ${jwt}` } });
};

export const getStandardizedCols = (
namespace: string,
name: string,
tag: string,
jwt: string | null,
schema: string,
) => {
const url = `${API_BASE}/projects/${namespace}/${name}/standardize?schema=${schema}&tag=${tag}`;
return axios
.get<StandardizeColsResponse>(url, { headers: { Authorization: `Bearer ${jwt}` } })
.then((res) => res.data);
};
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,15 @@ const SchemaDropdown: FC<Props> = ({ value, onChange, showDownload = true }) =>
onChange(newValue?.value || '');
}}
placeholder={isLoading ? 'Fetching schemas...' : 'Assign a schema...'}
isClearable
// isClearable
menuPlacement="top"
className="w-100"
styles={{
control: (provided) => ({
...provided,
borderRadius: '.33333em',
})
}}
/>
{showDownload && (
<a
Expand Down
4 changes: 3 additions & 1 deletion web/src/components/modals/add-view-options.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ type Props = {
show: boolean;
onHide: () => void;
filteredSamples: string[];
deleteView: (deletedView: string) => void;
};

type FormValues = {
Expand All @@ -30,7 +31,7 @@ type ViewOption = {
};

export const ViewOptionsModal = (props: Props) => {
const { show, onHide, filteredSamples } = props;
const { show, onHide, filteredSamples, deleteView } = props;

const { namespace, projectName, tag } = useProjectPage();

Expand Down Expand Up @@ -67,6 +68,7 @@ export const ViewOptionsModal = (props: Props) => {
}
viewMutations.removeViewMutation.mutate(selectedViewDelete.value);
setSelectedViewDelete(null);
deleteView(selectedViewDelete.value)
};

const onSubmit = () => {
Expand Down
Loading
Loading