Skip to content

Commit

Permalink
Merge branch 'cde-mvp2' of https://github.com/hubmapconsortium/hra-ui
Browse files Browse the repository at this point in the history
…into cde-csv-download-update
  • Loading branch information
edlu77 committed Oct 16, 2024
2 parents 75fc4b3 + 521d77b commit 986c99d
Show file tree
Hide file tree
Showing 141 changed files with 11,331 additions and 4,517 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/production-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ jobs:
app-configuration: production
nx-command: run-many
build-compodoc: false
build-storybook: false

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
Expand All @@ -37,6 +36,7 @@ jobs:
- name: Deploy to S3
run: |
aws s3 sync --delete deploy/apps/ s3://${{ secrets.AWS_S3_BUCKET_NAME }}/ui/
aws s3 sync deploy/storybook/ s3://${{ secrets.AWS_S3_BUCKET_NAME }}/ui/storybook/
aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_DISTRIBUTION_ID }} --paths "/ui/*"
aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_HUMANATLAS_IO_DISTRIBUTION_ID }} --paths "/*"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/staging-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ jobs:
app-configuration: staging
nx-command: run-many
build-compodoc: false
build-storybook: false

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
Expand All @@ -37,6 +36,7 @@ jobs:
- name: Deploy to S3
run: |
aws s3 sync --delete deploy/apps/ s3://${{ secrets.AWS_S3_BUCKET_NAME }}/ui--staging/
aws s3 sync deploy/storybook/ s3://${{ secrets.AWS_S3_BUCKET_NAME }}/ui--staging/storybook/
aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_DISTRIBUTION_ID }} --paths "/ui--staging/*"
- name: Publish
Expand Down
4 changes: 3 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
"ftu-ui",
"services",
"ccf-organ-info",
"design-system"
"design-system",
"body-ui",
"eui"
]
}
10 changes: 10 additions & 0 deletions apps/body-ui-e2e/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": ["plugin:cypress/recommended", "../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {}
}
]
}
7 changes: 7 additions & 0 deletions apps/body-ui-e2e/cypress.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { nxE2EPreset } from '@nx/cypress/plugins/cypress-preset';

import { defineConfig } from 'cypress';

export default defineConfig({
e2e: { ...nxE2EPreset(__filename, { cypressDir: 'src' }), baseUrl: 'http://localhost:4200' },
});
29 changes: 29 additions & 0 deletions apps/body-ui-e2e/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"name": "body-ui-e2e",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "application",
"sourceRoot": "apps/body-ui-e2e/src",
"tags": [],
"implicitDependencies": ["body-ui"],
"targets": {
"e2e": {
"executor": "@nx/cypress:cypress",
"options": {
"cypressConfig": "apps/body-ui-e2e/cypress.config.ts",
"testingType": "e2e",
"devServerTarget": "body-ui:serve:development"
},
"configurations": {
"production": {
"devServerTarget": "body-ui:serve:production"
},
"ci": {
"devServerTarget": "body-ui:serve-static"
}
}
},
"lint": {
"executor": "@nx/eslint:lint"
}
}
}
13 changes: 13 additions & 0 deletions apps/body-ui-e2e/src/e2e/app.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { getGreeting } from '../support/app.po';

describe('body-ui-e2e', () => {
beforeEach(() => cy.visit('/'));

it('should display welcome message', () => {
// Custom command example, see `../support/commands.ts` file
cy.login('[email protected]', 'myPassword');

// Function helper example, see `../support/app.po.ts` file
getGreeting().contains(/Welcome/);
});
});
5 changes: 5 additions & 0 deletions apps/body-ui-e2e/src/fixtures/example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "Using fixtures to represent data",
"email": "[email protected]",
"body": "Fixtures are a great way to mock data for responses to routes"
}
1 change: 1 addition & 0 deletions apps/body-ui-e2e/src/support/app.po.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const getGreeting = () => cy.get('h1');
35 changes: 35 additions & 0 deletions apps/body-ui-e2e/src/support/commands.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/// <reference types="cypress" />

// ***********************************************
// This example commands.ts shows you how to
// create various custom commands and overwrite
// existing commands.
//
// For more comprehensive examples of custom
// commands please read more here:
// https://on.cypress.io/custom-commands
// ***********************************************

// eslint-disable-next-line @typescript-eslint/no-namespace
declare namespace Cypress {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
interface Chainable<Subject> {
login(email: string, password: string): void;
}
}

// -- This is a parent command --
Cypress.Commands.add('login', (email, password) => {
console.log('Custom command example: Login', email, password);
});
//
// -- This is a child command --
// Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... })
//
//
// -- This is a dual command --
// Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... })
//
//
// -- This will overwrite an existing command --
// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })
17 changes: 17 additions & 0 deletions apps/body-ui-e2e/src/support/e2e.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// ***********************************************************
// This example support/e2e.ts is processed and
// loaded automatically before your test files.
//
// This is a great place to put global configuration and
// behavior that modifies Cypress.
//
// You can change the location of this file or turn off
// automatically serving support files with the
// 'supportFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/configuration
// ***********************************************************

// Import commands.ts using ES2015 syntax:
import './commands';
17 changes: 17 additions & 0 deletions apps/body-ui-e2e/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"allowJs": true,
"outDir": "../../dist/out-tsc",
"module": "commonjs",
"types": ["cypress", "node"],
"sourceMap": false,
"forceConsistentCasingInFileNames": true,
"strict": true,
"noImplicitOverride": true,
"noPropertyAccessFromIndexSignature": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true
},
"include": ["**/*.ts", "**/*.js", "cypress.config.ts", "**/*.cy.ts", "**/*.cy.js", "**/*.d.ts"]
}
33 changes: 33 additions & 0 deletions apps/body-ui/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"extends": ["../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts"],
"extends": ["plugin:@nx/angular", "plugin:@angular-eslint/template/process-inline-templates"],
"rules": {
"@angular-eslint/directive-selector": [
"error",
{
"type": "attribute",
"prefix": "app",
"style": "camelCase"
}
],
"@angular-eslint/component-selector": [
"error",
{
"type": "element",
"prefix": "app",
"style": "kebab-case"
}
]
}
},
{
"files": ["*.html"],
"extends": ["plugin:@nx/angular-template"],
"rules": {}
}
]
}
22 changes: 22 additions & 0 deletions apps/body-ui/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/* eslint-disable */
export default {
displayName: 'body-ui',
preset: '../../jest.preset.js',
setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'],
coverageDirectory: '../../coverage/apps/body-ui',
transform: {
'^.+\\.(ts|mjs|js|html)$': [
'jest-preset-angular',
{
tsconfig: '<rootDir>/tsconfig.spec.json',
stringifyContentPathRegex: '\\.(html|svg)$',
},
],
},
transformIgnorePatterns: ['node_modules/(?!.*\\.mjs$)'],
snapshotSerializers: [
'jest-preset-angular/build/serializers/no-ng-attributes',
'jest-preset-angular/build/serializers/ng-snapshot',
'jest-preset-angular/build/serializers/html-comment',
],
};
109 changes: 109 additions & 0 deletions apps/body-ui/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
{
"name": "body-ui",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "application",
"prefix": "app",
"sourceRoot": "apps/body-ui/src",
"tags": ["type:app"],
"targets": {
"build": {
"executor": "@nx/angular:application",
"outputs": ["{options.outputPath.base}"],
"options": {
"outputPath": {
"base": "dist/apps/body-ui",
"browser": "."
},
"index": "apps/body-ui/src/index.html",
"browser": "apps/body-ui/src/main.ts",
"polyfills": ["zone.js"],
"tsConfig": "apps/body-ui/tsconfig.app.json",
"inlineStyleLanguage": "scss",
"assets": [
{
"glob": "**/*",
"input": "apps/body-ui/public"
}
],
"styles": ["apps/body-ui/src/styles.scss"],
"scripts": [],
"define": {
"define": "undefined"
},
"outputHashing": "none",
"allowedCommonJsDependencies": ["*"]
},
"configurations": {
"production": {
"baseHref": "/ui/body-ui/",
"budgets": [
{
"type": "initial",
"maximumWarning": "1mb",
"maximumError": "2mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "2kb",
"maximumError": "4kb"
}
]
},
"development": {
"baseHref": "/",
"optimization": false,
"extractLicenses": false,
"sourceMap": true
},
"staging": {
"baseHref": "/ui--staging/body-ui/"
},
"preview": {
"baseHref": "/apps/body-ui/",
"optimization": false,
"extractLicenses": false,
"sourceMap": true,
"namedChunks": true
}
},
"defaultConfiguration": "production"
},
"serve": {
"executor": "@nx/angular:dev-server",
"configurations": {
"production": {
"buildTarget": "body-ui:build:production"
},
"development": {
"buildTarget": "body-ui:build:development"
}
},
"defaultConfiguration": "development"
},
"extract-i18n": {
"executor": "@angular-devkit/build-angular:extract-i18n",
"options": {
"buildTarget": "body-ui:build"
}
},
"lint": {
"executor": "@nx/eslint:lint"
},
"test": {
"executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
"options": {
"jestConfig": "apps/body-ui/jest.config.ts"
}
},
"serve-static": {
"executor": "@nx/web:file-server",
"options": {
"buildTarget": "body-ui:build",
"port": 4200,
"staticFilePath": "dist/apps/body-ui/browser",
"spa": true
}
}
}
}
Binary file added apps/body-ui/public/favicon.ico
Binary file not shown.
1 change: 1 addition & 0 deletions apps/body-ui/src/_redirects
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/* /index.html 200
15 changes: 15 additions & 0 deletions apps/body-ui/src/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Body UI</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="icon" type="image/x-icon" href="favicon.ico" />
</head>
<body>
<hra-body-ui
scene="https://apps.humanatlas.io/api/v1/reference-organ-scene?organ-iri=http%3A%2F%2Fpurl.obolibrary.org%2Fobo%2FUBERON_0000059&sex=male"
id="body-ui"
></hra-body-ui>
</body>
</html>
8 changes: 8 additions & 0 deletions apps/body-ui/src/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { provideHttpClient } from '@angular/common/http';
import { provideZoneChangeDetection } from '@angular/core';
import { createCustomElement } from '@hra-ui/webcomponents';
import { BodyUiComponent } from 'ccf-body-ui';

createCustomElement('hra-body-ui', BodyUiComponent, {
providers: [provideZoneChangeDetection({ eventCoalescing: true }), provideHttpClient()],
});
5 changes: 5 additions & 0 deletions apps/body-ui/src/styles.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/* You can add global styles to this file, and also import other style files */

body {
margin: 0;
}
8 changes: 8 additions & 0 deletions apps/body-ui/src/test-setup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// @ts-expect-error https://thymikee.github.io/jest-preset-angular/docs/getting-started/test-environment
globalThis.ngJest = {
testEnvironmentOptions: {
errorOnUnknownElements: true,
errorOnUnknownProperties: true,
},
};
import 'jest-preset-angular/setup-jest';
Loading

0 comments on commit 986c99d

Please sign in to comment.