Skip to content

Commit

Permalink
fixing modified-p logic with reset geneontology/noctua-annotation-rev…
Browse files Browse the repository at this point in the history
  • Loading branch information
tmushayahama committed Jan 5, 2021
1 parent 7ae9c19 commit 11de0b8
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 43 deletions.
2 changes: 0 additions & 2 deletions src/@noctua.form/models/annoton/cam.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ export class Cam {
storedGraph;
date;
modified = false;
modifiedP = false;
modifiedStats = new CamStats();
matchedCount = 0;
filter = {
Expand Down Expand Up @@ -314,7 +313,6 @@ export class Cam {
self.modifiedStats.termsCount++;
stat.termsCount++;
annoton.modified = true;
self.modified = true;
}
});
});
Expand Down
1 change: 0 additions & 1 deletion src/@noctua.form/services/cam.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ export class CamService {
cam.loading.status = true;
cam.loading.message = 'Sending Request...';
cam.graph = null;
cam.modified = false;
cam.modifiedStats = new CamStats();
cam.model = Object.assign({}, {
id: cam.id,
Expand Down
12 changes: 2 additions & 10 deletions src/@noctua.form/services/cams.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,21 +128,19 @@ export class CamsService {
return this.httpClient
.get(url)
.pipe(
map(res => this.foo(cam, res)),
map(res => this.populateStoredModel(cam, res)),
finalize(() => {
})
);
}

foo(cam: Cam, res) {
populateStoredModel(cam: Cam, res) {
const self = this;

const noctua_graph = model.graph;

cam.storedGraph = new noctua_graph();
cam.storedGraph.load_data_basic(res.storedModel);
cam.storedAnnotons = self._noctuaGraphService.graphToAnnotons(cam.storedGraph)
console.log(cam.storedGraph)
cam.checkStored()
}

Expand Down Expand Up @@ -212,8 +210,6 @@ export class CamsService {
return forkJoin(promises);
}



reviewChanges() {
const self = this;
const details = [];
Expand Down Expand Up @@ -261,8 +257,6 @@ export class CamsService {
}

resetMatch() {
const self = this;

each(this.cams, (cam: Cam) => {
cam.queryMatch = new CamQueryMatch();
});
Expand All @@ -273,8 +267,6 @@ export class CamsService {
}

updateDisplayNumber(cams: any[]) {
const self = this;

each(cams, (cam: Cam, key) => {
cam.displayNumber = (key + 1).toString();
cam.updateAnnotonDisplayNumber();
Expand Down
2 changes: 1 addition & 1 deletion src/@noctua.form/services/graph.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export class NoctuaGraphService {

cam.graph = new noctua_graph();
cam.id = response.data().id;
cam.modifiedP = response['modified-p'];
cam.modified = response.data()['modified-p'];
cam.graph.load_data_basic(response.data());
cam.isReasoned = response['is-reasoned'];

Expand Down
47 changes: 24 additions & 23 deletions src/@noctua.search/components/review-form/review-form.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,10 @@ import {
EntityLookup,
NoctuaLookupService,
EntityDefinition,
CamService,
Entity
} from 'noctua-form-base';

import { takeUntil, distinctUntilChanged, debounceTime } from 'rxjs/operators';
import { NoctuaDataService } from '@noctua.common/services/noctua-data.service';
import { noctuaAnimations } from '@noctua/animations';
import { FormGroup, FormControl } from '@angular/forms';
import { NoctuaReviewSearchService } from '@noctua.search/services/noctua-review-search.service';
Expand All @@ -41,20 +39,14 @@ import { NoctuaConfirmDialogService } from '@noctua/components/confirm-dialog/co
export class ReviewFormComponent implements OnInit, OnDestroy {
AnnotonType = AnnotonType;
ArtReplaceCategory = ArtReplaceCategory;

searchForm: FormGroup;
cams: Cam[] = [];

displayReplaceForm = {
replaceSection: false,
replaceActions: false
};


noctuaFormConfig = noctuaFormConfig;

categories: any;

gpNode: AnnotonNode;
termNode: AnnotonNode;
termReplaceNode: AnnotonNode;
Expand All @@ -63,7 +55,6 @@ export class ReviewFormComponent implements OnInit, OnDestroy {
private _unsubscribeAll: Subject<any>;

constructor(
private camService: CamService,
private camsService: CamsService,
private confirmDialogService: NoctuaConfirmDialogService,
public noctuaReviewSearchService: NoctuaReviewSearchService,
Expand All @@ -74,9 +65,7 @@ export class ReviewFormComponent implements OnInit, OnDestroy {
public noctuaFormMenuService: NoctuaFormMenuService) {

this._unsubscribeAll = new Subject();

this.categories = cloneDeep(this.noctuaFormConfigService.findReplaceCategories);

this.camsService.onCamsChanged
.pipe(takeUntil(this._unsubscribeAll))
.subscribe(cams => {
Expand Down Expand Up @@ -159,11 +148,13 @@ export class ReviewFormComponent implements OnInit, OnDestroy {
const value = this.searchForm.value;
const replaceWith = value.replaceWith;

this.noctuaReviewSearchService.replace(replaceWith).subscribe((cams) => {
if (cams) {
self.noctuaReviewSearchService.onReplaceChanged.next(true);
}
});
this.noctuaReviewSearchService.replace(replaceWith)
.pipe(takeUntil(this._unsubscribeAll))
.subscribe((cams) => {
if (cams) {
self.bulkStoredModel();
}
});
}

replaceAll() {
Expand All @@ -177,13 +168,13 @@ export class ReviewFormComponent implements OnInit, OnDestroy {
const occurrences = this.noctuaReviewSearchService.matchedCount;
const success = (replace) => {
if (replace) {
this.noctuaReviewSearchService.replaceAll(replaceWith).subscribe((cams) => {
if (cams) {
this.camsService.bulkStoredModel().subscribe((cams) => {
self.noctuaReviewSearchService.onReplaceChanged.next(true);
});
}
});
this.noctuaReviewSearchService.replaceAll(replaceWith)
.pipe(takeUntil(this._unsubscribeAll))
.subscribe((cams) => {
if (cams) {
self.bulkStoredModel();
}
});
}
};

Expand All @@ -192,6 +183,16 @@ export class ReviewFormComponent implements OnInit, OnDestroy {
success);
}

bulkStoredModel() {
const self = this;

this.camsService.bulkStoredModel()
.pipe(takeUntil(this._unsubscribeAll))
.subscribe((cams) => {
self.noctuaReviewSearchService.onReplaceChanged.next(true);
});
}

findNext() {
this.noctuaReviewSearchService.findNext();
}
Expand Down
4 changes: 2 additions & 2 deletions src/@noctua.search/services/noctua-search.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,8 @@ export class NoctuaSearchService {
cam.state = self.noctuaFormConfigService.findModelState(response.state);
cam.title = response.title;
cam.date = response.date;
cam.modifiedP = response['modified-p'];

cam.modified = response['modified-p'];
console.log('m', cam.modified)
cam.model = Object.assign({}, {
modelInfo: this.noctuaFormConfigService.getModelUrls(modelId)
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,7 @@
<mat-icon matChipRemove>cancel</mat-icon>
</mat-chip>
</div>

<div class="noc-summary-results-bar" fxLayout="row" fxLayoutAlign="start center">

<small>Results:</small>
<div class="ml-8 mr-16" fxLayout="row" fxLayoutAlign="start center">
<button mat-stroked-button color="" class="noc-rounded-button mr-4 noc-half-button noc-sm noc-r">
Expand Down Expand Up @@ -124,8 +122,8 @@
<th mat-header-cell *matHeaderCellDef fxFlex="50px" fxLayout="row" fxLayoutAlign="start center">Saved</th>
<td mat-cell *matCellDef="let cam" fxFlex="50px" class="noc-model-saved pr-12" fxLayout="row"
fxLayoutAlign="center center">
<fa-icon *ngIf="cam.modifiedP" class="red-500-fg" [icon]="['far', 'times-circle']"></fa-icon>
<fa-icon *ngIf="!cam.modifiedP" class="green-500-fg" [icon]="['far', 'check-circle']"></fa-icon>
<fa-icon *ngIf="cam.modified" class="red-500-fg" [icon]="['far', 'times-circle']"></fa-icon>
<fa-icon *ngIf="!cam.modified" class="green-500-fg" [icon]="['far', 'check-circle']"></fa-icon>
</td>
</ng-container>
<ng-container matColumnDef="state">
Expand Down

0 comments on commit 11de0b8

Please sign in to comment.