Fixing links

This commit is contained in:
Zoe Roux 2020-05-06 03:15:24 +02:00
parent 9eef270105
commit 14052324e3
2 changed files with 12 additions and 9 deletions

View File

@ -90,8 +90,8 @@
</mat-form-field>
<mat-form-field *ngFor="let provider of this.providers" class="provider px-1">
<mat-label>{{provider.name}} ID</mat-label>
<input matInput [value]="this.getMetadataID(show, provider)?.dataID" (input)="this.setMetadataID(show, provider, $event.target.value)" >
</mat-form-field>
<input matInput [value]="this.getMetadataID(provider)?.dataID" (input)="this.setMetadataID(provider, $event.target.value)" >
</mat-form-field>
<app-show-grid #identifyGrid [externalShows]="true" (clickCallback)="this.identifyID($event)"></app-show-grid>
</mat-expansion-panel>
</mat-accordion>

View File

@ -127,25 +127,28 @@ export class MetadataEditComponent
this.identityShow(search).subscribe(x => this.identifyGrid.shows = x);
}
getMetadataID(show: Show, provider: Provider)
getMetadataID(provider: Provider)
{
return show.externalIDs.find(x => x.provider.name == provider.name);
return this.show.externalIDs.find(x => x.provider.name == provider.name);
}
setMetadataID(show: Show, provider: Provider, id: string)
setMetadataID(provider: Provider, id: string, link: string = undefined)
{
let i = show.externalIDs.findIndex(x => x.provider.name == provider.name);
let i = this.show.externalIDs.findIndex(x => x.provider.name == provider.name);
this.metadataChanged = true;
if (i != -1)
show.externalIDs[i].dataID = id;
{
this.show.externalIDs[i].dataID = id;
this.show.externalIDs[i].link = link;
}
else
show.externalIDs.push({provider: provider, dataID: id, link: undefined});
this.show.externalIDs.push({provider: provider, dataID: id, link: link});
}
identifyID(show: Show)
{
for (let id of show.externalIDs)
this.setMetadataID(this.show, id.provider, id.dataID);
this.setMetadataID(id.provider, id.dataID, id.link);
}
}