mirror of
https://github.com/outscale/zabbix-super-vision.git
synced 2024-11-14 12:25:47 +01:00
f2235d4b45
- using fastAPI - offline/online working - warning if ZABBIX API is too long - showing settings - showing last ack message - showing procedure - menu split by SU team
30 lines
785 B
Python
30 lines
785 B
Python
from typing import Optional
|
|
|
|
from fastapi import Form
|
|
from fastapi.responses import RedirectResponse
|
|
|
|
from schemas.notes import Note, NoteManager
|
|
from super_server import app
|
|
|
|
|
|
@app.post("/post")
|
|
async def post_note(
|
|
name: str = Form(...),
|
|
msg: str = Form(...),
|
|
url: Optional[str] = Form(None),
|
|
lvl: str = Form(...),
|
|
team: str = Form(...),
|
|
save: Optional[str] = Form(None),
|
|
):
|
|
note = Note(name=name, msg=msg, url=url, lvl=lvl, team=team, save=save)
|
|
await NoteManager().add_note(note)
|
|
return RedirectResponse(url="/", status_code=303)
|
|
|
|
|
|
@app.post("/del")
|
|
async def del_note(
|
|
note_id: Optional[str] = Form(None), url: Optional[str] = Form(None)
|
|
):
|
|
await NoteManager().delete_note(note_id)
|
|
return RedirectResponse(url="/", status_code=303)
|