Skip to content

Commit ea449ac

Browse files
committed
✨ manually input path
1 parent 7b9315e commit ea449ac

8 files changed

Lines changed: 109 additions & 6 deletions

File tree

src/app/features/functions/explorer/explorer-viewer/explorer-viewer.component.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ import { CopyDialogComponent } from './copy-dialog/copy-dialog.component';
2929
import { DeleteConfirmDialogComponent } from './delete-confirm-dialog/delete-confirm-dialog.component';
3030
import { RenameDialogComponent } from './rename-dialog/rename-dialog.component';
3131

32-
type Loading = undefined;
3332
const Loading = undefined;
33+
type Loading = undefined;
3434

3535
@Component({
3636
selector: 'app-explorer-viewer[backend][path]',
@@ -95,6 +95,7 @@ export class ExplorerViewerComponent implements OnInit, OnChanges {
9595
);
9696
if (!result.ok) {
9797
this.snackBar.open(result.error, $localize`OK`);
98+
this.children = [];
9899
throw new Error(result.error);
99100
}
100101
if (taskPath !== this.path) {
Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,34 @@
1-
<button mat-icon-button (click)="pathClicked('')">/</button>
2-
<ng-container *ngFor="let part of pathParts; let last = last">
3-
<button mat-button (click)="pathClicked(part.fullPath)">
4-
{{ part.name }}
1+
<ng-container *ngIf="!editMode">
2+
<button mat-icon-button (click)="pathClicked('')">/</button>
3+
<ng-container *ngFor="let part of pathParts; let last = last">
4+
<button mat-button (click)="pathClicked(part.fullPath)">
5+
{{ part.name }}
6+
</button>
7+
<ng-container *ngIf="!last">/</ng-container>
8+
</ng-container>
9+
<span class="spacer"></span>
10+
<button mat-icon-button (click)="pathCopy(path)">
11+
<mat-icon fontIcon="content_copy"></mat-icon>
12+
</button>
13+
<button mat-icon-button (click)="pathEditClicked()">
14+
<mat-icon fontIcon="edit"></mat-icon>
15+
</button>
16+
</ng-container>
17+
<ng-container *ngIf="editMode">
18+
<mat-form-field class="path-edit-field">
19+
<mat-label i18n>Path</mat-label>
20+
<input
21+
matInput
22+
[(ngModel)]="editingPath"
23+
(keyup.enter)="pathEditSave()"
24+
(blur)="pathEditCancel()"
25+
#pathInput
26+
/>
27+
</mat-form-field>
28+
<button mat-icon-button (mousedown)="pathEditSave()">
29+
<mat-icon fontIcon="check"></mat-icon>
30+
</button>
31+
<button mat-icon-button (click)="pathEditCancel()">
32+
<mat-icon fontIcon="edit_off"></mat-icon>
533
</button>
6-
<ng-container *ngIf="!last">/</ng-container>
734
</ng-container>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
:host {
2+
display: flex;
3+
align-items: center;
4+
}
5+
6+
.spacer,
7+
.path-edit-field {
8+
flex: 1;
9+
}

src/app/features/functions/explorer/explorer-viewer/path-splitter/path-splitter.component.ts

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ import {
55
OnChanges,
66
OnInit,
77
Output,
8+
ViewChild,
89
} from '@angular/core';
10+
import { MatInput } from '@angular/material/input';
11+
import { MatSnackBar } from '@angular/material/snack-bar';
912

1013
@Component({
1114
selector: 'app-path-splitter[path]',
@@ -15,6 +18,12 @@ import {
1518
export class PathSplitterComponent implements OnInit, OnChanges {
1619
@Input() path!: string;
1720
@Output() pathChange = new EventEmitter<string>();
21+
editMode = false;
22+
editingPath = '';
23+
24+
@ViewChild('pathInput') pathInput: MatInput | undefined;
25+
26+
constructor(private snackBar: MatSnackBar) {}
1827

1928
pathParts: {
2029
name: string;
@@ -48,4 +57,31 @@ export class PathSplitterComponent implements OnInit, OnChanges {
4857
pathClicked(fullPath: string) {
4958
this.pathChange.emit(fullPath);
5059
}
60+
61+
pathCopy(fullPath: string) {
62+
navigator.clipboard.writeText('/' + fullPath);
63+
this.snackBar.open($localize`Path copied to clipboard`, undefined, {
64+
duration: 3000,
65+
});
66+
}
67+
68+
pathEditClicked() {
69+
this.editingPath = this.path;
70+
this.editMode = true;
71+
this.pathInput?.focus();
72+
}
73+
74+
pathEditCancel() {
75+
this.editMode = false;
76+
}
77+
78+
pathEditSave() {
79+
let newPath = this.editingPath.trim();
80+
// remove leading slash if present
81+
if (newPath.startsWith('/')) {
82+
newPath = newPath.substring(1);
83+
}
84+
this.pathChange.emit(newPath);
85+
this.editMode = false;
86+
}
5187
}

src/locale/messages.de-DE.xlf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -788,6 +788,14 @@
788788
<source> This name has been used </source>
789789
<target state="translated"> Dieser Name wurde bereits verwendet </target>
790790
</trans-unit>
791+
<trans-unit id="8911059720204770105" datatype="html">
792+
<source>Path</source>
793+
<target state="new">Path</target>
794+
</trans-unit>
795+
<trans-unit id="8839122668244053110" datatype="html">
796+
<source>Path copied to clipboard</source>
797+
<target state="new">Path copied to clipboard</target>
798+
</trans-unit>
791799
</body>
792800
</file>
793801
</xliff>

src/locale/messages.tr-TR.xlf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -788,6 +788,14 @@
788788
<source> This name has been used </source>
789789
<target state="new"> This name has been used </target>
790790
</trans-unit>
791+
<trans-unit id="8911059720204770105" datatype="html">
792+
<source>Path</source>
793+
<target state="new">Path</target>
794+
</trans-unit>
795+
<trans-unit id="8839122668244053110" datatype="html">
796+
<source>Path copied to clipboard</source>
797+
<target state="new">Path copied to clipboard</target>
798+
</trans-unit>
791799
</body>
792800
</file>
793801
</xliff>

src/locale/messages.xlf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -594,6 +594,12 @@
594594
<trans-unit id="7113597974464283349" datatype="html">
595595
<source>Mountpoints</source>
596596
</trans-unit>
597+
<trans-unit id="8839122668244053110" datatype="html">
598+
<source>Path copied to clipboard</source>
599+
</trans-unit>
600+
<trans-unit id="8911059720204770105" datatype="html">
601+
<source>Path</source>
602+
</trans-unit>
597603
</body>
598604
</file>
599605
</xliff>

src/locale/messages.zh-CN.xlf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -788,6 +788,14 @@
788788
<source> This name has been used </source>
789789
<target state="translated">此名称已被使用</target>
790790
</trans-unit>
791+
<trans-unit id="8911059720204770105" datatype="html">
792+
<source>Path</source>
793+
<target state="translated">路径</target>
794+
</trans-unit>
795+
<trans-unit id="8839122668244053110" datatype="html">
796+
<source>Path copied to clipboard</source>
797+
<target state="translated">路径已复制到剪贴板</target>
798+
</trans-unit>
791799
</body>
792800
</file>
793801
</xliff>

0 commit comments

Comments
 (0)