From 8989e8b50261b3f20be2535a8217c82a41cf1a34 Mon Sep 17 00:00:00 2001 From: Arthur Deierlein Date: Mon, 18 Mar 2024 15:41:59 +0100 Subject: [PATCH] feat(ember)!: dependency sources - adjust to backend - adjust form to include the ability to set maintainers per source --- api/outdated/outdated/tests/test_parser.py | 5 +- ember/app/components/project-compact.gjs | 2 +- ember/app/components/project-detailed.gjs | 67 ++++++----- .../app/components/project-form/component.js | 52 ++------- .../app/components/project-form/template.hbs | 24 +--- ember/app/components/source-form.gjs | 106 ++++++++++++++++++ ember/app/models/dependency-source.js | 20 ++++ ember/app/models/maintainer.js | 8 +- ember/app/models/project.js | 13 ++- ember/app/routes/projects/add.js | 3 +- ember/app/routes/projects/detailed.js | 2 +- ember/app/routes/projects/index.js | 2 +- ember/app/routes/versions/index.js | 2 +- ember/app/validations/project.js | 1 - ember/app/validations/source.js | 6 + ember/mirage/config.js | 3 +- ember/mirage/factories/dependency-source.js | 55 +++++++++ ember/mirage/factories/project.js | 29 ++--- ember/mirage/scenarios/default.js | 3 +- ember/tests/acceptance/projects-test.js | 10 +- .../components/project-compact-test.js | 4 +- .../components/project-detailed-test.js | 8 +- 22 files changed, 281 insertions(+), 144 deletions(-) create mode 100644 ember/app/components/source-form.gjs create mode 100644 ember/app/models/dependency-source.js create mode 100644 ember/app/validations/source.js create mode 100644 ember/mirage/factories/dependency-source.js diff --git a/api/outdated/outdated/tests/test_parser.py b/api/outdated/outdated/tests/test_parser.py index efe3cae3..c017c6f9 100644 --- a/api/outdated/outdated/tests/test_parser.py +++ b/api/outdated/outdated/tests/test_parser.py @@ -218,7 +218,7 @@ def test_fetch_end_of_life_invalid_json(mocker, requests_mock, project): text="503 Service Temporarily Unavailable", status_code=503, ) - LockfileParser([])._get_version(("django", "4.4.1"), provider="PIP") # noqa: SLF001 + LockfileParser(project, [])._get_version(("django", "4.4.1"), provider="PIP") # noqa: SLF001 @pytest.mark.django_db() @@ -227,6 +227,7 @@ def test_fetch_end_of_life_no_overwrite_if_already_set( dependency_factory: DependencyFactory, release_version_factory: ReleaseVersionFactory, version_factory: VersionFactory, + project: models.Project, ) -> None: end_of_life = date(2025, 1, 1) @@ -248,7 +249,7 @@ def test_fetch_end_of_life_no_overwrite_if_already_set( version: models.Version = version_factory(release_version=release_version) - LockfileParser([])._get_version( # noqa: SLF001 + LockfileParser(project, [])._get_version( # noqa: SLF001 (dependency.name, version.version), provider=dependency.provider ) diff --git a/ember/app/components/project-compact.gjs b/ember/app/components/project-compact.gjs index e364b7f8..b7301697 100644 --- a/ember/app/components/project-compact.gjs +++ b/ember/app/components/project-compact.gjs @@ -19,7 +19,7 @@ function icon(status) { } function version(project) { - return project.versionedDependencies[0]; + return project.sources.at(0)?.versions.at(0); } const Dependency =