Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into feat-display-git-diff
Browse files Browse the repository at this point in the history
  • Loading branch information
freshavocado7 committed Sep 18, 2024
2 parents 25b5025 + c9e4157 commit 2b157df
Show file tree
Hide file tree
Showing 26 changed files with 13,730 additions and 223 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build-test-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ jobs:
run: |-
python -m twine check dist/*
- name: Upload artifacts
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: Artifacts
path: 'dist/*'
path: "dist/*"
- name: Publish to PyPI (release only)
if: startsWith(github.ref, 'refs/tags/v')
run: python -m twine upload -u __token__ -p ${{ secrets.PYPI_TOKEN }} --non-interactive dist/*
60 changes: 31 additions & 29 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ default_install_hook_types: [commit-msg, pre-commit]
default_stages: [commit, merge-commit]
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v4.6.0
hooks:
- id: check-added-large-files
- id: check-ast
Expand All @@ -26,7 +26,7 @@ repos:
- id: fix-byte-order-marker
- id: trailing-whitespace
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 24.1.0
rev: 24.8.0
hooks:
- id: black
- repo: https://github.com/PyCQA/isort
Expand All @@ -43,24 +43,24 @@ repos:
rev: 6.3.0
hooks:
- id: pydocstyle
exclude: "^tests/"
exclude: '^tests/'
additional_dependencies:
- pydocstyle[toml]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.8.0
rev: v1.11.2
hooks:
- id: mypy
additional_dependencies:
- capellambse==0.5.72
- types-pyyaml==6.0.11
- repo: https://github.com/pylint-dev/pylint
rev: v3.1.0
rev: v3.2.7
hooks:
- id: pylint
require_serial: false
args: [-rn, -sn, -dfixme, -dduplicate-code]
- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.5.4
rev: v1.5.5
hooks:
- id: insert-license
name: Insert license headers (shell-style comments)
Expand All @@ -71,7 +71,7 @@ repos:
- --license-filepath
- LICENSES/.license_header.txt
- --comment-style
- "#"
- '#'
- id: insert-license
name: Insert license headers (XML-style comments)
files: '\.(?:html|md|xml)$'
Expand All @@ -81,7 +81,7 @@ repos:
- --license-filepath
- LICENSES/.license_header.txt
- --comment-style
- "<!--| ~| -->"
- '<!--| ~| -->'
- id: insert-license
name: Insert license headers (C-style comments)
files: '\.(?:css|js|ts)$'
Expand All @@ -91,7 +91,7 @@ repos:
- --license-filepath
- LICENSES/.license_header.txt
- --comment-style
- "/*| *| */"
- '/*| *| */'
- id: insert-license
name: Insert license headers (reST comments)
files: '\.rst$'
Expand All @@ -101,7 +101,7 @@ repos:
- --license-filepath
- LICENSES/.license_header.txt
- --comment-style
- "..| |"
- '..| |'
- id: insert-license
name: Insert license headers (JSX files)
files: '\.jsx$'
Expand All @@ -111,37 +111,39 @@ repos:
- --license-filepath
- LICENSES/.license_header.txt
- --comment-style
- "//"
- '//'
- repo: https://github.com/fsfe/reuse-tool
rev: v3.0.1
rev: v4.0.3
hooks:
- id: reuse
- repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook
rev: v9.11.0
rev: v9.17.0
hooks:
- id: commitlint
stages: [commit-msg]
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.1.0
- repo: local
hooks:
- id: prettier
name: prettier
entry: prettier --write
language: node
types_or: [ts, css, html, markdown]
additional_dependencies:
- "prettier@^3.2.5"
- "prettier-plugin-tailwindcss@^0.5.14"
- "tailwind-scrollbar@^3.1.0"
- 'prettier@^3.3.3'
- 'prettier-plugin-tailwindcss@^0.6.6'
- 'tailwind-scrollbar@^3.1.0'
- repo: https://github.com/pre-commit/mirrors-eslint
rev: v9.2.0
rev: v9.10.0
hooks:
- id: eslint
additional_dependencies:
- "eslint@^8.57.0"
- "eslint-config-prettier@^9.1.0"
- "eslint-plugin-import@^2.29.1"
- "eslint-plugin-unused-imports@^3.1.0"
- "eslint-plugin-deprecation@^2.0.0"
- "eslint-plugin-tailwindcss@^3.15.1"
- "eslint-plugin-storybook@^0.8.0"
- "eslint-plugin-react@^7.34.1"
- "eslint-plugin-react-hooks@^4.6.2"
- "eslint-plugin-react-refresh@^0.4.5"
- 'eslint@^8.57.0'
- 'eslint-config-prettier@^9.1.0'
- 'eslint-plugin-import@^2.29.1'
- 'eslint-plugin-unused-imports@^3.1.0'
- 'eslint-plugin-deprecation@^2.0.0'
- 'eslint-plugin-tailwindcss@^3.15.1'
- 'eslint-plugin-storybook@^0.8.0'
- 'eslint-plugin-react@^7.34.1'
- 'eslint-plugin-react-hooks@^4.6.2'
- 'eslint-plugin-react-refresh@^0.4.5'
11 changes: 5 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ Thanks for your interest in our project. Contributions are always welcome!
We are committed to fostering a welcoming, respectful, and harassment-free
environment. Be kind!

If you have questions, ideas or want to report a bug, feel free to [open an
issue]. Or go ahead and [open a pull request] to contribute code. In order to
reduce the burden on our maintainers, please make sure that your code follows
our style guidelines outlined below.
If you have questions, ideas or want to report a bug, feel free to [open
an issue]. Or go ahead and [open a pull request] to contribute code. In order to
reduce the burden on our maintainers, please make sure that your code follows our
style guidelines outlined below.

<!-- prettier-ignore -->
[open an issue]: https://github.com/DSD-DBS/capella-model-explorer/issues
Expand Down Expand Up @@ -129,8 +129,7 @@ The key differences are:
etc.
- For classes that are not builtin (e.g. `Iterable`),
`import collections.abc as cabc` and then use them like `cabc.Iterable`.
- Use [PEP-604-style unions], e.g. `int | float` instead of
`t.Union[int, float]`.
- Use [PEP-604-style unions], e.g. `int | float` instead of `t.Union[int, float]`.
- Use `... | None` (with `None` always as the last union member) instead of
`t.Optional[...]` and always explicitly annotate where `None` is possible.

Expand Down
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,9 @@ config:
methods:
- id: f51872a8-1a4f-4a4d-b4f4-b39cbd31a75b
type: http
name: default
name: Direct Browser connection
sharing:
enabled: true
ports:
metrics: 8000
http: 8000
Expand Down Expand Up @@ -162,6 +164,11 @@ config:
Replace the numbers in `compatible_versions` with the version IDs for the
versions you want to support.

When configured properly, users will be able to start read-only sessions for
the Capella Model Explorer. More information about read-only sessions is
available in the
[Capella Collaboration Manager documentation](https://dsd-dbs.github.io/capella-collab-manager/user/sessions/types/read-only/).

# Contributing

We'd love to see your bug reports and improvement suggestions! Please take a
Expand Down
14 changes: 6 additions & 8 deletions capella_model_explorer/backend/explorer.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import os
import pathlib
import time
import traceback
import typing as t
import urllib.parse as urlparse
from pathlib import Path
Expand Down Expand Up @@ -166,19 +167,16 @@ def render_instance_page(self, template_text, base, object=None):
print(base)
return HTMLResponse(content=error_message)
except Exception as e:
LOGGER.exception("Error rendering template")
trace = markupsafe.escape(traceback.format_exc())
error_message = markupsafe.Markup(
'<p style="color:red">'
"Unexpected error: {etype}: {emsg}"
f"Unexpected error: {type(e).__name__}: {str(e)}"
'</p><pre style="font-size:80%;overflow:scroll">'
"object={obj}\nmodel={model}"
f"object={repr(object)}\nmodel={repr(self.model)}"
f"\n\n{trace}"
"</pre>"
).format(
etype=type(e).__name__,
emsg=str(e),
obj=repr(object),
model=repr(self.model),
)
# error = error_message
return HTMLResponse(content=error_message)

def configure_routes(self):
Expand Down
19 changes: 11 additions & 8 deletions capella_model_explorer/backend/templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,17 @@ def find_objects(model, obj_type=None, below=None, attr=None, filters=None):
raise ValueError("No search criteria provided")

if filters:
objects = [
obj
for obj in objects
if all(
getattr(obj, key) == value for key, value in filters.items()
)
]

filtered = []
for object in objects:
for attr_key, filter in filters.items():
attr = getattr(object, attr_key)
if filter == "not_empty":
if attr:
filtered.append(object)
else:
if attr == filter:
filtered.append(object)
objects = filtered
return objects


Expand Down
3 changes: 0 additions & 3 deletions frontend/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,3 @@ dist-ssr
*.njsproj
*.sln
*.sw?

# Package
package-lock.json
Loading

0 comments on commit 2b157df

Please sign in to comment.