This commit is contained in:
Jan Prochazka
2020-11-12 15:28:37 +01:00
parent f30e7da503
commit 5eace3e332
12 changed files with 69 additions and 71 deletions

View File

@@ -8,6 +8,7 @@ import { isTypeDateTime } from '@dbgate/tools';
import { openDatabaseObjectDetail } from '../appobj/databaseObjectAppObject'; import { openDatabaseObjectDetail } from '../appobj/databaseObjectAppObject';
import { useSetOpenedTabs } from '../utility/globalState'; import { useSetOpenedTabs } from '../utility/globalState';
import { FontIcon } from '../icons'; import { FontIcon } from '../icons';
import useTheme from '../theme/useTheme';
const HeaderDiv = styled.div` const HeaderDiv = styled.div`
display: flex; display: flex;
@@ -28,7 +29,7 @@ const IconWrapper = styled.span`
`; `;
const ResizeHandle = styled.div` const ResizeHandle = styled.div`
background-color: #ccc; background-color: ${(props) => props.theme.border};
width: 2px; width: 2px;
cursor: col-resize; cursor: col-resize;
z-index: 1; z-index: 1;
@@ -52,6 +53,7 @@ export default function ColumnHeaderControl({
const onResizeDown = useSplitterDrag('clientX', onResize); const onResizeDown = useSplitterDrag('clientX', onResize);
const { foreignKey } = column; const { foreignKey } = column;
const setOpenedTabs = useSetOpenedTabs(); const setOpenedTabs = useSetOpenedTabs();
const theme = useTheme();
const openReferencedTable = () => { const openReferencedTable = () => {
openDatabaseObjectDetail(setOpenedTabs, 'TableDataTab', null, { openDatabaseObjectDetail(setOpenedTabs, 'TableDataTab', null, {
@@ -125,7 +127,7 @@ export default function ColumnHeaderControl({
)} )}
</DropDownButton> </DropDownButton>
)} )}
<ResizeHandle className="resizeHandleControl" onMouseDown={onResizeDown} /> <ResizeHandle className="resizeHandleControl" onMouseDown={onResizeDown} theme={theme} />
</HeaderDiv> </HeaderDiv>
); );
} }

View File

@@ -64,7 +64,7 @@ const TableHeaderRow = styled.tr`
`; `;
const TableHeaderCell = styled.td` const TableHeaderCell = styled.td`
// font-weight: bold; // font-weight: bold;
border: 1px solid #c0c0c0; border: 1px solid ${(props) => props.theme.border};
// border-collapse: collapse; // border-collapse: collapse;
text-align: left; text-align: left;
padding: 0; padding: 0;
@@ -970,6 +970,7 @@ export default function DataGridCore(props) {
{display.filterable && ( {display.filterable && (
<TableHeaderRow> <TableHeaderRow>
<TableHeaderCell <TableHeaderCell
theme={theme}
style={{ width: hederColwidthPx, minWidth: hederColwidthPx, maxWidth: hederColwidthPx }} style={{ width: hederColwidthPx, minWidth: hederColwidthPx, maxWidth: hederColwidthPx }}
data-row="filter" data-row="filter"
data-col="header" data-col="header"

View File

@@ -3,17 +3,18 @@ import ToolbarButton from '../widgets/ToolbarButton';
import styled from 'styled-components'; import styled from 'styled-components';
import dimensions from '../theme/dimensions'; import dimensions from '../theme/dimensions';
import { FontIcon } from '../icons'; import { FontIcon } from '../icons';
import useTheme from '../theme/useTheme';
const Container = styled.div` const Container = styled.div`
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
background: #ddeeee; background: ${(props) => props.theme.gridheader_background_cyan[0]};
height: ${dimensions.toolBar.height}px; height: ${dimensions.toolBar.height}px;
min-height: ${dimensions.toolBar.height}px; min-height: ${dimensions.toolBar.height}px;
overflow: hidden; overflow: hidden;
border-top: 1px solid #ccc; border-top: 1px solid ${(props) => props.theme.border};
border-bottom: 1px solid #ccc; border-bottom: 1px solid ${(props) => props.theme.border};
`; `;
const Header = styled.div` const Header = styled.div`
@@ -27,8 +28,9 @@ const HeaderText = styled.div`
`; `;
export default function ReferenceHeader({ reference, onClose }) { export default function ReferenceHeader({ reference, onClose }) {
const theme = useTheme();
return ( return (
<Container> <Container theme={theme}>
<Header> <Header>
<FontIcon icon="img reference" /> <FontIcon icon="img reference" />
<HeaderText> <HeaderText>

View File

@@ -4,6 +4,7 @@ import { ManagerInnerContainer } from './ManagerStyles';
import SearchInput from '../widgets/SearchInput'; import SearchInput from '../widgets/SearchInput';
import { filterName } from '@dbgate/datalib'; import { filterName } from '@dbgate/datalib';
import { FontIcon } from '../icons'; import { FontIcon } from '../icons';
import useTheme from '../theme/useTheme';
const SearchBoxWrapper = styled.div` const SearchBoxWrapper = styled.div`
display: flex; display: flex;
@@ -16,7 +17,7 @@ const Header = styled.div`
`; `;
const LinkContainer = styled.div` const LinkContainer = styled.div`
color: #337ab7; color: ${props=>props.theme.manager_font_blue[7]};
margin: 5px; margin: 5px;
&:hover { &:hover {
text-decoration: underline; text-decoration: underline;
@@ -32,8 +33,9 @@ const NameContainer = styled.div`
`; `;
function ManagerRow({ tableName, columns, icon, onClick }) { function ManagerRow({ tableName, columns, icon, onClick }) {
const theme = useTheme();
return ( return (
<LinkContainer onClick={onClick}> <LinkContainer onClick={onClick} theme={theme}>
<FontIcon icon={icon} /> <FontIcon icon={icon} />
<NameContainer> <NameContainer>
{tableName} ({columns.map((x) => x.columnName).join(', ')}) {tableName} ({columns.map((x) => x.columnName).join(', ')})

View File

@@ -9,6 +9,7 @@ import { WidgetTitle } from '../widgets/WidgetStyles';
import { FormButton } from '../utility/forms'; import { FormButton } from '../utility/forms';
import FormStyledButton from '../widgets/FormStyledButton'; import FormStyledButton from '../widgets/FormStyledButton';
import { FontIcon } from '../icons'; import { FontIcon } from '../icons';
import useTheme from '../theme/useTheme';
const Container = styled.div` const Container = styled.div`
display: flex; display: flex;
@@ -18,8 +19,8 @@ const Container = styled.div`
height: ${dimensions.toolBar.height}px; height: ${dimensions.toolBar.height}px;
min-height: ${dimensions.toolBar.height}px; min-height: ${dimensions.toolBar.height}px;
overflow: hidden; overflow: hidden;
border-top: 1px solid #ccc; border-top: 1px solid ${(props) => props.theme.border};
border-bottom: 1px solid #ccc; border-bottom: 1px solid ${(props) => props.theme.border};
`; `;
const Header = styled.div` const Header = styled.div`
@@ -60,8 +61,9 @@ const Buttons = styled.div`
`; `;
function MacroHeader({ selectedMacro, setSelectedMacro, onExecute }) { function MacroHeader({ selectedMacro, setSelectedMacro, onExecute }) {
const theme = useTheme();
return ( return (
<Container> <Container theme={theme}>
<Header> <Header>
<FontIcon icon="img macro" /> <FontIcon icon="img macro" />
<HeaderText>{selectedMacro.title}</HeaderText> <HeaderText>{selectedMacro.title}</HeaderText>

View File

@@ -44,7 +44,7 @@ const Column = styled.div`
const Label = styled.div` const Label = styled.div`
margin: 5px; margin: 5px;
margin-top: 15px; margin-top: 15px;
color: #777; color: ${(props) => props.theme.modal_font2};
`; `;
const SourceNameWrapper = styled.div` const SourceNameWrapper = styled.div`
@@ -54,10 +54,10 @@ const SourceNameWrapper = styled.div`
const TrashWrapper = styled.div` const TrashWrapper = styled.div`
&:hover { &:hover {
background-color: #ccc; background-color: ${(props) => props.theme.modal_background2};
} }
cursor: pointer; cursor: pointer;
color: blue; color: ${(props) => props.theme.modal_font_blue[7]};
`; `;
const SqlWrapper = styled.div` const SqlWrapper = styled.div`
@@ -170,6 +170,7 @@ function SourceTargetConfig({
tablesField = undefined, tablesField = undefined,
engine = undefined, engine = undefined,
}) { }) {
const theme = useTheme();
const { values, setFieldValue } = useFormikContext(); const { values, setFieldValue } = useFormikContext();
const types = const types =
values[storageTypeField] == 'jsldata' values[storageTypeField] == 'jsldata'
@@ -187,24 +188,24 @@ function SourceTargetConfig({
const archiveFiles = useArchiveFiles({ folder: values[archiveFolderField] }); const archiveFiles = useArchiveFiles({ folder: values[archiveFolderField] });
return ( return (
<Column> <Column>
{direction == 'source' && <Label>Source configuration</Label>} {direction == 'source' && <Label theme={theme}>Source configuration</Label>}
{direction == 'target' && <Label>Target configuration</Label>} {direction == 'target' && <Label theme={theme}>Target configuration</Label>}
<FormReactSelect options={types.filter((x) => x.directions.includes(direction))} name={storageTypeField} /> <FormReactSelect options={types.filter((x) => x.directions.includes(direction))} name={storageTypeField} />
{(storageType == 'database' || storageType == 'query') && ( {(storageType == 'database' || storageType == 'query') && (
<> <>
<Label>Server</Label> <Label theme={theme}>Server</Label>
<FormConnectionSelect name={connectionIdField} /> <FormConnectionSelect name={connectionIdField} />
<Label>Database</Label> <Label theme={theme}>Database</Label>
<FormDatabaseSelect conidName={connectionIdField} name={databaseNameField} /> <FormDatabaseSelect conidName={connectionIdField} name={databaseNameField} />
</> </>
)} )}
{storageType == 'database' && ( {storageType == 'database' && (
<> <>
<Label>Schema</Label> <Label theme={theme}>Schema</Label>
<FormSchemaSelect conidName={connectionIdField} databaseName={databaseNameField} name={schemaNameField} /> <FormSchemaSelect conidName={connectionIdField} databaseName={databaseNameField} name={schemaNameField} />
{tablesField && ( {tablesField && (
<> <>
<Label>Tables/views</Label> <Label theme={theme}>Tables/views</Label>
<FormTablesSelect <FormTablesSelect
conidName={connectionIdField} conidName={connectionIdField}
schemaName={schemaNameField} schemaName={schemaNameField}
@@ -240,7 +241,7 @@ function SourceTargetConfig({
)} )}
{storageType == 'query' && ( {storageType == 'query' && (
<> <>
<Label>Query</Label> <Label theme={theme}>Query</Label>
<SqlWrapper> <SqlWrapper>
<SqlEditor <SqlEditor
value={values.sourceSql} value={values.sourceSql}
@@ -254,14 +255,14 @@ function SourceTargetConfig({
{storageType == 'archive' && ( {storageType == 'archive' && (
<> <>
<Label>Archive folder</Label> <Label theme={theme}>Archive folder</Label>
<FormArchiveFolderSelect name={archiveFolderField} /> <FormArchiveFolderSelect name={archiveFolderField} />
</> </>
)} )}
{storageType == 'archive' && direction == 'source' && ( {storageType == 'archive' && direction == 'source' && (
<> <>
<Label>Source files</Label> <Label theme={theme}>Source files</Label>
<FormArchiveFilesSelect folderName={values[archiveFolderField]} name={tablesField} /> <FormArchiveFilesSelect folderName={values[archiveFolderField]} name={tablesField} />
<div> <div>
<FormStyledButton <FormStyledButton
@@ -286,6 +287,7 @@ function SourceTargetConfig({
function SourceName({ name }) { function SourceName({ name }) {
const { values, setFieldValue } = useFormikContext(); const { values, setFieldValue } = useFormikContext();
const theme = useTheme();
const handleDelete = () => { const handleDelete = () => {
setFieldValue( setFieldValue(
'sourceList', 'sourceList',
@@ -296,7 +298,7 @@ function SourceName({ name }) {
return ( return (
<SourceNameWrapper> <SourceNameWrapper>
<div>{name}</div> <div>{name}</div>
<TrashWrapper onClick={handleDelete}> <TrashWrapper onClick={handleDelete} theme={theme}>
<FontIcon icon="icon delete" /> <FontIcon icon="icon delete" />
</TrashWrapper> </TrashWrapper>
</SourceNameWrapper> </SourceNameWrapper>

View File

@@ -43,7 +43,7 @@ const WidgetColumnWrapper = styled.div`
display: flex; display: flex;
flex: 1; flex: 1;
overflow: hidden; overflow: hidden;
border-left: 1px solid #ccc; border-left: 1px solid ${(props) => props.theme.border};
`; `;
const StyledForm = styled(Form)` const StyledForm = styled(Form)`
@@ -58,9 +58,7 @@ const StyledForm = styled(Form)`
`; `;
const ContentWrapper = styled.div` const ContentWrapper = styled.div`
// border-bottom: 1px solid #ccc; border-top: 1px solid ${(props) => props.theme.border};
border-top: 1px solid #ccc;
// padding: 15px;
flex: 1; flex: 1;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
@@ -135,10 +133,10 @@ export default function ImportExportModal({ modalState, initialValues, uploadedF
<StyledForm> <StyledForm>
<ModalHeader modalState={modalState}>Import/Export</ModalHeader> <ModalHeader modalState={modalState}>Import/Export</ModalHeader>
<Wrapper> <Wrapper>
<ContentWrapper> <ContentWrapper theme={theme}>
<ImportExportConfigurator uploadedFile={uploadedFile} /> <ImportExportConfigurator uploadedFile={uploadedFile} />
</ContentWrapper> </ContentWrapper>
<WidgetColumnWrapper> <WidgetColumnWrapper theme={theme}>
<WidgetColumnBar> <WidgetColumnBar>
{/* <WidgetColumnBarItem title="Preview" name="preview"> {/* <WidgetColumnBarItem title="Preview" name="preview">
Preview Preview

View File

@@ -1,12 +1,14 @@
import React from 'react'; import React from 'react';
import styled from 'styled-components'; import styled from 'styled-components';
import useTheme from '../theme/useTheme';
const Wrapper = styled.div` const Wrapper = styled.div`
border-bottom: 1px solid #ccc; border-bottom: 1px solid ${(props) => props.theme.border};
border-top: 1px solid #ccc; border-top: 1px solid ${(props) => props.theme.border};
padding: 15px; padding: 15px;
`; `;
export default function ModalContent({ children }) { export default function ModalContent({ children }) {
return <Wrapper>{children}</Wrapper>; const theme = useTheme();
return <Wrapper theme={theme}>{children}</Wrapper>;
} }

View File

@@ -3,7 +3,7 @@ import styled from 'styled-components';
import useTheme from '../theme/useTheme'; import useTheme from '../theme/useTheme';
const Wrapper = styled.div` const Wrapper = styled.div`
border-bottom: 1px solid #ccc; border-bottom: 1px solid ${(props) => props.theme.border};
padding: 15px; padding: 15px;
background-color: ${(props) => props.theme.modalheader_background}; background-color: ${(props) => props.theme.modalheader_background};
`; `;

View File

@@ -18,15 +18,16 @@ const theme = {
widget_background: '#222', widget_background: '#222',
title_background: '#555', title_background: '#555',
manager_background: '#000', manager_background: '#000',
tabs_background: '#444', tabs_background: '#111',
gridheader_background: '#222', gridheader_background: '#222',
gridbody_background: '#000', gridbody_background: '#000',
scrollbar_background: '#444', scrollbar_background: '#444',
input_background: '#333', input_background: '#333',
modal_background: '#222', modal_background: '#222',
modalheader_background: '#555', modalheader_background: '#555',
button_background: '#337ab7', button_background: '#004488',
statusbar_background: '#00c', statusbar_background: '#00c',
inlinebtn_background: '#222',
}; };
export default fillTheme(theme); export default fillTheme(theme);

View File

@@ -26,6 +26,7 @@ const theme = {
modalheader_background: '#eff', modalheader_background: '#eff',
button_background: '#337ab7', button_background: '#337ab7',
statusbar_background: '#00c', statusbar_background: '#00c',
inlinebtn_background: '#ededed',
}; };
export default fillTheme(theme); export default fillTheme(theme);

View File

@@ -1,36 +1,38 @@
// @ts-nocheck // @ts-nocheck
import React from 'react'; import React from 'react';
import styled from 'styled-components'; import styled from 'styled-components';
import useTheme from '../theme/useTheme';
const ButtonDiv = styled.div` const ButtonDiv = styled.div`
//box-shadow: 3px 4px 0px 0px #899599; background: linear-gradient(
background: linear-gradient(to bottom, #ededed 5%, #bab1ba 100%); to bottom,
background-color: #ededed; ${(props) => props.theme.inlinebtn_background} 5%,
//border-radius: 15px; ${(props) => props.theme.inlinebtn_background3} 100%
border: 1px solid #bbb; );
background-color: ${(props) => props.theme.inlinebtn_background};
border: 1px solid ${(props) => props.theme.inlinebtn_background3};
display: inline-block; display: inline-block;
cursor: pointer; cursor: pointer;
// color: #3a8a9e;
// color: gray;
// font-family: Arial;
vertical-align: middle; vertical-align: middle;
color: black; color: ${(props) => props.theme.inlinebtn_font1};;
font-size: 12px; font-size: 12px;
padding: 3px; padding: 3px;
margin: 0; margin: 0;
// padding: 7px 25px;
text-decoration: none; text-decoration: none;
// text-shadow: 0px 1px 0px #e1e2ed;
&:hover { &:hover {
border: 1px solid #777; border: 1px solid ${(props) => props.theme.inlinebtn_font2};
} }
&:active:hover { &:active:hover {
background: linear-gradient(to bottom, #bab1ba 5%, #ededed 100%); background: linear-gradient(
background-color: #bab1ba; to bottom,
${(props) => props.theme.inlinebtn_background3} 5%,
${(props) => props.theme.inlinebtn_background} 100%
);
background-color: ${(props) => props.theme.inlinebtn_background3};
} }
display: flex; display: flex;
${props => ${(props) =>
props.square && props.square &&
` `
width: 18px; width: 18px;
@@ -43,25 +45,6 @@ const InnerDiv = styled.div`
text-align: center; text-align: center;
`; `;
// ${props =>
// !props.disabled &&
// `
// &:hover {
// background-color: #286090;
// }
// &:active:hover {
// background-color: #204d74;
// }
// `}
// ${props =>
// props.disabled &&
// `
// background-color: #ccc;
// color: gray;
// `}
export default function InlineButton({ export default function InlineButton({
children, children,
onClick = undefined, onClick = undefined,
@@ -69,6 +52,7 @@ export default function InlineButton({
disabled = undefined, disabled = undefined,
square = false, square = false,
}) { }) {
const theme = useTheme();
return ( return (
<ButtonDiv <ButtonDiv
className="buttonLike" className="buttonLike"
@@ -78,6 +62,7 @@ export default function InlineButton({
}} }}
disabled={disabled} disabled={disabled}
square={square} square={square}
theme={theme}
> >
<InnerDiv>{children}</InnerDiv> <InnerDiv>{children}</InnerDiv>
</ButtonDiv> </ButtonDiv>