Skip to content

Commit

Permalink
Merge branch 'develop' into dev-plfm-swc-6663
Browse files Browse the repository at this point in the history
  • Loading branch information
xschildw committed Sep 5, 2024
2 parents 06dd1fa + b74c31c commit 9721f28
Show file tree
Hide file tree
Showing 972 changed files with 15,885 additions and 40,831 deletions.
4 changes: 3 additions & 1 deletion .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Exclude the following commits from the git blame -- see https://stackoverflow.com/a/69118451
# You may need to run git config blame.ignoreRevsFile .git-blame-ignore-revs
## 2022-11-09 - Ran prettier code-formatter on entire repo after adding lint-staged to enforce code formatting
53b439d81b4126848ce42514c6b5cc62fe5f5fa8
53b439d81b4126848ce42514c6b5cc62fe5f5fa8
## 2024-03-22 - Reverted prettier-plugin-java to v2.5.0 to avoid regression https://github.com/jhipster/prettier-java/issues/650
09d3d9ef4c2a24d8079ab8dc7947c680f9c42efa
27 changes: 2 additions & 25 deletions .github/workflows/build-test-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
retention-days: 1
playwright-tests:
needs: [build]
runs-on: 'macos-latest'
runs-on: 'macos-12'
timeout-minutes: 60
# Ensure that at most one playwright-tests job will run at a time in Sage-Bionetworks repo,
# but allow multiple playwright-test jobs to run concurrently in forked repos
Expand Down Expand Up @@ -70,29 +70,6 @@ jobs:
- name: Check colima and lima version
if: runner.os == 'macos'
run: |
echo "- runner colima version: $(colima version)" >> $GITHUB_STEP_SUMMARY
LIMA_VERSION=$(limactl --version)
echo "- runner lima version: ${LIMA_VERSION}" >> $GITHUB_STEP_SUMMARY
if [[ !("${LIMA_VERSION}" == "limactl version 0.19.0" || "${LIMA_VERSION}" == "limactl version 0.19.1") ]]; then
echo "::warning::runner lima version has changed. Consider removing lima/colima downgrade, see SWC-6655."
fi
- name: Downgrade colima/lima versions
if: runner.os == 'macos'
run: |
brew uninstall colima
brew uninstall lima
# install lima
LIMA_VERSION="v0.18.0"
LIMA_VERSION_URL="https://github.com/lima-vm/lima/releases/download/${LIMA_VERSION}/lima-${LIMA_VERSION:1}-$(uname -s)-$(uname -m).tar.gz"
curl -fsSL "${LIMA_VERSION_URL}" | tar Cxzvm /usr/local
# install colima
COLIMA_VERSION="v0.6.6"
COLIMA_VERSION_URL="https://github.com/abiosoft/colima/releases/download/${COLIMA_VERSION}/colima-$(uname -s)-$(uname -m)"
sudo mkdir -p /usr/local/bin
sudo curl -L -o /usr/local/bin/colima "${COLIMA_VERSION_URL}" && sudo chmod +x /usr/local/bin/colima
# Get colima and lima versions
limactl --version
colima version
Expand All @@ -119,7 +96,7 @@ jobs:
with:
node-version: ${{ env.NODE_VERSION }}
- name: Install dependencies
run: yarn install --frozen-lockfile
run: yarn install --frozen-lockfile --network-timeout 1000000
- name: Install Playwright Browsers
run: yarn playwright install --with-deps
- name: Check for common errors
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ description: 'Build SWC'
runs:
using: 'composite'
steps:
- name: Set up JDK 8
uses: actions/setup-java@v3
- name: Set up JDK 11
uses: actions/setup-java@v4
with:
java-version: '8'
distribution: 'temurin'
java-version: '11'
distribution: 'corretto'
cache: maven
- name: Build with Maven
shell: bash
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ extras/
/.sass-cache/
.idea/*

src/main/main.iml
src/test/test.iml

# We use a maven plugin to download node and required modules.
# Since these are retrieved at build-time, no need to commit.
node/*
Expand Down
1 change: 0 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
# These artifacts were generated and/or pre-minified and then checked in
src/main/webapp/css/**/*
src/main/webapp/js/**/*
src/main/webapp/offline/**/*
src/main/webapp/pdf.js/**/*
src/main/webapp/research/**/*

Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# Synapse Web Client (SWC) [![Synapse website](https://img.shields.io/website-up-down-brightgreen-red/https/www.synapse.org.svg?label=synapse.org&style=flat-square)](https://www.synapse.org) [![Uptime Robot ratio (7 days)](https://img.shields.io/uptimerobot/ratio/7/m779300534-4f408b1654d840b82b911550.svg?style=flat-square)](https://stats.uptimerobot.com/mqmm6ILGx) [![jfrog](https://img.shields.io/website-available-unavailable-brightgreen-red/https/sagebionetworks.jfrog.io/sagebionetworks/webapp.svg?label=artifact&style=flat-square)](https://sagebionetworks.jfrog.io/sagebionetworks/webapp/#/artifacts/browse/tree/General/libs-releases/org/sagebionetworks/portal) [![license](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
# Synapse Web Client (SWC) [![Synapse website](https://img.shields.io/website-up-down-brightgreen-red/https/www.synapse.org.svg?label=synapse.org&style=flat-square)](https://www.synapse.org) [![Uptime Robot ratio (7 days)](https://img.shields.io/uptimerobot/ratio/7/m779300534-4f408b1654d840b82b911550.svg?style=flat-square)](https://stats.uptimerobot.com/mqmm6ILGx) [![license](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)

The Synapse Web Client is a [Google Web Toolkit](http://www.gwtproject.org/)-based [single-page application](https://en.wikipedia.org/wiki/Single-page_application), the web client of the Synapse REST service core. It provides access to the the cloud-hosted [Synapse backend services](https://github.com/Sage-Bionetworks/Synapse-Repository-Services).
The Synapse Web Client is a [Google Web Toolkit](http://www.gwtproject.org/)-based [single-page application](https://en.wikipedia.org/wiki/Single-page_application), the web client of the Synapse REST service core. It provides access to the the cloud-hosted [Synapse backend services](https://github.com/Sage-Bionetworks/Synapse-Repository-Services) ([API docs](https://rest-docs.synapse.org/rest/)).

The current SWC release build can be accessed by visiting https://www.synapse.org/

For more information about Synapse, please see the [Synapse Docs](http://docs.synapse.org/).

Interested in spinning up a local web client? Go to the [SWC Developer Bootstrap](https://sagebionetworks.jira.com/wiki/display/SWC/Developer+Bootstrap) to find out how.

A subset of the site is implemented by React components. [Storybook](https://sage-bionetworks.github.io/synapse-web-monorepo/) | [Github](https://github.com/Sage-Bionetworks/synapse-web-monorepo/tree/main/packages/synapse-react-client)
11 changes: 6 additions & 5 deletions devdocs/ReactIntegration.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Using JsInterop to call your React component can be summarized in these basic st

1. Create a class to represent your components' props
1. Add your component to the SRC JsInterop type
1. Add a ReactComponentDiv to your View
1. Add a ReactComponent to your View
1. In the View, use React and ReactDOM to render the element.

### Create a Prop Class
Expand All @@ -34,9 +34,9 @@ The [SRC class](../src/main/java/org/sagebionetworks/web/client/jsinterop/SRC.ja

Make sure you specify your prop type in the type parameter, and also make sure that your object name exactly matches the named export in `SynapseComponents`.

### Add a ReactComponentDiv or ReactComponentSpan to your View
### Add a ReactComponent to your View

While you can append your React component to any element, we have [ReactComponentDiv](../src/main/java/org/sagebionetworks/web/client/widget/ReactComponentDiv.java) and [ReactComponentSpan](../src/main/java/org/sagebionetworks/web/client/widget/ReactComponentDiv.java) that contain logic that simplifies managing the lifecycle of a React component. Add this to your View in code or `*.ui.xml` file, and make sure you can reference it for the next step.
While you can append your React component to any element, we have [ReactComponent](../src/main/java/org/sagebionetworks/web/client/widget/ReactComponent.java) that contains logic that simplifies managing the lifecycle of a React component. Add this to your View in code or `*.ui.xml` file, and make sure you can reference it for the next step.

### Passing Synapse context

Expand All @@ -49,6 +49,7 @@ How you manage updating your widget's view will vary based on the scenario, but
```java
import org.sagebionetworks.web.client.context.SynapseReactClientFullContextPropsProvider;
import org.sagebionetworks.web.client.jsinterop.React;
import org.sagebionetworks.web.client.jsinterop.ReactElement;

class MyView {

Expand All @@ -57,12 +58,12 @@ class MyView {

void renderComponent() {
MyProps props = props.create(/**/);
ReactNode reactNode = React.createElementWithSynapseContext(
ReactElement reactElement = React.createElementWithSynapseContext(
SRC.SynapseComponents.MyComponent,
props,
propsProvider.getJsInteropContextProps()
);
reactComponentDiv.render(reactNode);
reactComponent.render(reactElement);
}
}

Expand Down
19 changes: 0 additions & 19 deletions e2e/account.spec.ts

This file was deleted.

19 changes: 0 additions & 19 deletions e2e/create_account.spec.ts

This file was deleted.

8 changes: 4 additions & 4 deletions e2e/discussions.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Page, expect, test } from '@playwright/test'
import { Page, expect } from '@playwright/test'
import { defaultExpectTimeout } from '../playwright.config'
import { testAuth } from './fixtures/authenticatedUserPages'
import {
Expand Down Expand Up @@ -109,7 +109,7 @@ const getDiscussionReplyActionButtons = (page: Page, threadReply: string) => {
let userProject: Project
const fileHandleIds: string[] = []

test.describe('Discussions', () => {
testAuth.describe('Discussions', () => {
testAuth.beforeAll(async ({ browser, storageStatePaths }) => {
userProject = await setupProjectWithPermissions(
browser,
Expand All @@ -120,7 +120,7 @@ test.describe('Discussions', () => {
})

testAuth.afterAll(async ({ browser }) => {
test.slow()
testAuth.slow()
if (userProject.id) {
await teardownProjectsAndFileHandles(
browser,
Expand All @@ -133,7 +133,7 @@ test.describe('Discussions', () => {
testAuth(
'should allow discussion and reply CRUD',
async ({ userPage, validatedUserPage }) => {
test.slow()
testAuth.slow()

const threadTitle = 'The Title of the Thread'
const threadBody = 'The body of the Thread'
Expand Down
4 changes: 2 additions & 2 deletions e2e/favorites.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Page, expect, test } from '@playwright/test'
import { Page, expect } from '@playwright/test'
import { testAuth } from './fixtures/authenticatedUserPages'
import { entityUrlPathname } from './helpers/entities'
import {
Expand Down Expand Up @@ -41,7 +41,7 @@ function getFavoriteStarSpiner(page: Page) {
return page.locator('.pageHeader').locator('.spinner:visible')
}

test.describe('Favorites', () => {
testAuth.describe('Favorites', () => {
testAuth('should be visible', async ({ userPage }) => {
await goToDashboard(userPage)
await goToFavorites(userPage)
Expand Down
33 changes: 19 additions & 14 deletions e2e/files.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Page, expect, test } from '@playwright/test'
import { Page, expect } from '@playwright/test'
import path from 'path'
import { defaultExpectTimeout } from '../playwright.config'
import { testAuth } from './fixtures/authenticatedUserPages'
Expand Down Expand Up @@ -52,12 +52,12 @@ const expectNoAccessPage = async (
expectTimeout: number = defaultExpectTimeout,
) => {
await expect(
page.getByRole('heading', {
name: 'Sorry, no access to this page.',
}),
page.getByText('You don’t have permission to view this.'),
).toBeVisible({ timeout: expectTimeout })
await expect(
page.getByText('You are not authorized to access the page requested.'),
page.getByText(
'This account has not been granted access to view this resource.',
),
).toBeVisible({ timeout: expectTimeout })
}

Expand Down Expand Up @@ -178,13 +178,13 @@ const getFileMD5 = async (page: Page) => {
let userProject: Project
const fileHandleIds: string[] = []

test.describe('Files', () => {
testAuth.describe('Files', () => {
testAuth.beforeAll(async ({ browser, storageStatePaths }) => {
userProject = await setupProject(browser, 'swc-e2e-user', storageStatePaths)
})

testAuth.afterAll(async ({ browser }) => {
test.slow()
testAuth.slow()
if (userProject.id) {
await teardownProjectsAndFileHandles(
browser,
Expand All @@ -201,7 +201,7 @@ test.describe('Files', () => {
// when there is a test timeout. Since test timeouts are expensive,
// Playwright recommends skipping the test entirely with test.fixme.
// See: https://github.com/microsoft/playwright/issues/16317
test.fixme(
testAuth.fixme(
browserName === 'webkit' && !!process.env.CI,
`Very slow in webkit in CI only (passes after 6min in macos-latest runner,
times out after 10min in Sage ubuntu-22.04-4core-16GBRAM-150GBSSD runner).
Expand Down Expand Up @@ -345,7 +345,7 @@ test.describe('Files', () => {
)

testAuth('should create and delete a file', async ({ userPage }) => {
test.slow()
testAuth.slow()

const fileName = 'test_file.csv'
const filePath = `data/${fileName}`
Expand All @@ -356,7 +356,10 @@ test.describe('Files', () => {
await expect(
userPage.getByRole('heading', { name: userProject.name }),
).toBeVisible()
await userPage.getByRole('link', { name: 'Files', exact: true }).click()
await userPage
.getByRole('link', { name: 'Files', exact: true })
.first()
.click()
})

await testAuth.step('upload file', async () => {
Expand Down Expand Up @@ -474,7 +477,7 @@ test.describe('Files', () => {
).toBeVisible()
await expect(
userPage.getByText(
`Are you sure you want to delete File "${fileName}"?`,
`Are you sure you want to delete File ${fileName}?`,
),
).toBeVisible()
await expect(
Expand Down Expand Up @@ -519,9 +522,10 @@ test.describe('Files', () => {
})

await testAuth.step('remove file from trash can', async () => {
const fileCheckbox = userPage.getByRole('checkbox', {
name: `Select ${fileEntityId}`,
})
const fileCheckbox = userPage
.getByRole('row')
.filter({ hasText: fileEntityId })
.getByRole('checkbox')
await expect(fileCheckbox).not.toBeChecked()

// Currently programmatically dispatching the click event
Expand All @@ -540,6 +544,7 @@ test.describe('Files', () => {
userPage.getByText('Delete selected items from your Trash?'),
).toBeVisible()
await userPage.getByRole('button', { name: 'Delete' }).click()
await expect(userPage.locator('.spinner:visible')).toHaveCount(0)
})

await testAuth.step(
Expand Down
8 changes: 4 additions & 4 deletions e2e/helpers/entities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,19 @@ export function generateEntityName(
return `swc-e2e-${entityType}-entity-${uuidv4()}`
}

const entityHashBang = '#!Synapse'
const entityPlace = 'Synapse'

export function entityUrlPathname(entityId: string) {
return `/${entityHashBang}:${entityId}`
return `/${entityPlace}:${entityId}`
}

export function getEntityIdFromPathname(pathname: string) {
if (!pathname.includes(entityHashBang)) {
if (!pathname.includes(entityPlace)) {
return ''
}

return pathname
.replace(new RegExp(`.*${entityHashBang}:`), '')
.replace(new RegExp(`.*${entityPlace}:`), '')
.replace(/\/.*/, '')
}

Expand Down
Loading

0 comments on commit 9721f28

Please sign in to comment.