-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(pmp-web): display repositories statistics
- Loading branch information
Showing
34 changed files
with
405 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 1 addition & 5 deletions
6
...api-service/repository/core/src/lib/queries/handlers/list-repository-reviewers.handler.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
libs/pmp-web/repository/repositories-statistics/feature/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# pmp-web-repository-repositories-statistics-feature | ||
|
||
This library was generated with [Nx](https://nx.dev). | ||
|
||
## Running unit tests | ||
|
||
Run `nx test pmp-web-repository-repositories-statistics-feature` to execute the unit tests. |
10 changes: 10 additions & 0 deletions
10
libs/pmp-web/repository/repositories-statistics/feature/jest.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
module.exports = { | ||
name: 'pmp-web-repository-repositories-statistics-feature', | ||
preset: '../../../../../jest.config.js', | ||
coverageDirectory: | ||
'../../../../../coverage/libs/pmp-web/repository/repositories-statistics/feature', | ||
snapshotSerializers: [ | ||
'jest-preset-angular/AngularSnapshotSerializer.js', | ||
'jest-preset-angular/HTMLCommentSerializer.js' | ||
] | ||
}; |
1 change: 1 addition & 0 deletions
1
libs/pmp-web/repository/repositories-statistics/feature/src/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './lib/pmp-web-repository-repositories-statistics-feature.module'; |
4 changes: 4 additions & 0 deletions
4
...feature/src/lib/containers/repositories-statistics/repositories-statistics.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<pmp-table | ||
(navigateToItem)="onNavigateToRepository($event)" | ||
[tableConfig]="tableConfig" | ||
></pmp-table> |
11 changes: 11 additions & 0 deletions
11
...feature/src/lib/containers/repositories-statistics/repositories-statistics.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
:host { | ||
height: 100%; | ||
width: 100%; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
} | ||
|
||
pmp-table { | ||
width: 80%; | ||
} |
47 changes: 47 additions & 0 deletions
47
...s/feature/src/lib/containers/repositories-statistics/repositories-statistics.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { | ||
ChangeDetectionStrategy, | ||
ChangeDetectorRef, | ||
Component, | ||
OnDestroy, | ||
OnInit | ||
} from '@angular/core'; | ||
import { RepositoryStatisticsFacade } from '@pimp-my-pr/pmp-web/repository/data-access-repository-statistics'; | ||
import { RepositoryStatistics } from '@pimp-my-pr/shared/domain'; | ||
import { TableConfig } from '@pimp-my-pr/pmp-web/shared/domain'; | ||
import { untilDestroyed } from 'ngx-take-until-destroy'; | ||
import { RepositoriesStatisticsPresenter } from './repositories-statistics.presenter'; | ||
|
||
@Component({ | ||
selector: 'pimp-my-pr-repositories-statistics', | ||
templateUrl: './repositories-statistics.component.html', | ||
styleUrls: ['./repositories-statistics.component.scss'], | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
providers: [RepositoriesStatisticsPresenter] | ||
}) | ||
export class RepositoriesStatisticsComponent implements OnInit, OnDestroy { | ||
tableConfig: TableConfig<RepositoryStatistics[]>; | ||
|
||
constructor( | ||
private cdr: ChangeDetectorRef, | ||
private repositoryStatisticsFacade: RepositoryStatisticsFacade, | ||
private repositoriesStatisticsPresenter: RepositoriesStatisticsPresenter | ||
) {} | ||
|
||
ngOnDestroy(): void {} | ||
|
||
ngOnInit(): void { | ||
this.repositoryStatisticsFacade.repositoryStatisticsCollection$ | ||
.pipe(untilDestroyed(this)) | ||
.subscribe(repositoryStatistics => { | ||
this.tableConfig = this.repositoriesStatisticsPresenter.initTableConfig( | ||
repositoryStatistics | ||
); | ||
this.cdr.markForCheck(); | ||
}); | ||
this.repositoryStatisticsFacade.getRepositoryStatisticsCollection(); | ||
} | ||
|
||
onNavigateToRepository(repository: RepositoryStatistics): void { | ||
this.repositoriesStatisticsPresenter.navigateToRepository(repository.id); | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
...s/feature/src/lib/containers/repositories-statistics/repositories-statistics.presenter.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { Injectable } from '@angular/core'; | ||
import { RepositoryStatistics } from '@pimp-my-pr/shared/domain'; | ||
import { TableConfig } from '@pimp-my-pr/pmp-web/shared/domain'; | ||
import { Router } from '@angular/router'; | ||
|
||
@Injectable() | ||
export class RepositoriesStatisticsPresenter { | ||
constructor(private router: Router) {} | ||
|
||
initTableConfig(data: RepositoryStatistics[]): TableConfig<RepositoryStatistics[]> { | ||
return { | ||
columns: [ | ||
{ name: 'repository', property: 'name', label: 'Repository' }, | ||
{ | ||
name: 'pendingPrs', | ||
property: 'pendingPrs', | ||
label: 'Pending PR', | ||
isOrderColumn: true | ||
}, | ||
{ | ||
name: 'sumOfHoursPrsWaiting', | ||
property: 'sumOfHoursPrsWaiting', | ||
label: 'Sum of time PR waiting' | ||
}, | ||
{ | ||
name: 'linesOfCodeToCheck', | ||
property: 'linesOfCodeToCheck', | ||
label: 'To check [lines of code]' | ||
}, | ||
{ | ||
name: 'longestPrLinesOfCode', | ||
property: 'longestPrLinesOfCode', | ||
label: 'Longest PR [lines of code]' | ||
} | ||
], | ||
data: data | ||
}; | ||
} | ||
|
||
navigateToRepository(repositoryId: number): void { | ||
this.router.navigate(['repositories', repositoryId]); | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
...tistics/feature/src/lib/pmp-web-repository-repositories-statistics-feature.module.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { async, TestBed } from '@angular/core/testing'; | ||
import { PmpWebRepositoryRepositoriesStatisticsFeatureModule } from './pmp-web-repository-repositories-statistics-feature.module'; | ||
|
||
describe('PmpWebRepositoryRepositoriesStatisticsFeatureModule', () => { | ||
beforeEach(async(() => { | ||
TestBed.configureTestingModule({ | ||
imports: [PmpWebRepositoryRepositoriesStatisticsFeatureModule] | ||
}).compileComponents(); | ||
})); | ||
|
||
it('should create', () => { | ||
expect(PmpWebRepositoryRepositoriesStatisticsFeatureModule).toBeDefined(); | ||
}); | ||
}); |
17 changes: 17 additions & 0 deletions
17
...s-statistics/feature/src/lib/pmp-web-repository-repositories-statistics-feature.module.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { NgModule } from '@angular/core'; | ||
import { CommonModule } from '@angular/common'; | ||
import { RepositoriesStatisticsComponent } from './containers/repositories-statistics/repositories-statistics.component'; | ||
import { PmpWebRepositoryRepositoriesStatisticsRoutingModule } from './pmp-web-repository-repositories-statistics-routing.module'; | ||
import { PmpWebSharedUiTableModule } from '@pimp-my-pr/pmp-web/shared/ui-table'; | ||
import { PmpWebRepositoryStatisticsDataAccessModule } from '@pimp-my-pr/pmp-web/repository/data-access-repository-statistics'; | ||
|
||
@NgModule({ | ||
imports: [ | ||
CommonModule, | ||
PmpWebRepositoryStatisticsDataAccessModule, | ||
PmpWebRepositoryRepositoriesStatisticsRoutingModule, | ||
PmpWebSharedUiTableModule | ||
], | ||
declarations: [RepositoriesStatisticsComponent] | ||
}) | ||
export class PmpWebRepositoryRepositoriesStatisticsFeatureModule {} |
16 changes: 16 additions & 0 deletions
16
...s-statistics/feature/src/lib/pmp-web-repository-repositories-statistics-routing.module.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { NgModule } from '@angular/core'; | ||
import { RouterModule, Routes } from '@angular/router'; | ||
import { RepositoriesStatisticsComponent } from './containers/repositories-statistics/repositories-statistics.component'; | ||
|
||
const routes: Routes = [ | ||
{ | ||
path: '', | ||
component: RepositoriesStatisticsComponent | ||
} | ||
]; | ||
|
||
@NgModule({ | ||
imports: [RouterModule.forChild(routes)], | ||
exports: [RouterModule] | ||
}) | ||
export class PmpWebRepositoryRepositoriesStatisticsRoutingModule {} |
1 change: 1 addition & 0 deletions
1
libs/pmp-web/repository/repositories-statistics/feature/src/test-setup.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import 'jest-preset-angular'; |
7 changes: 7 additions & 0 deletions
7
libs/pmp-web/repository/repositories-statistics/feature/tsconfig.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"extends": "../../../../../tsconfig.json", | ||
"compilerOptions": { | ||
"types": ["node", "jest"] | ||
}, | ||
"include": ["**/*.ts"] | ||
} |
20 changes: 20 additions & 0 deletions
20
libs/pmp-web/repository/repositories-statistics/feature/tsconfig.lib.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"extends": "./tsconfig.json", | ||
"compilerOptions": { | ||
"outDir": "../../../../../dist/out-tsc", | ||
"target": "es2015", | ||
"declaration": true, | ||
"inlineSources": true, | ||
"types": [], | ||
"lib": ["dom", "es2018"] | ||
}, | ||
"angularCompilerOptions": { | ||
"annotateForClosureCompiler": true, | ||
"skipTemplateCodegen": true, | ||
"strictMetadataEmit": true, | ||
"fullTemplateTypeCheck": true, | ||
"strictInjectionParameters": true, | ||
"enableResourceInlining": true | ||
}, | ||
"exclude": ["src/test-setup.ts", "**/*.spec.ts"] | ||
} |
10 changes: 10 additions & 0 deletions
10
libs/pmp-web/repository/repositories-statistics/feature/tsconfig.spec.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"extends": "./tsconfig.json", | ||
"compilerOptions": { | ||
"outDir": "../../../../../dist/out-tsc", | ||
"module": "commonjs", | ||
"types": ["jest", "node"] | ||
}, | ||
"files": ["src/test-setup.ts"], | ||
"include": ["**/*.spec.ts", "**/*.d.ts"] | ||
} |
7 changes: 7 additions & 0 deletions
7
libs/pmp-web/repository/repositories-statistics/feature/tslint.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"extends": "../../../../../tslint.json", | ||
"rules": { | ||
"directive-selector": [true, "attribute", "pimpMyPr", "camelCase"], | ||
"component-selector": [true, "element", "pimp-my-pr", "kebab-case"] | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
libs/pmp-web/repository/shell/src/lib/containers/repositories/repositories.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<div class="repositories-component__container"> | ||
<pmp-navbar class="navbar"></pmp-navbar> | ||
<pmp-sidebar class="sidebar"></pmp-sidebar> | ||
<router-outlet></router-outlet> | ||
</div> |
23 changes: 23 additions & 0 deletions
23
libs/pmp-web/repository/shell/src/lib/containers/repositories/repositories.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
.repositories-component__container { | ||
background-color: #eef1f6; | ||
height: 100vh; | ||
} | ||
|
||
.navbar { | ||
overflow: hidden; | ||
position: fixed; | ||
top: 0; | ||
left: 0; | ||
width: 100%; | ||
z-index: 100; | ||
} | ||
|
||
.sidebar { | ||
position: fixed; | ||
top: 0; | ||
left: 0; | ||
height: 100%; | ||
width: 60px; | ||
overflow-x: hidden; | ||
box-shadow: 0 1px 2px rgb(0, 0, 0, 0.2); | ||
} |
10 changes: 10 additions & 0 deletions
10
libs/pmp-web/repository/shell/src/lib/containers/repositories/repositories.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'pmp-repositories', | ||
templateUrl: './repositories.component.html', | ||
styleUrls: ['./repositories.component.scss'] | ||
}) | ||
export class RepositoriesComponent { | ||
constructor() {} | ||
} |
13 changes: 11 additions & 2 deletions
13
libs/pmp-web/repository/shell/src/lib/pmp-web-repository-shell.module.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,18 @@ | ||
import { NgModule } from '@angular/core'; | ||
import { CommonModule } from '@angular/common'; | ||
import { ShellRoutingModule } from './shell-routing.module'; | ||
import { RepositoriesComponent } from './containers/repositories/repositories.component'; | ||
import { PmpWebSharedUiNavbarModule } from '@pimp-my-pr/pmp-web/shared/ui-navbar'; | ||
import { PmpWebSharedUiSidebarModule } from '@pimp-my-pr/pmp-web/shared/ui-sidebar'; | ||
|
||
@NgModule({ | ||
imports: [CommonModule, ShellRoutingModule], | ||
exports: [ShellRoutingModule] | ||
imports: [ | ||
CommonModule, | ||
ShellRoutingModule, | ||
PmpWebSharedUiNavbarModule, | ||
PmpWebSharedUiSidebarModule | ||
], | ||
exports: [ShellRoutingModule], | ||
declarations: [RepositoriesComponent] | ||
}) | ||
export class PmpWebRepositoryShellModule {} |
17 changes: 16 additions & 1 deletion
17
libs/pmp-web/repository/shell/src/lib/shell-routing.module.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.