changeset 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 b638c714bd1d
children 49017504bc39
files src/app/analysis-item/analysis-item.component.html src/app/analysis-item/analysis-item.component.ts src/app/app.component.ts src/app/notebook-feed/notebook-feed.component.html
diffstat 4 files changed, 12 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/app/analysis-item/analysis-item.component.html	Fri Mar 24 15:27:07 2017 +0000
+++ b/src/app/analysis-item/analysis-item.component.html	Fri Mar 24 16:14:57 2017 +0000
@@ -6,7 +6,7 @@
   <md-card-content>
     <app-waveform
       [timeline]="timeline"
-      [trackIdPrefix]="title"
+      [trackIdPrefix]=" id || title"
       [isSubscribedToAudioService]="isActive && isRoot"
       [isSubscribedToExtractionService]="isActive && !isRoot"
       [isOneShotExtractor]="true"
--- a/src/app/analysis-item/analysis-item.component.ts	Fri Mar 24 15:27:07 2017 +0000
+++ b/src/app/analysis-item/analysis-item.component.ts	Fri Mar 24 16:14:57 2017 +0000
@@ -11,6 +11,7 @@
   extractorKey: string;
   title?: string;
   description?: string;
+  id?: string;
 }
 
 @Component({
@@ -24,4 +25,5 @@
   @Input() description: string;
   @Input() isActive: boolean;
   @Input() isRoot: boolean;
+  @Input() id: string;
 }
--- 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({
--- a/src/app/notebook-feed/notebook-feed.component.html	Fri Mar 24 15:27:07 2017 +0000
+++ b/src/app/notebook-feed/notebook-feed.component.html	Fri Mar 24 16:14:57 2017 +0000
@@ -6,6 +6,7 @@
         [title]="item.title"
         [description]="item.description"
         [isActive]="rootAudioUri === item.rootAudioUri"
-        [isRoot]="item.isRoot"></ugly-analysis-item>
+        [isRoot]="item.isRoot"
+        [id]="item.id"></ugly-analysis-item>
   </div>
 </template>