mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-19 20:06:00 +00:00
favorite dialog
This commit is contained in:
@@ -17,6 +17,7 @@ import useOpenNewTab from '../utility/useOpenNewTab';
|
||||
import axios from '../utility/axios';
|
||||
import tabs from '../tabs';
|
||||
import uuidv1 from 'uuid/v1';
|
||||
import FavoriteModal from '../modals/FavoriteModal';
|
||||
|
||||
const ToolbarContainer = styled.div`
|
||||
display: flex;
|
||||
@@ -82,28 +83,29 @@ export default function ToolBar({ toolbarPortalRef }) {
|
||||
};
|
||||
|
||||
const addToFavorite = () => {
|
||||
const tabdata = {};
|
||||
showModal((modalState) => <FavoriteModal modalState={modalState} savingTab={currentTab} />);
|
||||
// const tabdata = {};
|
||||
|
||||
const re = new RegExp(`tabdata_(.*)_${currentTab.tabid}`);
|
||||
for (const key in localStorage) {
|
||||
const match = key.match(re);
|
||||
if (!match) continue;
|
||||
if (match[1] == 'editor') continue;
|
||||
tabdata[match[1]] = JSON.parse(localStorage.getItem(key));
|
||||
}
|
||||
// const re = new RegExp(`tabdata_(.*)_${currentTab.tabid}`);
|
||||
// for (const key in localStorage) {
|
||||
// const match = key.match(re);
|
||||
// if (!match) continue;
|
||||
// if (match[1] == 'editor') continue;
|
||||
// tabdata[match[1]] = JSON.parse(localStorage.getItem(key));
|
||||
// }
|
||||
|
||||
axios.post('files/save', {
|
||||
folder: 'favorites',
|
||||
file: uuidv1(),
|
||||
format: 'json',
|
||||
data: {
|
||||
title: currentTab.title,
|
||||
icon: currentTab.icon,
|
||||
props: currentTab.props,
|
||||
tabComponent: currentTab.tabComponent,
|
||||
tabdata,
|
||||
},
|
||||
});
|
||||
// axios.post('files/save', {
|
||||
// folder: 'favorites',
|
||||
// file: uuidv1(),
|
||||
// format: 'json',
|
||||
// data: {
|
||||
// title: currentTab.title,
|
||||
// icon: currentTab.icon,
|
||||
// props: currentTab.props,
|
||||
// tabComponent: currentTab.tabComponent,
|
||||
// tabdata,
|
||||
// },
|
||||
// });
|
||||
};
|
||||
|
||||
function openTabFromButton(page) {
|
||||
|
||||
Reference in New Issue
Block a user