mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-07-19 09:16:57 +00:00
perf: dbeaver 支持使用网关连接数据库
This commit is contained in:
parent
9d8c1bb317
commit
8d8f479da6
@ -1,14 +1,13 @@
|
|||||||
import os
|
import os
|
||||||
import time
|
|
||||||
import win32api
|
|
||||||
import shutil
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import time
|
||||||
from xml.etree import ElementTree
|
from xml.etree import ElementTree
|
||||||
from xml.sax import SAXException
|
from xml.sax import SAXException
|
||||||
|
|
||||||
from common import wait_pid, BaseApplication
|
import win32api
|
||||||
|
|
||||||
|
from common import wait_pid, BaseApplication
|
||||||
|
|
||||||
_default_path = r'C:\Program Files\DBeaver\dbeaver-cli.exe'
|
_default_path = r'C:\Program Files\DBeaver\dbeaver-cli.exe'
|
||||||
|
|
||||||
@ -22,6 +21,10 @@ class AppletApplication(BaseApplication):
|
|||||||
self.privileged = self.account.privileged
|
self.privileged = self.account.privileged
|
||||||
self.host = self.asset.address
|
self.host = self.asset.address
|
||||||
self.port = self.asset.get_protocol_port(self.protocol)
|
self.port = self.asset.get_protocol_port(self.protocol)
|
||||||
|
if self.tinker_forward:
|
||||||
|
self.host = self.tinker_forward.host
|
||||||
|
self.port = self.tinker_forward.port
|
||||||
|
|
||||||
self.db = self.asset.spec_info.db_name
|
self.db = self.asset.spec_info.db_name
|
||||||
self.name = '%s-%s-%s' % (self.host, self.db, int(time.time()))
|
self.name = '%s-%s-%s' % (self.host, self.db, int(time.time()))
|
||||||
self.app_work_path = self.get_app_work_path()
|
self.app_work_path = self.get_app_work_path()
|
||||||
|
@ -152,6 +152,20 @@ class Platform(DictObj):
|
|||||||
type: LabelValue
|
type: LabelValue
|
||||||
|
|
||||||
|
|
||||||
|
class Gateway(DictObj):
|
||||||
|
id: str
|
||||||
|
name: str
|
||||||
|
address: str
|
||||||
|
port: int
|
||||||
|
protocols: list[Protocol]
|
||||||
|
account: Account
|
||||||
|
|
||||||
|
|
||||||
|
class TinkerForward(DictObj):
|
||||||
|
host: str
|
||||||
|
port: int
|
||||||
|
|
||||||
|
|
||||||
class Manifest(DictObj):
|
class Manifest(DictObj):
|
||||||
name: str
|
name: str
|
||||||
version: str
|
version: str
|
||||||
@ -199,6 +213,14 @@ class BaseApplication(abc.ABC):
|
|||||||
self.asset = Asset(kwargs.get('asset', {}))
|
self.asset = Asset(kwargs.get('asset', {}))
|
||||||
self.account = Account(kwargs.get('account', {}))
|
self.account = Account(kwargs.get('account', {}))
|
||||||
self.platform = Platform(kwargs.get('platform', {}))
|
self.platform = Platform(kwargs.get('platform', {}))
|
||||||
|
self.gateway = None
|
||||||
|
self.tinker_forward = None
|
||||||
|
gateway = kwargs.get('gateway')
|
||||||
|
tinker_forward = kwargs.get('tinker_forward')
|
||||||
|
if gateway:
|
||||||
|
self.gateway = Gateway(gateway)
|
||||||
|
if tinker_forward:
|
||||||
|
self.tinker_forward = TinkerForward(tinker_forward)
|
||||||
|
|
||||||
@abc.abstractmethod
|
@abc.abstractmethod
|
||||||
def run(self):
|
def run(self):
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
name: dbeaver
|
name: dbeaver
|
||||||
display_name: "{{ 'DBeaver Community' | trans }}"
|
display_name: "{{ 'DBeaver Community' | trans }}"
|
||||||
comment: "{{ 'Free multi-platform database tool for developers, database administrators, analysts and all people who need to work with databases.' | trans }}"
|
comment: "{{ 'Free multi-platform database tool for developers, database administrators, analysts and all people who need to work with databases.' | trans }}"
|
||||||
version: 0.1
|
version: 0.2
|
||||||
exec_type: python
|
exec_type: python
|
||||||
author: JumpServer Team
|
author: JumpServer Team
|
||||||
type: general
|
type: general
|
||||||
|
Loading…
Reference in New Issue
Block a user