Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
tmushayahama committed Oct 5, 2020
1 parent 10d6aed commit 19d04e5
Show file tree
Hide file tree
Showing 15 changed files with 328 additions and 783 deletions.
13 changes: 11 additions & 2 deletions src/@noctua.form/models/annoton/cam.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,15 @@ export class CamQueryMatch {
reference?: Entity[] = [];
}

export class CamStats {
camsCount = 0;
termsCount = 0;
gpsCount = 0;
evidenceCount = 0;
referencesCount = 0;
relationsCount = 0;
}

export class Cam {
title: string;
state: any;
Expand Down Expand Up @@ -222,15 +231,15 @@ export class Cam {
});
}

reviewTermChanges(termsCount: number): Entity[] {
reviewTermChanges(stat: CamStats): Entity[] {
const self = this;
const result = [];

each(self._annotons, (annoton: Annoton) => {
each(annoton.nodes, (node: AnnotonNode) => {
if (node.term.modified) {
result.push(node.term);
termsCount++;
stat.termsCount++;
}
});
});
Expand Down
4 changes: 2 additions & 2 deletions src/@noctua.form/models/annoton/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export {
AnnotonType,
AnnotonState
} from './annoton';
export { Cam, CamQueryMatch } from './cam';
export { Cam, CamStats, CamQueryMatch } from './cam';
export { Evidence } from './evidence';
export { SimpleAnnoton } from './simple-annoton';
export {
Expand All @@ -27,4 +27,4 @@ export { Triple } from './triple';
export { Rule } from './rules/rule';
export { ConnectorRule } from './rules/connector-rule';

export * from './parser';
export * from './parser';
6 changes: 3 additions & 3 deletions src/@noctua.form/services/cam.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { AnnotonFormMetadata } from './../models/forms/annoton-form-metadata';
import { Evidence, compareEvidence } from './../models/annoton/evidence';

import { v4 as uuid } from 'uuid';
import { Cam } from './../models/annoton/cam';
import { Cam, CamStats } from './../models/annoton/cam';
import { uniqWith, each } from 'lodash';
import { AnnotonNodeType, AnnotonNode, Entity } from './../models/annoton';
import { compareTerm } from './../models/annoton/annoton-node';
Expand Down Expand Up @@ -175,9 +175,9 @@ export class CamService {
return self._noctuaGraphService.bulkEditAnnoton(cam);
}

reviewChanges(cam: Cam, termsCount: number) {
reviewChanges(cam: Cam, stats: CamStats) {
const result = {
terms: cam.reviewTermChanges(termsCount)
terms: cam.reviewTermChanges(stats)
};
return result;
}
Expand Down
15 changes: 4 additions & 11 deletions src/@noctua.form/services/cams.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { NoctuaGraphService } from './../services/graph.service';
import { NoctuaFormConfigService } from './../services/config/noctua-form-config.service';
import { Annoton } from './../models/annoton/annoton';

import { Cam } from './../models/annoton/cam';
import { Cam, CamStats } from './../models/annoton/cam';
import { each, groupBy, find, remove } from 'lodash';
import { CamService } from './cam.service';
import { Entity } from './../models/annoton/entity';
Expand Down Expand Up @@ -167,18 +167,11 @@ export class CamsService {
reviewChanges() {
const self = this;
const details = [];
const stats = {
camsCount: 0,
termsCount: 0,
gpsCount: 0,
evidenceCount: 0,
referencesCount: 0,
relationsCount: 0,
};
const stats = new CamStats();


each(this.cams, (cam: Cam) => {
const changes = self.camService.reviewChanges(cam, stats.termsCount);
const changes = self.camService.reviewChanges(cam, stats);
if (changes) {
details.push({
cam: cam,
Expand All @@ -189,7 +182,7 @@ export class CamsService {

const result = {
stats: stats,
details: details,
details: details
};

this.onCamsCheckoutChanged.next(result);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,14 @@
</div>
<div fxLayout="row" fxLayoutAlign="start center" class="noc-drawer-footer noc-submit-row">
<ng-container *ngIf="noctuaSearchMenuService.selectedMiddlePanel === MiddlePanel.cams">
<button (click)="clear()" type="button" mat-raised-button>Clear Basket</button>
<button (click)="clear()" type="button" mat-raised-button>Clear List</button>
</ng-container>
<ng-container *ngIf="noctuaSearchMenuService.selectedMiddlePanel === MiddlePanel.camsReview">
<button (click)="clear()" type="button" mat-raised-button>Clear Basket</button>
<button (click)="clear()" type="button" mat-raised-button>Clear List</button>
<span fxFlex=""></span>
<button (click)='resetAll()' type="button" mat-raised-button color="" class="mr-8">Reset</button>
<button (click)='resetAll()' type="button" mat-raised-button color="" class="mr-8">Undo Changes</button>
<button (click)="reviewChanges()" type="submit" class="" mat-raised-button color="primary">
Review Your Changes
Review Changes
</button>
</ng-container>
<ng-container *ngIf="noctuaSearchMenuService.selectedMiddlePanel === MiddlePanel.reviewChanges">
Expand Down
3 changes: 1 addition & 2 deletions src/@noctua.search/services/search-menu.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,10 @@ export class NoctuaSearchMenuService {
this.resultsViewScrollbar.update();

setTimeout(() => {
this.resultsViewScrollbar.scrollToElement(q, -100, 1000);
this.resultsViewScrollbar.scrollToElement(q, -140, 1000);
});
}
});
}


}
Original file line number Diff line number Diff line change
@@ -1,58 +1,61 @@
<div fxLayout="column" fxLayoutAlign="start stretch" class="noc-stats noc-drawer">
<div class="noc-drawer-header" fxLayout="row" fxLayoutAlign="start center">
<span class="noc-drawer-header-title">
Review Changes</span>
<span fxFlex></span>
<div class="noc-cams-table noc-drawer-body" fxLayout="column" fxLayoutAlign="start stretch">
<div *ngIf="!noctuaUserService.user" class="noc-draw-body-disabled" fxLayoutAlign="center center">
Log in to Continue
</div>
<div id="noc-review-results" class="noc-drawer-body w-100-p">
<div *ngIf="!noctuaUserService.user" class="noc-draw-body-disabled" fxLayoutAlign="center center">
Log in to Continue
</div>
<div class="noc-stats-results">
<table fxFlex="1 1 auto" mat-table class="" [dataSource]="stats" [@animateStagger]="{value:'50'}">
<ng-container matColumnDef="category">
<th mat-header-cell *matHeaderCellDef fxFlex="250px" fxLayout="row" fxLayoutAlign="start center">
Category
</th>
<td mat-cell *matCellDef="let stat" fxFlex="250px" class="noc-title" fxLayout="row"
fxLayoutAlign="start center">
{{stat.category }}
</td>
</ng-container>
<ng-container matColumnDef="count">
<th mat-header-cell *matHeaderCellDef fxFlex="" fxLayout="row" fxLayoutAlign="start center">Changes</th>
<td mat-cell *matCellDef="let stat" fxFlex="" fxLayout="row" fxLayoutAlign="start center">
{{stat.count}}
</td>
</ng-container>
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
<tr mat-row (click)="$event.stopPropagation()" *matRowDef="let stat; columns: displayedColumns;">
</tr>

</table>

<!-- <div fxLayout="row" fxLayoutAlign="start center">
<div fxFlex="200px">
Summary
</div>
<div fxFlex>
Details
</div>
<div class="noc-summary-bar" fxLayout="row" fxLayoutAlign="start center">
<span class="noc-header-title">
Review and submit changes</span>
</div>
<div class="noc-stats-results" fxLayout="column" fxLayoutAlign="start center">
<table fxFlex="1 1 auto" mat-table class="noc-review-changes-table" [dataSource]="stats"
[@animateStagger]="{value:'50'}">
<ng-container matColumnDef="category">
<th mat-header-cell *matHeaderCellDef fxFlex="250px" fxLayout="row" fxLayoutAlign="start center">
Category
</th>
<td mat-cell *matCellDef="let stat" fxFlex="250px" class="noc-title" fxLayout="row"
fxLayoutAlign="start center">
{{stat.category }}
</td>
</ng-container>
<ng-container matColumnDef="count">
<th mat-header-cell *matHeaderCellDef fxFlex="" fxLayout="row" fxLayoutAlign="start center">Changes</th>
<td mat-cell *matCellDef="let stat" fxFlex="" fxLayout="row" fxLayoutAlign="start center">
{{stat.count}}
</td>
</ng-container>
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
<tr mat-row (click)="$event.stopPropagation()" *matRowDef="let stat; columns: displayedColumns;">
</tr>
</table>
<!-- <div fxLayout="row" fxLayoutAlign="start center">
<div fxFlex="200px">
Summary
</div>
<div fxLayout="row" fxLayoutAlign="start center">
<div fxFlex="200px">
Terms
</div>
<div fxFlex>
<div *ngFor="let modelSummary of summary">
<div *ngFor="let term of modelSummary.changes?.terms">
<div *ngFor="let termHistory of term.termHistory">
{{term.label}} -> {{termHistory.label}}
</div>
<div fxFlex>
Details
</div>
</div>
<div fxLayout="row" fxLayoutAlign="start center">
<div fxFlex="200px">
Terms
</div>
<div fxFlex>
<div *ngFor="let modelSummary of summary">
<div *ngFor="let term of modelSummary.changes?.terms">
<div *ngFor="let termHistory of term.termHistory">
{{term.label}} -> {{termHistory.label}}
</div>
</div>
</div>
</div> -->
</div>
</div>
</div> -->
</div>
<div *ngIf="artBasket?.cams.length===0" class="noc-no-info">
No models to review
<a (click)="selectMiddlePanel(MiddlePanel.camsReview)">
Add Models
</a>
</div>
</div>
Loading

0 comments on commit 19d04e5

Please sign in to comment.