Skip to content

Commit

Permalink
feat: update models table and functions for display order
Browse files Browse the repository at this point in the history
fix: Get reorder path working

fix: Bad merge

fix: Hide reorder button from non-managers

refactor: remove unused comments

style: Clean up reorder modal

feat: Add function to update a group of models, use for model reordering

fix: Remove unused imports

feat: order models by id when no display order has been set

docs: Add missing license headers

fix: Remove excess declaration and format files

fix: Rename angular functions to meet linter standards

fix: eslint styling

fix: Move display order out of post model

test: Add test to patch model display order

fix: Revert unecessary angular function name changes

This reverts commit e876fed.

build: Update frontend versions

build(deps-dev): bump alembic from 1.12.0 to 1.12.1 in /backend

Bumps [alembic](https://github.com/sqlalchemy/alembic) from 1.12.0 to 1.12.1.
- [Release notes](https://github.com/sqlalchemy/alembic/releases)
- [Changelog](https://github.com/sqlalchemy/alembic/blob/main/CHANGES)
- [Commits](https://github.com/sqlalchemy/alembic/commits)

---
updated-dependencies:
- dependency-name: alembic
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>

docs(user): Add instructions for secondary click on macOS

The usual option to press `Control` while clicking doesn't work
in RDP-sessions on macOS. The `Control` can't be evaluated and mapped
properly. It's passed to the Linux container, which can't handle the
`Control` key.

refactor: Create floating window mgr component

feat: Add tiling window manager with slider

build: Update frontend versions

fix(session-viewer): Disable pointer event while resizing sessions

This commit fixes a small bug that was introduced in #1150.

When the pointer events are not disabled on the iframe, some pointer events
are "stolen" by the iframe. Therefore, they can not be used by our event handlers.
This led to a "jumpy" behaviour while resizing.

fix: Get reorder path working

fix: Undo rebase errors

feat: Add tiling window manager with slider

fix: Get reorder path working

Revert "build: Update frontend versions"

This reverts commit 800f6ce.

build: Update frontend versions

build(deps-dev): bump alembic from 1.12.0 to 1.12.1 in /backend

Bumps [alembic](https://github.com/sqlalchemy/alembic) from 1.12.0 to 1.12.1.
- [Release notes](https://github.com/sqlalchemy/alembic/releases)
- [Changelog](https://github.com/sqlalchemy/alembic/blob/main/CHANGES)
- [Commits](https://github.com/sqlalchemy/alembic/commits)

---
updated-dependencies:
- dependency-name: alembic
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>

docs(user): Add instructions for secondary click on macOS

The usual option to press `Control` while clicking doesn't work
in RDP-sessions on macOS. The `Control` can't be evaluated and mapped
properly. It's passed to the Linux container, which can't handle the
`Control` key.

refactor: Create floating window mgr component

feat: Add tiling window manager with slider

build: Update frontend versions

fix(session-viewer): Disable pointer event while resizing sessions

This commit fixes a small bug that was introduced in #1150.

When the pointer events are not disabled on the iframe, some pointer events
are "stolen" by the iframe. Therefore, they can not be used by our event handlers.
This led to a "jumpy" behaviour while resizing.

fix: Migrate logic for button showing to Angular 17 blocks

fix: replace if statement with rxjs filtering

fix: Remove unused matdialog declaration

fix: Shift logic for project check to come before sending data

fix: Refactor data model for reordering view

fix: Rename all related instances of reorderModels to reorderModelsDialog

fix: Update for loop of models to Angular 17 format

fix: Separate out patchModel to reduce duplication in model updates

fix: Manually format html

fix: use model ids in place of names and rename patch function
  • Loading branch information
romeonicholas committed Dec 12, 2023
1 parent dfed00a commit c739122
Show file tree
Hide file tree
Showing 31 changed files with 1,888 additions and 1,211 deletions.
12 changes: 6 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -138,14 +138,14 @@ repos:
hooks:
- id: eslint
additional_dependencies:
- "eslint@^8.50.0"
- "@angular-eslint/eslint-plugin@16.2.0"
- "@angular-eslint/eslint-plugin-template@16.2.0"
- "@angular-eslint/template-parser@16.2.0"
- "eslint@^8.54.0"
- "@angular-eslint/eslint-plugin@17.1.0"
- "@angular-eslint/eslint-plugin-template@17.1.0"
- "@angular-eslint/template-parser@17.1.0"
- "eslint-config-prettier@^9.0.0"
- "eslint-plugin-import@^2.29.0"
- "@typescript-eslint/eslint-plugin@^6.9.0"
- "@typescript-eslint/parser@^6.9.0"
- "@typescript-eslint/eslint-plugin@^6.12.0"
- "@typescript-eslint/parser@^6.12.0"
- "eslint-plugin-unused-imports@^3.0.0"
- "eslint-plugin-deprecation@^2.0.0"
- "eslint-plugin-tailwindcss@^3.13.0"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# SPDX-FileCopyrightText: Copyright DB Netz AG and the capella-collab-manager contributors
# SPDX-License-Identifier: Apache-2.0

"""Add user-determined display order to models
Revision ID: 0e2028f83156
Revises: ac0e6e0f77ee
Create Date: 2023-11-12 14:47:12.295103
"""
import sqlalchemy as sa
from alembic import op

# revision identifiers, used by Alembic.
revision = "0e2028f83156"
down_revision = "ac0e6e0f77ee"
branch_labels = None
depends_on = None


def upgrade():
op.add_column(
"models", sa.Column("display_order", sa.Integer(), nullable=True)
)
5 changes: 5 additions & 0 deletions backend/capellacollab/projects/toolmodels/crud.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ def create_model(
version: tools_models.DatabaseVersion | None = None,
nature: tools_models.DatabaseNature | None = None,
configuration: dict[str, str] | None = None,
display_order: int | None = None,
) -> models.DatabaseCapellaModel:
restrictions = restrictions_models.DatabaseToolModelRestrictions()

Expand All @@ -96,6 +97,7 @@ def create_model(
nature=nature,
restrictions=restrictions,
configuration=configuration,
display_order=display_order,
)
db.add(restrictions)
db.add(model)
Expand Down Expand Up @@ -133,6 +135,7 @@ def update_model(
version: tools_models.DatabaseVersion,
nature: tools_models.DatabaseNature,
project: projects_model.DatabaseProject,
display_order: int | None,
) -> models.DatabaseCapellaModel:
model.version = version
model.nature = nature
Expand All @@ -142,6 +145,8 @@ def update_model(
if name:
model.name = name
model.slug = slugify.slugify(name)
if display_order:
model.display_order = display_order
db.commit()
return model

Expand Down
3 changes: 3 additions & 0 deletions backend/capellacollab/projects/toolmodels/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class PatchCapellaModel(pydantic.BaseModel):
version_id: int | None = None
nature_id: int | None = None
project_slug: str | None = None
display_order: int | None = None


class ToolDetails(pydantic.BaseModel):
Expand All @@ -72,6 +73,7 @@ class DatabaseCapellaModel(database.Base):
name: orm.Mapped[str] = orm.mapped_column(index=True)
slug: orm.Mapped[str]
description: orm.Mapped[str]
display_order: orm.Mapped[int | None]

configuration: orm.Mapped[dict[str, str] | None]

Expand Down Expand Up @@ -116,6 +118,7 @@ class CapellaModel(pydantic.BaseModel):
slug: str
name: str
description: str
display_order: int | None
tool: tools_models.ToolBase
version: tools_models.ToolVersionBase | None = None
nature: tools_models.ToolNatureBase | None = None
Expand Down
9 changes: 8 additions & 1 deletion backend/capellacollab/projects/toolmodels/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,14 @@ def patch_tool_model(
new_project = model.project

return crud.update_model(
db, model, body.description, body.name, version, nature, new_project
db,
model,
body.description,
body.name,
version,
nature,
new_project,
body.display_order,
)


Expand Down
2 changes: 1 addition & 1 deletion backend/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ classifiers = [
]
dependencies = [
"PyYAML",
"alembic==1.12.0",
"alembic==1.12.1",
"appdirs",
"cachetools",
"fastapi>=0.101.0",
Expand Down
18 changes: 18 additions & 0 deletions backend/tests/projects/toolmodels/test_toolmodel_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,21 @@ def test_rename_toolmodel_where_name_already_exists(
assert response.status_code == 409
assert "A model with a similar name already exists" in response.text
mock_get_model_by_slugs.assert_called_once()


def test_update_toolmodel_order_successful(
capella_model: toolmodels_models.DatabaseCapellaModel,
project: projects_models.DatabaseProject,
client: testclient.TestClient,
executor_name: str,
db: orm.Session,
):
users_crud.create_user(db, executor_name, users_models.Role.ADMIN)

response = client.patch(
f"/api/v1/projects/{project.slug}/models/{capella_model.slug}",
json={"display_order": 1},
)

assert response.status_code == 200
assert "1" in response.text
12 changes: 9 additions & 3 deletions docs/docs/user/sessions/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
~ SPDX-License-Identifier: Apache-2.0
-->

<!-- prettier-ignore-start -->

??? question "My Capella crashed. What should I do?"

Capella can crash for many different reasons. Many issues are issues with
Eclipse Capella itself, so we try to escalate issues there. Bugs can be
reported to the Eclipse Capella team directly in the
Expand Down Expand Up @@ -53,4 +52,11 @@
please recreate your session to get a valid session password for the models
of the required project.

<!-- prettier-ignore-end -->
<!-- prettier-ignore -->
??? question "I can't use the `Control` key for the secondary/right-click on macOS"

Please use an external mouse or use the trackpad gesture (click with two
fingers on the trackpad).

The sessions run on Linux and the `Control` key can't be mapped properly
via the remote desktop protocol.
Loading

0 comments on commit c739122

Please sign in to comment.