mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-20 13:36:02 +00:00
prettier
This commit is contained in:
@@ -30,11 +30,11 @@ export default function ChartTab({ tabVisible, toolbarPortalRef, conid, database
|
||||
}, [modelState]);
|
||||
|
||||
const setConfig = React.useCallback(
|
||||
(config) =>
|
||||
config =>
|
||||
// @ts-ignore
|
||||
dispatchModel({
|
||||
type: 'compute',
|
||||
compute: (v) => ({ ...v, config: _.isFunction(config) ? config(v.config) : config }),
|
||||
compute: v => ({ ...v, config: _.isFunction(config) ? config(v.config) : config }),
|
||||
}),
|
||||
[dispatchModel]
|
||||
);
|
||||
@@ -75,4 +75,4 @@ export default function ChartTab({ tabVisible, toolbarPortalRef, conid, database
|
||||
);
|
||||
}
|
||||
|
||||
ChartTab.allowAddToFavorites = (props) => true;
|
||||
ChartTab.allowAddToFavorites = props => true;
|
||||
|
||||
@@ -42,7 +42,7 @@ export default function FavoriteEditorTab({ tabid, tabVisible, savedFile, toolba
|
||||
const data = JSON.parse(editorData);
|
||||
openFavorite(data);
|
||||
} catch (err) {
|
||||
showModal((modalState) => (
|
||||
showModal(modalState => (
|
||||
<ErrorMessageModal modalState={modalState} message={err.message} title="Error parsing JSON" />
|
||||
));
|
||||
}
|
||||
@@ -65,7 +65,7 @@ export default function FavoriteEditorTab({ tabid, tabVisible, savedFile, toolba
|
||||
data,
|
||||
});
|
||||
} catch (err) {
|
||||
showModal((modalState) => (
|
||||
showModal(modalState => (
|
||||
<ErrorMessageModal modalState={modalState} message={err.message} title="Error parsing JSON" />
|
||||
));
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React from 'react';
|
||||
import { createFreeTableModel } from 'dbgate-datalib';
|
||||
import { createFreeTableModel } from 'dbgate-datalib';
|
||||
import useUndoReducer from '../utility/useUndoReducer';
|
||||
import { useSetOpenedTabs } from '../utility/globalState';
|
||||
import useGridConfig from '../utility/useGridConfig';
|
||||
@@ -21,7 +21,7 @@ export default function FreeDataTab({ archiveFolder, archiveFile, tabVisible, to
|
||||
tabid,
|
||||
loadFromArgs:
|
||||
initialArgs && initialArgs.functionName
|
||||
? () => axios.post('runners/load-reader', initialArgs).then((x) => x.data)
|
||||
? () => axios.post('runners/load-reader', initialArgs).then(x => x.data)
|
||||
: null,
|
||||
});
|
||||
|
||||
@@ -36,7 +36,7 @@ export default function FreeDataTab({ archiveFolder, archiveFile, tabVisible, to
|
||||
|
||||
const handleSave = async (folder, file) => {
|
||||
await axios.post('archive/save-free-table', { folder, file, data: modelState.value });
|
||||
changeTab(tabid, setOpenedTabs, (tab) => ({
|
||||
changeTab(tabid, setOpenedTabs, tab => ({
|
||||
...tab,
|
||||
title: file,
|
||||
props: { archiveFile: file, archiveFolder: folder },
|
||||
|
||||
@@ -27,16 +27,16 @@ export default function MarkdownEditorTab({ tabid, tabVisible, toolbarPortalRef,
|
||||
|
||||
const showPreview = async () => {
|
||||
await saveToStorage();
|
||||
const existing = (openedTabs || []).find((x) => x.props && x.props.sourceTabId == tabid && x.closedTime == null);
|
||||
const existing = (openedTabs || []).find(x => x.props && x.props.sourceTabId == tabid && x.closedTime == null);
|
||||
if (existing) {
|
||||
setOpenedTabs((tabs) =>
|
||||
tabs.map((x) => ({
|
||||
setOpenedTabs(tabs =>
|
||||
tabs.map(x => ({
|
||||
...x,
|
||||
selected: x.tabid == existing.tabid,
|
||||
}))
|
||||
);
|
||||
} else {
|
||||
const thisTab = (openedTabs || []).find((x) => x.tabid == tabid);
|
||||
const thisTab = (openedTabs || []).find(x => x.tabid == tabid);
|
||||
openNewTab({
|
||||
title: thisTab.title,
|
||||
icon: 'img preview',
|
||||
|
||||
@@ -8,7 +8,7 @@ export default function MarkdownPreviewTab({ sourceTabId, tabVisible }) {
|
||||
const { editorData, isLoading } = useEditorData({ tabid: sourceTabId, reloadToken });
|
||||
|
||||
React.useEffect(() => {
|
||||
if (tabVisible) setReloadToken((x) => x + 1);
|
||||
if (tabVisible) setReloadToken(x => x + 1);
|
||||
}, [tabVisible]);
|
||||
|
||||
if (isLoading) {
|
||||
|
||||
@@ -33,4 +33,4 @@ export default function MarkdownViewTab({ savedFile }) {
|
||||
return <MarkdownExtendedView>{text || ''}</MarkdownExtendedView>;
|
||||
}
|
||||
|
||||
MarkdownViewTab.allowAddToFavorites = (props) => true;
|
||||
MarkdownViewTab.allowAddToFavorites = props => true;
|
||||
|
||||
@@ -18,7 +18,7 @@ const WhitePage = styled.div`
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background-color: ${(props) => props.theme.main_background};
|
||||
background-color: ${props => props.theme.main_background};
|
||||
overflow: auto;
|
||||
padding: 10px;
|
||||
`;
|
||||
@@ -30,7 +30,7 @@ const Icon = styled.img`
|
||||
|
||||
const Header = styled.div`
|
||||
display: flex;
|
||||
border-bottom: 1px solid ${(props) => props.theme.border};
|
||||
border-bottom: 1px solid ${props => props.theme.border};
|
||||
margin-bottom: 20px;
|
||||
padding-bottom: 20px;
|
||||
`;
|
||||
@@ -81,7 +81,7 @@ function PluginTabCore({ packageName }) {
|
||||
return <LoadingInfo message="Loading extension detail" />;
|
||||
}
|
||||
|
||||
const installedFound = installed.find((x) => x.name == packageName);
|
||||
const installedFound = installed.find(x => x.name == packageName);
|
||||
const onlineFound = manifest;
|
||||
|
||||
if (manifest == null) {
|
||||
|
||||
@@ -79,7 +79,7 @@ export default function QueryDesignTab({ tabid, conid, database, tabVisible, too
|
||||
dispatchModel({
|
||||
type: 'compute',
|
||||
useMerge: skipUndoChain,
|
||||
compute: (v) => (_.isFunction(value) ? value(v) : value),
|
||||
compute: v => (_.isFunction(value) ? value(v) : value),
|
||||
}),
|
||||
[dispatchModel]
|
||||
);
|
||||
@@ -94,14 +94,14 @@ export default function QueryDesignTab({ tabid, conid, database, tabVisible, too
|
||||
}, [sessionId, socket]);
|
||||
|
||||
React.useEffect(() => {
|
||||
changeTab(tabid, setOpenedTabs, (tab) => ({ ...tab, busy }));
|
||||
changeTab(tabid, setOpenedTabs, tab => ({ ...tab, busy }));
|
||||
}, [busy]);
|
||||
|
||||
useUpdateDatabaseForTab(tabVisible, conid, database);
|
||||
|
||||
const handleExecute = React.useCallback(async () => {
|
||||
if (busy) return;
|
||||
setExecuteNumber((num) => num + 1);
|
||||
setExecuteNumber(num => num + 1);
|
||||
setVisibleResultTabs(true);
|
||||
|
||||
let sesid = sessionId;
|
||||
@@ -129,7 +129,7 @@ export default function QueryDesignTab({ tabid, conid, database, tabVisible, too
|
||||
};
|
||||
|
||||
const handleKeyDown = React.useCallback(
|
||||
(e) => {
|
||||
e => {
|
||||
if (e.keyCode == keycodes.f5) {
|
||||
e.preventDefault();
|
||||
handleExecute();
|
||||
@@ -212,4 +212,4 @@ export default function QueryDesignTab({ tabid, conid, database, tabVisible, too
|
||||
);
|
||||
}
|
||||
|
||||
QueryDesignTab.allowAddToFavorites = (props) => true;
|
||||
QueryDesignTab.allowAddToFavorites = props => true;
|
||||
|
||||
@@ -55,7 +55,7 @@ export default function QueryTab({ tabid, conid, database, initialArgs, tabVisib
|
||||
}, [sessionId, socket]);
|
||||
|
||||
React.useEffect(() => {
|
||||
changeTab(tabid, setOpenedTabs, (tab) => ({ ...tab, busy }));
|
||||
changeTab(tabid, setOpenedTabs, tab => ({ ...tab, busy }));
|
||||
}, [busy]);
|
||||
|
||||
useUpdateDatabaseForTab(tabVisible, conid, database);
|
||||
@@ -63,7 +63,7 @@ export default function QueryTab({ tabid, conid, database, initialArgs, tabVisib
|
||||
|
||||
const handleExecute = async () => {
|
||||
if (busy) return;
|
||||
setExecuteNumber((num) => num + 1);
|
||||
setExecuteNumber(num => num + 1);
|
||||
setVisibleResultTabs(true);
|
||||
const selectedText = editorRef.current.editor.getSelectedText();
|
||||
|
||||
@@ -104,7 +104,7 @@ export default function QueryTab({ tabid, conid, database, initialArgs, tabVisib
|
||||
}
|
||||
};
|
||||
|
||||
const handleMesageClick = (message) => {
|
||||
const handleMesageClick = message => {
|
||||
// console.log('EDITOR', editorRef.current.editor);
|
||||
if (editorRef.current && editorRef.current.editor) {
|
||||
editorRef.current.editor.gotoLine(message.line);
|
||||
@@ -179,4 +179,4 @@ export default function QueryTab({ tabid, conid, database, initialArgs, tabVisib
|
||||
);
|
||||
}
|
||||
|
||||
QueryTab.allowAddToFavorites = (props) => true;
|
||||
QueryTab.allowAddToFavorites = props => true;
|
||||
|
||||
@@ -35,7 +35,7 @@ export default function ShellTab({ tabid, tabVisible, toolbarPortalRef, ...other
|
||||
const socket = useSocket();
|
||||
|
||||
React.useEffect(() => {
|
||||
changeTab(tabid, setOpenedTabs, (tab) => ({ ...tab, busy }));
|
||||
changeTab(tabid, setOpenedTabs, tab => ({ ...tab, busy }));
|
||||
}, [busy]);
|
||||
|
||||
const editorRef = React.useRef(null);
|
||||
@@ -55,14 +55,14 @@ export default function ShellTab({ tabid, tabVisible, toolbarPortalRef, ...other
|
||||
|
||||
const handleExecute = async () => {
|
||||
if (busy) return;
|
||||
setExecuteNumber((num) => num + 1);
|
||||
setExecuteNumber(num => num + 1);
|
||||
const selectedText = editorRef.current.editor.getSelectedText();
|
||||
|
||||
let runid = runnerId;
|
||||
const resp = await axios.post('runners/start', {
|
||||
script: selectedText
|
||||
? [...(editorData || '').matchAll(requireRegex)].map((x) => `${x[1]}\n`).join('') +
|
||||
[...(editorData || '').matchAll(initRegex)].map((x) => `${x[1]}\n`).join('') +
|
||||
? [...(editorData || '').matchAll(requireRegex)].map(x => `${x[1]}\n`).join('') +
|
||||
[...(editorData || '').matchAll(initRegex)].map(x => `${x[1]}\n`).join('') +
|
||||
selectedText
|
||||
: editorData,
|
||||
});
|
||||
@@ -87,7 +87,7 @@ export default function ShellTab({ tabid, tabVisible, toolbarPortalRef, ...other
|
||||
const handleEdit = () => {
|
||||
const jsonTextMatch = (editorData || '').match(configRegex);
|
||||
if (jsonTextMatch) {
|
||||
showModal((modalState) => (
|
||||
showModal(modalState => (
|
||||
<ImportExportModal modalState={modalState} initialValues={JSON.parse(jsonTextMatch[1])} />
|
||||
));
|
||||
}
|
||||
@@ -140,4 +140,4 @@ export default function ShellTab({ tabid, tabVisible, toolbarPortalRef, ...other
|
||||
);
|
||||
}
|
||||
|
||||
ShellTab.allowAddToFavorites = (props) => true;
|
||||
ShellTab.allowAddToFavorites = props => true;
|
||||
|
||||
@@ -28,4 +28,4 @@ export default function TableDataTab({ conid, database, schemaName, pureName, ta
|
||||
}
|
||||
|
||||
TableDataTab.matchingProps = ['conid', 'database', 'schemaName', 'pureName'];
|
||||
TableDataTab.allowAddToFavorites = (props) => true;
|
||||
TableDataTab.allowAddToFavorites = props => true;
|
||||
|
||||
@@ -14,7 +14,7 @@ const WhitePage = styled.div`
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background-color: ${(props) => props.theme.main_background};
|
||||
background-color: ${props => props.theme.main_background};
|
||||
overflow: auto;
|
||||
`;
|
||||
|
||||
@@ -54,7 +54,7 @@ export default function TableStructureTab({ conid, database, schemaName, pureNam
|
||||
fieldName="notNull"
|
||||
header="Not NULL"
|
||||
sortable={true}
|
||||
formatter={(row) => (row.notNull ? 'YES' : 'NO')}
|
||||
formatter={row => (row.notNull ? 'YES' : 'NO')}
|
||||
/>
|
||||
<TableColumn fieldName="dataType" header="Data Type" sortable={true} />
|
||||
<TableColumn fieldName="defaultValue" header="Default value" sortable={true} />
|
||||
@@ -62,14 +62,14 @@ export default function TableStructureTab({ conid, database, schemaName, pureNam
|
||||
fieldName="isSparse"
|
||||
header="Is Sparse"
|
||||
sortable={true}
|
||||
formatter={(row) => (row.isSparse ? 'YES' : 'NO')}
|
||||
formatter={row => (row.isSparse ? 'YES' : 'NO')}
|
||||
/>
|
||||
<TableColumn fieldName="computedExpression" header="Computed Expression" sortable={true} />
|
||||
<TableColumn
|
||||
fieldName="isPersisted"
|
||||
header="Is Persisted"
|
||||
sortable={true}
|
||||
formatter={(row) => (row.isPersisted ? 'YES' : 'NO')}
|
||||
formatter={row => (row.isPersisted ? 'YES' : 'NO')}
|
||||
/>
|
||||
{/* {_.includes(dbCaps.columnListOptionalColumns, 'referencedTableNamesFormatted') && (
|
||||
<TableColumn fieldName="referencedTableNamesFormatted" header="References" sortable={true} />
|
||||
@@ -101,7 +101,7 @@ export default function TableStructureTab({ conid, database, schemaName, pureNam
|
||||
<TableColumn
|
||||
fieldName="columns"
|
||||
header="Columns"
|
||||
formatter={(row) => row.columns.map((x) => x.columnName).join(', ')}
|
||||
formatter={row => row.columns.map(x => x.columnName).join(', ')}
|
||||
/>
|
||||
</ObjectListControl>
|
||||
|
||||
@@ -109,13 +109,13 @@ export default function TableStructureTab({ conid, database, schemaName, pureNam
|
||||
<TableColumn
|
||||
fieldName="baseColumns"
|
||||
header="Base columns"
|
||||
formatter={(row) => row.columns.map((x) => x.columnName).join(', ')}
|
||||
formatter={row => row.columns.map(x => x.columnName).join(', ')}
|
||||
/>
|
||||
<TableColumn fieldName="refTable" header="Referenced table" formatter={(row) => row.refTableName} />
|
||||
<TableColumn fieldName="refTable" header="Referenced table" formatter={row => row.refTableName} />
|
||||
<TableColumn
|
||||
fieldName="refColumns"
|
||||
header="Referenced columns"
|
||||
formatter={(row) => row.columns.map((x) => x.refColumnName).join(', ')}
|
||||
formatter={row => row.columns.map(x => x.refColumnName).join(', ')}
|
||||
/>
|
||||
<TableColumn fieldName="updateAction" header="ON UPDATE" />
|
||||
<TableColumn fieldName="deleteAction" header="ON DELETE" />
|
||||
@@ -125,13 +125,13 @@ export default function TableStructureTab({ conid, database, schemaName, pureNam
|
||||
<TableColumn
|
||||
fieldName="baseColumns"
|
||||
header="Base columns"
|
||||
formatter={(row) => row.columns.map((x) => x.columnName).join(', ')}
|
||||
formatter={row => row.columns.map(x => x.columnName).join(', ')}
|
||||
/>
|
||||
<TableColumn fieldName="baseTable" header="Base table" formatter={(row) => row.pureName} />
|
||||
<TableColumn fieldName="baseTable" header="Base table" formatter={row => row.pureName} />
|
||||
<TableColumn
|
||||
fieldName="refColumns"
|
||||
header="Referenced columns"
|
||||
formatter={(row) => row.columns.map((x) => x.refColumnName).join(', ')}
|
||||
formatter={row => row.columns.map(x => x.refColumnName).join(', ')}
|
||||
/>
|
||||
<TableColumn fieldName="updateAction" header="ON UPDATE" />
|
||||
<TableColumn fieldName="deleteAction" header="ON DELETE" />
|
||||
|
||||
@@ -15,7 +15,7 @@ export default function ViewDataTab({ conid, database, schemaName, pureName, tab
|
||||
const [config, setConfig] = useGridConfig(tabid);
|
||||
const [cache, setCache] = React.useState(createGridCache());
|
||||
const [changeSetState, dispatchChangeSet] = useUndoReducer(createChangeSet());
|
||||
const extensions = useExtensions()
|
||||
const extensions = useExtensions();
|
||||
|
||||
useUpdateDatabaseForTab(tabVisible, conid, database);
|
||||
const connection = useConnectionInfo({ conid });
|
||||
@@ -51,9 +51,9 @@ export default function ViewDataTab({ conid, database, schemaName, pureName, tab
|
||||
dispatchChangeSet={dispatchChangeSet}
|
||||
toolbarPortalRef={toolbarPortalRef}
|
||||
GridCore={SqlDataGridCore}
|
||||
/>
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
ViewDataTab.matchingProps = ['conid', 'database', 'schemaName', 'pureName'];
|
||||
ViewDataTab.allowAddToFavorites = (props) => true;
|
||||
ViewDataTab.allowAddToFavorites = props => true;
|
||||
|
||||
Reference in New Issue
Block a user