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

Composition API Migration for moving towards real-time collaboration #186

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
1e3ef5c
First steps of work in progress to migrate towards using the composit…
SeriousHorncat Oct 11, 2024
48f8a1d
work in progress for revising tests for composition API and first pas…
SeriousHorncat Oct 15, 2024
a59a079
Linting and unit testing pass; moving on to system testing
SeriousHorncat Oct 15, 2024
55709cb
Fixed issues discovered during system testing with the first pass of …
SeriousHorncat Oct 15, 2024
d4a1831
first draft of testing done; cut time down in half but its still taki…
SeriousHorncat Oct 23, 2024
8ff6416
Work in progress for migrating a view to use the composition API and …
SeriousHorncat Oct 29, 2024
481ef4a
Cleaned up the migration of quite a bit buisness logic to the analysi…
SeriousHorncat Oct 30, 2024
261e7ad
Fixed a system test to wait until the page loads to
SeriousHorncat Oct 30, 2024
5795442
system tests
SeriousHorncat Oct 30, 2024
a35f9d7
updated system tests for real
SeriousHorncat Oct 30, 2024
fe98a79
Resolved linting issues that were discovered on push
SeriousHorncat Oct 31, 2024
9a94440
Finished cleaning up unit tests for the migrated toast code, and upda…
SeriousHorncat Nov 1, 2024
e97b71a
Renaming the RosalutionToast to ToastDialog to correspond with the ot…
SeriousHorncat Nov 8, 2024
9140cc8
Updated comments to organize sections of the code a bit easier.
SeriousHorncat Nov 8, 2024
b7cc0bf
Secured the specific endpoints by requiring an authenticated user to …
SeriousHorncat Nov 19, 2024
23df1b8
Missed formatting
SeriousHorncat Nov 19, 2024
821c13e
Updated system test to force click in the situation the menu visibili…
SeriousHorncat Nov 19, 2024
8dfffa0
Fixed the 'AS' characters for the dockerfiles and fixing the accident…
SeriousHorncat Nov 22, 2024
c5ef145
Fixed issue Rabab found in review; where the store was not switching …
SeriousHorncat Dec 2, 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
4 changes: 2 additions & 2 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Local Development Stage
FROM python:3.11-slim-bookworm as development-stage
FROM python:3.11-slim-bookworm AS development-stage
WORKDIR /app
COPY requirements.txt /app/requirements.txt
RUN pip install --no-cache-dir --upgrade -r /app/requirements.txt
COPY ./src /app/src
ENTRYPOINT ["/bin/sh", "-c", "uvicorn src.main:app --host 0.0.0.0 --port 8000 --log-level info --reload"]

# Production Build Stage
FROM python:3.11-slim-bookworm as production-stage
FROM python:3.11-slim-bookworm AS production-stage
WORKDIR /app
COPY logging.conf /app/logging.conf
COPY requirements.txt /app/requirements.txt
Expand Down
6 changes: 5 additions & 1 deletion backend/src/routers/analysis_discussion_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@


@router.get("/{analysis_name}/discussions")
def get_analysis_discussions(analysis_name: str, repositories=Depends(database)):
def get_analysis_discussions(
analysis_name: str,
repositories=Depends(database),
username: VerifyUser = Security(get_current_user) #pylint: disable=unused-argument
):
""" Returns a list of discussion posts for a given analysis """

found_analysis = repositories['analysis'].find_by_name(analysis_name)
Expand Down
27 changes: 20 additions & 7 deletions backend/src/routers/analysis_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@


@router.get("", tags=["analysis"], response_model=List[Analysis])
def get_all_analyses(repositories=Depends(database)):
def get_all_analyses(repositories=Depends(database), username: VerifyUser = Security(get_current_user)): #pylint: disable=unused-argument
"""Returns every analysis available"""
return repositories["analysis"].all()

Expand Down Expand Up @@ -76,7 +76,11 @@ async def create_file(


@router.get("/{analysis_name}", tags=["analysis"], response_model=Analysis, response_model_exclude_none=True)
def get_analysis_by_name(analysis_name: str, repositories=Depends(database)):
def get_analysis_by_name(
analysis_name: str,
repositories=Depends(database),
username: VerifyUser = Security(get_current_user) #pylint: disable=unused-argument
):
"""Returns analysis case data by calling method to find case by it's analysis_name"""
analysis = repositories["analysis"].find_by_name(analysis_name)

Expand Down Expand Up @@ -116,15 +120,24 @@ def update_event(
raise HTTPException(status_code=409, detail=str(exception)) from exception


@router.get("/download/{file_id}")
def download_file_by_id(file_id: str, repositories=Depends(database)):
@router.get("/download/{file_id}", tags=["analysis"])
def download_file_by_id(
file_id: str,
repositories=Depends(database),
username: VerifyUser = Security(get_current_user) #pylint: disable=unused-argument
):
""" Returns a file from GridFS using the file's id """
grid_fs_file = repositories['bucket'].stream_analysis_file_by_id(file_id)
return StreamingResponse(grid_fs_file, media_type=grid_fs_file.content_type)


@router.get("/{analysis_name}/download/{file_name}")
def download(analysis_name: str, file_name: str, repositories=Depends(database)):
@router.get("/{analysis_name}/download/{file_name}", tags=["analysis"])
def download(
analysis_name: str,
file_name: str,
repositories=Depends(database),
username: VerifyUser = Security(get_current_user) #pylint: disable=unused-argument
):
""" Returns a file saved to an analysis from GridFS by file name """
# Does file exist by name in the given analysis?
file = repositories['analysis'].find_file_by_name(analysis_name, file_name)
Expand All @@ -135,7 +148,7 @@ def download(analysis_name: str, file_name: str, repositories=Depends(database))
return StreamingResponse(repositories['bucket'].stream_analysis_file_by_id(file['attachment_id']))


@router.put("/{analysis_name}/attach/{third_party_enum}")
@router.put("/{analysis_name}/attach/{third_party_enum}", tags=["analysis"])
def attach_third_party_link(
analysis_name: str,
third_party_enum: ThirdPartyLinkType,
Expand Down
1 change: 1 addition & 0 deletions backend/src/routers/annotation_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def annotate_analysis(
background_tasks: BackgroundTasks,
repositories=Depends(database),
annotation_task_queue=Depends(annotation_queue),
authorized=Security(get_authorization, scopes=["write"]) #pylint: disable=unused-argument
):
"""
Placeholder to initiate annotations for an analysis. This queueing/running
Expand Down
2 changes: 0 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: '3.5'

services:
reverse-proxy:
image: traefik
Expand Down
6 changes: 3 additions & 3 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Local development stage
FROM node:20.8-alpine3.18 as development-stage
FROM node:20.8-alpine3.18 AS development-stage
WORKDIR /app
COPY package.json /app/
COPY yarn.lock /app/
Expand All @@ -10,7 +10,7 @@ EXPOSE 3000
ENTRYPOINT ["yarn", "dev:host"]

# Production Build stage
FROM node:20.8-alpine3.18 as production-build
FROM node:20.8-alpine3.18 AS production-build
WORKDIR /app
COPY ./src /app/src/
COPY package.json /app/
Expand All @@ -23,7 +23,7 @@ ENV VITE_ROSALUTION_VERSION=$VERSION_BUILD_TAG

RUN yarn install --frozen-lockfile && yarn build --base=/rosalution/

FROM nginx:1.25.2-alpine3.18 as production-stage
FROM nginx:1.25.2-alpine3.18 AS production-stage

COPY etc/default.conf /etc/nginx/conf.d/
COPY --from=production-build /app/dist/ /usr/share/nginx/html/
Expand Down
2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"@fortawesome/free-solid-svg-icons": "6.4.2",
"@fortawesome/vue-fontawesome": "3.0.3",
"@rollup/plugin-strip": "3.0.4",
"vue": "3.3.4",
"vue": "3.5.12",
"vue-router": "4.2.5"
},
"devDependencies": {
Expand Down
38 changes: 38 additions & 0 deletions frontend/src/components/AnalysisView/useActionMenu.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import {ref} from 'vue';
import {StatusType, getWorkflowStatusIcon} from '@/config.js';


/**
* Builds an actionMenu that can be used for the main header
* @return {Object} {actionChoices, builder} to return the actions to render and the builder to update the choices
*/
export function useActionMenu() {
const actionChoices = ref([]);

const builder = {
addWorkflowActions: (latest, operation) => {
if ( latest in StatusType ) {
for ( const [text, nextEvent, nextStatus] of StatusType[latest].transitions) {
builder.addMenuAction(text, getWorkflowStatusIcon(nextStatus), () => {
operation(nextEvent);
});
}
}
},
addMenuAction: (text, icon, operation) => {
actionChoices.value.push({
icon: icon,
text: text,
operation: operation,
});
},
addDivider: () => {
actionChoices.value.push({divider: true});
},
clear: () => {
actionChoices.value = [];
},
};

return {actionChoices, builder};
}
134 changes: 0 additions & 134 deletions frontend/src/components/Dialogs/Toast.vue

This file was deleted.

Loading