Skip to content

Commit

Permalink
fix after replace and replace all logistics geneontology/noctua-annot…
Browse files Browse the repository at this point in the history
  • Loading branch information
tmushayahama committed Jan 14, 2021
1 parent b165ea7 commit a2da659
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 62 deletions.
3 changes: 3 additions & 0 deletions src/@noctua.form/models/annoton/annoton-node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ export class AnnotonNode implements AnnotonNodeDisplay {

private _id: string;

//For Save
pendingChangeEntity: Entity;

constructor(annotonNode?: Partial<AnnotonNodeDisplay>) {
if (annotonNode) {
this.overrideValues(annotonNode);
Expand Down
8 changes: 3 additions & 5 deletions src/@noctua.form/models/annoton/cam.ts
Original file line number Diff line number Diff line change
Expand Up @@ -282,18 +282,16 @@ export class Cam {
}
}

replace(findEntities: Entity[], replaceWith: Entity) {
addPendingChanges(findEntities: Entity[], replaceWith: Entity) {
const self = this;

each(self._annotons, (annoton: Annoton) => {
each(annoton.nodes, (node: AnnotonNode) => {
// node.term.highlight = false;
each(findEntities, (entity: Entity) => {
if (node.term.uuid === entity.uuid) {
node.term.termHistory.push(new Entity(node.term.id, node.term.label));
node.term.modified = true;
node.term.id = replaceWith.id;
node.term.label = replaceWith.label;
node.pendingChangeEntity = new Entity(replaceWith.id, replaceWith.label);
node.pendingChangeEntity.uuid = node.term.uuid;
}
});
});
Expand Down
6 changes: 0 additions & 6 deletions src/@noctua.form/services/cam.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,12 +161,6 @@ export class CamService {
return result;
}

diffModel(cam: Cam) {
const self = this;

return self._noctuaGraphService.diffModel(cam);
}

resetModel(cam: Cam) {
const self = this;

Expand Down
4 changes: 2 additions & 2 deletions src/@noctua.form/services/cams.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ export class CamsService {
return this.httpClient
.get(url)
.pipe(
map(res => this.populateStoredModel(cam, res)),
map(res => self.populateStoredModel(cam, res)),
finalize(() => {
})
);
Expand Down Expand Up @@ -183,7 +183,7 @@ export class CamsService {
each(groupedEntities, (values: Entity[], key) => {
const cam: Cam = find(this.cams, { id: key });
if (cam) {
cam.replace(entities, replaceWithTerm);
cam.addPendingChanges(entities, replaceWithTerm);
cams.push(cam)
}
});
Expand Down
36 changes: 3 additions & 33 deletions src/@noctua.form/services/graph.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -536,16 +536,6 @@ export class NoctuaGraphService {
return connectorAnnotons;
}

graphToAnnotonDFSError(annoton, annotonNode) {
const self = this;
const edge = annoton.getEdges(annotonNode.id);

each(edge.nodes, function (node) {
node.object.status = 2;
self.graphToAnnotonDFSError(annoton, node.object);
});
}

evidenceUseGroups(reqs, evidence: Evidence) {
const self = this;
const assignedBy = evidence.assignedBy;
Expand Down Expand Up @@ -575,16 +565,6 @@ export class NoctuaGraphService {
return cam.manager.request_with(reqs);
}

diffModel(cam: Cam) {
const self = this;
const reqs = new minerva_requests.request_set(self.noctuaUserService.baristaToken, cam.id);
const req = new minerva_requests.request('model', 'diff');
req.model(cam.id);
reqs.add(req, 'query');

return cam.artManager.request_with(reqs);
}

storeModel(cam: Cam) {
const self = this;
const reqs = new minerva_requests.request_set(self.noctuaUserService.baristaToken, cam.id);
Expand All @@ -597,16 +577,6 @@ export class NoctuaGraphService {
return cam.manager.request_with(reqs);
}

storedModel(cam: Cam) {
const self = this;
const reqs = new minerva_requests.request_set(self.noctuaUserService.baristaToken, cam.id);
const req = new minerva_requests.request('model', 'get-stored-model');
req.model(cam.id);
reqs.add(req, 'query');

return cam.artManager.request_with(reqs);
}

saveCamAnnotations(cam: Cam, annotations) {
const self = this;

Expand Down Expand Up @@ -935,16 +905,16 @@ export class NoctuaGraphService {
}

bulkEditIndividual(reqs, cam: Cam, node: AnnotonNode) {
if (node.hasValue() && node.term.modified) {
if (node.hasValue() && node.pendingChangeEntity) {
reqs.remove_type_from_individual(
node.classExpression,
node.uuid,
cam.id,
);

reqs.add_type_to_individual(
class_expression.cls(node.getTerm().id),
node.uuid,
class_expression.cls(node.pendingChangeEntity.id),
node.pendingChangeEntity.uuid,
cam.id,
);
}
Expand Down
5 changes: 4 additions & 1 deletion src/@noctua.search/services/noctua-search.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import { CamPage } from './../models/cam-page';
import { SearchHistory } from './../models/search-history';
import { NoctuaDataService } from '@noctua.common/services/noctua-data.service';
import { NoctuaSearchMenuService } from './search-menu.service';
import { MiddlePanel } from '../models/menu-panels';

declare const require: any;

Expand Down Expand Up @@ -102,7 +103,9 @@ export class NoctuaSearchService {
this.onCamsPageChanged.next(this.camPage);
});

this.noctuaSearchMenuService.resetResults();
if (this.noctuaSearchMenuService.selectedMiddlePanel === MiddlePanel.cams) {
this.noctuaSearchMenuService.resetResults();
}
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,12 @@
</mat-chip>
</div>
<span fxFlex></span>
<button mat-button class="" color="primary" (click)="resetModel(cam)">
<!-- <button mat-button class="" color="primary" (click)="resetModel(cam)">
Reset Me
</button>
<button mat-button class="" color="primary" (click)="storedModel(cam)">
Stored
</button>
<button mat-button class="" color="primary" (click)="diffModel(cam)">
Diff
</button>
</button> -->
<button mat-icon-button class="" fxFlex="40px" color="primary" [matMenuTriggerFor]="activityOptionMenu">
<mat-icon>more_vert</mat-icon>
</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,6 @@ export class CamTableComponent implements OnInit, OnDestroy {
}
}

diffModel(cam: Cam) {
this.camService.diffModel(cam);
}

resetModel(cam: Cam) {
this.camService.resetModel(cam);
Expand Down
7 changes: 0 additions & 7 deletions src/app/main/apps/noctua-search/noctua-search.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,16 +144,9 @@ export class NoctuaSearchComponent implements OnInit, AfterViewInit, OnDestroy {
}

loadCam(modelId) {
const self = this;

this.cam = this.camService.getCam(modelId);
}

edit() {
// this.loadModel(this.selectCam)
// this.openRightDrawer(RightPanel.camForm);
}

openLeftDrawer(panel) {
this.noctuaSearchMenuService.selectLeftPanel(panel);
this.noctuaSearchMenuService.openLeftDrawer();
Expand Down

0 comments on commit a2da659

Please sign in to comment.