Skip to content

Commit

Permalink
add sidebar, worktree table, example rete editor
Browse files Browse the repository at this point in the history
  • Loading branch information
superstar54 committed Dec 10, 2023
1 parent 4bdae47 commit fd179b1
Show file tree
Hide file tree
Showing 14 changed files with 626 additions and 159 deletions.
31 changes: 29 additions & 2 deletions aiida_worktree/web/backend/app/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,35 @@ async def read_root() -> dict:
return {"message": "Welcome to your todo list."}


@app.get("/worktree-data")
async def read_worktree_data():
from fastapi import HTTPException
from aiida_worktree.cli.query_worktree import WorkTreeQueryBuilder

try:
relationships = {}
builder = WorkTreeQueryBuilder()
query_set = builder.get_query_set(
relationships=relationships,
# filters=filters,
# order_by={order_by: order_dir},
# past_days=past_days,
# limit=limit,
)
project = ["pk", "uuid", "state", "ctime", "mtime", "process_label"]
projected = builder.get_projected(query_set, projections=project)
# pop headers
projected.pop(0)
data = []
for p in projected:
data.append({project[i]: p[i] for i in range(len(project))})
return data
except KeyError:
raise HTTPException(status_code=404, detail=f"Worktree {id} not found")


@app.get("/worktree/{id}")
async def read_item(id: str):
async def read_worktree_item(id: int):
from fastapi import HTTPException
from .utils import worktree_to_json

Expand All @@ -38,6 +65,6 @@ async def read_item(id: str):
return
wtdata = deserialize_unsafe(wtdata)
content = worktree_to_json(wtdata)
return {"id": id, "content": content}
return content
except KeyError:
raise HTTPException(status_code=404, detail=f"Worktree {id} not found")
159 changes: 159 additions & 0 deletions aiida_worktree/web/frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions aiida_worktree/web/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"@fortawesome/free-solid-svg-icons": "^6.5.1",
"@fortawesome/react-fontawesome": "^0.2.0",
"@testing-library/jest-dom": "^5.17.0",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
Expand All @@ -15,6 +17,8 @@
"elkjs": "^0.8.2",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-paginate": "^8.2.0",
"react-router-dom": "^6.20.1",
"react-scripts": "5.0.1",
"rete": "^2.0.2",
"rete-area-3d-plugin": "^2.0.3",
Expand Down
Loading

0 comments on commit fd179b1

Please sign in to comment.