diff src/app/app.component.ts @ 206:1db0bb28688b

Introduce id field for analysis items, currently optional but arguably shouldn't be. Currently an incrementing counter uniquely identifies an item - not ideal.
author Lucas Thompson <dev@lucas.im>
date Fri, 24 Mar 2017 16:14:57 +0000
parents f9088265a1fc
children 4865567d9e43
line wrap: on
line diff
--- a/src/app/app.component.ts	Fri Mar 24 15:27:07 2017 +0000
+++ b/src/app/app.component.ts	Fri Mar 24 16:14:57 2017 +0000
@@ -21,6 +21,7 @@
   private onAudioDataSubscription: Subscription;
   private analyses: AnalysisItem[]; // TODO some immutable state container describing entire session
   private nRecordings: number; // TODO user control for naming a recording
+  private countingId: number; // TODO improve uniquely identifying items
   private rootAudioUri: string;
 
   constructor(private audioService: AudioPlayerService,
@@ -30,6 +31,8 @@
     this.analyses = [];
     this.canExtract = false;
     this.nRecordings = 0;
+    this.countingId = 1;
+
     iconRegistry.addSvgIcon(
       'duck',
       sanitizer.bypassSecurityTrustResourceUrl('assets/duck.svg')
@@ -76,7 +79,8 @@
       extractorKey: 'not:real',
       isRoot: true,
       title: title,
-      description: new Date().toLocaleString()
+      description: new Date().toLocaleString(),
+      id: `${this.countingId++}`
     });
   }
 
@@ -90,7 +94,8 @@
       extractorKey: outputInfo.combinedKey,
       isRoot: false,
       title: outputInfo.name,
-      description: outputInfo.outputId
+      description: outputInfo.outputId,
+      id: `${this.countingId++}`
     });
 
     this.piperService.collect({