changeset 433:48904aa87ba3

Rudimentary mechanism for loading remote plugins, with a loading spinner. Also small clean up for stuff left over from the md-select stuff.
author Lucas Thompson <dev@lucas.im>
date Wed, 07 Jun 2017 14:51:30 +0100
parents 5220174f2712
children 0991af5c6eb2
files src/app/feature-extraction-menu/feature-extraction-menu.component.css src/app/feature-extraction-menu/feature-extraction-menu.component.html src/app/feature-extraction-menu/feature-extraction-menu.component.ts
diffstat 3 files changed, 24 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/app/feature-extraction-menu/feature-extraction-menu.component.css	Wed Jun 07 08:58:38 2017 +0100
+++ b/src/app/feature-extraction-menu/feature-extraction-menu.component.css	Wed Jun 07 14:51:30 2017 +0100
@@ -8,3 +8,19 @@
   margin-top: 10pt;
   padding: 10pt;
 }
+
+.container button {
+  margin: 0 auto;
+  display: block;
+}
+
+.container md-spinner {
+  height: 20px;
+  width: 20px;
+  margin: 0 auto;
+  display: block;
+}
+
+md-list-item {
+  cursor: pointer;
+}
--- a/src/app/feature-extraction-menu/feature-extraction-menu.component.html	Wed Jun 07 08:58:38 2017 +0100
+++ b/src/app/feature-extraction-menu/feature-extraction-menu.component.html	Wed Jun 07 14:51:30 2017 +0100
@@ -19,4 +19,9 @@
       <md-divider></md-divider>
     </ng-container>
   </md-list>
+  <md-spinner *ngIf="isLoading"></md-spinner>
+  <button
+    md-button
+    (click)="load()"
+  ><md-icon>cloud_download</md-icon> Load more</button>
 </div>
--- a/src/app/feature-extraction-menu/feature-extraction-menu.component.ts	Wed Jun 07 08:58:38 2017 +0100
+++ b/src/app/feature-extraction-menu/feature-extraction-menu.component.ts	Wed Jun 07 14:51:30 2017 +0100
@@ -11,7 +11,6 @@
 } from '../services/feature-extraction/feature-extraction.service';
 import {ListResponse} from 'piper';
 import {Subscription} from 'rxjs/Subscription';
-import {MdSelect} from '@angular/material';
 
 export interface ExtractorOutputInfo {
   extractorKey: string;
@@ -48,6 +47,7 @@
   private populateExtractors: (available: ListResponse) => void;
   extractors: Iterable<ExtractorInfo>;
   private librariesUpdatedSubscription: Subscription;
+  private isLoading: boolean;
 
   constructor(private piperService: FeatureExtractionService) {
     this.extractors = [];
@@ -69,17 +69,10 @@
         acc.push({name, outputs});
         return acc;
       }, [] as ExtractorInfo[]);
+      this.isLoading = false;
     };
   }
 
-  private getFirstSelectedItemOrEmpty(select: MdSelect): string {
-    const selected = select.selected;
-    if (selected) {
-      return selected instanceof Array ? selected[0].value : selected.value;
-    }
-    return '';
-  }
-
   ngOnInit() {
     this.librariesUpdatedSubscription =
       this.piperService.librariesUpdated$.subscribe(this.populateExtractors);
@@ -96,6 +89,7 @@
   }
 
   load(): void {
+    this.isLoading = true;
     this.piperService.updateAvailableLibraries();
   }