mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-20 13:36:02 +00:00
add to favorites basic functionality
This commit is contained in:
@@ -74,3 +74,5 @@ export default function ChartTab({ tabVisible, toolbarPortalRef, conid, database
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
ChartTab.allowAddToFavorites = (props) => props.savedFile;
|
||||
|
||||
@@ -3,13 +3,17 @@ import axios from '../utility/axios';
|
||||
import LoadingInfo from '../widgets/LoadingInfo';
|
||||
import MarkdownExtendedView from '../markdown/MarkdownExtendedView';
|
||||
|
||||
export default function MarkdownViewTab({ file }) {
|
||||
export default function MarkdownViewTab({ savedFile }) {
|
||||
const [isLoading, setIsLoading] = React.useState(false);
|
||||
const [text, setText] = React.useState(null);
|
||||
|
||||
const handleLoad = async () => {
|
||||
setIsLoading(true);
|
||||
const resp = await axios.post('files/load', { folder: 'markdown', file, format: 'text' });
|
||||
const resp = await axios.post('files/load', {
|
||||
folder: 'markdown',
|
||||
file: savedFile,
|
||||
format: 'text',
|
||||
});
|
||||
setText(resp.data);
|
||||
setIsLoading(false);
|
||||
};
|
||||
@@ -28,3 +32,5 @@ export default function MarkdownViewTab({ file }) {
|
||||
|
||||
return <MarkdownExtendedView>{text || ''}</MarkdownExtendedView>;
|
||||
}
|
||||
|
||||
MarkdownViewTab.allowAddToFavorites = (props) => true;
|
||||
|
||||
@@ -176,3 +176,5 @@ export default function QueryTab({ tabid, conid, database, initialArgs, tabVisib
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
QueryTab.allowAddToFavorites = (props) => props.savedFile;
|
||||
|
||||
@@ -139,3 +139,5 @@ export default function ShellTab({ tabid, tabVisible, toolbarPortalRef, ...other
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
ShellTab.allowAddToFavorites = (props) => props.savedFile;
|
||||
|
||||
@@ -28,3 +28,4 @@ export default function TableDataTab({ conid, database, schemaName, pureName, ta
|
||||
}
|
||||
|
||||
TableDataTab.matchingProps = ['conid', 'database', 'schemaName', 'pureName'];
|
||||
TableDataTab.allowAddToFavorites = (props) => true;
|
||||
|
||||
@@ -55,4 +55,5 @@ export default function ViewDataTab({ conid, database, schemaName, pureName, tab
|
||||
);
|
||||
}
|
||||
|
||||
ViewDataTab.matchingProps = ['conid', 'database', 'schemaName', 'pureName'];
|
||||
ViewDataTab.matchingProps = ['conid', 'database', 'schemaName', 'pureName'];
|
||||
ViewDataTab.allowAddToFavorites = (props) => true;
|
||||
|
||||
Reference in New Issue
Block a user