mirror of
https://github.com/Tzahi12345/YoutubeDL-Material.git
synced 2026-03-15 09:10:56 +03:00
Changed DB structure again
Added support for MongoDB Added tests relating to new DB system Category rules are now case insensitive Fixed playlist modification change state
This commit is contained in:
@@ -29,6 +29,10 @@ export class SettingsComponent implements OnInit {
|
||||
generated_bookmarklet_code = null;
|
||||
bookmarkletAudioOnly = false;
|
||||
|
||||
db_info = null;
|
||||
db_transferring = false;
|
||||
testing_connection_string = false;
|
||||
|
||||
_settingsSame = true;
|
||||
|
||||
latestGithubRelease = null;
|
||||
@@ -48,6 +52,7 @@ export class SettingsComponent implements OnInit {
|
||||
|
||||
ngOnInit() {
|
||||
this.getConfig();
|
||||
this.getDBInfo();
|
||||
|
||||
this.generated_bookmarklet_code = this.sanitizer.bypassSecurityTrustUrl(this.generateBookmarkletCode());
|
||||
|
||||
@@ -263,6 +268,60 @@ export class SettingsComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
getDBInfo() {
|
||||
this.postsService.getDBInfo().subscribe(res => {
|
||||
this.db_info = res['db_info'];
|
||||
});
|
||||
}
|
||||
|
||||
transferDB() {
|
||||
const dialogRef = this.dialog.open(ConfirmDialogComponent, {
|
||||
data: {
|
||||
dialogTitle: 'Transfer DB',
|
||||
dialogText: `Are you sure you want to transfer the DB?`,
|
||||
submitText: 'Transfer',
|
||||
}
|
||||
});
|
||||
dialogRef.afterClosed().subscribe(confirmed => {
|
||||
if (confirmed) {
|
||||
this._transferDB();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
_transferDB() {
|
||||
this.db_transferring = true;
|
||||
this.postsService.transferDB(this.db_info['using_local_db']).subscribe(res => {
|
||||
this.db_transferring = false;
|
||||
const success = res['success'];
|
||||
if (success) {
|
||||
this.openSnackBar('Successfully transfered DB! Reloading info...');
|
||||
this.getDBInfo();
|
||||
} else {
|
||||
this.openSnackBar('Failed to transfer DB -- transfer was aborted. Error: ' + res['error']);
|
||||
}
|
||||
}, err => {
|
||||
this.db_transferring = false;
|
||||
this.openSnackBar('Failed to transfer DB -- API call failed. See browser logs for details.');
|
||||
console.error(err);
|
||||
});
|
||||
}
|
||||
|
||||
testConnectionString() {
|
||||
this.testing_connection_string = true;
|
||||
this.postsService.testConnectionString().subscribe(res => {
|
||||
this.testing_connection_string = false;
|
||||
if (res['success']) {
|
||||
this.postsService.openSnackBar('Connection successful!');
|
||||
} else {
|
||||
this.postsService.openSnackBar('Connection failed! Error: ' + res['error']);
|
||||
}
|
||||
}, err => {
|
||||
this.testing_connection_string = false;
|
||||
this.postsService.openSnackBar('Connection failed! Error: Server error. See logs for more info.');
|
||||
});
|
||||
}
|
||||
|
||||
// snackbar helper
|
||||
public openSnackBar(message: string, action: string = '') {
|
||||
this.snackBar.open(message, action, {
|
||||
|
||||
Reference in New Issue
Block a user