Migrate to Angular 4
This commit is contained in:
@@ -1,119 +0,0 @@
|
||||
<div class="container">
|
||||
<h1>{{albumName}}</h1>
|
||||
|
||||
<div class="alert alert-warning">
|
||||
<h3>Debug Zone</h3>
|
||||
Returned song: {{songs.length}}<br />
|
||||
Theorical number song: {{ album ? album['Track Count'] : "" }}
|
||||
<span *ngIf="album && (songs.length == album['Track Count'])" class="glyphicon glyphicon-ok" style="color:green"></span>
|
||||
<span *ngIf="album && (songs.length != album['Track Count'])" class="glyphicon glyphicon-remove" style="color:red"></span>
|
||||
</div>
|
||||
|
||||
<div class="row cardAdmin">
|
||||
<div class="col-lg-3 col-md-3">
|
||||
<div class="panel panel-yellow">
|
||||
<div class="panel-heading">
|
||||
<div class="row">
|
||||
<div class="col-xs-3">
|
||||
<span class="glyphicon glyphicon-star stats_icon"></span>
|
||||
</div>
|
||||
<div class="col-xs-9 text-right">
|
||||
<div>
|
||||
<h3 *ngIf="!album"><span class="glyphicon glyphicon-refresh loading"></span></h3>
|
||||
<h3 *ngIf="album">{{album.Rating}}/100</h3>
|
||||
</div>
|
||||
<div><br>Rating</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-3 col-md-3">
|
||||
<div class="panel panel-green">
|
||||
<div class="panel-heading">
|
||||
<div class="row">
|
||||
<div class="col-xs-3">
|
||||
<span class="glyphicon glyphicon-list-alt stats_icon"></span>
|
||||
</div>
|
||||
<div class="col-xs-9 text-right">
|
||||
<div>
|
||||
<h3 *ngIf="!album"><span class="glyphicon glyphicon-refresh loading"></span></h3>
|
||||
<h3 *ngIf="album">{{album['Track Count']}}</h3>
|
||||
</div>
|
||||
<div><br>Songs</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-3 col-md-3">
|
||||
<div class="panel panel-purple">
|
||||
<div class="panel-heading">
|
||||
<div class="row">
|
||||
<div class="col-xs-3">
|
||||
<span class="glyphicon glyphicon-headphones stats_icon"></span>
|
||||
</div>
|
||||
<div class="col-xs-9 text-right">
|
||||
<div>
|
||||
<h3 *ngIf="!album"><span class="glyphicon glyphicon-refresh loading"></span></h3>
|
||||
<h3 *ngIf="album">{{album['Play Count']}} list.</h3>
|
||||
</div>
|
||||
<div><br>~{{album['Play Count'] / album['Track Count'] | number:'1.0-0'}} listening avg.</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-3 col-md-3">
|
||||
<div class="panel panel-blue">
|
||||
<div class="panel-heading">
|
||||
<div class="row">
|
||||
<div class="col-xs-3">
|
||||
<span class="glyphicon glyphicon-time stats_icon"></span>
|
||||
</div>
|
||||
<div class="col-xs-9 text-right">
|
||||
<div>
|
||||
<h3 *ngIf="!album"><span class="glyphicon glyphicon-refresh loading"></span></h3>
|
||||
<h3 *ngIf="album">{{album['Total Time'] | convertMs}}</h3>
|
||||
</div>
|
||||
<div><br>Album time</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<table class="table table-striped" (window:scroll)="onScroll($event)">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th>Name</th>
|
||||
<th>Artist</th>
|
||||
<th>Album</th>
|
||||
<th>Album Artist</th>
|
||||
<th>Play Count</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr *ngFor="let song of songs | sortBy : 'Track Number'">
|
||||
<td>{{song['Track Number'] ? (("0" + song['Track Number']).slice(-2)) : "--"}}</td>
|
||||
<td [title]="song.Name">{{song.Name}}</td>
|
||||
<td [title]="song.Artist"><a [routerLink]="['/artist', song.Artist]">{{song.Artist}}</a></td>
|
||||
<td [title]="song.Album"><a [routerLink]="['/album', song.Album]">{{song.Album}}</a></td>
|
||||
<td [title]="song.Album">{{song['Album Artist']}}</td>
|
||||
<td [title]="song['Play Count']">{{song['Play Count']}}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<button type="button" *ngIf="moreDataAvailable" class="btn btn-default" aria-label="More" (click)="loadSongs()">
|
||||
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span> More...
|
||||
</button>
|
||||
|
||||
<!-- Go to Top Button-->
|
||||
<button type="button" class="btn btn-warning btn-top" [class.btn-top-is-visible]="atBottom"
|
||||
aria-label="Top" (click)="scrollTop()">
|
||||
<span class="glyphicon glyphicon-menu-up" aria-hidden="true"></span>
|
||||
</button>
|
||||
</div>
|
||||
@@ -34,4 +34,4 @@
|
||||
.btn-sort {
|
||||
bottom: 20px;
|
||||
right: 70px;
|
||||
}
|
||||
}
|
||||
119
dashboard/src/app/album/album.component.html
Normal file
119
dashboard/src/app/album/album.component.html
Normal file
@@ -0,0 +1,119 @@
|
||||
<div class="container">
|
||||
<h1>{{albumName}}</h1>
|
||||
|
||||
<div class="alert alert-warning">
|
||||
<h3>Debug Zone</h3>
|
||||
Returned song: {{songs.length}}<br />
|
||||
Theorical number song: {{ album ? album['Track Count'] : "" }}
|
||||
<span *ngIf="album && (songs.length == album['Track Count'])" class="glyphicon glyphicon-ok" style="color:green"></span>
|
||||
<span *ngIf="album && (songs.length != album['Track Count'])" class="glyphicon glyphicon-remove" style="color:red"></span>
|
||||
</div>
|
||||
|
||||
<div class="row cardAdmin">
|
||||
<div class="col-lg-3 col-md-3">
|
||||
<div class="panel panel-yellow">
|
||||
<div class="panel-heading">
|
||||
<div class="row">
|
||||
<div class="col-xs-3">
|
||||
<span class="glyphicon glyphicon-star stats_icon"></span>
|
||||
</div>
|
||||
<div class="col-xs-9 text-right">
|
||||
<div>
|
||||
<h3 *ngIf="!album"><span class="glyphicon glyphicon-refresh loading"></span></h3>
|
||||
<h3 *ngIf="album">{{album.Rating}}/100</h3>
|
||||
</div>
|
||||
<div><br>Rating</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-3 col-md-3">
|
||||
<div class="panel panel-green">
|
||||
<div class="panel-heading">
|
||||
<div class="row">
|
||||
<div class="col-xs-3">
|
||||
<span class="glyphicon glyphicon-list-alt stats_icon"></span>
|
||||
</div>
|
||||
<div class="col-xs-9 text-right">
|
||||
<div>
|
||||
<h3 *ngIf="!album"><span class="glyphicon glyphicon-refresh loading"></span></h3>
|
||||
<h3 *ngIf="album">{{album['Track Count']}}</h3>
|
||||
</div>
|
||||
<div><br>Songs</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-3 col-md-3">
|
||||
<div class="panel panel-purple">
|
||||
<div class="panel-heading">
|
||||
<div class="row">
|
||||
<div class="col-xs-3">
|
||||
<span class="glyphicon glyphicon-headphones stats_icon"></span>
|
||||
</div>
|
||||
<div class="col-xs-9 text-right">
|
||||
<div>
|
||||
<h3 *ngIf="!album"><span class="glyphicon glyphicon-refresh loading"></span></h3>
|
||||
<h3 *ngIf="album">{{album['Play Count']}} list.</h3>
|
||||
</div>
|
||||
<div><br>~{{album['Play Count'] / album['Track Count'] | number:'1.0-0'}} listening avg.</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-3 col-md-3">
|
||||
<div class="panel panel-blue">
|
||||
<div class="panel-heading">
|
||||
<div class="row">
|
||||
<div class="col-xs-3">
|
||||
<span class="glyphicon glyphicon-time stats_icon"></span>
|
||||
</div>
|
||||
<div class="col-xs-9 text-right">
|
||||
<div>
|
||||
<h3 *ngIf="!album"><span class="glyphicon glyphicon-refresh loading"></span></h3>
|
||||
<h3 *ngIf="album">{{album['Total Time'] | convertMs}}</h3>
|
||||
</div>
|
||||
<div><br>Album time</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<table class="table table-striped" (window:scroll)="onScroll($event)">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th>Name</th>
|
||||
<th>Artist</th>
|
||||
<th>Album</th>
|
||||
<th>Album Artist</th>
|
||||
<th>Play Count</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr *ngFor="let song of songs | sortBy : 'Track Number'">
|
||||
<td>{{song['Track Number'] ? (("0" + song['Track Number']).slice(-2)) : "--"}}</td>
|
||||
<td [title]="song.Name">{{song.Name}}</td>
|
||||
<td [title]="song.Artist"><a [routerLink]="['/artist', song.Artist]">{{song.Artist}}</a></td>
|
||||
<td [title]="song.Album"><a [routerLink]="['/album', song.Album]">{{song.Album}}</a></td>
|
||||
<td [title]="song.Album">{{song['Album Artist']}}</td>
|
||||
<td [title]="song['Play Count']">{{song['Play Count']}}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<button type="button" *ngIf="moreDataAvailable" class="btn btn-default" aria-label="More" (click)="loadSongs()">
|
||||
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span> More...
|
||||
</button>
|
||||
|
||||
<!-- Go to Top Button-->
|
||||
<button type="button" class="btn btn-warning btn-top" [class.btn-top-is-visible]="atBottom"
|
||||
aria-label="Top" (click)="scrollTop()">
|
||||
<span class="glyphicon glyphicon-menu-up" aria-hidden="true"></span>
|
||||
</button>
|
||||
</div>
|
||||
25
dashboard/src/app/album/album.component.spec.ts
Normal file
25
dashboard/src/app/album/album.component.spec.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { AlbumComponent } from './album.component';
|
||||
|
||||
describe('AlbumComponent', () => {
|
||||
let component: AlbumComponent;
|
||||
let fixture: ComponentFixture<AlbumComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ AlbumComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(AlbumComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -1,23 +1,23 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { ActivatedRoute, Params } from '@angular/router';
|
||||
import { Location } from '@angular/common';
|
||||
import { Location } from '@angular/common';
|
||||
|
||||
import { ElsService } from './els.service';
|
||||
import { Song } from './object/song';
|
||||
import { Album } from './object/album';
|
||||
import { ElsService } from './../els.service';
|
||||
import { Song } from './../object/song';
|
||||
import { Album } from './../object/album';
|
||||
|
||||
@Component({
|
||||
selector: 'album-component',
|
||||
selector: 'app-album-component',
|
||||
templateUrl: './album.component.html',
|
||||
styleUrls: [ './album.component.css', './dashboard.component.css' ]
|
||||
styleUrls: [ './album.component.css', './../dashboard.component.css' ]
|
||||
})
|
||||
|
||||
export class AlbumComponent implements OnInit {
|
||||
albumName = '';
|
||||
songs: Array<Song> = [];
|
||||
album: Album = new Album(); // If album not found, will be replaced by 'undefined'
|
||||
moreDataAvailable: boolean = false;
|
||||
atBottom: boolean = false;
|
||||
moreDataAvailable = false;
|
||||
atBottom = false;
|
||||
|
||||
constructor(
|
||||
private elsService: ElsService,
|
||||
@@ -1,9 +1,9 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { RouterModule, Routes } from '@angular/router';
|
||||
|
||||
import { DashboardComponent } from './dashboard.component';
|
||||
import { AlbumComponent } from './album.component';
|
||||
import { ArtistComponent } from './artist.component';
|
||||
import { DashboardComponent } from './dashboard.component';
|
||||
import { AlbumComponent } from './album/album.component';
|
||||
import { ArtistComponent } from './artist/artist.component';
|
||||
|
||||
const routes: Routes = [
|
||||
{ path: '', redirectTo: '/dashboard', pathMatch: 'full' },
|
||||
|
||||
4
dashboard/src/app/app.component.html
Normal file
4
dashboard/src/app/app.component.html
Normal file
@@ -0,0 +1,4 @@
|
||||
<nav>
|
||||
<a routerLink="/dashboard" routerLinkActive="active">Dashboard</a>
|
||||
</nav>
|
||||
<router-outlet></router-outlet>
|
||||
32
dashboard/src/app/app.component.spec.ts
Normal file
32
dashboard/src/app/app.component.spec.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import { TestBed, async } from '@angular/core/testing';
|
||||
|
||||
import { AppComponent } from './app.component';
|
||||
|
||||
describe('AppComponent', () => {
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [
|
||||
AppComponent
|
||||
],
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
it('should create the app', async(() => {
|
||||
const fixture = TestBed.createComponent(AppComponent);
|
||||
const app = fixture.debugElement.componentInstance;
|
||||
expect(app).toBeTruthy();
|
||||
}));
|
||||
|
||||
it(`should have as title 'app'`, async(() => {
|
||||
const fixture = TestBed.createComponent(AppComponent);
|
||||
const app = fixture.debugElement.componentInstance;
|
||||
expect(app.title).toEqual('app');
|
||||
}));
|
||||
|
||||
it('should render title in a h1 tag', async(() => {
|
||||
const fixture = TestBed.createComponent(AppComponent);
|
||||
fixture.detectChanges();
|
||||
const compiled = fixture.debugElement.nativeElement;
|
||||
expect(compiled.querySelector('h1').textContent).toContain('Welcome to app!');
|
||||
}));
|
||||
});
|
||||
@@ -1,17 +1,10 @@
|
||||
import { Component } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'my-app',
|
||||
template: `
|
||||
<nav>
|
||||
<a routerLink="/dashboard" routerLinkActive="active">Dashboard</a>
|
||||
<a routerLink="/heroes" routerLinkActive="active">Heroes</a>
|
||||
</nav>
|
||||
<router-outlet></router-outlet>
|
||||
`,
|
||||
styleUrls: [ './app.component.css' ]
|
||||
selector: 'app-root',
|
||||
templateUrl: './app.component.html',
|
||||
styleUrls: ['./app.component.css']
|
||||
})
|
||||
|
||||
export class AppComponent {
|
||||
title = 'Tour of Heroes';
|
||||
title = 'app';
|
||||
}
|
||||
|
||||
@@ -1,30 +1,23 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { BrowserModule } from '@angular/platform-browser';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { HttpModule } from '@angular/http';
|
||||
import { NgModule } from '@angular/core';
|
||||
import { BrowserModule } from '@angular/platform-browser';
|
||||
import { HttpModule } from '@angular/http';
|
||||
|
||||
// Imports for loading & configuring the in-memory web api
|
||||
// import { InMemoryWebApiModule } from 'angular-in-memory-web-api';
|
||||
// import { InMemoryDataService } from './in-memory-data.service';
|
||||
import { AppComponent } from './app.component';
|
||||
import { DashboardComponent } from './dashboard.component';
|
||||
import { AlbumComponent } from './album/album.component';
|
||||
import { ArtistComponent } from './artist/artist.component';
|
||||
|
||||
import { AppComponent } from './app.component';
|
||||
import { DashboardComponent } from './dashboard.component';
|
||||
import { AlbumComponent } from './album.component';
|
||||
import { ArtistComponent } from './artist.component';
|
||||
|
||||
import { ElsService } from './els.service';
|
||||
import { ElsService } from './els.service';
|
||||
|
||||
import { AppRoutingModule } from './app-routing.module';
|
||||
|
||||
import { ConvertMsPipe } from './convertms.pipe';
|
||||
import { SortPipe } from './sortby.pipe';
|
||||
import { SortByPipe } from './sort-by.pipe';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
imports: [
|
||||
BrowserModule,
|
||||
FormsModule,
|
||||
HttpModule,
|
||||
// InMemoryWebApiModule.forRoot(InMemoryDataService),
|
||||
AppRoutingModule
|
||||
],
|
||||
declarations: [
|
||||
@@ -33,7 +26,7 @@ import { SortPipe } from './sortby.pipe';
|
||||
AlbumComponent,
|
||||
ArtistComponent,
|
||||
ConvertMsPipe,
|
||||
SortPipe
|
||||
SortByPipe
|
||||
],
|
||||
providers: [
|
||||
ElsService
|
||||
|
||||
@@ -1,126 +0,0 @@
|
||||
<div class="container">
|
||||
<h1>{{artistName}}</h1>
|
||||
|
||||
<div class="alert alert-warning">
|
||||
<h3>Debug Zone</h3>
|
||||
Returned song: {{songs.length}}<br />
|
||||
Theorical song: {{ artist ? artist['Track Count'] : "" }}
|
||||
<span *ngIf="artist && (songs.length == artist['Track Count'])" class="glyphicon glyphicon-ok" style="color:green"></span>
|
||||
<span *ngIf="artist && (songs.length != artist['Track Count'])" class="glyphicon glyphicon-remove" style="color:red"></span>
|
||||
</div>
|
||||
|
||||
<div class="row cardAdmin">
|
||||
<div class="col-lg-3 col-md-3">
|
||||
<div class="panel panel-yellow">
|
||||
<div class="panel-heading">
|
||||
<div class="row">
|
||||
<div class="col-xs-3">
|
||||
<span class="glyphicon glyphicon-star stats_icon"></span>
|
||||
</div>
|
||||
<div class="col-xs-9 text-right">
|
||||
<div>
|
||||
<h3 *ngIf="!artist"><span class="glyphicon glyphicon-refresh loading"></span></h3>
|
||||
<h3 *ngIf="artist">{{artist.Rating}}/100</h3>
|
||||
</div>
|
||||
<div>Rating</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-3 col-md-3">
|
||||
<div class="panel panel-blue">
|
||||
<div class="panel-heading">
|
||||
<div class="row">
|
||||
<div class="col-xs-3">
|
||||
<span class="glyphicon glyphicon-cd stats_icon"></span>
|
||||
</div>
|
||||
<div class="col-xs-9 text-right">
|
||||
<div>
|
||||
<h3 *ngIf="!artist"><span class="glyphicon glyphicon-refresh loading"></span></h3>
|
||||
<h3 *ngIf="artist">{{artist.Album?.length}}</h3>
|
||||
</div>
|
||||
<div>Albums</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-3 col-md-3">
|
||||
<div class="panel panel-green">
|
||||
<div class="panel-heading">
|
||||
<div class="row">
|
||||
<div class="col-xs-3">
|
||||
<span class="glyphicon glyphicon-list-alt stats_icon"></span>
|
||||
</div>
|
||||
<div class="col-xs-9 text-right">
|
||||
<div>
|
||||
<h3 *ngIf="!artist"><span class="glyphicon glyphicon-refresh loading"></span></h3>
|
||||
<h3 *ngIf="artist">{{artist['Track Count']}}</h3>
|
||||
</div>
|
||||
<div>Songs</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-3 col-md-3">
|
||||
<div class="panel panel-purple">
|
||||
<div class="panel-heading">
|
||||
<div class="row">
|
||||
<div class="col-xs-3">
|
||||
<span class="glyphicon glyphicon-headphones stats_icon"></span>
|
||||
</div>
|
||||
<div class="col-xs-9 text-right">
|
||||
<div>
|
||||
<h3 *ngIf="!artist"><span class="glyphicon glyphicon-refresh loading"></span></h3>
|
||||
<h3 *ngIf="artist">{{artist['Play Count']}} list.</h3>
|
||||
</div>
|
||||
<div *ngIf="artist">~{{artist['Play Count'] / artist['Track Count'] | number:'1.0-0'}} listening avg.</div>
|
||||
<div *ngIf="!artist">Listening</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<table class="table table-striped" (window:scroll)="onScroll($event)">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th>Name</th>
|
||||
<th>Album</th>
|
||||
<th>Year</th>
|
||||
<th>Artist</th>
|
||||
<th>Album Artist</th>
|
||||
<th>Play Count</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr *ngFor="let song of songs | sortBy : 'Year':'Album':'Track Number'">
|
||||
<td>{{song['Track Number'] ? (("0" + song['Track Number']).slice(-2)) : "--"}}</td>
|
||||
<td>{{song.Name}}</td>
|
||||
<td><a [routerLink]="['/album', song.Album]">{{song.Album}}</a></td>
|
||||
<td>{{song.Year}}</td>
|
||||
<td><a [routerLink]="['/artist', song.Artist]">{{song.Artist}}</a></td>
|
||||
<td>{{song['Album Artist'] ? song['Album Artist'] : "-" }}</td>
|
||||
<td>{{song['Play Count']}}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<button type="button" *ngIf="moreDataAvailable" class="btn btn-default" aria-label="More" (click)="loadSongs()">
|
||||
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span> More...
|
||||
</button>
|
||||
|
||||
<!-- Go to Top Button-->
|
||||
<button type="button" class="btn btn-warning btn-top" [class.btn-top-is-visible]="atBottom"
|
||||
aria-label="Top" (click)="scrollTop()" title="Go back to Top!">
|
||||
<span class="glyphicon glyphicon-menu-up" aria-hidden="true"></span>
|
||||
</button>
|
||||
<button type="button" class="btn btn-primary btn-top btn-sort" [class.btn-top-is-visible]="sortable"
|
||||
aria-label="Top" (click)="sort()" title="Sort by Album & Track Number">
|
||||
<span class="glyphicon glyphicon-sort-by-attributes" aria-hidden="true"></span>
|
||||
</button>
|
||||
</div>
|
||||
0
dashboard/src/app/artist/artist.component.css
Normal file
0
dashboard/src/app/artist/artist.component.css
Normal file
126
dashboard/src/app/artist/artist.component.html
Normal file
126
dashboard/src/app/artist/artist.component.html
Normal file
@@ -0,0 +1,126 @@
|
||||
<div class="container">
|
||||
<h1>{{artistName}}</h1>
|
||||
|
||||
<div class="alert alert-warning">
|
||||
<h3>Debug Zone</h3>
|
||||
Returned song: {{songs.length}}<br />
|
||||
Theorical song: {{ artist ? artist['Track Count'] : "" }}
|
||||
<span *ngIf="artist && (songs.length == artist['Track Count'])" class="glyphicon glyphicon-ok" style="color:green"></span>
|
||||
<span *ngIf="artist && (songs.length != artist['Track Count'])" class="glyphicon glyphicon-remove" style="color:red"></span>
|
||||
</div>
|
||||
|
||||
<div class="row cardAdmin">
|
||||
<div class="col-lg-3 col-md-3">
|
||||
<div class="panel panel-yellow">
|
||||
<div class="panel-heading">
|
||||
<div class="row">
|
||||
<div class="col-xs-3">
|
||||
<span class="glyphicon glyphicon-star stats_icon"></span>
|
||||
</div>
|
||||
<div class="col-xs-9 text-right">
|
||||
<div>
|
||||
<h3 *ngIf="!artist"><span class="glyphicon glyphicon-refresh loading"></span></h3>
|
||||
<h3 *ngIf="artist">{{artist.Rating}}/100</h3>
|
||||
</div>
|
||||
<div>Rating</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-3 col-md-3">
|
||||
<div class="panel panel-blue">
|
||||
<div class="panel-heading">
|
||||
<div class="row">
|
||||
<div class="col-xs-3">
|
||||
<span class="glyphicon glyphicon-cd stats_icon"></span>
|
||||
</div>
|
||||
<div class="col-xs-9 text-right">
|
||||
<div>
|
||||
<h3 *ngIf="!artist"><span class="glyphicon glyphicon-refresh loading"></span></h3>
|
||||
<h3 *ngIf="artist">{{artist.Album?.length}}</h3>
|
||||
</div>
|
||||
<div>Albums</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-3 col-md-3">
|
||||
<div class="panel panel-green">
|
||||
<div class="panel-heading">
|
||||
<div class="row">
|
||||
<div class="col-xs-3">
|
||||
<span class="glyphicon glyphicon-list-alt stats_icon"></span>
|
||||
</div>
|
||||
<div class="col-xs-9 text-right">
|
||||
<div>
|
||||
<h3 *ngIf="!artist"><span class="glyphicon glyphicon-refresh loading"></span></h3>
|
||||
<h3 *ngIf="artist">{{artist['Track Count']}}</h3>
|
||||
</div>
|
||||
<div>Songs</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-3 col-md-3">
|
||||
<div class="panel panel-purple">
|
||||
<div class="panel-heading">
|
||||
<div class="row">
|
||||
<div class="col-xs-3">
|
||||
<span class="glyphicon glyphicon-headphones stats_icon"></span>
|
||||
</div>
|
||||
<div class="col-xs-9 text-right">
|
||||
<div>
|
||||
<h3 *ngIf="!artist"><span class="glyphicon glyphicon-refresh loading"></span></h3>
|
||||
<h3 *ngIf="artist">{{artist['Play Count']}} list.</h3>
|
||||
</div>
|
||||
<div *ngIf="artist">~{{artist['Play Count'] / artist['Track Count'] | number:'1.0-0'}} listening avg.</div>
|
||||
<div *ngIf="!artist">Listening</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<table class="table table-striped" (window:scroll)="onScroll($event)">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th>Name</th>
|
||||
<th>Album</th>
|
||||
<th>Year</th>
|
||||
<th>Artist</th>
|
||||
<th>Album Artist</th>
|
||||
<th>Play Count</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr *ngFor="let song of songs | sortBy : 'Year':'Album':'Track Number'">
|
||||
<td>{{song['Track Number'] ? (("0" + song['Track Number']).slice(-2)) : "--"}}</td>
|
||||
<td>{{song.Name}}</td>
|
||||
<td><a [routerLink]="['/album', song.Album]">{{song.Album}}</a></td>
|
||||
<td>{{song.Year}}</td>
|
||||
<td><a [routerLink]="['/artist', song.Artist]">{{song.Artist}}</a></td>
|
||||
<td>{{song['Album Artist'] ? song['Album Artist'] : "-" }}</td>
|
||||
<td>{{song['Play Count']}}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<button type="button" *ngIf="moreDataAvailable" class="btn btn-default" aria-label="More" (click)="loadSongs()">
|
||||
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span> More...
|
||||
</button>
|
||||
|
||||
<!-- Go to Top Button-->
|
||||
<button type="button" class="btn btn-warning btn-top" [class.btn-top-is-visible]="atBottom"
|
||||
aria-label="Top" (click)="scrollTop()" title="Go back to Top!">
|
||||
<span class="glyphicon glyphicon-menu-up" aria-hidden="true"></span>
|
||||
</button>
|
||||
<button type="button" class="btn btn-primary btn-top btn-sort" [class.btn-top-is-visible]="sortable"
|
||||
aria-label="Top" (click)="sort()" title="Sort by Album & Track Number">
|
||||
<span class="glyphicon glyphicon-sort-by-attributes" aria-hidden="true"></span>
|
||||
</button>
|
||||
</div>
|
||||
25
dashboard/src/app/artist/artist.component.spec.ts
Normal file
25
dashboard/src/app/artist/artist.component.spec.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ArtistComponent } from './artist.component';
|
||||
|
||||
describe('ArtistComponent', () => {
|
||||
let component: ArtistComponent;
|
||||
let fixture: ComponentFixture<ArtistComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ArtistComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(ArtistComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -1,17 +1,17 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { ActivatedRoute, Params } from '@angular/router';
|
||||
import { Location } from '@angular/common';
|
||||
import { Location } from '@angular/common';
|
||||
|
||||
import { ElsService } from './els.service';
|
||||
import { Song } from './object/song';
|
||||
import { Artist } from './object/artist';
|
||||
import { ElsService } from './../els.service';
|
||||
import { Song } from './../object/song';
|
||||
import { Artist } from './../object/artist';
|
||||
|
||||
import { SortPipe } from './sortby.pipe';
|
||||
import { SortByPipe } from './../sort-by.pipe';
|
||||
|
||||
@Component({
|
||||
selector: 'artist-component',
|
||||
selector: 'app-artist-component',
|
||||
templateUrl: './artist.component.html',
|
||||
styleUrls: [ './album.component.css', './dashboard.component.css' ]
|
||||
styleUrls: [ './../album/album.component.css', './../dashboard.component.css' ]
|
||||
})
|
||||
|
||||
export class ArtistComponent implements OnInit {
|
||||
@@ -19,11 +19,11 @@ export class ArtistComponent implements OnInit {
|
||||
songs: Array<Song> = [];
|
||||
artist: Artist = new Artist();
|
||||
// To activate button in interface var
|
||||
moreDataAvailable: boolean = false;
|
||||
atBottom: boolean = false;
|
||||
sortable: boolean = false;
|
||||
moreDataAvailable = false;
|
||||
atBottom = false;
|
||||
sortable = false;
|
||||
|
||||
lockLoadData: boolean = false;
|
||||
lockLoadData = false;
|
||||
|
||||
constructor(
|
||||
private elsService: ElsService,
|
||||
@@ -41,7 +41,7 @@ export class ArtistComponent implements OnInit {
|
||||
// TODO Duplicate code!
|
||||
loadSongs(): void {
|
||||
if (this.lockLoadData) {
|
||||
console.debug('Loading data locked');
|
||||
console.log('Loading data locked');
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ export class ArtistComponent implements OnInit {
|
||||
this.songs.push(song);
|
||||
});
|
||||
}
|
||||
console.debug('Unlock load data');
|
||||
console.log('Unlock load data');
|
||||
this.lockLoadData = false;
|
||||
}
|
||||
);
|
||||
@@ -93,7 +93,7 @@ export class ArtistComponent implements OnInit {
|
||||
}
|
||||
|
||||
sort(): void {
|
||||
this.songs = new SortPipe().transform(this.songs, 'Year', 'Album', 'Track Number', 'Play Count');
|
||||
this.songs = new SortByPipe().transform(this.songs, 'Year', 'Album', 'Track Number', 'Play Count');
|
||||
this.sortable = false;
|
||||
}
|
||||
}
|
||||
8
dashboard/src/app/convertms.pipe.spec.ts
Normal file
8
dashboard/src/app/convertms.pipe.spec.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
import { ConvertmsPipe } from './convertms.pipe';
|
||||
|
||||
describe('ConvertmsPipe', () => {
|
||||
it('create an instance', () => {
|
||||
const pipe = new ConvertmsPipe();
|
||||
expect(pipe).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -1,11 +1,14 @@
|
||||
import { Pipe, PipeTransform } from '@angular/core';
|
||||
|
||||
@Pipe({name: 'convertMs'})
|
||||
@Pipe({
|
||||
name: 'convertMs'
|
||||
})
|
||||
export class ConvertMsPipe implements PipeTransform {
|
||||
|
||||
transform(timeMs: number): string {
|
||||
let x = timeMs / 1000;
|
||||
|
||||
let seconds = Math.round(x % 60);
|
||||
const seconds = Math.round(x % 60);
|
||||
x /= 60;
|
||||
|
||||
let minutes = 0;
|
||||
@@ -16,7 +19,7 @@ export class ConvertMsPipe implements PipeTransform {
|
||||
if (x > 1) { hours = Math.round(x % 24); }
|
||||
// TODO Enable/disable day
|
||||
x /= 24;
|
||||
let days = Math.round(x);
|
||||
const days = Math.round(x);
|
||||
|
||||
// Final string
|
||||
let ret = '';
|
||||
|
||||
@@ -35,4 +35,4 @@
|
||||
background-color: #9b59b6;
|
||||
margin: 0 auto;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,19 +5,19 @@ import { Song } from './object/song';
|
||||
import { Bucket } from './object/bucket';
|
||||
|
||||
@Component({
|
||||
selector: 'my-dashboard',
|
||||
selector: 'app-dashboard',
|
||||
templateUrl: './dashboard.component.html',
|
||||
styleUrls: [ './dashboard.component.css' ]
|
||||
})
|
||||
|
||||
export class DashboardComponent implements OnInit {
|
||||
totalTime: number = 0;
|
||||
totalSize: number = 0;
|
||||
totalTime = 0;
|
||||
totalSize = 0;
|
||||
totalSizeSt = '';
|
||||
trackCountSong: number = 0;
|
||||
trackCountArtist: number = 0;
|
||||
trackCountAlbum: number = 0;
|
||||
neverListenSong: number = 0;
|
||||
trackCountSong = 0;
|
||||
trackCountArtist = 0;
|
||||
trackCountAlbum = 0;
|
||||
neverListenSong = 0;
|
||||
|
||||
topGenres: Bucket[] = [];
|
||||
bottomGenres: Bucket[] = [];
|
||||
@@ -61,13 +61,13 @@ export class DashboardComponent implements OnInit {
|
||||
*/
|
||||
|
||||
convertSizeToString(size: number) {
|
||||
let units = ['Bytes', 'KiB', 'MiB', 'GiB', 'TiB'];
|
||||
const units = ['Bytes', 'KiB', 'MiB', 'GiB', 'TiB'];
|
||||
|
||||
if (size === 0) {
|
||||
return '0 Byte';
|
||||
}
|
||||
|
||||
let i = Math.floor(Math.log(size) / Math.log(1024));
|
||||
const i = Math.floor(Math.log(size) / Math.log(1024));
|
||||
let calcSize = size / Math.pow(1024, i);
|
||||
calcSize = Math.round(calcSize * 100) / 100;
|
||||
|
||||
|
||||
15
dashboard/src/app/els.service.spec.ts
Normal file
15
dashboard/src/app/els.service.spec.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { TestBed, inject } from '@angular/core/testing';
|
||||
|
||||
import { ElsService } from './els.service';
|
||||
|
||||
describe('ElsService', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [ElsService]
|
||||
});
|
||||
});
|
||||
|
||||
it('should be created', inject([ElsService], (service: ElsService) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
});
|
||||
@@ -1,11 +1,11 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Headers, Http } from '@angular/http';
|
||||
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import 'rxjs/add/operator/toPromise';
|
||||
import 'rxjs/add/operator/map';
|
||||
|
||||
import { Song } from './object/song';
|
||||
import { Song } from './object/song';
|
||||
import { Album } from './object/album';
|
||||
import { Artist } from './object/artist';
|
||||
import { Bucket } from './object/bucket';
|
||||
@@ -117,7 +117,7 @@ export class ElsService {
|
||||
return res.json().hits.hits;
|
||||
})
|
||||
.map((hits: Array<any>) => {
|
||||
let result: Array<Song> = [];
|
||||
const result: Array<Song> = [];
|
||||
hits.forEach((hit) => {
|
||||
result.push(hit._source);
|
||||
});
|
||||
@@ -134,7 +134,7 @@ export class ElsService {
|
||||
}
|
||||
|
||||
getAlbumSongs(albumName: string, from: number = 0): Observable<Song[]> {
|
||||
console.debug('getAlbumSongs- Album name: ' + albumName + ' - from: ' + from);
|
||||
console.info('getAlbumSongs- Album name: ' + albumName + ' - from: ' + from);
|
||||
return this.http
|
||||
.post(this.elsUrl + 'song' + ElsService.ACTION_SEARCH,
|
||||
JSON.stringify({
|
||||
@@ -148,7 +148,7 @@ export class ElsService {
|
||||
return res.json().hits.hits;
|
||||
})
|
||||
.map((hits: Array<any>) => {
|
||||
let result: Array<Song> = [];
|
||||
const result: Array<Song> = [];
|
||||
hits.forEach((hit) => {
|
||||
result.push(hit._source);
|
||||
});
|
||||
@@ -157,7 +157,7 @@ export class ElsService {
|
||||
}
|
||||
|
||||
getArtistSongs(artistName: string, from: number = 0): Observable<Song[]> {
|
||||
console.debug('getArtistSongs- Artist name: ' + artistName + ' - from: ' + from);
|
||||
console.info('getArtistSongs- Artist name: ' + artistName + ' - from: ' + from);
|
||||
return this.http
|
||||
.post(this.elsUrl + 'song' + ElsService.ACTION_SEARCH,
|
||||
JSON.stringify({
|
||||
@@ -176,7 +176,7 @@ export class ElsService {
|
||||
return res.json().hits.hits;
|
||||
})
|
||||
.map((hits: Array<any>) => {
|
||||
let result: Array<Song> = [];
|
||||
const result: Array<Song> = [];
|
||||
hits.forEach((hit) => {
|
||||
result.push(hit._source);
|
||||
});
|
||||
@@ -251,7 +251,7 @@ export class ElsService {
|
||||
}), {headers: this.headers})
|
||||
.map(res => res.json().aggregations.genres.buckets)
|
||||
.map((hits: Array<any>) => {
|
||||
let result: Array<Bucket> = [];
|
||||
const result: Array<Bucket> = [];
|
||||
hits.forEach((bucket) => {
|
||||
result.push(bucket);
|
||||
});
|
||||
|
||||
@@ -4,10 +4,10 @@ export class Album {
|
||||
Artist: Array<string>;
|
||||
Rating: number;
|
||||
Genre: Array<string>;
|
||||
"Track Count": number;
|
||||
"Album Rating": number;
|
||||
"Persistent ID": string;
|
||||
"Album Rating Computed": boolean;
|
||||
"Play Count": number;
|
||||
"Total Time": number;
|
||||
}
|
||||
'Track Count': number;
|
||||
'Album Rating': number;
|
||||
'Persistent ID': string;
|
||||
'Album Rating Computed': boolean;
|
||||
'Play Count': number;
|
||||
'Total Time': number;
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ export class Artist {
|
||||
Artist: string;
|
||||
Rating: number;
|
||||
Genre: Array<string>;
|
||||
"Track Count": number;
|
||||
"Persistent ID": string;
|
||||
"Play Count": number;
|
||||
}
|
||||
'Track Count': number;
|
||||
'Persistent ID': string;
|
||||
'Play Count': number;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
export class Bucket {
|
||||
key: string;
|
||||
doc_count: number;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
export class Song {
|
||||
Name: string;
|
||||
Artist: string;
|
||||
"Play Count": number;
|
||||
'Play Count': number;
|
||||
Album: string;
|
||||
"Track Number": number; // TODO Default property
|
||||
}
|
||||
'Track Number': number; // TODO Default property
|
||||
}
|
||||
|
||||
8
dashboard/src/app/sort-by.pipe.spec.ts
Normal file
8
dashboard/src/app/sort-by.pipe.spec.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
import { SortByPipe } from './sort-by.pipe';
|
||||
|
||||
describe('SortByPipe', () => {
|
||||
it('create an instance', () => {
|
||||
const pipe = new SortByPipe();
|
||||
expect(pipe).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -1,14 +1,14 @@
|
||||
// Thank to http://4dev.tech/2016/09/angular2-how-to-sort-a-json-dataset-by-field/ for the pipe
|
||||
// Thank to http://stackoverflow.com/questions/28560801/javascript-sorting-array-by-multiple-criteria for the multi-args part
|
||||
|
||||
import { Pipe, PipeTransform } from '@angular/core';
|
||||
|
||||
@Pipe({name: 'sortBy'})
|
||||
export class SortPipe implements PipeTransform {
|
||||
@Pipe({
|
||||
name: 'sortBy'
|
||||
})
|
||||
export class SortByPipe implements PipeTransform {
|
||||
|
||||
transform(array: Array<any>, ...args: any[]): Array<any> {
|
||||
array.sort((a: any, b: any) => {
|
||||
for (let i = 0; i < array.length; i++) {
|
||||
let arg = args[i];
|
||||
const arg = args[i];
|
||||
|
||||
if (a[arg] === undefined && b[arg] !== undefined) { return -1; }
|
||||
if (a[arg] !== undefined && b[arg] === undefined) { return 1; }
|
||||
@@ -20,4 +20,5 @@ export class SortPipe implements PipeTransform {
|
||||
});
|
||||
return array;
|
||||
}
|
||||
|
||||
}
|
||||
0
dashboard/src/assets/.gitkeep
Normal file
0
dashboard/src/assets/.gitkeep
Normal file
3
dashboard/src/environments/environment.prod.ts
Normal file
3
dashboard/src/environments/environment.prod.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
export const environment = {
|
||||
production: true
|
||||
};
|
||||
8
dashboard/src/environments/environment.ts
Normal file
8
dashboard/src/environments/environment.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
// The file contents for the current environment will overwrite these during build.
|
||||
// The build system defaults to the dev environment which uses `environment.ts`, but if you do
|
||||
// `ng build --env=prod` then `environment.prod.ts` will be used instead.
|
||||
// The list of which env maps to which file can be found in `.angular-cli.json`.
|
||||
|
||||
export const environment = {
|
||||
production: false
|
||||
};
|
||||
@@ -1,29 +1,14 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Music Dashboard</title>
|
||||
<base href="/">
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="stylesheet" href="styles.css">
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Dashboard</title>
|
||||
<base href="/">
|
||||
|
||||
<!-- Polyfill(s) for older browsers -->
|
||||
<script src="node_modules/core-js/client/shim.min.js"></script>
|
||||
|
||||
<script src="node_modules/zone.js/dist/zone.js"></script>
|
||||
<script src="node_modules/systemjs/dist/system.src.js"></script>
|
||||
|
||||
<link rel="stylesheet" href="node_modules/bootstrap/dist/css/bootstrap.min.css">
|
||||
<script src="node_modules/jquery/dist/jquery.min.js"></script>
|
||||
<script src="node_modules/bootstrap/dist/js/bootstrap.min.js"></script>
|
||||
|
||||
<script src="systemjs.config.js"></script>
|
||||
<script>
|
||||
System.import('main.js').catch(function(err){ console.error(err); });
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<my-app>Loading AppComponent content here ...</my-app>
|
||||
</body>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="icon" type="image/x-icon" href="favicon.ico">
|
||||
</head>
|
||||
<body>
|
||||
<app-root></app-root>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
"use strict";
|
||||
var platform_browser_dynamic_1 = require("@angular/platform-browser-dynamic");
|
||||
var app_module_1 = require("./app/app.module");
|
||||
platform_browser_dynamic_1.platformBrowserDynamic().bootstrapModule(app_module_1.AppModule);
|
||||
//# sourceMappingURL=main.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"file":"main.js","sourceRoot":"","sources":["main.ts"],"names":[],"mappings":";AAAA,8EAA2E;AAE3E,+CAA6C;AAE7C,iDAAsB,EAAE,CAAC,eAAe,CAAC,sBAAS,CAAC,CAAC"}
|
||||
@@ -1,5 +1,11 @@
|
||||
import { enableProdMode } from '@angular/core';
|
||||
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
||||
|
||||
import { AppModule } from './app/app.module';
|
||||
import { environment } from './environments/environment';
|
||||
|
||||
if (environment.production) {
|
||||
enableProdMode();
|
||||
}
|
||||
|
||||
platformBrowserDynamic().bootstrapModule(AppModule);
|
||||
|
||||
72
dashboard/src/polyfills.ts
Normal file
72
dashboard/src/polyfills.ts
Normal file
@@ -0,0 +1,72 @@
|
||||
/**
|
||||
* This file includes polyfills needed by Angular and is loaded before the app.
|
||||
* You can add your own extra polyfills to this file.
|
||||
*
|
||||
* This file is divided into 2 sections:
|
||||
* 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
|
||||
* 2. Application imports. Files imported after ZoneJS that should be loaded before your main
|
||||
* file.
|
||||
*
|
||||
* The current setup is for so-called "evergreen" browsers; the last versions of browsers that
|
||||
* automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera),
|
||||
* Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile.
|
||||
*
|
||||
* Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html
|
||||
*/
|
||||
|
||||
/***************************************************************************************************
|
||||
* BROWSER POLYFILLS
|
||||
*/
|
||||
|
||||
/** IE9, IE10 and IE11 requires all of the following polyfills. **/
|
||||
// import 'core-js/es6/symbol';
|
||||
// import 'core-js/es6/object';
|
||||
// import 'core-js/es6/function';
|
||||
// import 'core-js/es6/parse-int';
|
||||
// import 'core-js/es6/parse-float';
|
||||
// import 'core-js/es6/number';
|
||||
// import 'core-js/es6/math';
|
||||
// import 'core-js/es6/string';
|
||||
// import 'core-js/es6/date';
|
||||
// import 'core-js/es6/array';
|
||||
// import 'core-js/es6/regexp';
|
||||
// import 'core-js/es6/map';
|
||||
// import 'core-js/es6/weak-map';
|
||||
// import 'core-js/es6/set';
|
||||
|
||||
/** IE10 and IE11 requires the following for NgClass support on SVG elements */
|
||||
// import 'classlist.js'; // Run `npm install --save classlist.js`.
|
||||
|
||||
/** Evergreen browsers require these. **/
|
||||
import 'core-js/es6/reflect';
|
||||
import 'core-js/es7/reflect';
|
||||
|
||||
|
||||
/**
|
||||
* Required to support Web Animations `@angular/animation`.
|
||||
* Needed for: All but Chrome, Firefox and Opera. http://caniuse.com/#feat=web-animation
|
||||
**/
|
||||
// import 'web-animations-js'; // Run `npm install --save web-animations-js`.
|
||||
|
||||
|
||||
|
||||
/***************************************************************************************************
|
||||
* Zone JS is required by Angular itself.
|
||||
*/
|
||||
import 'zone.js/dist/zone'; // Included with Angular CLI.
|
||||
|
||||
|
||||
|
||||
/***************************************************************************************************
|
||||
* APPLICATION IMPORTS
|
||||
*/
|
||||
|
||||
/**
|
||||
* Date, currency, decimal and percent pipes.
|
||||
* Needed for: All but Chrome, Firefox, Edge, IE11 and Safari 10
|
||||
*/
|
||||
// import 'intl'; // Run `npm install --save intl`.
|
||||
/**
|
||||
* Need to import at least one locale-data with intl.
|
||||
*/
|
||||
// import 'intl/locale-data/jsonp/en';
|
||||
@@ -1,49 +0,0 @@
|
||||
var templateUrlRegex = /templateUrl\s*:(\s*['"`](.*?)['"`]\s*)/gm;
|
||||
var stylesRegex = /styleUrls *:(\s*\[[^\]]*?\])/g;
|
||||
var stringRegex = /(['`"])((?:[^\\]\\\1|.)*?)\1/g;
|
||||
|
||||
module.exports.translate = function(load){
|
||||
if (load.source.indexOf('moduleId') != -1) return load;
|
||||
|
||||
var url = document.createElement('a');
|
||||
url.href = load.address;
|
||||
|
||||
var basePathParts = url.pathname.split('/');
|
||||
|
||||
basePathParts.pop();
|
||||
var basePath = basePathParts.join('/');
|
||||
|
||||
var baseHref = document.createElement('a');
|
||||
baseHref.href = this.baseURL;
|
||||
baseHref = baseHref.pathname;
|
||||
|
||||
if (!baseHref.startsWith('/base/')) { // it is not karma
|
||||
basePath = basePath.replace(baseHref, '');
|
||||
}
|
||||
|
||||
load.source = load.source
|
||||
.replace(templateUrlRegex, function(match, quote, url){
|
||||
var resolvedUrl = url;
|
||||
|
||||
if (url.startsWith('.')) {
|
||||
resolvedUrl = basePath + url.substr(1);
|
||||
}
|
||||
|
||||
return 'templateUrl: "' + resolvedUrl + '"';
|
||||
})
|
||||
.replace(stylesRegex, function(match, relativeUrls) {
|
||||
var urls = [];
|
||||
|
||||
while ((match = stringRegex.exec(relativeUrls)) !== null) {
|
||||
if (match[2].startsWith('.')) {
|
||||
urls.push('"' + basePath + match[2].substr(1) + '"');
|
||||
} else {
|
||||
urls.push('"' + match[2] + '"');
|
||||
}
|
||||
}
|
||||
|
||||
return "styleUrls: [" + urls.join(', ') + "]";
|
||||
});
|
||||
|
||||
return load;
|
||||
};
|
||||
@@ -1,11 +0,0 @@
|
||||
/**
|
||||
* Add barrels and stuff
|
||||
* Adjust as necessary for your application needs.
|
||||
*/
|
||||
// (function (global) {
|
||||
// System.config({
|
||||
// packages: {
|
||||
// // add packages here
|
||||
// }
|
||||
// });
|
||||
// })(this);
|
||||
@@ -1,45 +0,0 @@
|
||||
/**
|
||||
* System configuration for Angular samples
|
||||
* Adjust as necessary for your application needs.
|
||||
*/
|
||||
(function (global) {
|
||||
System.config({
|
||||
paths: {
|
||||
// paths serve as alias
|
||||
'npm:': 'node_modules/'
|
||||
},
|
||||
// map tells the System loader where to look for things
|
||||
map: {
|
||||
// our app is within the app folder
|
||||
'app': 'app',
|
||||
|
||||
// angular bundles
|
||||
'@angular/core': 'npm:@angular/core/bundles/core.umd.js',
|
||||
'@angular/common': 'npm:@angular/common/bundles/common.umd.js',
|
||||
'@angular/compiler': 'npm:@angular/compiler/bundles/compiler.umd.js',
|
||||
'@angular/platform-browser': 'npm:@angular/platform-browser/bundles/platform-browser.umd.js',
|
||||
'@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js',
|
||||
'@angular/http': 'npm:@angular/http/bundles/http.umd.js',
|
||||
'@angular/router': 'npm:@angular/router/bundles/router.umd.js',
|
||||
'@angular/forms': 'npm:@angular/forms/bundles/forms.umd.js',
|
||||
|
||||
// other libraries
|
||||
'rxjs': 'npm:rxjs',
|
||||
'angular-in-memory-web-api': 'npm:angular-in-memory-web-api/bundles/in-memory-web-api.umd.js'
|
||||
},
|
||||
// packages tells the System loader how to load when no filename and/or no extension
|
||||
packages: {
|
||||
app: {
|
||||
defaultExtension: 'js',
|
||||
meta: {
|
||||
'./*.js': {
|
||||
loader: 'systemjs-angular-loader.js'
|
||||
}
|
||||
}
|
||||
},
|
||||
rxjs: {
|
||||
defaultExtension: 'js'
|
||||
}
|
||||
}
|
||||
});
|
||||
})(this);
|
||||
32
dashboard/src/test.ts
Normal file
32
dashboard/src/test.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
|
||||
|
||||
import 'zone.js/dist/long-stack-trace-zone';
|
||||
import 'zone.js/dist/proxy.js';
|
||||
import 'zone.js/dist/sync-test';
|
||||
import 'zone.js/dist/jasmine-patch';
|
||||
import 'zone.js/dist/async-test';
|
||||
import 'zone.js/dist/fake-async-test';
|
||||
import { getTestBed } from '@angular/core/testing';
|
||||
import {
|
||||
BrowserDynamicTestingModule,
|
||||
platformBrowserDynamicTesting
|
||||
} from '@angular/platform-browser-dynamic/testing';
|
||||
|
||||
// Unfortunately there's no typing for the `__karma__` variable. Just declare it as any.
|
||||
declare const __karma__: any;
|
||||
declare const require: any;
|
||||
|
||||
// Prevent Karma from running prematurely.
|
||||
__karma__.loaded = function () {};
|
||||
|
||||
// First, initialize the Angular testing environment.
|
||||
getTestBed().initTestEnvironment(
|
||||
BrowserDynamicTestingModule,
|
||||
platformBrowserDynamicTesting()
|
||||
);
|
||||
// Then we find all the tests.
|
||||
const context = require.context('./', true, /\.spec\.ts$/);
|
||||
// And load the modules.
|
||||
context.keys().map(context);
|
||||
// Finally, start Karma to run the tests.
|
||||
__karma__.start();
|
||||
13
dashboard/src/tsconfig.app.json
Normal file
13
dashboard/src/tsconfig.app.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"extends": "../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "../out-tsc/app",
|
||||
"baseUrl": "./",
|
||||
"module": "es2015",
|
||||
"types": []
|
||||
},
|
||||
"exclude": [
|
||||
"test.ts",
|
||||
"**/*.spec.ts"
|
||||
]
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"module": "commonjs",
|
||||
"moduleResolution": "node",
|
||||
"sourceMap": true,
|
||||
"emitDecoratorMetadata": true,
|
||||
"experimentalDecorators": true,
|
||||
"lib": [ "es2015", "dom" ],
|
||||
"noImplicitAny": true,
|
||||
"suppressImplicitAnyIndexErrors": true
|
||||
}
|
||||
}
|
||||
20
dashboard/src/tsconfig.spec.json
Normal file
20
dashboard/src/tsconfig.spec.json
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"extends": "../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "../out-tsc/spec",
|
||||
"baseUrl": "./",
|
||||
"module": "commonjs",
|
||||
"target": "es5",
|
||||
"types": [
|
||||
"jasmine",
|
||||
"node"
|
||||
]
|
||||
},
|
||||
"files": [
|
||||
"test.ts"
|
||||
],
|
||||
"include": [
|
||||
"**/*.spec.ts",
|
||||
"**/*.d.ts"
|
||||
]
|
||||
}
|
||||
5
dashboard/src/typings.d.ts
vendored
Normal file
5
dashboard/src/typings.d.ts
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
/* SystemJS module definition */
|
||||
declare var module: NodeModule;
|
||||
interface NodeModule {
|
||||
id: string;
|
||||
}
|
||||
Reference in New Issue
Block a user