|
|
@ -14,6 +14,8 @@ import {
|
|
|
|
MatTableDataSource
|
|
|
|
MatTableDataSource
|
|
|
|
} from '@angular/material';
|
|
|
|
} from '@angular/material';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import { DatePipe } from '@angular/common';
|
|
|
|
|
|
|
|
|
|
|
|
import {
|
|
|
|
import {
|
|
|
|
debounceTime,
|
|
|
|
debounceTime,
|
|
|
|
distinctUntilChanged,
|
|
|
|
distinctUntilChanged,
|
|
|
@ -25,6 +27,9 @@ import {
|
|
|
|
import { merge } from 'rxjs/observable/merge';
|
|
|
|
import { merge } from 'rxjs/observable/merge';
|
|
|
|
import { fromEvent } from 'rxjs/observable/fromEvent';
|
|
|
|
import { fromEvent } from 'rxjs/observable/fromEvent';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import { saveAs } from 'file-saver';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import { Quotes } from '../models/quotes';
|
|
|
|
import { QuotesService } from '../services/quotes.service';
|
|
|
|
import { QuotesService } from '../services/quotes.service';
|
|
|
|
import { QuotesDataSource } from '../services/quotes.datasource';
|
|
|
|
import { QuotesDataSource } from '../services/quotes.datasource';
|
|
|
|
|
|
|
|
|
|
|
@ -85,4 +90,26 @@ export class QuotesComponent implements OnInit, AfterViewInit {
|
|
|
|
this.paginator.pageIndex,
|
|
|
|
this.paginator.pageIndex,
|
|
|
|
this.paginator.pageSize);
|
|
|
|
this.paginator.pageSize);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
saveFile(quotes) {
|
|
|
|
|
|
|
|
let lines = [];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (const quote of quotes) {
|
|
|
|
|
|
|
|
let date = new DatePipe('en-US-POSIX').transform(quote.date, 'dd-MM-yyyy');
|
|
|
|
|
|
|
|
lines.push('"' + quote.text + '" [' + quote.game + '] [' + date + ']\r\n');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let data = new Blob(lines, {
|
|
|
|
|
|
|
|
type: 'text/plain; charset=utf-8'
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
saveAs(data, 'quotes.txt');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export() {
|
|
|
|
|
|
|
|
this.quotesService.findQuotes('', 'id', 'asc', 0, 0)
|
|
|
|
|
|
|
|
.subscribe(quotes => {
|
|
|
|
|
|
|
|
this.saveFile((<Quotes>quotes).quotes)
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|