mirror of
https://github.com/dbeaver/cloudbeaver.git
synced 2026-09-24 16:04:36 +08:00
Merge remote-tracking branch 'origin/devel' into feat-data-refresh
This commit is contained in:
+2
-1
@@ -50,6 +50,8 @@ public class WebServiceBindingCore extends WebServiceBindingBase<DBWServiceCore>
|
||||
.dataFetcher("sessionPermissions", env -> getService(env).getSessionPermissions(getWebSession(env)))
|
||||
.dataFetcher("sessionState", env -> getService(env).getSessionState(getWebSession(env)))
|
||||
|
||||
.dataFetcher("connectionState", env -> getService(env).getConnectionState(getWebSession(env), env.getArgument("id")))
|
||||
|
||||
.dataFetcher("readSessionLog", env -> getService(env).readSessionLog(
|
||||
getWebSession(env),
|
||||
env.getArgument("maxEntries"),
|
||||
@@ -62,7 +64,6 @@ public class WebServiceBindingCore extends WebServiceBindingBase<DBWServiceCore>
|
||||
.dataFetcher("touchSession", env -> getService(env).touchSession(GraphQLEndpoint.getServletRequest(env)))
|
||||
.dataFetcher("changeSessionLanguage", env -> getService(env).changeSessionLanguage(getWebSession(env), env.getArgument("locale")))
|
||||
|
||||
.dataFetcher("connectionState", env -> getService(env).getConnectionState(getWebSession(env), env.getArgument("id")))
|
||||
.dataFetcher("openConnection", env -> getService(env).openConnection(getWebSession(env), getConnectionConfig(env)))
|
||||
.dataFetcher("createConnection", env -> getService(env).createConnection(getWebSession(env), getConnectionConfig(env)))
|
||||
.dataFetcher("testConnection", env -> getService(env).testConnection(getWebSession(env), getConnectionConfig(env)))
|
||||
|
||||
@@ -27,6 +27,10 @@ const styles = css`
|
||||
padding: 0 12px;
|
||||
line-height: 16px;
|
||||
font-weight: 500;
|
||||
|
||||
&:empty {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
& input {
|
||||
flex: 1;
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"table_header_sql_expression": "Enter a SQL expression to filter results"
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"table_header_sql_expression": "Введите SQL выражение чтобы отфильтровать результаты"
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* cloudbeaver - Cloud Database Manager
|
||||
* Copyright (C) 2020 DBeaver Corp and others
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0.
|
||||
* you may not use this file except in compliance with the License.
|
||||
*/
|
||||
|
||||
import { observer } from 'mobx-react';
|
||||
import styled, { css } from 'reshadow';
|
||||
|
||||
import { Placeholder } from '@dbeaver/core/blocks';
|
||||
import { useService } from '@dbeaver/core/dist/di';
|
||||
import { composes, useStyles } from '@dbeaver/core/theming';
|
||||
|
||||
import { TableViewerModel } from '../TableViewerModel';
|
||||
import { TableHeaderService } from './TableHeaderService';
|
||||
|
||||
const styles = composes(
|
||||
css`
|
||||
table-header {
|
||||
composes: theme-background-secondary theme-text-on-secondary from global;
|
||||
}
|
||||
`,
|
||||
css`
|
||||
table-header {
|
||||
height: 40px;
|
||||
flex: 0 0 auto;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
`
|
||||
);
|
||||
|
||||
type Props = {
|
||||
model: TableViewerModel;
|
||||
}
|
||||
|
||||
export const TableHeader = observer(function TableHeader({
|
||||
model,
|
||||
}: Props) {
|
||||
const service = useService(TableHeaderService);
|
||||
|
||||
return styled(useStyles(styles))(
|
||||
<table-header as="div">
|
||||
<Placeholder container={service.tableHeaderPlaceholder} context={model}/>
|
||||
</table-header>
|
||||
);
|
||||
});
|
||||
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* cloudbeaver - Cloud Database Manager
|
||||
* Copyright (C) 2020 DBeaver Corp and others
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0.
|
||||
* you may not use this file except in compliance with the License.
|
||||
*/
|
||||
|
||||
import { PlaceholderContainer } from '@dbeaver/core/blocks';
|
||||
import { injectable, Bootstrap } from '@dbeaver/core/di';
|
||||
|
||||
import { TableViewerModel } from '../TableViewerModel';
|
||||
import { TableWhereFilter } from './TableWhereFilter';
|
||||
|
||||
@injectable()
|
||||
export class TableHeaderService extends Bootstrap {
|
||||
readonly tableHeaderPlaceholder = new PlaceholderContainer<TableViewerModel>()
|
||||
|
||||
bootstrap() {
|
||||
this.tableHeaderPlaceholder.add(TableWhereFilter, 1);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* cloudbeaver - Cloud Database Manager
|
||||
* Copyright (C) 2020 DBeaver Corp and others
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0.
|
||||
* you may not use this file except in compliance with the License.
|
||||
*/
|
||||
|
||||
import { observer } from 'mobx-react';
|
||||
import { useCallback } from 'react';
|
||||
import styled, { css } from 'reshadow';
|
||||
|
||||
import { InputField, IconButton, SubmittingForm } from '@dbeaver/core/blocks';
|
||||
import { useTranslate } from '@dbeaver/core/localization';
|
||||
import { composes, useStyles } from '@dbeaver/core/theming';
|
||||
|
||||
import { TableViewerModel } from '../TableViewerModel';
|
||||
|
||||
const styles = composes(
|
||||
css`
|
||||
IconButton {
|
||||
composes: theme-text-primary theme-ripple from global;
|
||||
}
|
||||
`,
|
||||
css`
|
||||
SubmittingForm {
|
||||
height: 40px;
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
InputField {
|
||||
flex: 1;
|
||||
}
|
||||
IconButton {
|
||||
margin-right: 18px;
|
||||
position: relative;
|
||||
height: 24px;
|
||||
width: 24px;
|
||||
display: block;
|
||||
}
|
||||
`
|
||||
);
|
||||
|
||||
type Props = {
|
||||
context: TableViewerModel;
|
||||
}
|
||||
|
||||
export const TableWhereFilter = observer(function TableWhereFilter({
|
||||
context,
|
||||
}: Props) {
|
||||
const translate = useTranslate();
|
||||
const handleChange = useCallback(
|
||||
(value: string) => context.setQueryWhereFilter(value),
|
||||
[context]
|
||||
);
|
||||
|
||||
return styled(useStyles(styles))(
|
||||
<SubmittingForm onSubmit={() => context.applyQueryFilters()}>
|
||||
<InputField
|
||||
type='text'
|
||||
name='whereFilter'
|
||||
placeholder={translate('table_header_sql_expression')}
|
||||
value={context.getQueryWhereFilter() || ''}
|
||||
onChange={handleChange}
|
||||
mod='surface'
|
||||
/>
|
||||
<IconButton name='apply' viewBox='' onClick={() => context.applyQueryFilters()}/>
|
||||
</SubmittingForm>
|
||||
);
|
||||
});
|
||||
@@ -15,6 +15,7 @@ import { useService } from '@dbeaver/core/di';
|
||||
|
||||
import { TableFooter } from './TableFooter/TableFooter';
|
||||
import { TableGrid } from './TableGrid';
|
||||
import { TableHeader } from './TableHeader/TableHeader';
|
||||
import { TableViewerStorageService } from './TableViewerStorageService';
|
||||
|
||||
const viewerStyles = css`
|
||||
@@ -45,6 +46,7 @@ export const TableViewer = observer(function TableViewer({
|
||||
|
||||
return styled(viewerStyles)(
|
||||
<table-viewer as="div" className={className}>
|
||||
<TableHeader model={tableViewerModel} />
|
||||
<TableGrid model={tableViewerModel} />
|
||||
<TableFooter model={tableViewerModel} />
|
||||
<Loader loading={tableViewerModel.isLoaderVisible} overlay/>
|
||||
|
||||
@@ -147,6 +147,9 @@ export class TableViewerModel implements ITableViewerModelOptions {
|
||||
|
||||
setQueryWhereFilter(where: string | null) {
|
||||
this.queryWhereFilter = where;
|
||||
}
|
||||
|
||||
applyQueryFilters() {
|
||||
this.resetData();
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ import { DataViewerBootstrap } from './DataViewerBootstrap';
|
||||
import { DataViewerTableService } from './DataViewerTableService';
|
||||
import { DataViewerTabService } from './DataViewerTabService';
|
||||
import { TableFooterMenuService } from './TableViewer/TableFooter/TableFooterMenu/TableFooterMenuService';
|
||||
import { TableHeaderService } from './TableViewer/TableHeader/TableHeaderService';
|
||||
import { TableViewerStorageService } from './TableViewer/TableViewerStorageService';
|
||||
|
||||
export const manifest: PluginManifest = {
|
||||
@@ -24,6 +25,7 @@ export const manifest: PluginManifest = {
|
||||
DataViewerTableService,
|
||||
TableViewerStorageService,
|
||||
TableFooterMenuService,
|
||||
TableHeaderService,
|
||||
],
|
||||
|
||||
async initialize(services: IServiceInjector) {
|
||||
|
||||
Reference in New Issue
Block a user