Skip to content

Commit

Permalink
Merge branch 'main' into kira/single-deposition-info-panel
Browse files Browse the repository at this point in the history
* main: (21 commits)
  feat: add filter panel to single deposition page (#1030)
  chore(main): release web 1.21.0 (#1032)
  feat: Update Tomogram Processing field format and query (#1031)
  chore(main): release web 1.20.0 (#1028)
  feat: Implement collapsing Annotated Objects list (#1024)
  chore: Add e2e test for errors on Neuroglancer site (#1027)
  chore(main): release web 1.19.1 (#1023)
  fix: Fix Neuroglancer URL bug (#1026)
  fix: Dedupe authors (#1018)
  chore(main): release web 1.19.0 (#1019)
  refactor: download dialog tests (#1011)
  feat: Add Tomograms table (#988)
  feat: Enable pagination of Annotations table with temporary hacky query (#992)
  chore(main): release web 1.18.0 (#984)
  feat: Add Tomograms tab to Run page (#983)
  chore: remove extra GHA concurrency lock from prod-deploy.yml (#982)
  feat: add user agent to client requests (#966)
  chore: Add additional test case to TestGetDestinationPath (#955)
  chore(main): release web 1.17.0 (#971)
  ci: update frontend release pr filter (#977)
  ...
  • Loading branch information
kne42 committed Aug 16, 2024
2 parents 82e2951 + d378e7c commit 146a922
Show file tree
Hide file tree
Showing 79 changed files with 2,543 additions and 1,965 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/prod-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
const { owner, repo } = context.repo
const { data: searchResult } = await github.rest.search.issuesAndPullRequests(
{
q: `repo:${owner}/${repo} is:pr label:"autorelease: pending"`,
q: `repo:${owner}/${repo} is:pr is:open label:"autorelease: pending" "chore(main): release web"`,
per_page: 1,
}
)
Expand Down Expand Up @@ -63,9 +63,6 @@ jobs:
environment: staging

tag-frontend-release:
concurrency:
group: tag-frontend-release-${{ github.ref }}
cancel-in-progress: true

outputs:
tag: ${{ fromJson(steps.get-tag-name.outputs.result).tag }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@
For more information on the API, visit the [cryoet-data-portal repo](https://github.com/chanzuckerberg/cryoet-data-portal/)
"""

try:
from importlib import metadata
except ImportError:
# for python <=3.7
import importlib_metadata as metadata # type: ignore[no-redef]

from ._client import Client
from ._models import (
Annotation,
Expand All @@ -24,12 +18,9 @@
TomogramAuthor,
TomogramVoxelSpacing,
)
from ._version import version

try:
__version__ = metadata.version("cryoet_data_portal")
except metadata.PackageNotFoundError:
# package is not installed
__version__ = "0.0.0-unknown"
__version__ = version

__all__ = [
"Client",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
from gql.dsl import DSLQuery, DSLSchema, dsl_gql
from gql.transport.requests import RequestsHTTPTransport

from cryoet_data_portal._constants import USER_AGENT


class Client:
"""A GraphQL Client library that can traverse all the metadata in the CryoET Data Portal
Expand All @@ -29,6 +31,7 @@ def __init__(self, url: Optional[str] = None):
transport = RequestsHTTPTransport(
url=url,
retries=3,
headers={"User-agent": USER_AGENT},
)

with open(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import sys

from ._version import version

# added to all http requests to identify the client for analytics
USER_AGENT = ";".join(
[
f"python={sys.version_info.major}.{sys.version_info.minor}",
f"cryoet_data_portal_client={version}",
],
)
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
from botocore.client import Config
from tqdm import tqdm

from cryoet_data_portal._constants import USER_AGENT

logger = logging.getLogger("cryoet-data-portal")


Expand All @@ -20,10 +22,13 @@ def get_anon_s3_client():
return boto3.client(
"s3",
endpoint_url=boto_url,
config=Config(signature_version=signature_version),
config=Config(signature_version=signature_version, user_agent=USER_AGENT),
)

return boto3.client("s3", config=Config(signature_version=UNSIGNED))
return boto3.client(
"s3",
config=Config(signature_version=UNSIGNED, user_agent=USER_AGENT),
)


def parse_s3_url(url: str) -> (str, str):
Expand All @@ -37,7 +42,7 @@ def download_https(
with_progress: bool = True,
):
dest_path = get_destination_path(url, dest_path)
fetch_request = requests.get(url, stream=True)
fetch_request = requests.get(url, stream=True, headers={"User-agent": USER_AGENT})
total_size = int(fetch_request.headers["content-length"])
block_size = 1024 * 512
logger.info("Downloading %s to %s", url, dest_path)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
try:
from importlib import metadata
except ImportError:
# for python <=3.7
import importlib_metadata as metadata # type: ignore[no-redef]

try:
version = metadata.version("cryoet_data_portal")
except metadata.PackageNotFoundError:
# package is not installed
version = "0.0.0-unknown"
14 changes: 10 additions & 4 deletions client/python/cryoet_data_portal/tests/test_file_tools.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
from pathlib import Path
from unittest.mock import patch

import pytest
Expand Down Expand Up @@ -57,8 +58,13 @@ def test_invalid_dest_path(
url = "https://example.com/file.txt"
dest_path = os.path.join(tmp_path, "\000")
recursive_from_prefix = "https://example.com/"
expected = os.path.join(dest_path, "file.txt")
with pytest.raises(ValueError):
assert (
get_destination_path(url, dest_path, recursive_from_prefix) == expected
)
get_destination_path(url, dest_path, recursive_from_prefix)

def test_dest_path_is_existing_file(self, tmp_path) -> None:
"""Test that an error is raised if the dest_path is an existing file"""
url = "https://example.com/file.txt"
dest_path = os.path.join(tmp_path, "test.txt")
Path(dest_path).touch()
with pytest.raises(ValueError):
get_destination_path(url, dest_path)
59 changes: 59 additions & 0 deletions frontend/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,64 @@
# Changelog

## [1.21.0](https://github.com/chanzuckerberg/cryoet-data-portal/compare/web-v1.20.0...web-v1.21.0) (2024-08-15)


### ✨ Features

* Update Tomogram Processing field format and query ([#1031](https://github.com/chanzuckerberg/cryoet-data-portal/issues/1031)) ([80e1b51](https://github.com/chanzuckerberg/cryoet-data-portal/commit/80e1b51995094f2ee42768c36e6499d11be5b936))

## [1.20.0](https://github.com/chanzuckerberg/cryoet-data-portal/compare/web-v1.19.1...web-v1.20.0) (2024-08-15)


### ✨ Features

* Implement collapsing Annotated Objects list ([#1024](https://github.com/chanzuckerberg/cryoet-data-portal/issues/1024)) ([9343d12](https://github.com/chanzuckerberg/cryoet-data-portal/commit/9343d1215a60632696efba551c9272aa7ce98b85))


### 🧹 Miscellaneous Chores

* Add e2e test for errors on Neuroglancer site ([#1027](https://github.com/chanzuckerberg/cryoet-data-portal/issues/1027)) ([572972d](https://github.com/chanzuckerberg/cryoet-data-portal/commit/572972d915a20338d9a4a59742233f855e3720c8))

## [1.19.1](https://github.com/chanzuckerberg/cryoet-data-portal/compare/web-v1.19.0...web-v1.19.1) (2024-08-13)


### 🐞 Bug Fixes

* Dedupe authors ([#1018](https://github.com/chanzuckerberg/cryoet-data-portal/issues/1018)) ([bdbc034](https://github.com/chanzuckerberg/cryoet-data-portal/commit/bdbc034dd20d9db42536e8a84e312545148e6a55)), closes [#752](https://github.com/chanzuckerberg/cryoet-data-portal/issues/752)
* Fix Neuroglancer URL bug ([#1026](https://github.com/chanzuckerberg/cryoet-data-portal/issues/1026)) ([377d6dc](https://github.com/chanzuckerberg/cryoet-data-portal/commit/377d6dcd38870190601ac28d8ddd695f2e8adfb5)), closes [#1025](https://github.com/chanzuckerberg/cryoet-data-portal/issues/1025)

## [1.19.0](https://github.com/chanzuckerberg/cryoet-data-portal/compare/web-v1.18.0...web-v1.19.0) (2024-08-12)


### ✨ Features

* Add Tomograms table ([#988](https://github.com/chanzuckerberg/cryoet-data-portal/issues/988)) ([420acdd](https://github.com/chanzuckerberg/cryoet-data-portal/commit/420acdd2999e4261214a9475c9a6d37b1c85ef28))
* Enable pagination of Annotations table with temporary hacky query ([#992](https://github.com/chanzuckerberg/cryoet-data-portal/issues/992)) ([79f7247](https://github.com/chanzuckerberg/cryoet-data-portal/commit/79f724798caacab162eb89a0a4ce57a7b19f5e2d))


### ♻️ Code Refactoring

* download dialog tests ([#1011](https://github.com/chanzuckerberg/cryoet-data-portal/issues/1011)) ([f0ece55](https://github.com/chanzuckerberg/cryoet-data-portal/commit/f0ece552004cad1d3847691aab0bfd8b0ab6b8e3)), closes [#962](https://github.com/chanzuckerberg/cryoet-data-portal/issues/962)

## [1.18.0](https://github.com/chanzuckerberg/cryoet-data-portal/compare/web-v1.17.0...web-v1.18.0) (2024-08-02)


### ✨ Features

* Add Tomograms tab to Run page ([#983](https://github.com/chanzuckerberg/cryoet-data-portal/issues/983)) ([c357e6e](https://github.com/chanzuckerberg/cryoet-data-portal/commit/c357e6e804ac31a854a5012295a459c3be19e6e6))

## [1.17.0](https://github.com/chanzuckerberg/cryoet-data-portal/compare/web-v1.16.0...web-v1.17.0) (2024-07-31)


### ✨ Features

* Update cell strain links. ([#968](https://github.com/chanzuckerberg/cryoet-data-portal/issues/968)) ([df43bd6](https://github.com/chanzuckerberg/cryoet-data-portal/commit/df43bd68953557c64fa311c9ce417c027acda486))


### 🐞 Bug Fixes

* avoid double-encoding spaces in breadcrumb url ([#970](https://github.com/chanzuckerberg/cryoet-data-portal/issues/970)) ([8b8a4b4](https://github.com/chanzuckerberg/cryoet-data-portal/commit/8b8a4b4fdedc46b65f86ab2353885151cd53b851))

## [1.16.0](https://github.com/chanzuckerberg/cryoet-data-portal/compare/web-v1.15.0...web-v1.16.0) (2024-07-29)


Expand Down
2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "web",
"version": "1.16.0",
"version": "1.21.0",
"scripts": {
"preinstall": "npx only-allow pnpm",
"build": "pnpm -r build",
Expand Down
35 changes: 35 additions & 0 deletions frontend/packages/data-portal/_templates/e2e/new/pageActor.cjs.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
to: e2e/pageObjects/<%= name %>/<%= name %>Actor.ts
---
/**
* This file contains combinations of page interactions or data fetching. Remove if not needed.
*/
import { <%= h.changeCase.pascal(name) %>Page } from 'e2e/pageObjects/<%= name %>/<%= name %>Page'

export class <%= h.changeCase.pascal(name) %>Actor {
private <%= name %>Page: <%= h.changeCase.pascal(name) %>Page

constructor(<%= name %>Page: <%= h.changeCase.pascal(name) %>Page) {
this.<%= name %>Page = <%= name %>Page
}
// #region Navigate
// #endregion Navigate

// #region Click
// #endregion Click

// #region Hover
// #endregion Hover

// #region Get
// #endregion Get

// #region Macro
// #endregion Macro

// #region Validation
// #endregion Validation

// #region Bool
// #endregion Bool
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
to: e2e/pageObjects/<%= name %>/<%= name %>Page.ts
---
import { expect } from '@playwright/test'
import { BasePage } from 'e2e/pageObjects/basePage'

export class <%= h.changeCase.pascal(name) %>Page extends BasePage {
Expand Down
11 changes: 9 additions & 2 deletions frontend/packages/data-portal/_templates/e2e/new/testFile.cjs.t
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
---
to: e2e/<%= name %>.test.ts
---
import { ApolloClient, NormalizedCacheObject } from '@apollo/client'
import { test } from '@playwright/test'
import { <%= h.changeCase.pascal(name) %>Page } from 'e2e/pageObjects/<%= name %>/<%= name %>Page'

test.describe('<%= name %>', () => {
test('should work', async ({ page }) => {
const <%= name %>Page = new <%= h.changeCase.pascal(name) %>Page(page)
let client: ApolloClient<NormalizedCacheObject>
let <%= name %>Page: <%= h.changeCase.pascal(name) %>Page

test.beforeEach(({page}) => {
<%= name %>Page = new <%= h.changeCase.pascal(name) %>Page(page)
})

test('should work', async () => {
await <%= name %>Page.goTo('https://playwright.dev/')
})
})
Loading

0 comments on commit 146a922

Please sign in to comment.