1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-11-29 03:38:06 +00:00

Merge remote-tracking branch 'origin/3.0' into gh-pages

This commit is contained in:
github-actions 2022-09-06 23:07:02 +00:00
commit 60ac9abab8
11 changed files with 53 additions and 14 deletions

View File

@ -1,5 +1,16 @@
# Change Log
## 3.0.0a2 06/09/2022
* Add web-ui v3.0.0a2
* Upgrade FastAPI to v0.82.0
* API endpoint to get the locked status of a project
* Global project lock and unlock
* Update appliance files
* Require name for custom adapters. Fixes #2098
* Allow empty adapter slots for Dynamips templates. Ref https://github.com/GNS3/gns3-gui/issues/3373
* Use original $PATH in init.sh for Docker containers. Ref #2069
## 3.0.0a1 04/08/2022
* Bundle gns3-web-ui v3.0.0a1

View File

@ -30,7 +30,7 @@ import logging
log = logging.getLogger()
from fastapi import APIRouter, Depends, Request, Response, Body, HTTPException, status, WebSocket, WebSocketDisconnect
from fastapi import APIRouter, Depends, Request, Body, HTTPException, status, WebSocket, WebSocketDisconnect
from fastapi.encoders import jsonable_encoder
from fastapi.responses import StreamingResponse, FileResponse
from websockets.exceptions import ConnectionClosed, WebSocketException
@ -395,6 +395,15 @@ async def duplicate_project(
return new_project.asdict()
@router.get("/{project_id}/locked")
async def locked_project(project: Project = Depends(dep_project)) -> bool:
"""
Returns whether a project is locked or not
"""
return project.locked
@router.post("/{project_id}/lock", status_code=status.HTTP_204_NO_CONTENT)
async def lock_project(project: Project = Depends(dep_project)) -> None:
"""

View File

@ -1144,6 +1144,21 @@ class Project:
self.emit_notification("node.updated", node.asdict())
self.dump()
@property
@open_required
def locked(self):
"""
Check if all items in a project are locked and not
"""
for drawing in self._drawings.values():
if not drawing.locked:
return False
for node in self.nodes.values():
if not node.locked:
return False
return True
def dump(self):
"""
Dump topology to disk

View File

@ -59,7 +59,7 @@ class CrashReport:
Report crash to a third party service
"""
DSN = "https://db7d5c538c3642b281fd27bb2fb6349f@o19455.ingest.sentry.io/38482"
DSN = "https://bad2bd9ef9f14c8d9239d6f815ed453f@o19455.ingest.sentry.io/38482"
_instance = None
def __init__(self):

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -22,8 +22,8 @@
# or negative for a release candidate or beta (after the base version
# number has been incremented)
__version__ = "3.0.0dev4"
__version_info__ = (3, 0, 0, 99)
__version__ = "3.0.0a2"
__version_info__ = (3, 0, 0, -99)
if "dev" in __version__:
try:

View File

@ -1,5 +1,5 @@
uvicorn==0.18.3
fastapi==0.81.0
fastapi==0.82.0
python-multipart==0.0.5
websockets==10.3
aiohttp==3.8.1

View File

@ -511,6 +511,10 @@ async def test_lock_unlock(app: FastAPI, client: AsyncClient, project: Project,
for node in project.nodes.values():
assert node.locked is True
response = await client.get(app.url_path_for("locked_project", project_id=project.id))
assert response.status_code == status.HTTP_200_OK
assert response.json() is True
response = await client.post(app.url_path_for("unlock_project", project_id=project.id))
assert response.status_code == status.HTTP_204_NO_CONTENT