Skip to content

Commit

Permalink
feat(agora): migrate Nominated Targets (AG-1551) (#2864)
Browse files Browse the repository at this point in the history
  • Loading branch information
sagely1 authored Oct 2, 2024
1 parent e3d1844 commit 7f424c7
Show file tree
Hide file tree
Showing 83 changed files with 2,885 additions and 732 deletions.
10 changes: 4 additions & 6 deletions apps/agora/api/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,10 @@
"rules": {}
},
{
"files": ["*.ts", "*.tsx"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"rules": {}
"files": ["*.ts", "*.config.ts", "webpack.config.js"],
"rules": {
"tailwindcss/no-custom-classname": "off"
}
}
]
}
2 changes: 1 addition & 1 deletion apps/agora/api/src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const router = express.Router();
mongoose.connection.once('open', async () => {
router.get('/dataversion', dataVersionRoute);
router.get('/teams', teamsRoute);
router.get('/team-members/:name/image', teamMemberImageRoute);
router.get('/teamMembers/:name/image', teamMemberImageRoute);
});

export default router;
17 changes: 17 additions & 0 deletions apps/agora/app/src/app/app.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,23 @@ export const routes: Route[] = [
description: "See what's new in Agora, from new features to our latest data updates.",
},
},
{
path: 'genes/nominated-targets',
loadChildren: () =>
import('@sagebionetworks/agora/nominated-targets').then((routes) => routes.routes),
data: {
title: 'Nominated Targets | Candidate genes for AD treatment or prevention',
description:
'Browse a list of genes that researchers have identified using computational analyses of high-dimensional human genomic, proteomic and metabolomic data.',
},
},
// {
// path: 'nomination-form', component: NominationFormPageComponent,
// data: {
// title: 'Nominate a Target | Suggest a new AD therapeutic target',
// description: 'Nominate a gene as a new candidate for AD treatment or prevention.'
// }
// },
{
path: 'not-found',
loadChildren: () => import('@sagebionetworks/agora/not-found').then((routes) => routes.routes),
Expand Down
1 change: 0 additions & 1 deletion apps/agora/app/src/styles.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* You can add global styles to this file, and also import other style files */
@use 'libs/agora/styles/src/index';

@use 'app-theme';
15 changes: 10 additions & 5 deletions libs/agora/api-client-angular/src/lib/api/teamMember.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ export class TeamMemberService {
observe?: 'body',
reportProgress?: boolean,
options?: {
httpHeaderAccept?: 'image/jpeg' | 'application/problem+json';
httpHeaderAccept?: 'image/jpg' | 'image/jpeg' | 'image/png' | 'application/problem+json';
context?: HttpContext;
},
): Observable<Blob>;
Expand All @@ -126,7 +126,7 @@ export class TeamMemberService {
observe?: 'response',
reportProgress?: boolean,
options?: {
httpHeaderAccept?: 'image/jpeg' | 'application/problem+json';
httpHeaderAccept?: 'image/jpg' | 'image/jpeg' | 'image/png' | 'application/problem+json';
context?: HttpContext;
},
): Observable<HttpResponse<Blob>>;
Expand All @@ -135,7 +135,7 @@ export class TeamMemberService {
observe?: 'events',
reportProgress?: boolean,
options?: {
httpHeaderAccept?: 'image/jpeg' | 'application/problem+json';
httpHeaderAccept?: 'image/jpg' | 'image/jpeg' | 'image/png' | 'application/problem+json';
context?: HttpContext;
},
): Observable<HttpEvent<Blob>>;
Expand All @@ -144,7 +144,7 @@ export class TeamMemberService {
observe: any = 'body',
reportProgress: boolean = false,
options?: {
httpHeaderAccept?: 'image/jpeg' | 'application/problem+json';
httpHeaderAccept?: 'image/jpg' | 'image/jpeg' | 'image/png' | 'application/problem+json';
context?: HttpContext;
},
): Observable<any> {
Expand All @@ -159,7 +159,12 @@ export class TeamMemberService {
let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
if (localVarHttpHeaderAcceptSelected === undefined) {
// to determine the Accept header
const httpHeaderAccepts: string[] = ['image/jpeg', 'application/problem+json'];
const httpHeaderAccepts: string[] = [
'image/jpg',
'image/jpeg',
'image/png',
'application/problem+json',
];
localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
}
if (localVarHttpHeaderAcceptSelected !== undefined) {
Expand Down
14 changes: 11 additions & 3 deletions libs/agora/api-description/build/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,17 @@ paths:
type: string
responses:
'200':
description: Success
content:
image/jpg:
schema:
$ref: '#/components/schemas/TeamImage'
image/jpeg:
schema:
type: string
format: binary
description: Success
$ref: '#/components/schemas/TeamImage'
image/png:
schema:
$ref: '#/components/schemas/TeamImage'
'400':
$ref: '#/components/responses/BadRequest'
'500':
Expand Down Expand Up @@ -163,6 +168,9 @@ components:
type: array
items:
$ref: '#/components/schemas/Team'
TeamImage:
type: string
format: binary
responses:
BadRequest:
description: Invalid request
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
type: string
format: binary
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,17 @@ get:
type: string
responses:
'200':
description: Success
content:
image/jpg:
schema:
$ref: ../../../components/schemas/TeamImage.yaml
image/jpeg:
schema:
type: string
format: binary
description: Success
$ref: ../../../components/schemas/TeamImage.yaml
image/png:
schema:
$ref: ../../../components/schemas/TeamImage.yaml
'400':
$ref: ../../../components/responses/BadRequest.yaml
'500':
Expand Down
46 changes: 46 additions & 0 deletions libs/agora/genes/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"extends": ["../../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"env": {
"jest": true
},
"overrides": [
{
"files": ["*.ts"],
"extends": [
"plugin:@nx/angular",
"plugin:@angular-eslint/template/process-inline-templates",
"plugin:jest/recommended"
],
"rules": {
"@angular-eslint/directive-selector": [
"error",
{
"type": "attribute",
"prefix": "agora",
"style": "camelCase"
}
],
"@angular-eslint/component-selector": [
"error",
{
"type": "element",
"prefix": "agora",
"style": "kebab-case"
}
]
}
},
{
"files": ["*.html"],
"extends": ["plugin:@nx/angular-template"],
"rules": {}
},
{
"files": ["*.ts", "jest.config.ts"],
"rules": {
"tailwindcss/no-custom-classname": "off"
}
}
]
}
7 changes: 7 additions & 0 deletions libs/agora/genes/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# agora-genes

This library was generated with [Nx](https://nx.dev).

## Running unit tests

Run `nx test agora-genes` to execute the unit tests.
23 changes: 23 additions & 0 deletions libs/agora/genes/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/* eslint-disable */
export default {
displayName: 'agora-genes',
preset: '../../../jest.preset.js',
setupFilesAfterEnv: ['<rootDir>/src/test-setup.ts'],
globals: {},
coverageDirectory: '../../../coverage/libs/agora/genes',
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',
],
};
27 changes: 27 additions & 0 deletions libs/agora/genes/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "agora-genes",
"$schema": "../../../node_modules/nx/schemas/project-schema.json",
"projectType": "library",
"sourceRoot": "libs/agora/genes/src",
"prefix": "agora",
"targets": {
"test": {
"executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coverage/libs/agora/genes"],
"options": {
"jestConfig": "libs/agora/genes/jest.config.ts"
}
},
"lint": {
"executor": "@nx/eslint:lint"
},
"lint-fix": {
"executor": "@nx/eslint:lint",
"options": {
"fix": true
}
}
},
"tags": ["type:feature", "scope:agora", "language:typescript"],
"implicitDependencies": []
}
2 changes: 2 additions & 0 deletions libs/agora/genes/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './lib/components/gene-search/gene-search.component';
export * from './lib/components/gene-table/gene-table.component';
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<p>gene-search works!</p>
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { GeneSearchComponent } from './gene-search.component';

describe('GeneSearchComponent', () => {
let component: GeneSearchComponent;
let fixture: ComponentFixture<GeneSearchComponent>;

beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [GeneSearchComponent],
}).compileComponents();

fixture = TestBed.createComponent(GeneSearchComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { Component } from '@angular/core';
import { CommonModule } from '@angular/common';

@Component({
selector: 'agora-gene-search',
standalone: true,
imports: [CommonModule],
templateUrl: './gene-search.component.html',
styleUrl: './gene-search.component.scss',
})
export class GeneSearchComponent {}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<p>gene table works!</p>
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { GeneTableComponent } from './gene-table.component';

describe('GeneSearchComponent', () => {
let component: GeneTableComponent;
let fixture: ComponentFixture<GeneTableComponent>;

beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [GeneTableComponent],
}).compileComponents();

fixture = TestBed.createComponent(GeneTableComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { Component, inject, OnInit } from '@angular/core';
import { CommonModule } from '@angular/common';
import { RouterModule } from '@angular/router';
import { Dataversion, DataversionService } from '@sagebionetworks/agora/api-client-angular';
import { Observable } from 'rxjs';
import { SafeUrl } from '@angular/platform-browser';
import { PathSanitizer } from '@sagebionetworks/agora/util';
import { ConfigService } from '@sagebionetworks/agora/config';
// import { NavigationLink } from '../../models/navigation-link';

@Component({
selector: 'agora-gene-table',
standalone: true,
imports: [CommonModule, RouterModule],
templateUrl: './gene-table.component.html',
styleUrls: ['./gene-table.component.scss'],
})
export class GeneTableComponent {
// configService = inject(ConfigService);
// dataVersionService = inject(DataversionService);
// sanitizer = inject(PathSanitizer);
// footerLogoPath!: SafeUrl;
// dataVersion$!: Observable<Dataversion>;
}
1 change: 1 addition & 0 deletions libs/agora/genes/src/test-setup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import 'jest-preset-angular/setup-jest';
28 changes: 28 additions & 0 deletions libs/agora/genes/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"extends": "../../../tsconfig.base.json",
"files": [],
"include": [],
"references": [
{
"path": "./tsconfig.lib.json"
},
{
"path": "./tsconfig.spec.json"
}
],
"compilerOptions": {
"forceConsistentCasingInFileNames": true,
"strict": true,
"noImplicitOverride": true,
"noPropertyAccessFromIndexSignature": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"target": "es2020",
"esModuleInterop": true
},
"angularCompilerOptions": {
"strictInjectionParameters": true,
"strictInputAccessModifiers": true,
"strictTemplates": true
}
}
12 changes: 12 additions & 0 deletions libs/agora/genes/tsconfig.lib.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../../dist/out-tsc",
"declaration": true,
"declarationMap": true,
"inlineSources": true,
"types": []
},
"exclude": ["src/test-setup.ts", "**/*.spec.ts", "**/*.test.ts", "jest.config.ts"],
"include": ["**/*.ts"]
}
Loading

0 comments on commit 7f424c7

Please sign in to comment.