Skip to content

Commit

Permalink
Merge branch 'dev' into DDO-3418-workflows-dispatch-test
Browse files Browse the repository at this point in the history
  • Loading branch information
jyang-broad authored Feb 5, 2024
2 parents a9d84f7 + 0881a8c commit ac7faa1
Show file tree
Hide file tree
Showing 302 changed files with 4,356 additions and 1,555 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ module.exports = {
vars: 'all',
args: 'all',
argsIgnorePattern: '_|^_|^props',
destructuredArrayIgnorePattern: '_|^_',
ignoreRestSiblings: true,
},
],
Expand Down
8 changes: 1 addition & 7 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Each line is a file pattern followed by one or more owners.
# See https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners#codeowners-syntax
/src/analysis @DataBiosphere/broad-interactive-analysis
/src/pages/EnvironmentsPage/ @DataBiosphere/broad-interactive-analysis
/src/constants/datasets.js @DataBiosphere/data-explorer-eng
/src/import-data/ @DataBiosphere/data-explorer-eng @DataBiosphere/analysisjourneys
/src/libs/brand*.js @DataBiosphere/terra-cobranding
Expand All @@ -19,13 +20,6 @@
/src/pages/LandingPage* @DataBiosphere/terra-cobranding
/src/pages/billing/ @DataBiosphere/broadworkspaces-terra-ui
/src/pages/workspaces/* @DataBiosphere/broadworkspaces-terra-ui
/src/pages/workspaces/hooks/* @DataBiosphere/broadworkspaces-terra-ui
/src/pages/workspaces/migration/* @DataBiosphere/broadworkspaces-terra-ui
/src/pages/workspaces/workspace/*Dashboard* @DataBiosphere/broadworkspaces-terra-ui
/src/pages/workspaces/workspace/*Workspace* @DataBiosphere/broadworkspaces-terra-ui
/src/pages/workspaces/WorkspacesList/* @DataBiosphere/broadworkspaces-terra-ui
/src/components/*Workspace* @DataBiosphere/broadworkspaces-terra-ui
/src/components/workspace-utils* @DataBiosphere/broadworkspaces-terra-ui
/src/workflows-app/ @DataBiosphere/broad-workflow-management @DataBiosphere/broad-workflow-execution
/src/workspace-data/ @DataBiosphere/analysisjourneys
/src/workspaces/ @DataBiosphere/broadworkspaces-terra-ui
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/publish-pacts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@ jobs:
yarn install
- name: Run tests
run: yarn test Cbas.test.js # As of now, this is the only contract test file in terra-ui.
# When another test file is added, a naming convention for contract tests should be established,
# so that contract tests can be run in isolation.
run: yarn test "\b\w*Pact\w*\.test\.(js|ts)\b" # This matches any test file that contains the word "Pact" at the end of its name, either js or ts.

- name: Encode the pact as non-breaking base 64 string
id: encode
Expand Down
134 changes: 68 additions & 66 deletions .pnp.cjs

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
2 changes: 0 additions & 2 deletions config/alpha.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,11 @@
"isProd": true,
"jobManagerUrlRoot": "https://job-manager.dsde-alpha.broadinstitute.org/jobs",
"leoUrlRoot": "https://leonardo.dsde-alpha.broadinstitute.org",
"marthaUrlRoot": "https://us-central1-broad-dsde-alpha.cloudfunctions.net",
"orchestrationUrlRoot": "https://firecloud-orchestration.dsde-alpha.broadinstitute.org",
"rawlsUrlRoot": "https://rawls.dsde-alpha.broadinstitute.org",
"rexUrlRoot": "https://terra-rex-alpha.appspot.com",
"samUrlRoot": "https://sam.dsde-alpha.broadinstitute.org",
"shibbolethUrlRoot": "https://broad-shibboleth-prod.appspot.com/dev",
"shouldUseDrsHub": false,
"workspaceManagerUrlRoot": "https://workspace.dsde-alpha.broadinstitute.org",
"tCell": {
"appId": "saturnnonprod-O9lUP",
Expand Down
2 changes: 0 additions & 2 deletions config/dev.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,11 @@
"isProd": false,
"jobManagerUrlRoot": "https://job-manager.dsde-dev.broadinstitute.org/jobs",
"leoUrlRoot": "https://leonardo.dsde-dev.broadinstitute.org",
"marthaUrlRoot": "https://us-central1-broad-dsde-dev.cloudfunctions.net",
"orchestrationUrlRoot": "https://firecloud-orchestration.dsde-dev.broadinstitute.org",
"rawlsUrlRoot": "https://rawls.dsde-dev.broadinstitute.org",
"rexUrlRoot": "https://terra-rex-dev.appspot.com",
"samUrlRoot": "https://sam.dsde-dev.broadinstitute.org",
"shibbolethUrlRoot": "https://broad-shibboleth-prod.appspot.com/dev",
"shouldUseDrsHub": true,
"workspaceManagerUrlRoot": "https://workspace.dsde-dev.broadinstitute.org",
"tCell": {
"appId": "saturnnonprod-O9lUP",
Expand Down
2 changes: 0 additions & 2 deletions config/prod.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,11 @@
"isProd": true,
"jobManagerUrlRoot": "https://job-manager.dsde-prod.broadinstitute.org/jobs",
"leoUrlRoot": "https://notebooks.firecloud.org",
"marthaUrlRoot": "https://us-central1-broad-dsde-prod.cloudfunctions.net",
"orchestrationUrlRoot": "https://api.firecloud.org",
"rawlsUrlRoot": "https://rawls.dsde-prod.broadinstitute.org",
"rexUrlRoot": "https://terra-rex-prod.appspot.com",
"samUrlRoot": "https://sam.dsde-prod.broadinstitute.org",
"shibbolethUrlRoot": "https://broad-shibboleth-prod.appspot.com",
"shouldUseDrsHub": false,
"workspaceManagerUrlRoot": "https://workspace.dsde-prod.broadinstitute.org",
"tCell": {
"appId": "saturnprod-VuHKy",
Expand Down
2 changes: 0 additions & 2 deletions config/staging.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,11 @@
"isProd": true,
"jobManagerUrlRoot": "https://job-manager.dsde-staging.broadinstitute.org/jobs",
"leoUrlRoot": "https://leonardo.dsde-staging.broadinstitute.org",
"marthaUrlRoot": "https://us-central1-broad-dsde-staging.cloudfunctions.net",
"orchestrationUrlRoot": "https://firecloud-orchestration.dsde-staging.broadinstitute.org",
"rawlsUrlRoot": "https://rawls.dsde-staging.broadinstitute.org",
"rexUrlRoot": "https://terra-rex-staging.appspot.com",
"samUrlRoot": "https://sam.dsde-staging.broadinstitute.org",
"shibbolethUrlRoot": "https://broad-shibboleth-prod.appspot.com/dev",
"shouldUseDrsHub": false,
"workspaceManagerUrlRoot": "https://workspace.dsde-staging.broadinstitute.org",
"tCell": {
"appId": "saturnnonprod-O9lUP",
Expand Down
2 changes: 2 additions & 0 deletions integration-tests/slack/notify-circleci-test-results.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ const notifyCircleCITestResults = async () => {

// Slack notification: CircleCI job failed. Message contains list of failed test names.
const channelIDsAndNames = getFailedTestsAndChannelIDs(failedTestNames);
console.log(`Failed tests: \n${failedTestNames.map((test) => `* ${test}`).join('\n')}\n`);
_.forEach(async ([channelId, testNames]) => {
console.log(`Notifying channel ${channelId} of ${testNames.length} test failures (${testNames.join(', ')})`);
const messageBlocks = getMessageBlockTemplate(testNames);
await postMessage({ channel: channelId, blocks: messageBlocks });
}, _.toPairs(channelIDsAndNames));
Expand Down
6 changes: 4 additions & 2 deletions integration-tests/tests/billing-projects.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ const setAjaxMockValues = async (
spendData: [
{ cost: '999', category: 'Compute' },
{ cost: '22', category: 'Storage' },
{ cost: '11', category: 'WorkspaceInfrastructure' },
{ cost: '89', category: 'Other' },
],
},
Expand Down Expand Up @@ -403,8 +404,9 @@ const testBillingSpendReportFn = withUserToken(async ({ page, testUrl, token })

// Title and cost are in different elements, but check both in same text assert to verify that category is correctly associated to its cost.
await billingPage.assertText('Total spend$1,110.17');
await billingPage.assertText('Total compute$999.00');
await billingPage.assertText('Total storage$22.00');
await billingPage.assertText('Total analysis compute$999.00');
await billingPage.assertText('Total workspace storage$22.00');
await billingPage.assertText('Total workspace infrastructure$11.00');
await billingPage.assertText(
'Total spend includes $89.00 in other infrastructure or query costs related to the general operations of Terra. See our documentation to learn more about Azure costs.'
);
Expand Down
60 changes: 0 additions & 60 deletions integration-tests/tests/run-workflow.js

This file was deleted.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@
"storybook": "^7.6.7",
"svgo": "^1.3.2",
"typescript": "~5.1.6",
"vite": "^4.3.9",
"vite": "^4.5.2",
"vite-plugin-svgr": "^3.2.0"
},
"resolutions": {
Expand Down
2 changes: 1 addition & 1 deletion packages/build-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"tslib": "^2.6.1"
},
"devDependencies": {
"vite": "^4.3.9"
"vite": "^4.5.2"
},
"peerDependencies": {
"typescript": "~5.1.6",
Expand Down
2 changes: 1 addition & 1 deletion packages/components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"react": "18.2.0",
"react-dom": "18.2.0",
"typescript": "~5.1.6",
"vite": "^4.3.9",
"vite": "^4.5.2",
"vite-plugin-svgr": "^3.2.0"
},
"peerDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/core-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@
"check-dts": "^0.7.2",
"jest": "^27.4.3",
"typescript": "~5.1.6",
"vite": "^4.3.9"
"vite": "^4.5.2"
}
}
2 changes: 1 addition & 1 deletion packages/test-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,6 @@
"@types/node": "^20.6.2",
"check-dts": "^0.7.2",
"typescript": "~5.1.6",
"vite": "^4.3.9"
"vite": "^4.5.2"
}
}
39 changes: 39 additions & 0 deletions src/alerts/RequiredUpdateAlert.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { h } from 'react-hyperscript-helpers';
import { asMockedFn, renderWithAppContexts } from 'src/testing/test-utils';

import { RequiredUpdateAlert } from './RequiredUpdateAlert';
import { useTimeUntilRequiredUpdate } from './version-alerts';

type VersionAlertsExports = typeof import('./version-alerts');
jest.mock('./version-alerts', (): VersionAlertsExports => {
return {
...jest.requireActual<VersionAlertsExports>('./version-alerts'),
useTimeUntilRequiredUpdate: jest.fn(),
};
});

describe('RequiredUpdateAlert', () => {
it('renders nothing if no update is required', () => {
// Arrange
asMockedFn(useTimeUntilRequiredUpdate).mockReturnValue(undefined);

// Act
const { container } = renderWithAppContexts(h(RequiredUpdateAlert));

// Assert
expect(container).toBeEmptyDOMElement();
});

it('renders time until required update', () => {
// Arrange
asMockedFn(useTimeUntilRequiredUpdate).mockReturnValue(90);

// Act
const { container } = renderWithAppContexts(h(RequiredUpdateAlert));

// Assert
expect(container).toHaveTextContent(
'A required update is available. Terra will automatically refresh your browser in 1 minute 30 seconds.'
);
});
});
51 changes: 51 additions & 0 deletions src/alerts/RequiredUpdateAlert.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import { icon, useThemeFromContext } from '@terra-ui-packages/components';
import { formatDuration } from 'date-fns';
import { Fragment, ReactNode } from 'react';
import { div, h, span } from 'react-hyperscript-helpers';

import { useTimeUntilRequiredUpdate } from './version-alerts';

export const RequiredUpdateAlert = (): ReactNode => {
const { colors } = useThemeFromContext();

const timeUntilRequiredUpdate = useTimeUntilRequiredUpdate();

if (timeUntilRequiredUpdate === undefined) {
return null;
}

const minutesRemaining = Math.floor(timeUntilRequiredUpdate / 60);
const secondsRemaining = timeUntilRequiredUpdate % 60;

return div(
{
role: 'alert',
style: {
display: 'flex',
alignItems: 'center',
padding: '1rem 1.25rem',
border: `2px solid ${colors.warning()}`,
backgroundColor: colors.warning(0.15),
color: colors.dark(),
fontWeight: 'bold',
fontSize: 12,
},
},
[
icon('warning-standard', { size: 26, color: colors.warning(), style: { marginRight: '1ch' } }),
'A required update is available. Terra will automatically refresh your browser ',
timeUntilRequiredUpdate > 0
? h(Fragment, [
'in ',
span({ role: 'timer', style: { marginLeft: '0.5ch' } }, [
formatDuration({
minutes: minutesRemaining,
seconds: secondsRemaining,
}),
]),
])
: 'now',
'.',
]
);
};
Loading

0 comments on commit ac7faa1

Please sign in to comment.