Skip to content

Commit

Permalink
fix(front) search in tempForeignKeys always return found fix #482 fix #…
Browse files Browse the repository at this point in the history
  • Loading branch information
t8g committed Oct 18, 2017
1 parent aef49ff commit 18f5e92
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions client/src/app/isari-data.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -586,11 +586,10 @@ export class IsariDataService {
}

const api = mongoSchema2Api[feature] || feature;
const url = `${this.dataUrl}/${api}/`
+ (<string[]>((this.tempForeignKeys[api] && intersection(this.tempForeignKeys[api], values))
const ids = (<string[]>((this.tempForeignKeys[api] && intersection(this.tempForeignKeys[api], values).length)
? this.tempForeignKeys[api]
: (<string[]>values))).join(',')
+ '/string';
: (<string[]>values))).join(',');
const url = `${this.dataUrl}/${api}/${ids}/string`;

if (!this.labelsCache[url]) {
this.labelsCache[url] = this.http.get(url, this.getHttpOptions())
Expand Down Expand Up @@ -623,13 +622,17 @@ export class IsariDataService {
}));
}

resetTemForeignKeys() {
this.tempForeignKeys = {};
}

buildForm(layout, data, base = false): FormGroup {
let form = this.fb.group({});
let fields = layout.reduce((acc, cv) => [...acc, ...cv.fields], []);

// reset tempForeignKeys
if (base) {
this.tempForeignKeys = {};
this.resetTemForeignKeys();
}

// build form from object after layout manipluation
Expand Down

0 comments on commit 18f5e92

Please sign in to comment.