dbeaver/pro#8655 support function role

This commit is contained in:
naumov
2026-04-06 11:58:57 +02:00
parent c2506e6bf5
commit 7343af5e97
13 changed files with 22 additions and 26 deletions
@@ -9,27 +9,28 @@ import { observer } from 'mobx-react-lite';
import { type ReactNode } from 'react';
import { IconOrImage } from '../IconOrImage.js';
import { DisclosureProvider, Disclosure, DisclosureContent } from '@dbeaver/ui-kit';
import { DisclosureProvider, Disclosure, DisclosureContent, clsx } from '@dbeaver/ui-kit';
import './Expandable.css';
interface Props {
label: string;
label: string | ReactNode;
children: ReactNode;
defaultExpanded?: boolean;
disabled?: boolean;
className?: string;
}
export const Expandable = observer(function Expandable({ label, defaultExpanded, disabled, children }: Props) {
export const Expandable = observer(function Expandable({ label, defaultExpanded, disabled, children, className }: Props) {
return (
<div>
<DisclosureProvider defaultOpen={defaultExpanded}>
<Disclosure disabled={disabled}>
<IconOrImage className="disclosure-icon" icon="arrow" />
<h2 className="theme-typography--body2 disclosure-label">{label}</h2>
{typeof label === 'string' ? <h2 className="theme-typography--body2 disclosure-label">{label}</h2> : label}
</Disclosure>
<DisclosureContent>
<div>
<div className="disclosure-content-inner"> {children}</div>
<div className={clsx('disclosure-content-inner', className)}> {children}</div>
</div>
</DisclosureContent>
</DisclosureProvider>
@@ -12,7 +12,7 @@ import type { CbDatasourceFolderEvent as IConnectionFolderEvent } from '@cloudbe
export type { IConnectionFolderEvent };
@injectable(() => [SessionEventSource])
export class ConnectionFolderEventHandler extends TopicEventHandler<IConnectionFolderEvent, ISessionEvent, SessionEventId, SessionEventTopic> {
export class ConnectionFolderEventHandler extends TopicEventHandler<IConnectionFolderEvent, ISessionEvent, SessionEventId, string> {
constructor(sessionEventSource: SessionEventSource) {
super(SessionEventTopic.CbDatasourceFolder, sessionEventSource);
}
@@ -12,7 +12,7 @@ import type { CbDatasourceEvent as IConnectionInfoEvent } from '@cloudbeaver/cor
export type { IConnectionInfoEvent };
@injectable(() => [SessionEventSource])
export class ConnectionInfoEventHandler extends TopicEventHandler<IConnectionInfoEvent, ISessionEvent, SessionEventId, SessionEventTopic> {
export class ConnectionInfoEventHandler extends TopicEventHandler<IConnectionInfoEvent, ISessionEvent, SessionEventId, string> {
constructor(sessionEventSource: SessionEventSource) {
super(SessionEventTopic.CbDatasource, sessionEventSource);
}
@@ -15,7 +15,7 @@ export type IWsDataSourceConnectEvent = WsDataSourceConnectEvent;
type ConnectionStateEvent = IWsDataSourceConnectEvent | IWsDataSourceDisconnectEvent;
@injectable(() => [SessionEventSource])
export class ConnectionStateEventHandler extends TopicEventHandler<ConnectionStateEvent, ISessionEvent, SessionEventId, SessionEventTopic> {
export class ConnectionStateEventHandler extends TopicEventHandler<ConnectionStateEvent, ISessionEvent, SessionEventId, string> {
constructor(sessionEventSource: SessionEventSource) {
super(SessionEventTopic.CbDatasourceConnection, sessionEventSource);
}
@@ -20,7 +20,7 @@ import { isArraysEqual } from '@cloudbeaver/core-utils';
export type { IProjectInfoEvent };
@injectable(() => [SessionEventSource])
export class ProjectInfoEventHandler extends TopicEventHandler<IProjectInfoEvent, ISessionEvent, SessionEventId, SessionEventTopic> {
export class ProjectInfoEventHandler extends TopicEventHandler<IProjectInfoEvent, ISessionEvent, SessionEventId, string> {
private lastActiveProjects: string[];
constructor(sessionEventSource: SessionEventSource) {
@@ -10,7 +10,7 @@ import { type ISessionEvent, type SessionEventId, SessionEventSource, SessionEve
import type { CbrmEvent as IResourceManagerEvent } from '@cloudbeaver/core-sdk';
@injectable(() => [SessionEventSource])
export class ResourceManagerEventHandler extends TopicEventHandler<IResourceManagerEvent, ISessionEvent, SessionEventId, SessionEventTopic> {
export class ResourceManagerEventHandler extends TopicEventHandler<IResourceManagerEvent, ISessionEvent, SessionEventId, string> {
constructor(sessionEventSource: SessionEventSource) {
super(SessionEventTopic.CbScripts, sessionEventSource);
}
@@ -12,7 +12,7 @@ import { TopicEventHandler } from '../ServerEventEmitter/TopicEventHandler.js';
import { type ISessionEvent, type SessionEventId, SessionEventSource, SessionEventTopic } from '../SessionEventSource.js';
@injectable(() => [SessionEventSource])
export class AsyncTaskInfoEventHandler extends TopicEventHandler<WsAsyncTaskInfo, ISessionEvent, SessionEventId, SessionEventTopic> {
export class AsyncTaskInfoEventHandler extends TopicEventHandler<WsAsyncTaskInfo, ISessionEvent, SessionEventId, string> {
constructor(sessionEventSource: SessionEventSource) {
super(SessionEventTopic.CbSessionTask, sessionEventSource);
}
@@ -47,22 +47,22 @@ export { ServerEventId, SessionEventTopic, ClientEventId };
export type SessionEventId = ServerEventId | ClientEventId | string;
export interface ISessionEvent extends IBaseServerEvent<SessionEventId, SessionEventTopic> {
export interface ISessionEvent extends IBaseServerEvent<SessionEventId, string> {
id: SessionEventId;
topicId?: SessionEventTopic;
topicId?: string;
[key: string]: any;
}
export interface ITopicSubEvent extends ISessionEvent {
id: ClientEventId.CbClientTopicSubscribe | ClientEventId.CbClientTopicUnsubscribe;
topicId: SessionEventTopic;
topicId: string;
}
const RETRY_INTERVALS = [1000, 5000, 30000, 60000]; // 1s, 5s, 30s, 1m
const MAX_RETRY_ATTEMPTS = 4;
@injectable(() => [SessionExpireService, EnvironmentService])
export class SessionEventSource implements IServerEventEmitter<ISessionEvent, ISessionEvent, SessionEventId, SessionEventTopic> {
export class SessionEventSource implements IServerEventEmitter<ISessionEvent, ISessionEvent, SessionEventId, string> {
readonly eventsSubject: Observable<ISessionEvent>;
readonly onActivate: IExecutor;
readonly onInit: ISyncExecutor;
@@ -14,7 +14,7 @@ import { ClientEventId, type ISessionEvent, type SessionEventId, SessionEventSou
export { type ISessionStateEvent };
@injectable(() => [SessionEventSource])
export class SessionInfoEventHandler extends TopicEventHandler<ISessionStateEvent, ISessionEvent, SessionEventId, SessionEventTopic> {
export class SessionInfoEventHandler extends TopicEventHandler<ISessionStateEvent, ISessionEvent, SessionEventId, string> {
constructor(sessionEventSource: SessionEventSource) {
super(SessionEventTopic.CbSession, sessionEventSource);
}
@@ -14,7 +14,7 @@ import { type ISessionEvent, type SessionEventId, SessionEventSource, SessionEve
export type { ISessionPermissionEvent };
@injectable(() => [SessionEventSource])
export class SessionPermissionEventHandler extends TopicEventHandler<ISessionPermissionEvent, ISessionEvent, SessionEventId, SessionEventTopic> {
export class SessionPermissionEventHandler extends TopicEventHandler<ISessionPermissionEvent, ISessionEvent, SessionEventId, string> {
constructor(sessionEventSource: SessionEventSource) {
super(SessionEventTopic.CbSubjectPermissions, sessionEventSource);
}
@@ -30,12 +30,7 @@ interface ServerNotificationEventMapped extends IBaseServerEvent<SessionEventId,
}
@injectable(() => [SessionEventSource])
export class ServerNotificationsEventHandler extends TopicEventHandler<
ServerNotificationEventMapped,
ISessionEvent,
SessionEventId,
SessionEventTopic
> {
export class ServerNotificationsEventHandler extends TopicEventHandler<ServerNotificationEventMapped, ISessionEvent, SessionEventId, string> {
constructor(sessionEventSource: SessionEventSource) {
super(CbEventTopic.CbNotification, sessionEventSource);
}
@@ -6,11 +6,11 @@
* you may not use this file except in compliance with the License.
*/
import { injectable } from '@cloudbeaver/core-di';
import { type ISessionEvent, type SessionEventId, SessionEventSource, SessionEventTopic, TopicEventHandler } from '@cloudbeaver/core-root';
import { type ISessionEvent, type SessionEventId, SessionEventSource, TopicEventHandler } from '@cloudbeaver/core-root';
import { CbEventTopic, type WsOpenUrlEvent } from '@cloudbeaver/core-sdk';
@injectable(() => [SessionEventSource])
export class SessionActionsEventHandler extends TopicEventHandler<WsOpenUrlEvent, ISessionEvent, SessionEventId, SessionEventTopic> {
export class SessionActionsEventHandler extends TopicEventHandler<WsOpenUrlEvent, ISessionEvent, SessionEventId, string> {
constructor(sessionEventSource: SessionEventSource) {
super(CbEventTopic.CbSessionAction, sessionEventSource);
}
@@ -14,7 +14,7 @@ export type IWsTransactionCountEvent = WsTransactionalCountEvent;
type TransactionCountEvent = IWsTransactionCountEvent;
@injectable(() => [SessionEventSource])
export class TransactionLogCountEventHandler extends TopicEventHandler<TransactionCountEvent, ISessionEvent, SessionEventId, SessionEventTopic> {
export class TransactionLogCountEventHandler extends TopicEventHandler<TransactionCountEvent, ISessionEvent, SessionEventId, string> {
constructor(sessionEventSource: SessionEventSource) {
super(SessionEventTopic.CbTransaction, sessionEventSource);
}