more electron/web separation

This commit is contained in:
Eugene Pankov
2021-06-19 01:36:25 +02:00
parent fa31ac65ab
commit fad7858f3f
50 changed files with 568 additions and 448 deletions

View File

@@ -1,6 +1,6 @@
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
import { Injectable } from '@angular/core'
import { HotkeysService, ToolbarButtonProvider, ToolbarButton } from 'terminus-core'
import { HotkeysService, ToolbarButtonProvider, ToolbarButton, HostAppService, Platform } from 'terminus-core'
import { SSHService } from './services/ssh.service'
/** @hidden */
@@ -8,6 +8,7 @@ import { SSHService } from './services/ssh.service'
export class ButtonProvider extends ToolbarButtonProvider {
constructor (
hotkeys: HotkeysService,
private hostApp: HostAppService,
private ssh: SSHService,
) {
super()
@@ -23,14 +24,20 @@ export class ButtonProvider extends ToolbarButtonProvider {
}
provide (): ToolbarButton[] {
return [{
icon: require('./icons/globe.svg'),
weight: 5,
title: 'SSH connections',
touchBarNSImage: 'NSTouchBarOpenInBrowserTemplate',
click: () => {
this.activate()
},
}]
if (this.hostApp.platform === Platform.Web) {
return [{
icon: require('../../terminus-local/src/icons/plus.svg'),
title: 'SSH connections',
click: () => this.activate(),
}]
} else {
return [{
icon: require('./icons/globe.svg'),
weight: 5,
title: 'SSH connections',
touchBarNSImage: 'NSTouchBarOpenInBrowserTemplate',
click: () => this.activate(),
}]
}
}
}

View File

@@ -4,7 +4,7 @@ import { NgbModal, NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'
import { Observable } from 'rxjs'
import { debounceTime, distinctUntilChanged, map } from 'rxjs/operators'
import { ElectronService, HostAppService, ConfigService, PlatformService } from 'terminus-core'
import { ElectronService, ConfigService, PlatformService } from 'terminus-core'
import { PasswordStorageService } from '../services/passwordStorage.service'
import { SSHConnection, LoginScript, ForwardedPortConfig, SSHAlgorithmType, ALGORITHM_BLACKLIST } from '../api'
import { PromptModalComponent } from './promptModal.component'
@@ -30,7 +30,6 @@ export class EditConnectionModalComponent {
private modalInstance: NgbActiveModal,
private electron: ElectronService,
private platform: PlatformService,
private hostApp: HostAppService,
private passwordStorage: PasswordStorageService,
private ngbModal: NgbModal,
) {
@@ -104,7 +103,6 @@ export class EditConnectionModalComponent {
addPrivateKey () {
this.electron.dialog.showOpenDialog(
this.hostApp.getWindow(),
{
defaultPath: this.connection.privateKeys![0],
title: 'Select private key',