mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-22 04:06:00 +00:00
compare model functions
This commit is contained in:
@@ -61,12 +61,37 @@
|
||||
showSnackbarSuccess(`Saved to archive ${resp.data.archiveFolder}`);
|
||||
};
|
||||
|
||||
const handleCompareWithCurrentDb = () => {
|
||||
openNewTab(
|
||||
{
|
||||
title: 'Compare',
|
||||
icon: 'img compare',
|
||||
tabComponent: 'CompareModelTab',
|
||||
},
|
||||
{
|
||||
editor: {
|
||||
sourceConid: _.get($currentDatabase, 'connection._id'),
|
||||
sourceDatabase: _.get($currentDatabase, 'name'),
|
||||
targetConid: _.get(connection, '_id'),
|
||||
targetDatabase: name,
|
||||
},
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
return [
|
||||
{ onClick: handleNewQuery, text: 'New query', isNewQuery: true },
|
||||
{ onClick: handleImport, text: 'Import' },
|
||||
{ onClick: handleExport, text: 'Export' },
|
||||
{ onClick: handleSqlGenerator, text: 'SQL Generator' },
|
||||
{ onClick: handleExportModel, text: 'Export DB model' },
|
||||
_.get($currentDatabase, 'connection._id') &&
|
||||
(_.get($currentDatabase, 'connection._id') != _.get(connection, '_id') ||
|
||||
(_.get($currentDatabase, 'connection._id') == _.get(connection, '_id') &&
|
||||
_.get($currentDatabase, 'name') != _.get(connection, 'name'))) && {
|
||||
onClick: handleCompareWithCurrentDb,
|
||||
text: `Compare with ${_.get($currentDatabase, 'name')}`,
|
||||
},
|
||||
|
||||
_.get($currentDatabase, 'connection._id') == _.get(connection, '_id') &&
|
||||
_.get($currentDatabase, 'name') == name && { onClick: handleDisconnect, text: 'Disconnect' },
|
||||
|
||||
@@ -160,7 +160,8 @@ registerCommand({
|
||||
id: 'new.modelCompare',
|
||||
category: 'New',
|
||||
icon: 'img compare',
|
||||
name: 'Compare DB Models',
|
||||
name: 'Compare DB',
|
||||
toolbar: true,
|
||||
onClick: () => {
|
||||
openNewTab({
|
||||
title: 'Compare',
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
<script lang="ts" context="module">
|
||||
export const matchingProps = [];
|
||||
|
||||
const getCurrentEditor = () => getActiveComponent('CompareModelTab');
|
||||
|
||||
registerCommand({
|
||||
@@ -205,7 +203,7 @@
|
||||
|
||||
$: changeTab(tabid, tab => ({
|
||||
...tab,
|
||||
title: $values?.targetDatabase,
|
||||
title: `${$values?.sourceDatabase || '???'}=>${$values?.targetDatabase || '???'}`,
|
||||
props: {
|
||||
...tab.props,
|
||||
conid: $values?.targetConid,
|
||||
|
||||
Reference in New Issue
Block a user