saved sql files

This commit is contained in:
Jan Prochazka
2020-04-13 17:14:50 +02:00
parent 41322f237a
commit 7a0b9a27d2
8 changed files with 137 additions and 11 deletions

View File

@@ -0,0 +1,33 @@
import React from 'react';
import _ from 'lodash';
import { SqlIcon } from '../icons';
import { openNewTab } from '../utility/common';
const savedSqlFileAppObject = () => ({ name, storageKey }, { setOpenedTabs, newQuery, openedTabs }) => {
const key = storageKey;
const title = name;
const Icon = SqlIcon;
const onClick = () => {
const existing = openedTabs.find((x) => x.props && x.props.storageKey == storageKey);
if (existing) {
setOpenedTabs(
openedTabs.map((x) => ({
...x,
selected: x == existing,
}))
);
} else {
console.log('OPENING QUERY', title, storageKey);
newQuery({
title,
storageKey,
});
}
};
return { title, key, Icon, onClick };
};
export default savedSqlFileAppObject;