Browse Source

Merge remote-tracking branch 'origin' into sftp

Thomas Peterson 3 years ago
parent
commit
d1532f64a0

+ 9 - 0
.all-contributorsrc

@@ -673,6 +673,15 @@
       "contributions": [
         "code"
       ]
+    },
+    {
+      "login": "artu-ole",
+      "name": "artu-ole",
+      "avatar_url": "https://avatars.githubusercontent.com/u/15938416?v=4",
+      "profile": "https://github.com/artu-ole",
+      "contributions": [
+        "code"
+      ]
     }
   ],
   "contributorsPerLine": 7,

+ 1 - 0
README.it-IT.md

@@ -243,6 +243,7 @@ Grazie a queste persone meravigliose ([emoji key](https://allcontributors.org/do
     <td align="center"><a href="http://microhobby.com.br/blog"><img src="https://avatars.githubusercontent.com/u/2633321?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Matheus Castello</b></sub></a><br /><a href="https://github.com/Eugeny/tabby/commits?author=microhobby" title="Code">💻</a></td>
     <td align="center"><a href="https://github.com/Jai-JAP"><img src="https://avatars.githubusercontent.com/u/78354625?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Jai A P</b></sub></a><br /><a href="#platform-Jai-JAP" title="Packaging/porting to new platform">📦</a></td>
     <td align="center"><a href="https://blog.ysc3839.com"><img src="https://avatars.githubusercontent.com/u/12028138?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Richard Yu</b></sub></a><br /><a href="https://github.com/Eugeny/tabby/commits?author=ysc3839" title="Code">💻</a></td>
+    <td align="center"><a href="https://github.com/artu-ole"><img src="https://avatars.githubusercontent.com/u/15938416?v=4?s=100" width="100px;" alt=""/><br /><sub><b>artu-ole</b></sub></a><br /><a href="https://github.com/Eugeny/tabby/commits?author=artu-ole" title="Code">💻</a></td>
   </tr>
 </table>
 

+ 1 - 0
README.ko-KR.md

@@ -237,6 +237,7 @@ Pull requests and plugins are welcome!
     <td align="center"><a href="http://microhobby.com.br/blog"><img src="https://avatars.githubusercontent.com/u/2633321?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Matheus Castello</b></sub></a><br /><a href="https://github.com/Eugeny/tabby/commits?author=microhobby" title="Code">💻</a></td>
     <td align="center"><a href="https://github.com/Jai-JAP"><img src="https://avatars.githubusercontent.com/u/78354625?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Jai A P</b></sub></a><br /><a href="#platform-Jai-JAP" title="Packaging/porting to new platform">📦</a></td>
     <td align="center"><a href="https://blog.ysc3839.com"><img src="https://avatars.githubusercontent.com/u/12028138?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Richard Yu</b></sub></a><br /><a href="https://github.com/Eugeny/tabby/commits?author=ysc3839" title="Code">💻</a></td>
+    <td align="center"><a href="https://github.com/artu-ole"><img src="https://avatars.githubusercontent.com/u/15938416?v=4?s=100" width="100px;" alt=""/><br /><sub><b>artu-ole</b></sub></a><br /><a href="https://github.com/Eugeny/tabby/commits?author=artu-ole" title="Code">💻</a></td>
   </tr>
 </table>
 

+ 1 - 0
README.md

@@ -242,6 +242,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
     <td align="center"><a href="http://microhobby.com.br/blog"><img src="https://avatars.githubusercontent.com/u/2633321?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Matheus Castello</b></sub></a><br /><a href="https://github.com/Eugeny/tabby/commits?author=microhobby" title="Code">💻</a></td>
     <td align="center"><a href="https://github.com/Jai-JAP"><img src="https://avatars.githubusercontent.com/u/78354625?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Jai A P</b></sub></a><br /><a href="#platform-Jai-JAP" title="Packaging/porting to new platform">📦</a></td>
     <td align="center"><a href="https://blog.ysc3839.com"><img src="https://avatars.githubusercontent.com/u/12028138?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Richard Yu</b></sub></a><br /><a href="https://github.com/Eugeny/tabby/commits?author=ysc3839" title="Code">💻</a></td>
+    <td align="center"><a href="https://github.com/artu-ole"><img src="https://avatars.githubusercontent.com/u/15938416?v=4?s=100" width="100px;" alt=""/><br /><sub><b>artu-ole</b></sub></a><br /><a href="https://github.com/Eugeny/tabby/commits?author=artu-ole" title="Code">💻</a></td>
   </tr>
 </table>
 

+ 1 - 0
README.ru-RU.md

@@ -243,6 +243,7 @@ Pull-запросы и плагины приветствуются!
     <td align="center"><a href="http://microhobby.com.br/blog"><img src="https://avatars.githubusercontent.com/u/2633321?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Matheus Castello</b></sub></a><br /><a href="https://github.com/Eugeny/tabby/commits?author=microhobby" title="Code">💻</a></td>
     <td align="center"><a href="https://github.com/Jai-JAP"><img src="https://avatars.githubusercontent.com/u/78354625?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Jai A P</b></sub></a><br /><a href="#platform-Jai-JAP" title="Packaging/porting to new platform">📦</a></td>
     <td align="center"><a href="https://blog.ysc3839.com"><img src="https://avatars.githubusercontent.com/u/12028138?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Richard Yu</b></sub></a><br /><a href="https://github.com/Eugeny/tabby/commits?author=ysc3839" title="Code">💻</a></td>
+    <td align="center"><a href="https://github.com/artu-ole"><img src="https://avatars.githubusercontent.com/u/15938416?v=4?s=100" width="100px;" alt=""/><br /><sub><b>artu-ole</b></sub></a><br /><a href="https://github.com/Eugeny/tabby/commits?author=artu-ole" title="Code">💻</a></td>
   </tr>
 </table>
 

+ 1 - 0
README.zh-CN.md

@@ -242,6 +242,7 @@
     <td align="center"><a href="http://microhobby.com.br/blog"><img src="https://avatars.githubusercontent.com/u/2633321?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Matheus Castello</b></sub></a><br /><a href="https://github.com/Eugeny/tabby/commits?author=microhobby" title="Code">💻</a></td>
     <td align="center"><a href="https://github.com/Jai-JAP"><img src="https://avatars.githubusercontent.com/u/78354625?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Jai A P</b></sub></a><br /><a href="#platform-Jai-JAP" title="Packaging/porting to new platform">📦</a></td>
     <td align="center"><a href="https://blog.ysc3839.com"><img src="https://avatars.githubusercontent.com/u/12028138?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Richard Yu</b></sub></a><br /><a href="https://github.com/Eugeny/tabby/commits?author=ysc3839" title="Code">💻</a></td>
+    <td align="center"><a href="https://github.com/artu-ole"><img src="https://avatars.githubusercontent.com/u/15938416?v=4?s=100" width="100px;" alt=""/><br /><sub><b>artu-ole</b></sub></a><br /><a href="https://github.com/Eugeny/tabby/commits?author=artu-ole" title="Code">💻</a></td>
   </tr>
 </table>
 

+ 1 - 1
tabby-settings/src/components/profilesSettingsTab.component.pug

@@ -36,7 +36,7 @@ ul.nav-tabs(ngbNav, #nav='ngbNav')
                 ng-container(*ngFor='let group of profileGroups')
                     ng-container(*ngIf='isGroupVisible(group)')
                         .list-group-item.list-group-item-action.d-flex.align-items-center(
-                            (click)='group.collapsed = !group.collapsed'
+                            (click)='toggleGroupCollapse(group)'
                         )
                             .fa.fa-fw.fa-chevron-right(*ngIf='group.collapsed')
                             .fa.fa-fw.fa-chevron-down(*ngIf='!group.collapsed')

+ 13 - 3
tabby-settings/src/components/profilesSettingsTab.component.ts

@@ -143,6 +143,7 @@ export class ProfilesSettingsTabComponent extends BaseComponent {
     refresh (): void {
         this.profiles = this.config.store.profiles
         this.profileGroups = []
+        const profileGroupCollapsed = JSON.parse(window.localStorage.profileGroupCollapsed ?? '{}')
 
         for (const profile of this.profiles) {
             let group = this.profileGroups.find(x => x.name === profile.group)
@@ -151,7 +152,7 @@ export class ProfilesSettingsTabComponent extends BaseComponent {
                     name: profile.group,
                     profiles: [],
                     editable: true,
-                    collapsed: false,
+                    collapsed: profileGroupCollapsed[profile.group ?? ''] ?? false,
                 }
                 this.profileGroups.push(group)
             }
@@ -160,12 +161,14 @@ export class ProfilesSettingsTabComponent extends BaseComponent {
 
         this.profileGroups.sort((a, b) => a.name?.localeCompare(b.name ?? '') ?? -1)
 
-        this.profileGroups.push({
+        const builtIn = {
             name: this.translate.instant('Built-in'),
             profiles: this.builtinProfiles,
             editable: false,
             collapsed: false,
-        })
+        }
+        builtIn.collapsed = profileGroupCollapsed[builtIn.name ?? ''] ?? false
+        this.profileGroups.push(builtIn)
     }
 
     async editGroup (group: ProfileGroup): Promise<void> {
@@ -246,6 +249,13 @@ export class ProfilesSettingsTabComponent extends BaseComponent {
         }[this.profilesService.providerForProfile(profile)?.id ?? ''] ?? 'warning'
     }
 
+    toggleGroupCollapse (group: ProfileGroup): void {
+        group.collapsed = !group.collapsed
+        const profileGroupCollapsed = JSON.parse(window.localStorage.profileGroupCollapsed ?? '{}')
+        profileGroupCollapsed[group.name ?? ''] = group.collapsed
+        window.localStorage.profileGroupCollapsed = JSON.stringify(profileGroupCollapsed)
+    }
+
     async editDefaults (provider: ProfileProvider<Profile>): Promise<void> {
         const modal = this.ngbModal.open(
             EditProfileModalComponent,

+ 8 - 1
tabby-ssh/src/components/sftpPanel.component.ts

@@ -113,8 +113,11 @@ export class SFTPPanelComponent {
         const modal = this.ngbModal.open(SFTPCreateDirectoryModalComponent)
         const directoryName = await modal.result
         if (directoryName !== '') {
-            this.sftp.mkdir(path.join(this.path, directoryName)).finally(() => {
+            this.sftp.mkdir(path.join(this.path, directoryName)).then(() => {
+                this.notifications.notice('The directory was created successfully')
                 this.navigate(path.join(this.path, directoryName))
+            }).catch(() => {
+                this.notifications.error('The directory could not be created')
             })
         }
     }
@@ -125,7 +128,11 @@ export class SFTPPanelComponent {
     }
 
     async uploadOne (transfer: FileUpload): Promise<void> {
+        const savedPath = this.path
         await this.sftp.upload(path.join(this.path, transfer.getName()), transfer)
+        if (this.path === savedPath) {
+            await this.navigate(this.path)
+        }
     }
 
     async download (itemPath: string, mode: number, size: number): Promise<void> {

+ 0 - 3
tabby-ssh/src/session/sftp.ts

@@ -12,7 +12,6 @@ import type { FileEntry, Stats } from 'ssh2-streams'
 export interface SFTPFile {
     name: string
     fullPath: string
-    directory: string
     isDirectory: boolean
     isSymlink: boolean
     mode: number
@@ -104,7 +103,6 @@ export class SFTPSession {
         const stats = await wrapPromise(this.zone, promisify<Stats>(f => this.sftp.stat(p, f))())
         return {
             name: posixPath.basename(p),
-            directory: posixPath.dirname(p),
             fullPath: p,
             isDirectory: stats.isDirectory(),
             isSymlink: stats.isSymbolicLink(),
@@ -188,7 +186,6 @@ export class SFTPSession {
         return {
             fullPath: p,
             name: posixPath.basename(p),
-            directory: posixPath.dirname(p),
             isDirectory: (entry.attrs.mode & C.S_IFDIR) === C.S_IFDIR,
             isSymlink: (entry.attrs.mode & C.S_IFLNK) === C.S_IFLNK,
             mode: entry.attrs.mode,