This commit is contained in:
2020-03-02 18:47:04 +01:00
committed by smuddy
parent 5b746e0db5
commit ccd91aa81c
93 changed files with 444 additions and 89 deletions

View File

@@ -0,0 +1,22 @@
<app-card heading="Angehängte Dateien">
<div *ngIf="currentUpload">
<div class="progress">
<div [ngStyle]="{ 'width': currentUpload?.progress + '%' }" class="progress-bar progress-bar-animated"></div>
</div>
Progress: {{currentUpload?.name}} | {{currentUpload?.progress}}% Complete
</div>
<div class="upload">
<label>
<input (change)="detectFiles($event)" type="file">
</label>
<button (click)="uploadSingle()"
[disabled]="!selectedFiles"
mat-icon-button>
<mat-icon>cloud_upload</mat-icon>
</button>
</div>
</app-card>

View File

@@ -0,0 +1,5 @@
.upload {
display: flex;
justify-content: space-between;
align-items: center;
}

View File

@@ -0,0 +1,25 @@
import {async, ComponentFixture, TestBed} from '@angular/core/testing';
import {EditFileComponent} from './edit-file.component';
describe('EditFileComponent', () => {
let component: EditFileComponent;
let fixture: ComponentFixture<EditFileComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [EditFileComponent]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(EditFileComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@@ -0,0 +1,36 @@
import {Component} from '@angular/core';
import {Upload} from '../../../services/upload';
import {UploadService} from '../../../services/upload.service';
import {ActivatedRoute} from '@angular/router';
import {map} from 'rxjs/operators';
@Component({
selector: 'app-edit-file',
templateUrl: './edit-file.component.html',
styleUrls: ['./edit-file.component.less']
})
export class EditFileComponent {
public selectedFiles: FileList;
public currentUpload: Upload;
public songId: string;
constructor(private activatedRoute: ActivatedRoute, private uploadService: UploadService) {
this.activatedRoute.params.pipe(
map(param => param.songId),
).subscribe(songId => {
this.songId = songId;
});
}
detectFiles(event) {
this.selectedFiles = event.target.files;
}
public async uploadSingle() {
const file = this.selectedFiles.item(0);
this.currentUpload = new Upload(file as any);
await this.uploadService.pushUpload(this.songId, this.currentUpload);
}
}

View File

@@ -0,0 +1 @@
<p>file works!</p>

View File

@@ -0,0 +1,25 @@
import {async, ComponentFixture, TestBed} from '@angular/core/testing';
import {FileComponent} from './file.component';
describe('FileComponent', () => {
let component: FileComponent;
let fixture: ComponentFixture<FileComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [FileComponent]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(FileComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@@ -0,0 +1,16 @@
import {Component, OnInit} from '@angular/core';
@Component({
selector: 'app-file',
templateUrl: './file.component.html',
styleUrls: ['./file.component.less']
})
export class FileComponent implements OnInit {
constructor() {
}
ngOnInit() {
}
}