mirror of
https://github.com/Tzahi12345/YoutubeDL-Material.git
synced 2026-03-25 14:10:57 +03:00
Added support for generate NFO files for Kodi
Minor UI updates to settings
This commit is contained in:
@@ -12,6 +12,7 @@ import { ConfirmDialogComponent } from 'app/dialogs/confirm-dialog/confirm-dialo
|
||||
import { moveItemInArray, CdkDragDrop } from '@angular/cdk/drag-drop';
|
||||
import { InputDialogComponent } from 'app/input-dialog/input-dialog.component';
|
||||
import { EditCategoryDialogComponent } from 'app/dialogs/edit-category-dialog/edit-category-dialog.component';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
|
||||
@Component({
|
||||
selector: 'app-settings',
|
||||
@@ -38,17 +39,28 @@ export class SettingsComponent implements OnInit {
|
||||
latestGithubRelease = null;
|
||||
CURRENT_VERSION = CURRENT_VERSION
|
||||
|
||||
get settingsAreTheSame() {
|
||||
tabs = ['main', 'downloader', 'extra', 'database', 'advanced', 'users', 'logs'];
|
||||
tabIndex = 0;
|
||||
|
||||
INDEX_TO_TAB = Object.assign({}, this.tabs);
|
||||
TAB_TO_INDEX = {};
|
||||
|
||||
usersTabDisabledTooltip = $localize`You must enable multi-user mode to access this tab.`;
|
||||
|
||||
get settingsAreTheSame(): boolean {
|
||||
this._settingsSame = this.settingsSame()
|
||||
return this._settingsSame;
|
||||
}
|
||||
|
||||
set settingsAreTheSame(val) {
|
||||
set settingsAreTheSame(val: boolean) {
|
||||
this._settingsSame = val;
|
||||
}
|
||||
|
||||
constructor(public postsService: PostsService, private snackBar: MatSnackBar, private sanitizer: DomSanitizer,
|
||||
private dialog: MatDialog) { }
|
||||
private dialog: MatDialog, private router: Router, private route: ActivatedRoute) {
|
||||
// invert index to tab
|
||||
Object.keys(this.INDEX_TO_TAB).forEach(key => { this.TAB_TO_INDEX[this.INDEX_TO_TAB[key]] = key; });
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
if (this.postsService.initialized) {
|
||||
@@ -66,6 +78,9 @@ export class SettingsComponent implements OnInit {
|
||||
this.generated_bookmarklet_code = this.sanitizer.bypassSecurityTrustUrl(this.generateBookmarkletCode());
|
||||
|
||||
this.getLatestGithubRelease();
|
||||
|
||||
const tab = this.route.snapshot.paramMap.get('tab');
|
||||
this.tabIndex = tab && this.TAB_TO_INDEX[tab] ? this.TAB_TO_INDEX[tab] : 0;
|
||||
}
|
||||
|
||||
getConfig() {
|
||||
@@ -98,6 +113,11 @@ export class SettingsComponent implements OnInit {
|
||||
this.new_config = JSON.parse(JSON.stringify(this.initial_config));
|
||||
}
|
||||
|
||||
tabChanged(event) {
|
||||
const index = event['index'];
|
||||
this.router.navigate(['/settings', {tab: this.INDEX_TO_TAB[index]}]);
|
||||
}
|
||||
|
||||
dropCategory(event: CdkDragDrop<string[]>) {
|
||||
moveItemInArray(this.postsService.categories, event.previousIndex, event.currentIndex);
|
||||
this.postsService.updateCategories(this.postsService.categories).subscribe(res => {
|
||||
|
||||
Reference in New Issue
Block a user