mirror of
https://github.com/xuthus83/pigallery2.git
synced 2025-01-14 14:43:17 +08:00
Add Alt+UP shortkey for folder navigation #587
This commit is contained in:
parent
bc0728c282
commit
b6a72af3c7
@ -1,10 +1,6 @@
|
|||||||
import { Component } from '@angular/core';
|
import { OnDestroy, OnInit,Component } from '@angular/core';
|
||||||
import { RouterLink } from '@angular/router';
|
import { RouterLink } from '@angular/router';
|
||||||
import { FilterOption, FilterService, SelectedFilter } from './filter.service';
|
import { FilterOption, FilterService, SelectedFilter } from './filter.service';
|
||||||
import {
|
|
||||||
OnDestroy,
|
|
||||||
OnInit,
|
|
||||||
} from '../../../../../../node_modules/@angular/core';
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-gallery-filter',
|
selector: 'app-gallery-filter',
|
||||||
|
@ -432,7 +432,7 @@ export class ControlsLightboxComponent implements OnDestroy, OnInit, OnChanges {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private hideControls = () => {
|
private hideControls = () => {
|
||||||
this.controllersDimmed = true;
|
this.controllersDimmed = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
private updateFaceContainerDim(): void {
|
private updateFaceContainerDim(): void {
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
<ol *ngIf="isDirectory" id="directory-path" class="mb-0 mt-1 breadcrumb">
|
<ol *ngIf="isDirectory" id="directory-path" class="mb-0 mt-1 breadcrumb">
|
||||||
<li *ngFor="let path of routes | async" class="breadcrumb-item">
|
<li *ngFor="let path of routes | async" class="breadcrumb-item">
|
||||||
<a *ngIf="path.route" [routerLink]="['/gallery',path.route]"
|
<a *ngIf="path.route" [routerLink]="['/gallery',path.route]"
|
||||||
|
[title]="path.title || ''"
|
||||||
[queryParams]="queryService.getParams()">{{path.name}}</a>
|
[queryParams]="queryService.getParams()">{{path.name}}</a>
|
||||||
<ng-container *ngIf="!path.route">{{path.name}}</ng-container>
|
<ng-container *ngIf="!path.route">{{path.name}}</ng-container>
|
||||||
</li>
|
</li>
|
||||||
|
@ -1,21 +1,13 @@
|
|||||||
import {Component} from '@angular/core';
|
import {Component, HostListener} from '@angular/core';
|
||||||
import {RouterLink} from '@angular/router';
|
import {Router, RouterLink} from '@angular/router';
|
||||||
import {UserDTOUtils} from '../../../../../common/entities/UserDTO';
|
import {UserDTOUtils} from '../../../../../common/entities/UserDTO';
|
||||||
import {AuthenticationService} from '../../../model/network/authentication.service';
|
import {AuthenticationService} from '../../../model/network/authentication.service';
|
||||||
import {QueryService} from '../../../model/query.service';
|
import {QueryService} from '../../../model/query.service';
|
||||||
import {
|
import {ContentService, ContentWrapperWithError, DirectoryContent,} from '../content.service';
|
||||||
ContentService,
|
|
||||||
ContentWrapperWithError,
|
|
||||||
DirectoryContent,
|
|
||||||
} from '../content.service';
|
|
||||||
import {Utils} from '../../../../../common/Utils';
|
import {Utils} from '../../../../../common/Utils';
|
||||||
import {SortingMethods} from '../../../../../common/entities/SortingMethods';
|
import {SortingMethods} from '../../../../../common/entities/SortingMethods';
|
||||||
import {Config} from '../../../../../common/config/public/Config';
|
import {Config} from '../../../../../common/config/public/Config';
|
||||||
import {
|
import {SearchQueryTypes, TextSearch, TextSearchQueryMatchTypes,} from '../../../../../common/entities/SearchQueryDTO';
|
||||||
SearchQueryTypes,
|
|
||||||
TextSearch,
|
|
||||||
TextSearchQueryMatchTypes,
|
|
||||||
} from '../../../../../common/entities/SearchQueryDTO';
|
|
||||||
import {Observable} from 'rxjs';
|
import {Observable} from 'rxjs';
|
||||||
import {map} from 'rxjs/operators';
|
import {map} from 'rxjs/operators';
|
||||||
import {GallerySortingService} from './sorting.service';
|
import {GallerySortingService} from './sorting.service';
|
||||||
@ -37,12 +29,14 @@ export class GalleryNavigatorComponent {
|
|||||||
public routes: Observable<NavigatorPath[]>;
|
public routes: Observable<NavigatorPath[]>;
|
||||||
public showFilters = false;
|
public showFilters = false;
|
||||||
private readonly RootFolderName: string;
|
private readonly RootFolderName: string;
|
||||||
|
private parentPath: string = null;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
public authService: AuthenticationService,
|
public authService: AuthenticationService,
|
||||||
public queryService: QueryService,
|
public queryService: QueryService,
|
||||||
public galleryService: ContentService,
|
public galleryService: ContentService,
|
||||||
public sortingService: GallerySortingService
|
public sortingService: GallerySortingService,
|
||||||
|
private router: Router,
|
||||||
) {
|
) {
|
||||||
this.sortingMethodsType = Utils.enumToArray(SortingMethods);
|
this.sortingMethodsType = Utils.enumToArray(SortingMethods);
|
||||||
this.RootFolderName = $localize`Home`;
|
this.RootFolderName = $localize`Home`;
|
||||||
@ -52,6 +46,7 @@ export class GalleryNavigatorComponent {
|
|||||||
);
|
);
|
||||||
this.routes = this.galleryService.content.pipe(
|
this.routes = this.galleryService.content.pipe(
|
||||||
map((c) => {
|
map((c) => {
|
||||||
|
this.parentPath = null;
|
||||||
if (!c.directory) {
|
if (!c.directory) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
@ -96,9 +91,15 @@ export class GalleryNavigatorComponent {
|
|||||||
? route
|
? route
|
||||||
: null,
|
: null,
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// parent directory has a shortcut to navigate to
|
||||||
|
if (arr.length >= 2 && arr[arr.length - 2].route) {
|
||||||
|
this.parentPath = arr[arr.length - 2].route;
|
||||||
|
arr[arr.length - 2].title = $localize`key: alt + up`;
|
||||||
|
}
|
||||||
return arr;
|
return arr;
|
||||||
|
|
||||||
})
|
})
|
||||||
@ -158,10 +159,32 @@ export class GalleryNavigatorComponent {
|
|||||||
text: Utils.concatUrls('./', c.directory.path, c.directory.name),
|
text: Utils.concatUrls('./', c.directory.path, c.directory.name),
|
||||||
} as TextSearch);
|
} as TextSearch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
navigateToParentDirectory() {
|
||||||
|
if (!this.parentPath) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.router.navigate(['/gallery', this.parentPath],
|
||||||
|
{queryParams: this.queryService.getParams()})
|
||||||
|
.catch(console.error);
|
||||||
|
}
|
||||||
|
|
||||||
|
@HostListener('window:keydown', ['$event'])
|
||||||
|
onKeyPress(event: KeyboardEvent): void {
|
||||||
|
switch (event.key) {
|
||||||
|
case 'ArrowUp':
|
||||||
|
if (event.altKey) {
|
||||||
|
this.navigateToParentDirectory();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
interface NavigatorPath {
|
interface NavigatorPath {
|
||||||
name: string;
|
name: string;
|
||||||
route: string;
|
route: string;
|
||||||
|
title?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
import {Component, EventEmitter, forwardRef, Input, Output,} from '@angular/core';
|
import {Component, EventEmitter, forwardRef, Input, Output,TemplateRef} from '@angular/core';
|
||||||
import {Router, RouterLink} from '@angular/router';
|
import {Router, RouterLink} from '@angular/router';
|
||||||
import {AutoCompleteService} from '../autocomplete.service';
|
import {AutoCompleteService} from '../autocomplete.service';
|
||||||
import {SearchQueryDTO} from '../../../../../../common/entities/SearchQueryDTO';
|
import {SearchQueryDTO} from '../../../../../../common/entities/SearchQueryDTO';
|
||||||
import {ControlValueAccessor, FormControl, NG_VALIDATORS, NG_VALUE_ACCESSOR, ValidationErrors, Validator,} from '@angular/forms';
|
import {ControlValueAccessor, FormControl, NG_VALIDATORS, NG_VALUE_ACCESSOR, ValidationErrors, Validator,} from '@angular/forms';
|
||||||
import {SearchQueryParserService} from '../search-query-parser.service';
|
import {SearchQueryParserService} from '../search-query-parser.service';
|
||||||
import {TemplateRef} from '../../../../../../../node_modules/@angular/core';
|
|
||||||
import {BsModalRef, BsModalService,} from '../../../../../../../node_modules/ngx-bootstrap/modal';
|
import {BsModalRef, BsModalService,} from '../../../../../../../node_modules/ngx-bootstrap/modal';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -7,7 +7,7 @@ import {WebConfig} from '../../../../../common/config/private/WebConfig';
|
|||||||
import {JobProgressDTO} from '../../../../../common/entities/job/JobProgressDTO';
|
import {JobProgressDTO} from '../../../../../common/entities/job/JobProgressDTO';
|
||||||
import {JobDTOUtils} from '../../../../../common/entities/job/JobDTO';
|
import {JobDTOUtils} from '../../../../../common/entities/job/JobDTO';
|
||||||
import {ScheduledJobsService} from '../scheduled-jobs.service';
|
import {ScheduledJobsService} from '../scheduled-jobs.service';
|
||||||
import {FormControl} from '../../../../../../node_modules/@angular/forms';
|
import {FormControl} from '@angular/forms';
|
||||||
import {Subscription} from 'rxjs';
|
import {Subscription} from 'rxjs';
|
||||||
import {IWebConfigClassPrivate} from '../../../../../../node_modules/typeconfig/src/decorators/class/IWebConfigClass';
|
import {IWebConfigClassPrivate} from '../../../../../../node_modules/typeconfig/src/decorators/class/IWebConfigClass';
|
||||||
import {ConfigPriority, TAGS} from '../../../../../common/config/public/ClientConfig';
|
import {ConfigPriority, TAGS} from '../../../../../common/config/public/ClientConfig';
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import {Component, OnDestroy, OnInit, QueryList, ViewChildren} from '@angular/core';
|
import {Component, forwardRef, OnDestroy, OnInit, QueryList, ViewChildren} from '@angular/core';
|
||||||
import {forwardRef} from '../../../../../../node_modules/@angular/core';
|
|
||||||
import {ModalDirective} from 'ngx-bootstrap/modal';
|
import {ModalDirective} from 'ngx-bootstrap/modal';
|
||||||
import {
|
import {
|
||||||
AfterJobTrigger,
|
AfterJobTrigger,
|
||||||
@ -11,7 +10,6 @@ import {
|
|||||||
import {ScheduledJobsService} from '../scheduled-jobs.service';
|
import {ScheduledJobsService} from '../scheduled-jobs.service';
|
||||||
import {BackendtextService} from '../../../model/backendtext.service';
|
import {BackendtextService} from '../../../model/backendtext.service';
|
||||||
import {SettingsService} from '../settings.service';
|
import {SettingsService} from '../settings.service';
|
||||||
import {ConfigTemplateEntry} from '../../../../../common/entities/job/JobDTO';
|
|
||||||
import {JobProgressDTO, JobProgressStates} from '../../../../../common/entities/job/JobProgressDTO';
|
import {JobProgressDTO, JobProgressStates} from '../../../../../common/entities/job/JobProgressDTO';
|
||||||
import {
|
import {
|
||||||
AfterJobTriggerConfig,
|
AfterJobTriggerConfig,
|
||||||
@ -20,13 +18,7 @@ import {
|
|||||||
PeriodicJobTriggerConfig,
|
PeriodicJobTriggerConfig,
|
||||||
ScheduledJobTriggerConfig
|
ScheduledJobTriggerConfig
|
||||||
} from '../../../../../common/config/private/PrivateConfig';
|
} from '../../../../../common/config/private/PrivateConfig';
|
||||||
import {
|
import {ControlValueAccessor, NG_VALIDATORS, NG_VALUE_ACCESSOR, ValidationErrors, Validator} from '@angular/forms';
|
||||||
ControlValueAccessor,
|
|
||||||
NG_VALIDATORS,
|
|
||||||
NG_VALUE_ACCESSOR,
|
|
||||||
ValidationErrors,
|
|
||||||
Validator
|
|
||||||
} from '../../../../../../node_modules/@angular/forms';
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-settings-workflow',
|
selector: 'app-settings-workflow',
|
||||||
@ -105,7 +97,6 @@ export class WorkflowComponent implements ControlValueAccessor, Validator, OnIni
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.jobsService.subscribeToProgress();
|
this.jobsService.subscribeToProgress();
|
||||||
this.jobsService.getAvailableJobs().catch(console.error);
|
this.jobsService.getAvailableJobs().catch(console.error);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user