mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-19 02:36:00 +00:00
tabs drop down menu
This commit is contained in:
@@ -102,12 +102,36 @@
|
||||
}
|
||||
};
|
||||
|
||||
const tabContextMenu = tabid => () => [
|
||||
{
|
||||
text: 'Close',
|
||||
onClick: () => closeTab(tabid),
|
||||
},
|
||||
];
|
||||
const tabContextMenu = (tabid, props) => () => {
|
||||
const { conid, database } = props || {};
|
||||
const res = [
|
||||
{
|
||||
text: 'Close',
|
||||
onClick: () => closeTab(tabid),
|
||||
},
|
||||
{
|
||||
text: 'Close all',
|
||||
onClick: closeAll,
|
||||
},
|
||||
{
|
||||
text: 'Close others',
|
||||
onClick: () => closeOthers(tabid),
|
||||
},
|
||||
];
|
||||
if (conid && database) {
|
||||
res.push(
|
||||
{
|
||||
text: `Close with same DB - ${database}`,
|
||||
onClick: () => closeWithSameDb(tabid),
|
||||
},
|
||||
{
|
||||
text: `Close with other DB than ${database}`,
|
||||
onClick: () => closeWithOtherDb(tabid),
|
||||
}
|
||||
);
|
||||
}
|
||||
return res;
|
||||
};
|
||||
</script>
|
||||
|
||||
{#each dbKeys as dbKey}
|
||||
@@ -123,7 +147,7 @@
|
||||
class:selected={tab.selected}
|
||||
on:click={e => handleTabClick(e, tab.tabid)}
|
||||
on:mouseup={e => handleMouseUp(e, tab.tabid)}
|
||||
use:contextMenu={tabContextMenu(tab.tabid)}
|
||||
use:contextMenu={tabContextMenu(tab.tabid, tab.props)}
|
||||
>
|
||||
<FontIcon icon={tab.busy ? 'icon loading' : tab.icon} />
|
||||
<span class="file-name">
|
||||
|
||||
Reference in New Issue
Block a user